BaseSeller.php 28 KB

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