BaseSeller.php 28 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. * 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. //卖家中心模板路径
  28. $this->template_dir = 'default/seller/' . strtolower(request()->controller()) . '/';
  29. if (request()->controller() != 'Sellerlogin') {
  30. if (!session('member_id')) {
  31. $this->redirect('home/Sellerlogin/login');
  32. }
  33. if (!session('seller_id')) {
  34. $this->redirect('home/Sellerlogin/login');
  35. }
  36. // 验证店铺是否存在
  37. $store_model = model('store');
  38. $this->store_info = $store_model->getStoreInfoByID(session('store_id'));
  39. if (empty($this->store_info)) {
  40. $this->redirect('home/Sellerlogin/login');
  41. }
  42. // 店铺关闭标志
  43. if (intval($this->store_info['store_state']) === 0) {
  44. View::assign('store_closed', true);
  45. View::assign('store_close_info', $this->store_info['store_close_info']);
  46. }
  47. // 店铺等级
  48. if (session('is_platform_store')) {
  49. $this->store_grade = array(
  50. 'storegrade_id' => '0',
  51. 'storegrade_name' => lang('exclusive_grade_stores'),
  52. 'storegrade_goods_limit' => '0',
  53. 'storegrade_album_limit' => '0',
  54. 'storegrade_space_limit' => '999999999',
  55. 'storegrade_template_number' => '6',
  56. // 'storegrade_template' => 'default|style1|style2|style3|style4|style5',
  57. 'storegrade_price' => '0.00',
  58. 'storegrade_description' => '',
  59. 'storegrade_sort' => '255',
  60. );
  61. } else {
  62. $store_grade = rkcache('storegrade', true);
  63. $this->store_grade = @$store_grade[$this->store_info['grade_id']];
  64. }
  65. if (session('seller_is_admin') !== 1 && request()->controller() !== 'Seller' && request()->controller() !== 'Sellerlogin') {
  66. $this->checkPermission();
  67. }
  68. }
  69. }
  70. /**
  71. * 记录卖家日志
  72. *
  73. * @param $content 日志内容
  74. * @param $state 1成功 0失败
  75. */
  76. protected function recordSellerlog($content = '', $state = 1) {
  77. $seller_info = array();
  78. $seller_info['sellerlog_content'] = $content;
  79. $seller_info['sellerlog_time'] = TIMESTAMP;
  80. $seller_info['sellerlog_seller_id'] = session('seller_id');
  81. $seller_info['sellerlog_seller_name'] = session('seller_name');
  82. $seller_info['sellerlog_store_id'] = session('store_id');
  83. $seller_info['sellerlog_seller_ip'] = request()->ip();
  84. $seller_info['sellerlog_url'] = 'home/' . request()->controller() . '/' . request()->action();
  85. $seller_info['sellerlog_state'] = $state;
  86. $sellerlog_model = model('sellerlog');
  87. $sellerlog_model->addSellerlog($seller_info);
  88. }
  89. /**
  90. * 记录店铺费用
  91. *
  92. * @param $storecost_price 费用金额
  93. * @param $storecost_remark 费用备注
  94. */
  95. protected function recordStorecost($storecost_price, $storecost_remark) {
  96. // 平台店铺不记录店铺费用
  97. if (check_platform_store()) {
  98. return false;
  99. }
  100. $storecost_model = model('storecost');
  101. $param = array();
  102. $param['storecost_store_id'] = session('store_id');
  103. $param['storecost_seller_id'] = session('seller_id');
  104. $param['storecost_price'] = $storecost_price;
  105. $param['storecost_remark'] = $storecost_remark;
  106. $param['storecost_state'] = 0;
  107. $param['storecost_time'] = TIMESTAMP;
  108. $storecost_model->addStorecost($param);
  109. // 发送店铺消息
  110. $param = array();
  111. $param['code'] = 'store_cost';
  112. $param['store_id'] = session('store_id');
  113. $param['ali_param'] = array(
  114. 'price' => $storecost_price,
  115. 'seller_name' => session('seller_name'),
  116. 'remark' => $storecost_remark
  117. );
  118. $param['ten_param'] = array(
  119. $storecost_price,
  120. session('seller_name'),
  121. $storecost_remark
  122. );
  123. $param['param'] = $param['ali_param'];
  124. //微信模板消息
  125. $param['weixin_param'] = array(
  126. 'url' => config('ds_config.h5_site_url') . '/seller/cost_list',
  127. 'data' => array(
  128. "keyword1" => array(
  129. "value" => $storecost_price,
  130. "color" => "#333"
  131. ),
  132. "keyword2" => array(
  133. "value" => date('Y-m-d H:i'),
  134. "color" => "#333"
  135. )
  136. ),
  137. );
  138. \mall\queue\QueueClient::push('sendStoremsg', $param);
  139. }
  140. /**
  141. * 添加到任务队列
  142. *
  143. * @param array $goods_array
  144. * @param boolean $ifdel 是否删除以原记录
  145. */
  146. protected function addcron($data = array(), $ifdel = false) {
  147. $cron_model = model('cron');
  148. if (isset($data[0])) { // 批量插入
  149. $where = array();
  150. foreach ($data as $k => $v) {
  151. if (isset($v['content'])) {
  152. $data[$k]['content'] = serialize($v['content']);
  153. }
  154. // 删除原纪录条件
  155. if ($ifdel) {
  156. $where[] = '(type = ' . $data['type'] . ' and exeid = ' . $data['exeid'] . ')';
  157. }
  158. }
  159. // 删除原纪录
  160. if ($ifdel) {
  161. $cron_model->delCron(implode(',', $where));
  162. }
  163. $cron_model->addCronAll($data);
  164. } else { // 单条插入
  165. if (isset($data['content'])) {
  166. $data['content'] = serialize($data['content']);
  167. }
  168. // 删除原纪录
  169. if ($ifdel) {
  170. $cron_model->delCron(array('type' => $data['type'], 'exeid' => $data['exeid']));
  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. )
  305. ),
  306. 'sellerorder' =>
  307. array(
  308. 'ico' => '&#xe71f;',
  309. 'name' => 'sellerorder',
  310. 'text' => lang('pointsorderdesc_1'),
  311. 'url' => (string) url('Sellerorder/index'),
  312. 'submenu' => array(
  313. array('name' => 'sellerorder', 'text' => lang('order_physical_transaction'), 'action' => null, 'controller' => 'Sellerorder', 'url' => (string) url('Sellerorder/index'),),
  314. array('name' => 'sellervrorder', 'text' => lang('code_order'), 'action' => null, 'controller' => 'Sellervrorder', 'url' => (string) url('Sellervrorder/index'),),
  315. array('name' => 'sellerstoreorder', 'text' => '到店付款订单', 'action' => null, 'controller' => 'Sellerstoreorder', 'url' => (string) url('Sellerstoreorder/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' => 'sellerinfo', 'text' => lang('store_information'), 'action' => null, 'controller' => 'Sellerinfo', 'url' => (string) url('Sellerinfo/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. array('name' => 'sellercost', 'text' => lang('store_consumption'), 'action' => null, 'controller' => 'Sellercost', 'url' => (string) url('Sellercost/cost_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'),)), $menu_list['seller']['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. ?>