BaseSeller.php 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. <?php
  2. /*
  3. * 卖家相关控制中心
  4. */
  5. namespace app\home\controller;
  6. use think\facade\View;
  7. use think\facade\Lang;
  8. /**
  9. * ============================================================================
  10. * DSMall多用户商城
  11. * ============================================================================
  12. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  13. * 网站地址: http://www.csdeshang.com
  14. * ----------------------------------------------------------------------------
  15. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  16. * 不允许对程序代码以任何形式任何目的的再发布。
  17. * ============================================================================
  18. * 控制器
  19. */
  20. class BaseSeller extends BaseMall {
  21. //店铺信息
  22. protected $store_info = array();
  23. public function initialize() {
  24. parent::initialize();
  25. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/basemember.lang.php');
  26. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/baseseller.lang.php');
  27. if(input('post.PHPSESSID') && !session('seller_id') && request()->controller() == 'SellerTaobaoImport' && request()->action() == 'upload'){
  28. $this->app->session->setId(input('post.PHPSESSID'));
  29. $this->app->session->init();
  30. session('limited', 1);
  31. }
  32. if(session('limited') && (request()->controller() != 'SellerTaobaoImport' || request()->action() != 'upload')){
  33. $this->redirect('home/Sellerlogin/login');
  34. }
  35. //卖家中心模板路径
  36. $this->template_dir = 'default/seller/' . strtolower(request()->controller()) . '/';
  37. if (request()->controller() != 'Sellerlogin') {
  38. if (!session('member_id')) {
  39. $this->redirect('home/Sellerlogin/login');
  40. }
  41. if (!session('seller_id')) {
  42. $this->redirect('home/Sellerlogin/login');
  43. }
  44. // 验证店铺是否存在
  45. $store_model = model('store');
  46. $this->store_info = $store_model->getStoreInfoByID(session('store_id'));
  47. if (empty($this->store_info)) {
  48. $this->redirect('home/Sellerlogin/login');
  49. }
  50. // 店铺关闭标志
  51. if (intval($this->store_info['store_state']) === 0) {
  52. View::assign('store_closed', true);
  53. View::assign('store_close_info', $this->store_info['store_close_info']);
  54. }
  55. // 店铺等级
  56. if (session('is_platform_store')) {
  57. $this->store_grade = array(
  58. 'storegrade_id' => '0',
  59. 'storegrade_name' => lang('exclusive_grade_stores'),
  60. 'storegrade_goods_limit' => '0',
  61. 'storegrade_album_limit' => '0',
  62. 'storegrade_space_limit' => '999999999',
  63. 'storegrade_template_number' => '6',
  64. // 'storegrade_template' => 'default|style1|style2|style3|style4|style5',
  65. 'storegrade_price' => '0.00',
  66. 'storegrade_description' => '',
  67. 'storegrade_sort' => '255',
  68. );
  69. } else {
  70. $store_grade = rkcache('storegrade', true);
  71. $this->store_grade = @$store_grade[$this->store_info['grade_id']];
  72. }
  73. if (session('seller_is_admin') !== 1 && request()->controller() !== 'Seller' && request()->controller() !== 'Sellerlogin') {
  74. $this->checkPermission();
  75. }
  76. }
  77. }
  78. /**
  79. * 记录卖家日志
  80. *
  81. * @param $content 日志内容
  82. * @param $state 1成功 0失败
  83. */
  84. protected function recordSellerlog($content = '', $state = 1) {
  85. $seller_info = array();
  86. $seller_info['sellerlog_content'] = $content;
  87. $seller_info['sellerlog_time'] = TIMESTAMP;
  88. $seller_info['sellerlog_seller_id'] = session('seller_id');
  89. $seller_info['sellerlog_seller_name'] = session('seller_name');
  90. $seller_info['sellerlog_store_id'] = session('store_id');
  91. $seller_info['sellerlog_seller_ip'] = request()->ip();
  92. $seller_info['sellerlog_url'] = 'home/' . request()->controller() . '/' . request()->action();
  93. $seller_info['sellerlog_state'] = $state;
  94. $sellerlog_model = model('sellerlog');
  95. $sellerlog_model->addSellerlog($seller_info);
  96. }
  97. /**
  98. * 记录店铺费用
  99. *
  100. * @param $storecost_price 费用金额
  101. * @param $storecost_remark 费用备注
  102. */
  103. protected function recordStorecost($storecost_price, $storecost_remark) {
  104. // 平台店铺不记录店铺费用
  105. if (check_platform_store()) {
  106. return false;
  107. }
  108. $storecost_model = model('storecost');
  109. $param = array();
  110. $param['storecost_store_id'] = session('store_id');
  111. $param['storecost_seller_id'] = session('seller_id');
  112. $param['storecost_price'] = $storecost_price;
  113. $param['storecost_remark'] = $storecost_remark;
  114. $param['storecost_state'] = 0;
  115. $param['storecost_time'] = TIMESTAMP;
  116. $storecost_model->addStorecost($param);
  117. // 发送店铺消息
  118. $param = array();
  119. $param['code'] = 'store_cost';
  120. $param['store_id'] = session('store_id');
  121. $param['ali_param'] = array(
  122. 'price' => $storecost_price,
  123. 'seller_name' => session('seller_name'),
  124. 'remark' => $storecost_remark
  125. );
  126. $param['ten_param'] = array(
  127. $storecost_price,
  128. session('seller_name'),
  129. $storecost_remark
  130. );
  131. $param['param'] = $param['ali_param'];
  132. //微信模板消息
  133. $param['weixin_param'] = array(
  134. 'url' => config('ds_config.h5_store_site_url') . '/pages/seller/cost/CostList',
  135. 'data' => array(
  136. "keyword1" => array(
  137. "value" => $storecost_price,
  138. "color" => "#333"
  139. ),
  140. "keyword2" => array(
  141. "value" => date('Y-m-d H:i'),
  142. "color" => "#333"
  143. )
  144. ),
  145. );
  146. model('cron')->addCron(array('cron_exetime'=>TIMESTAMP,'cron_type'=>'sendStoremsg','cron_value'=>serialize($param)));
  147. }
  148. /**
  149. * 添加到任务队列
  150. *
  151. * @param array $goods_array
  152. * @param boolean $ifdel 是否删除以原记录
  153. */
  154. protected function addcron($data = array(), $ifdel = false) {
  155. $cron_model = model('cron');
  156. if (isset($data[0])) { // 批量插入
  157. $where = array();
  158. foreach ($data as $k => $v) {
  159. // 删除原纪录条件
  160. if ($ifdel) {
  161. $where[] = '(cron_type = "' . $data['cron_type'] . '" and cron_value = "' . $data['cron_value'] . '")';
  162. }
  163. }
  164. // 删除原纪录
  165. if ($ifdel) {
  166. $cron_model->delCron(implode(',', $where));
  167. }
  168. $cron_model->addCronAll($data);
  169. } else { // 单条插入
  170. // 删除原纪录
  171. if ($ifdel) {
  172. $cron_model->delCron(array('cron_type' => $data['cron_type'], 'cron_value' => $data['cron_value']));
  173. }
  174. $cron_model->addCron($data);
  175. }
  176. }
  177. /**
  178. * 当前选中的栏目
  179. */
  180. protected function setSellerCurItem($curitem = '') {
  181. View::assign('seller_item', $this->getSellerItemList());
  182. View::assign('curitem', $curitem);
  183. }
  184. /**
  185. * 当前选中的子菜单
  186. */
  187. protected function setSellerCurMenu($cursubmenu = '') {
  188. $seller_menu = self::getSellerMenuList($this->store_info['is_platform_store']);
  189. $seller_menu=$this->parseMenu($seller_menu);
  190. View::assign('seller_menu', $seller_menu);
  191. $curmenu = '';
  192. foreach ($seller_menu as $key => $menu) {
  193. foreach ($menu['submenu'] as $subkey => $submenu) {
  194. if ($submenu['name'] == $cursubmenu) {
  195. $curmenu = $menu['name'];
  196. }
  197. }
  198. }
  199. //当前一级菜单
  200. View::assign('curmenu', $curmenu);
  201. //当前二级菜单
  202. View::assign('cursubmenu', $cursubmenu);
  203. }
  204. /*
  205. * 获取卖家栏目列表,针对控制器下的栏目
  206. */
  207. protected function getSellerItemList() {
  208. return array();
  209. }
  210. /**
  211. * 验证当前管理员权限是否可以进行操作
  212. *
  213. * @param string $link_nav
  214. * @return
  215. */
  216. protected final function checkPermission($link_nav = null) {
  217. if (session('seller_is_admin') == 1)
  218. return true;
  219. $controller = request()->controller();
  220. $action = request()->action();
  221. if (!empty(session('seller_limits'))) {
  222. $permission = session('seller_limits');
  223. //显示隐藏小导航,成功与否都直接返回
  224. if (is_array($link_nav)) {
  225. if (!in_array("{$link_nav['controller']}.{$link_nav['action']}", $permission) && !in_array($link_nav['controller'], $permission)) {
  226. return false;
  227. } else {
  228. return true;
  229. }
  230. }
  231. //以下几项不需要验证
  232. $tmp = array();
  233. if (in_array($controller, $tmp)) {
  234. return true;
  235. }
  236. if (in_array($controller, $permission) || in_array("$controller.$action", $permission)) {
  237. return true;
  238. } else {
  239. $extlimit = array('ajax', 'export_step1');
  240. if (in_array($action, $extlimit) && (in_array($controller, $permission) || strpos(serialize($permission), '"' . $controller . '.'))) {
  241. return true;
  242. }
  243. //带前缀的都通过
  244. foreach ($permission as $v) {
  245. if (!empty($v) && strpos("$controller.$action", $v . '_') !== false) {
  246. return true;
  247. break;
  248. }
  249. }
  250. }
  251. }
  252. $this->error(lang('have_no_legalpower'), 'Seller/index');
  253. }
  254. /**
  255. * 过滤掉无权查看的菜单
  256. *
  257. * @param array $menu
  258. * @return array
  259. */
  260. private final function parseMenu($menu = array()) {
  261. if (session('seller_is_admin') === 1) {
  262. return $menu;
  263. }
  264. foreach ($menu as $k => $v) {
  265. foreach ($v['submenu'] as $ck => $cv) {
  266. $tmp = array($cv['action'], $cv['controller']);
  267. //以下几项不需要验证
  268. $except = array();
  269. if (in_array($tmp[1], $except))
  270. continue;
  271. if (!in_array($tmp[1], session('seller_limits')) && !in_array($tmp[1] . '.' . $tmp[0], session('seller_limits'))) {
  272. unset($menu[$k]['submenu'][$ck]);
  273. }
  274. }
  275. if (empty($menu[$k]['submenu'])) {
  276. unset($menu[$k]);
  277. unset($menu[$k]['submenu']);
  278. } else {
  279. $temp=current($menu[$k]['submenu']);
  280. $menu[$k]['url'] = $temp['url'];
  281. }
  282. }
  283. return $menu;
  284. }
  285. /*
  286. * 获取卖家菜单列表
  287. */
  288. public static function getSellerMenuList($is_platform_store = 0) {
  289. //controller 注意第一个字母要大写
  290. $menu_list = array(
  291. 'sellergoods' =>
  292. array(
  293. 'ico' => '&#xe732;',
  294. 'name' => 'sellergoods',
  295. 'text' => lang('site_search_goods'),
  296. 'url' => (string) url('Sellergoodsonline/index'),
  297. 'submenu' => array(
  298. array('name' => 'sellergoodsadd', 'text' => lang('goods_released'), 'action' => null, 'controller' => 'Sellergoodsadd', 'url' => (string) url('Sellergoodsadd/index'),),
  299. array('name' => 'seller_taobao_import', 'text' => lang('taobao_import'), 'action' => null, 'controller' => 'SellerTaobaoImport', 'url' => (string) url('SellerTaobaoImport/index'),),
  300. array('name' => 'sellergoodsonline', 'text' => lang('goods_on_sale'), 'action' => null, 'controller' => 'Sellergoodsonline', 'url' => (string) url('Sellergoodsonline/index'),),
  301. array('name' => 'sellergoodsoffline', 'text' => lang('warehouse_goods'), 'action' => null, 'controller' => 'Sellergoodsoffline', 'url' => (string) url('Sellergoodsoffline/index'),),
  302. array('name' => 'sellerplate', 'text' => lang('associated_format'), 'action' => null, 'controller' => 'Sellerplate', 'url' => (string) url('Sellerplate/index'),),
  303. array('name' => 'sellerspec', 'text' => lang('product_specifications'), 'action' => null, 'controller' => 'Sellerspec', 'url' => (string) url('Sellerspec/index'),),
  304. array('name' => 'selleralbum', 'text' => lang('image_space'), 'action' => null, 'controller' => 'Selleralbum', 'url' => (string) url('Selleralbum/index'),),
  305. array('name' => 'sellervideo', 'text' => lang('seller_goodsvideo'), 'action' => null, 'controller' => 'Sellervideo', 'url' => (string) url('Sellervideo/index'),),
  306. array('name' => 'seller_service', 'text' => lang('seller_service'), 'action' => null, 'controller' => 'SellerService', 'url' => (string) url('SellerService/index'),),
  307. )
  308. ),
  309. 'sellerorder' =>
  310. array(
  311. 'ico' => '&#xe71f;',
  312. 'name' => 'sellerorder',
  313. 'text' => lang('pointsorderdesc_1'),
  314. 'url' => (string) url('Sellerorder/index'),
  315. 'submenu' => array(
  316. array('name' => 'sellerorder', 'text' => lang('order_physical_transaction'), 'action' => null, 'controller' => 'Sellerorder', 'url' => (string) url('Sellerorder/index'),),
  317. array('name' => 'sellervrorder', 'text' => lang('code_order'), 'action' => null, 'controller' => 'Sellervrorder', 'url' => (string) url('Sellervrorder/index'),),
  318. array('name' => 'sellerdeliver', 'text' => lang('delivery_management'), 'action' => null, 'controller' => 'Sellerdeliver', 'url' => (string) url('Sellerdeliver/index'),),
  319. array('name' => 'sellerdeliverset', 'text' => lang('delivery_settings'), 'action' => null, 'controller' => 'Sellerdeliverset', 'url' => (string) url('Sellerdeliverset/index'),),
  320. array('name' => 'sellerevaluate', 'text' => lang('evaluation_management'), 'action' => null, 'controller' => 'Sellerevaluate', 'url' => (string) url('Sellerevaluate/index'),),
  321. array('name' => 'sellertransport', 'text' => lang('sales_area'), 'action' => null, 'controller' => 'Sellertransport', 'url' => (string) url('Sellertransport/index'),),
  322. array('name' => 'Sellerbill', 'text' => lang('physical_settlement'), 'action' => null, 'controller' => 'Sellerbill', 'url' => (string) url('Sellerbill/index'),),
  323. )
  324. ),
  325. 'sellergroupbuy' =>
  326. array(
  327. 'ico' => '&#xe704;',
  328. 'name' => 'sellergroupbuy',
  329. 'text' => lang('sales_promotion'),
  330. 'url' => (string) url('Sellergroupbuy/index'),
  331. 'submenu' => array(
  332. array('name' => 'Sellerpromotionwholesale', 'text' => lang('wholesale_management'), 'action' => null, 'controller' => 'Sellerpromotionwholesale', 'url' => (string) url('Sellerpromotionwholesale/index'),),
  333. array('name' => 'Sellergroupbuy', 'text' => lang('snap_up_management'), 'action' => null, 'controller' => 'Sellergroupbuy', 'url' => (string) url('Sellergroupbuy/index'),),
  334. array('name' => 'Sellerpromotionxianshi', 'text' => lang('time_discount'), 'action' => null, 'controller' => 'Sellerpromotionxianshi', 'url' => (string) url('Sellerpromotionxianshi/index'),),
  335. array('name' => 'Sellermgdiscount', 'text' => lang('membership_level_discount'), 'action' => null, 'controller' => 'Sellerpromotionmgdiscount', 'url' => (string) url('Sellerpromotionmgdiscount/mgdiscount_store'),),
  336. array('name' => 'Sellerpromotionpintuan', 'text' => lang('syndication'), 'action' => null, 'controller' => 'Sellerpromotionpintuan', 'url' => (string) url('Sellerpromotionpintuan/index'),),
  337. array('name' => 'Sellerpromotionbargain', 'text' => lang('baseseller_bargain'), 'action' => null, 'controller' => 'Sellerpromotionbargain', 'url' => (string) url('Sellerpromotionbargain/index'),),
  338. array('name' => 'Sellerpromotionpresell', 'text' => lang('baseseller_presell'), 'action' => null, 'controller' => 'Sellerpromotionpresell', 'url' => (string) url('Sellerpromotionpresell/index'),),
  339. array('name' => 'Sellerpromotionmansong', 'text' => lang('free_on_delivery'), 'action' => null, 'controller' => 'Sellerpromotionmansong', 'url' => (string) url('Sellerpromotionmansong/index'),),
  340. array('name' => 'Sellerpromotionbundling', 'text' => lang('discount_package'), 'action' => null, 'controller' => 'Sellerpromotionbundling', 'url' => (string) url('Sellerpromotionbundling/index'),),
  341. array('name' => 'Sellerpromotionbooth', 'text' => lang('recommended_stand'), 'action' => null, 'controller' => 'Sellerpromotionbooth', 'url' => (string) url('Sellerpromotionbooth/index'),),
  342. array('name' => 'Sellervoucher', 'text' => lang('voucher_management'), 'action' => null, 'controller' => 'Sellervoucher', 'url' => (string) url('Sellervoucher/templatelist'),),
  343. array('name' => 'Selleractivity', 'text' => lang('activity_management'), 'action' => null, 'controller' => 'Selleractivity', 'url' => (string) url('Selleractivity/index'),),
  344. )
  345. ),
  346. 'seller' =>
  347. array(
  348. 'ico' => '&#xe663;',
  349. 'name' => 'seller',
  350. 'text' => lang('site_search_store'),
  351. 'url' => (string) url('Seller/index'),
  352. 'submenu' => array(
  353. array('name' => 'seller_index', 'text' => lang('store_overview'), 'action' => null, 'controller' => 'Seller', 'url' => (string) url('Seller/index'),),
  354. array('name' => 'seller_setting', 'text' => lang('store_setup'), 'action' => null, 'controller' => 'Sellersetting', 'url' => (string) url('Sellersetting/setting'),),
  355. array('name' => 'seller_editable_page_pc', 'text' => lang('store_editable_page_pc'), 'action' => 'page_list', 'controller' => 'SellerEditablePage', 'url' => (string) url('SellerEditablePage/page_list'),),
  356. array('name' => 'seller_editable_page_h5', 'text' => lang('store_editable_page_h5'), 'action' => 'h5_page_list', 'controller' => 'SellerEditablePage', 'url' => (string) url('SellerEditablePage/h5_page_list'),),
  357. array('name' => 'seller_navigation', 'text' => lang('store_navigation'), 'action' => null, 'controller' => 'Sellernavigation', 'url' => (string) url('Sellernavigation/index'),),
  358. array('name' => 'sellersns', 'text' => lang('store_dynamics'), 'action' => null, 'controller' => 'Sellersns', 'url' => (string) url('Sellersns/index'),),
  359. array('name' => 'sellergoodsclass', 'text' => lang('store_classification'), 'action' => null, 'controller' => 'Sellergoodsclass', 'url' => (string) url('Sellergoodsclass/index'),),
  360. array('name' => 'seller_chain', 'text' => lang('seller_chain'), 'action' => null, 'controller' => 'SellerChain', 'url' => (string) url('SellerChain/index'),),
  361. array('name' => 'seller_brand', 'text' => lang('brand_application'), 'action' => null, 'controller' => 'Sellerbrand', 'url' => (string) url('Sellerbrand/index'),),
  362. )
  363. ),
  364. 'sellerconsult' =>
  365. array(
  366. 'ico' => '&#xe6ab;',
  367. 'name' => 'sellerconsult',
  368. 'text' => lang('after_sales_service'),
  369. 'url' => (string) url('Sellerconsult/index'),
  370. 'submenu' => array(
  371. array('name' => 'seller_consult', 'text' => lang('consulting_management'), 'action' => null, 'controller' => 'Sellerconsult', 'url' => (string) url('Sellerconsult/index'),),
  372. array('name' => 'seller_complain', 'text' => lang('complaint_record'), 'action' => null, 'controller' => 'Sellercomplain', 'url' => (string) url('Sellercomplain/index'),),
  373. array('name' => 'seller_refund', 'text' => lang('refund_paragraph'), 'action' => null, 'controller' => 'Sellerrefund', 'url' => (string) url('Sellerrefund/index'),),
  374. array('name' => 'seller_return', 'text' => lang('refund_cargo'), 'action' => null, 'controller' => 'Sellerreturn', 'url' => (string) url('Sellerreturn/index'),),
  375. )
  376. ),
  377. 'sellerstatistics' =>
  378. array(
  379. 'ico' => '&#xe6a3;',
  380. 'name' => 'sellerstatistics',
  381. 'text' => lang('statistics'),
  382. 'url' => (string) url('Statisticsgeneral/index'),
  383. 'submenu' => array(
  384. array('name' => 'Statisticsgeneral', 'text' => lang('store_overview'), 'action' => null, 'controller' => 'Statisticsgeneral', 'url' => (string) url('Statisticsgeneral/index'),),
  385. array('name' => 'Statisticsgoods', 'text' => lang('commodity_analysis'), 'action' => null, 'controller' => 'Statisticsgoods', 'url' => (string) url('Statisticsgoods/index'),),
  386. array('name' => 'Statisticssale', 'text' => lang('operational_report'), 'action' => null, 'controller' => 'Statisticssale', 'url' => (string) url('Statisticssale/index'),),
  387. array('name' => 'Statisticsindustry', 'text' => lang('industry_analysis'), 'action' => null, 'controller' => 'Statisticsindustry', 'url' => (string) url('Statisticsindustry/index'),),
  388. array('name' => 'Statisticsflow', 'text' => lang('traffic_statistics'), 'action' => null, 'controller' => 'Statisticsflow', 'url' => (string) url('Statisticsflow/index'),),
  389. )
  390. ),
  391. 'sellercallcenter' =>
  392. array(
  393. 'ico' => '&#xe61c;',
  394. 'name' => 'sellercallcenter',
  395. 'text' => lang('news_service'),
  396. 'url' => (string) url('Sellercallcenter/index'),
  397. 'submenu' => array(
  398. array('name' => 'Sellercallcenter', 'text' => lang('setting_service'), 'action' => null, 'controller' => 'Sellercallcenter', 'url' => (string) url('Sellercallcenter/index'),),
  399. array('name' => 'Sellermsg', 'text' => lang('system_message'), 'action' => null, 'controller' => 'Sellermsg', 'url' => (string) url('Sellermsg/index'),),
  400. array('name' => 'seller_instant_message', 'text' => lang('chat_query'), 'action' => null, 'controller' => 'SellerInstantMessage', 'url' => (string) url('SellerInstantMessage/index'),),
  401. )
  402. ),
  403. 'selleraccount' =>
  404. array(
  405. 'ico' => '&#xe702;',
  406. 'name' => 'selleraccount',
  407. 'text' => lang('account'),
  408. 'url' => (string) url('Selleraccount/account_list'),
  409. 'submenu' => array(
  410. array('name' => 'selleraccount', 'text' => lang('account_list'), 'action' => null, 'controller' => 'Selleraccount', 'url' => (string) url('Selleraccount/account_list'),),
  411. array('name' => 'selleraccountgroup', 'text' => lang('account_group'), 'action' => null, 'controller' => 'Selleraccountgroup', 'url' => (string) url('Selleraccountgroup/group_list'),),
  412. array('name' => 'sellerlog', 'text' => lang('account_log'), 'action' => null, 'controller' => 'Sellerlog', 'url' => (string) url('Sellerlog/log_list'),),
  413. )
  414. ),
  415. );
  416. if (!$is_platform_store) {
  417. $menu_list['seller']['submenu'] = array_merge(array(array('name' => 'seller_money', 'text' => lang('store_money'), 'action' => null, 'controller' => 'Sellermoney', 'url' => (string) url('Sellermoney/index'),), array('name' => 'seller_deposit', 'text' => lang('store_deposit'), 'action' => null, 'controller' => 'Sellerdeposit', 'url' => (string) url('Sellerdeposit/index'),),array('name' => 'sellerinfo', 'text' => lang('store_information'), 'action' => null, 'controller' => 'Sellerinfo', 'url' => (string) url('Sellerinfo/index'),),), $menu_list['seller']['submenu']);
  418. $menu_list['selleraccount']['submenu'] = array_merge(array(array('name' => 'sellercost', 'text' => lang('store_consumption'), 'action' => null, 'controller' => 'Sellercost', 'url' => (string) url('Sellercost/cost_list'),)), $menu_list['selleraccount']['submenu']);
  419. }
  420. if (config('ds_config.inviter_open')) {
  421. $menu_list['sellerinviter'] = array(
  422. 'ico' => '&#xe6ed;',
  423. 'name' => 'sellerinviter',
  424. 'text' => lang('distribution'),
  425. 'url' => (string) url('Sellerinviter/goods_list'),
  426. 'submenu' => array(
  427. array('name' => 'sellerinviter_goods', 'text' => lang('distribution_management'), 'action' => 'goods_list', 'controller' => 'Sellerinviter', 'url' => (string) url('Sellerinviter/goods_list'),),
  428. array('name' => 'sellerinviter_order', 'text' => lang('distribution_earnings'), 'action' => 'order_list', 'controller' => 'Sellerinviter', 'url' => (string) url('Sellerinviter/order_list'),),
  429. )
  430. );
  431. }
  432. return $menu_list;
  433. }
  434. /**
  435. * 自动发布店铺动态
  436. *
  437. * @param array $data 相关数据
  438. * @param string $type 类型 'new','coupon','xianshi','mansong','bundling','groupbuy'
  439. * 所需字段
  440. * new goods表' goods_id,store_id,goods_name,goods_image,goods_price,goods_transfee_charge,goods_freight
  441. * xianshi pxianshigoods表' goods_id,store_id,goods_name,goods_image,goods_price,goods_freight,xianshi_price
  442. * mansong pmansong表' mansong_name,start_time,end_time,store_id
  443. * bundling pbundling表' bl_id,bl_name,bl_img,bl_discount_price,bl_freight_choose,bl_freight,store_id
  444. * groupbuy goodsgroup表' group_id,group_name,goods_id,goods_price,groupbuy_price,group_pic,rebate,start_time,end_time
  445. * coupon在后台发布
  446. */
  447. public function storeAutoShare($data, $type) {
  448. $param = array(
  449. 3 => 'new',
  450. 4 => 'coupon',
  451. 5 => 'xianshi',
  452. 6 => 'mansong',
  453. 7 => 'bundling',
  454. 8 => 'groupbuy'
  455. );
  456. $param_flip = array_flip($param);
  457. if (!in_array($type, $param) || empty($data)) {
  458. return false;
  459. }
  460. $auto_setting = model('storesnssetting')->getStoresnssettingInfo(array('storesnsset_storeid' => session('store_id')));
  461. $auto_sign = false; // 自动发布开启标志
  462. if ($auto_setting['storesnsset_' . $type] == 1) {
  463. $auto_sign = true;
  464. $goodsdata = addslashes(json_encode($data));
  465. if ($auto_setting['storesnsset_' . $type . 'title'] != '') {
  466. $title = $auto_setting['storesnsset_' . $type . 'title'];
  467. } else {
  468. $auto_title = 'ds_store_auto_share_' . $type . rand(1, 5);
  469. $title = lang($auto_title);
  470. }
  471. }
  472. if ($auto_sign) {
  473. // 插入数据
  474. $stracelog_array = array();
  475. $stracelog_array['stracelog_storeid'] = $this->store_info['store_id'];
  476. $stracelog_array['stracelog_storename'] = $this->store_info['store_name'];
  477. $stracelog_array['stracelog_storelogo'] = empty($this->store_info['store_avatar']) ? '' : $this->store_info['store_avatar'];
  478. $stracelog_array['stracelog_title'] = $title;
  479. $stracelog_array['stracelog_content'] = '';
  480. $stracelog_array['stracelog_time'] = TIMESTAMP;
  481. $stracelog_array['stracelog_type'] = $param_flip[$type];
  482. $stracelog_array['stracelog_goodsdata'] = $goodsdata;
  483. model('storesnstracelog')->addStoresnstracelog($stracelog_array);
  484. return true;
  485. } else {
  486. return false;
  487. }
  488. }
  489. }
  490. ?>