BaseSeller.php 29 KB

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