Sellerpromotionxianshi.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. use think\facade\Db;
  6. /**
  7. *
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * 控制器
  12. */
  13. class Sellerpromotionxianshi extends BaseSeller
  14. {
  15. public function initialize()
  16. {
  17. parent::initialize(); // TODO: Change the autogenerated stub
  18. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/sellerpromotionxianshi.lang.php');
  19. if (intval(config('ds_config.promotion_allow')) !== 1) {
  20. $this->error(lang('promotion_unavailable'), 'seller/index');
  21. }
  22. }
  23. public function index()
  24. {
  25. $xianshiquota_model = model('pxianshiquota');
  26. $pxianshi_model = model('pxianshi');
  27. if (check_platform_store()) {
  28. View::assign('isPlatformStore', true);
  29. } else {
  30. $current_xianshi_quota = $xianshiquota_model->getXianshiquotaCurrent(session('store_id'));
  31. View::assign('current_xianshi_quota', $current_xianshi_quota);
  32. }
  33. $condition = array();
  34. $condition[] = array('store_id', '=', session('store_id'));
  35. if ((input('param.xianshi_name'))) {
  36. $condition[] = array('xianshi_name', 'like', '%' . input('param.xianshi_name') . '%');
  37. }
  38. if ((input('param.state'))) {
  39. $condition[] = array('xianshi_state', '=', intval(input('param.state')));
  40. }
  41. $xianshi_list = $pxianshi_model->getXianshiList($condition, 10, Db::raw('FIELD(xianshi_state, 1,0,2,3), xianshi_end_time desc'));
  42. View::assign('xianshi_list', $xianshi_list);
  43. View::assign('show_page', $pxianshi_model->page_info->render());
  44. View::assign('xianshi_state_array', $pxianshi_model->getXianshiStateArray());
  45. $this->setSellerCurMenu('Sellerpromotionxianshi');
  46. $this->setSellerCurItem('xianshi_list');
  47. return View::fetch($this->template_dir . 'index');
  48. }
  49. /**
  50. * 添加秒杀活动
  51. * */
  52. public function xianshi_add()
  53. {
  54. if (check_platform_store()) {
  55. View::assign('isPlatformStore', true);
  56. } else {
  57. View::assign('isPlatformStore', false);
  58. $xianshiquota_model = model('pxianshiquota');
  59. $current_xianshi_quota = $xianshiquota_model->getXianshiquotaCurrent(session('store_id'));
  60. if (empty($current_xianshi_quota)) {
  61. if (intval(config('ds_config.promotion_xianshi_price')) != 0) {
  62. $this->error(lang('xianshi_quota_current_error1'));
  63. } else {
  64. $current_xianshi_quota = array('xianshiquota_starttime' => TIMESTAMP, 'xianshiquota_endtime' => TIMESTAMP + 86400 * 30); //没有套餐时,最多一个月
  65. }
  66. }
  67. View::assign('current_xianshi_quota', $current_xianshi_quota);
  68. }
  69. //输出导航
  70. $this->setSellerCurMenu('Sellerpromotionxianshi');
  71. $this->setSellerCurItem('xianshi_add');
  72. return View::fetch($this->template_dir . 'xianshi_add');
  73. }
  74. /**
  75. * 保存添加的秒杀活动
  76. * */
  77. public function xianshi_save()
  78. {
  79. //验证输入
  80. $xianshi_name = trim(input('post.xianshi_name'));
  81. $start_time = strtotime(input('post.start_time'));
  82. $end_time = strtotime(input('post.end_time'));
  83. $lower_limit = intval(input('post.lower_limit'));
  84. if ($lower_limit <= 0) {
  85. $lower_limit = 1;
  86. }
  87. if (empty($xianshi_name)) {
  88. ds_json_encode(10001, lang('xianshi_name_error'));
  89. }
  90. if ($start_time >= $end_time) {
  91. ds_json_encode(10001, lang('greater_than_start_time'));
  92. }
  93. if (!check_platform_store()) {
  94. //获取当前套餐
  95. $xianshiquota_model = model('pxianshiquota');
  96. $current_xianshi_quota = $xianshiquota_model->getXianshiquotaCurrent(session('store_id'));
  97. if (empty($current_xianshi_quota)) {
  98. if (intval(config('ds_config.promotion_xianshi_price')) != 0) {
  99. ds_json_encode(10001, lang('please_buy_package_first'));
  100. } else {
  101. $current_xianshi_quota = array('xianshiquota_starttime' => TIMESTAMP, 'xianshiquota_endtime' => TIMESTAMP + 86400 * 30); //没有套餐时,最多一个月
  102. }
  103. }
  104. $quota_start_time = intval($current_xianshi_quota['xianshiquota_starttime']);
  105. $quota_end_time = intval($current_xianshi_quota['xianshiquota_endtime']);
  106. if ($start_time < $quota_start_time) {
  107. ds_json_encode(10001, sprintf(lang('xianshi_add_start_time_explain'), date('Y-m-d', $current_xianshi_quota['xianshiquota_starttime'])));
  108. }
  109. if ($end_time > $quota_end_time) {
  110. ds_json_encode(10001, sprintf(lang('xianshi_add_end_time_explain'), date('Y-m-d', $current_xianshi_quota['xianshiquota_endtime'])));
  111. }
  112. }
  113. if ($end_time < TIMESTAMP) {
  114. ds_json_encode(10001, sprintf(lang('xianshi_add_end_time_explain'), date('Y-m-d')));
  115. }
  116. //生成活动
  117. $pxianshi_model = model('pxianshi');
  118. $param = array();
  119. $param['xianshi_name'] = $xianshi_name;
  120. $param['xianshi_title'] = input('post.xianshi_title');
  121. $param['xianshi_explain'] = input('post.xianshi_explain');
  122. $param['xianshiquota_id'] = isset($current_xianshi_quota['xianshiquota_id']) ? $current_xianshi_quota['xianshiquota_id'] : 0;
  123. $param['xianshi_starttime'] = $start_time;
  124. $param['xianshi_end_time'] = $end_time;
  125. $param['store_id'] = session('store_id');
  126. $param['store_name'] = session('store_name');
  127. $param['member_id'] = session('member_id');
  128. $param['member_name'] = session('member_name');
  129. $param['xianshi_lower_limit'] = $lower_limit;
  130. $result = $pxianshi_model->addXianshi($param);
  131. if ($result) {
  132. $this->recordSellerlog(lang('add_limited_time_discount_activity') . $xianshi_name . lang('activity_number') . $result);
  133. // 添加计划任务
  134. $this->addcron(array('cron_exetime' => $param['xianshi_end_time'], 'cron_value' => serialize(intval($result)), 'cron_type' => 'editExpireXianshi'), true);
  135. ds_json_encode(10000, lang('xianshi_add_success'));
  136. } else {
  137. ds_json_encode(10001, lang('xianshi_add_fail'));
  138. }
  139. }
  140. /**
  141. * 编辑秒杀活动
  142. * */
  143. public function xianshi_edit()
  144. {
  145. if (check_platform_store()) {
  146. View::assign('isPlatformStore', true);
  147. } else {
  148. View::assign('isPlatformStore', false);
  149. }
  150. $pxianshi_model = model('pxianshi');
  151. $xianshi_info = $pxianshi_model->getXianshiInfoByID(input('param.xianshi_id'));
  152. if (empty($xianshi_info) || !$xianshi_info['editable']) {
  153. $this->error(lang('param_error'));
  154. }
  155. View::assign('xianshi_info', $xianshi_info);
  156. //输出导航
  157. $this->setSellerCurMenu('Sellerpromotionxianshi');
  158. $this->setSellerCurItem('xianshi_edit');
  159. return View::fetch($this->template_dir . 'xianshi_add');
  160. }
  161. /**
  162. * 编辑保存秒杀活动
  163. * */
  164. public function xianshi_edit_save()
  165. {
  166. $xianshi_id = input('post.xianshi_id');
  167. $pxianshi_model = model('pxianshi');
  168. $xianshigoods_model = model('pxianshigoods');
  169. $xianshi_info = $pxianshi_model->getXianshiInfoByID($xianshi_id, session('store_id'));
  170. if (empty($xianshi_info) || !$xianshi_info['editable']) {
  171. ds_json_encode(10001, lang('param_error'));
  172. }
  173. //验证输入
  174. $xianshi_name = trim(input('post.xianshi_name'));
  175. $lower_limit = intval(input('post.lower_limit'));
  176. if ($lower_limit <= 0) {
  177. $lower_limit = 1;
  178. }
  179. if (empty($xianshi_name)) {
  180. ds_json_encode(10001, lang('xianshi_name_error'));
  181. }
  182. //生成活动
  183. $param = array();
  184. $param['xianshi_name'] = $xianshi_name;
  185. $param['xianshi_title'] = input('post.xianshi_title');
  186. $param['xianshi_explain'] = input('post.xianshi_explain');
  187. $param['xianshi_lower_limit'] = $lower_limit;
  188. $param_goods = array();
  189. $param_goods['xianshi_name'] = $xianshi_name;
  190. $param_goods['xianshi_title'] = input('post.xianshi_title');
  191. $param_goods['xianshi_explain'] = input('post.xianshi_explain');
  192. $param_goods['xianshigoods_lower_limit'] = $lower_limit;
  193. $result = $pxianshi_model->editXianshi($param, array('xianshi_id' => $xianshi_id));
  194. $result1 = $xianshigoods_model->editXianshigoods($param_goods, array('xianshi_id' => $xianshi_id));
  195. if ($result) {
  196. $this->recordSellerlog(lang('edit_limited_time_discount_activity') . $xianshi_name . lang('activity_number') . $xianshi_id);
  197. ds_json_encode(10000, lang('ds_common_op_succ'));
  198. } else {
  199. ds_json_encode(10001, lang('ds_common_op_fail'));
  200. }
  201. }
  202. /**
  203. * 秒杀活动删除
  204. * */
  205. public function xianshi_del()
  206. {
  207. $xianshi_id = intval(input('post.xianshi_id'));
  208. $pxianshi_model = model('pxianshi');
  209. $data = array();
  210. $data['result'] = true;
  211. $xianshi_info = $pxianshi_model->getXianshiInfoByID($xianshi_id, session('store_id'));
  212. if (!$xianshi_info) {
  213. ds_json_encode(10001, lang('param_error'));
  214. }
  215. $pxianshi_model = model('pxianshi');
  216. $result = $pxianshi_model->delXianshi(array('xianshi_id' => $xianshi_id));
  217. if ($result) {
  218. $this->recordSellerlog(lang('delete_limited_time_discount_activity') . $xianshi_info['xianshi_name'] . lang('activity_number') . $xianshi_id);
  219. ds_json_encode(10000, lang('ds_common_op_succ'));
  220. } else {
  221. ds_json_encode(10001, lang('ds_common_op_fail'));
  222. }
  223. }
  224. /**
  225. * 秒杀活动管理
  226. * */
  227. public function xianshi_manage()
  228. {
  229. $pxianshi_model = model('pxianshi');
  230. $xianshigoods_model = model('pxianshigoods');
  231. $xianshi_id = intval(input('param.xianshi_id'));
  232. $xianshi_info = $pxianshi_model->getXianshiInfoByID($xianshi_id, session('store_id'));
  233. if (empty($xianshi_info)) {
  234. $this->error(lang('param_error'));
  235. }
  236. View::assign('xianshi_info', $xianshi_info);
  237. //获取秒杀商品列表
  238. $condition = array();
  239. $condition[] = array('xianshi_id', '=', $xianshi_id);
  240. $xianshigoods_list = $xianshigoods_model->getXianshigoodsExtendList($condition);
  241. View::assign('xianshi_goods_list', $xianshigoods_list);
  242. //输出导航
  243. $this->setSellerCurMenu('Sellerpromotionxianshi');
  244. $this->setSellerCurItem('xianshi_manage');
  245. return View::fetch($this->template_dir . 'xianshi_manage');
  246. }
  247. /**
  248. * 秒杀套餐购买
  249. * */
  250. public function xianshi_quota_add()
  251. {
  252. //输出导航
  253. $this->setSellerCurMenu('Sellerpromotionxianshi');
  254. $this->setSellerCurItem('xianshi_quota_add');
  255. return View::fetch($this->template_dir . 'xianshi_quota_add');
  256. }
  257. /**
  258. * 秒杀套餐购买保存
  259. * */
  260. public function xianshi_quota_add_save()
  261. {
  262. if (intval(config('ds_config.promotion_xianshi_price')) == 0) {
  263. ds_json_encode(10001, lang('param_error'));
  264. }
  265. $xianshi_quota_quantity = intval(input('post.xianshi_quota_quantity'));
  266. if ($xianshi_quota_quantity <= 0 || $xianshi_quota_quantity > 12) {
  267. ds_json_encode(10001, lang('xianshi_quota_quantity_error'));
  268. }
  269. //获取当前价格
  270. $current_price = intval(config('ds_config.promotion_xianshi_price'));
  271. //获取该用户已有套餐
  272. $xianshiquota_model = model('pxianshiquota');
  273. $current_xianshi_quota = $xianshiquota_model->getXianshiquotaCurrent(session('store_id'));
  274. $xianshi_add_time = 86400 * 30 * $xianshi_quota_quantity;
  275. if (empty($current_xianshi_quota)) {
  276. //生成套餐
  277. $param = array();
  278. $param['member_id'] = session('member_id');
  279. $param['member_name'] = session('member_name');
  280. $param['store_id'] = session('store_id');
  281. $param['store_name'] = session('store_name');
  282. $param['xianshiquota_starttime'] = TIMESTAMP;
  283. $param['xianshiquota_endtime'] = TIMESTAMP + $xianshi_add_time;
  284. $xianshiquota_model->addXianshiquota($param);
  285. } else {
  286. $param = array();
  287. $param['xianshiquota_endtime'] = Db::raw('xianshiquota_endtime+' . $xianshi_add_time);
  288. $xianshiquota_model->editXianshiquota($param, array('xianshiquota_id' => $current_xianshi_quota['xianshiquota_id']));
  289. }
  290. //记录店铺费用
  291. $this->recordStorecost($current_price * $xianshi_quota_quantity, lang('buy_limited_time_discount'));
  292. $this->recordSellerlog(lang('buy') . $xianshi_quota_quantity . lang('limited_time_discount_package') . $current_price . lang('ds_yuan'));
  293. ds_json_encode(10000, lang('xianshi_quota_add_success'));
  294. }
  295. /**
  296. * 选择活动商品
  297. * */
  298. public function goods_select()
  299. {
  300. $goods_model = model('goods');
  301. $condition = array();
  302. $condition[] = array('goods.store_id', '=', session('store_id'));
  303. $condition[] = array('goods.goods_name', 'like', '%' . input('param.goods_name') . '%');
  304. $goods_list = $goods_model->getGoodsListForPromotion($condition, 'goods.goods_id,goods.goods_commonid,goods.goods_name,goods.goods_image,goods.goods_price', 10, 'xianshi');
  305. View::assign('goods_list', $goods_list);
  306. View::assign('show_page', $goods_model->page_info->render());
  307. echo View::fetch($this->template_dir . 'goods_select');
  308. }
  309. /**
  310. * 秒杀商品添加
  311. * */
  312. public function xianshi_goods_add()
  313. {
  314. $goods_id = intval(input('post.goods_id'));
  315. $xianshi_id = intval(input('post.xianshi_id'));
  316. $xianshi_price = floatval(input('post.xianshi_price'));
  317. $goods_model = model('goods');
  318. $pxianshi_model = model('pxianshi');
  319. $xianshigoods_model = model('pxianshigoods');
  320. $data = array();
  321. $data['result'] = true;
  322. $goods_info = $goods_model->getGoodsInfoByID($goods_id);
  323. if (empty($goods_info) || $goods_info['store_id'] != session('store_id')) {
  324. $data['result'] = false;
  325. $data['message'] = lang('param_error');
  326. echo json_encode($data);
  327. die;
  328. }
  329. $xianshi_info = $pxianshi_model->getXianshiInfoByID($xianshi_id, session('store_id'));
  330. if (!$xianshi_info) {
  331. $data['result'] = false;
  332. $data['message'] = lang('param_error');
  333. echo json_encode($data);
  334. die;
  335. }
  336. //检查商品是否已经参加同时段活动
  337. $condition = array();
  338. $condition[] = array('xianshigoods_end_time', '>', $xianshi_info['xianshi_starttime']);
  339. $condition[] = array('goods_id', '=', $goods_id);
  340. $xianshigoods = $xianshigoods_model->getXianshigoodsExtendList($condition);
  341. if (!empty($xianshigoods)) {
  342. $data['result'] = false;
  343. $data['message'] = lang('product_participated_simultaneous_activities');
  344. echo json_encode($data);
  345. die;
  346. }
  347. //添加到活动商品表
  348. $param = array();
  349. $param['xianshi_id'] = $xianshi_info['xianshi_id'];
  350. $param['xianshi_name'] = $xianshi_info['xianshi_name'];
  351. $param['xianshi_title'] = $xianshi_info['xianshi_title'];
  352. $param['xianshi_explain'] = $xianshi_info['xianshi_explain'];
  353. $param['goods_id'] = $goods_info['goods_id'];
  354. $param['goods_commonid'] = $goods_info['goods_commonid'];
  355. $param['store_id'] = $goods_info['store_id'];
  356. $param['goods_name'] = $goods_info['goods_name'];
  357. $param['goods_price'] = $goods_info['goods_price'];
  358. $param['xianshigoods_price'] = $xianshi_price;
  359. $param['goods_image'] = $goods_info['goods_image'];
  360. $param['xianshigoods_starttime'] = $xianshi_info['xianshi_starttime'];
  361. $param['xianshigoods_end_time'] = $xianshi_info['xianshi_end_time'];
  362. $param['xianshigoods_lower_limit'] = $xianshi_info['xianshi_lower_limit'];
  363. $result = array();
  364. $xianshigoods_info = $xianshigoods_model->addXianshigoods($param);
  365. if ($xianshigoods_info) {
  366. $result['result'] = true;
  367. $data['message'] = lang('add_success');
  368. $data['xianshi_goods'] = $xianshigoods_info;
  369. // 自动发布动态
  370. // goods_id,store_id,goods_name,goods_image,goods_price,goods_freight,xianshi_price
  371. $data_array = array();
  372. $data_array['goods_id'] = $goods_info['goods_id'];
  373. $data_array['store_id'] = session('store_id');
  374. $data_array['goods_name'] = $goods_info['goods_name'];
  375. $data_array['goods_image'] = $goods_info['goods_image'];
  376. $data_array['goods_price'] = $goods_info['goods_price'];
  377. $data_array['goods_freight'] = $goods_info['goods_freight'];
  378. $data_array['xianshigoods_price'] = $xianshi_price;
  379. $this->storeAutoShare($data_array, 'xianshi');
  380. $this->recordSellerlog(lang('add_limited_time_discount_items') . $xianshi_info['xianshi_name'] . ',' . lang('goods_name') . ':' . $goods_info['goods_name']);
  381. // 添加任务计划
  382. $this->addcron(array('cron_type' => 'updateGoodsPromotionPriceByGoodsId', 'cron_value' => serialize($goods_info['goods_id']), 'cron_exetime' => $param['xianshigoods_starttime']));
  383. } else {
  384. $data['result'] = false;
  385. $data['message'] = lang('param_error');
  386. }
  387. echo json_encode($data);
  388. die;
  389. }
  390. /**
  391. * 秒杀商品价格修改
  392. * */
  393. public function xianshi_goods_price_edit()
  394. {
  395. $xianshigoods_id = intval(input('post.xianshigoods_id'));
  396. $xianshi_price = floatval(input('post.xianshi_price'));
  397. $data = array();
  398. $data['result'] = true;
  399. $xianshigoods_model = model('pxianshigoods');
  400. $xianshigoods_info = $xianshigoods_model->getXianshigoodsInfoByID($xianshigoods_id, session('store_id'));
  401. if (!$xianshigoods_info) {
  402. $data['result'] = false;
  403. $data['message'] = lang('param_error');
  404. echo json_encode($data);
  405. die;
  406. }
  407. $update = array();
  408. $update['xianshigoods_price'] = $xianshi_price;
  409. $condition = array();
  410. $condition[] = array('xianshigoods_id', '=', $xianshigoods_id);
  411. $result = $xianshigoods_model->editXianshigoods($update, $condition);
  412. if ($result) {
  413. $xianshigoods_info['xianshigoods_price'] = $xianshi_price;
  414. $xianshigoods_info = $xianshigoods_model->getXianshigoodsExtendInfo($xianshigoods_info);
  415. $data['xianshi_price'] = $xianshigoods_info['xianshigoods_price'];
  416. $data['xianshi_discount'] = $xianshigoods_info['xianshi_discount'];
  417. // 添加对列修改商品促销价格
  418. model('cron')->addCron(array('cron_exetime' => TIMESTAMP, 'cron_type' => 'updateGoodsPromotionPriceByGoodsId', 'cron_value' => serialize($xianshigoods_info['goods_id'])));
  419. $this->recordSellerlog(lang('limited_time_discount_price_modified') . $xianshigoods_info['xianshigoods_price'] . ',' . lang('goods_name') . ':' . $xianshigoods_info['goods_name']);
  420. } else {
  421. $data['result'] = false;
  422. $data['message'] = lang('ds_common_op_succ');
  423. }
  424. echo json_encode($data);
  425. die;
  426. }
  427. /**
  428. * 秒杀商品删除
  429. * */
  430. public function xianshi_goods_delete()
  431. {
  432. $xianshigoods_model = model('pxianshigoods');
  433. $pxianshi_model = model('pxianshi');
  434. $data = array();
  435. $data['result'] = true;
  436. $xianshigoods_id = intval(input('post.xianshigoods_id'));
  437. $xianshigoods_info = $xianshigoods_model->getXianshigoodsInfoByID($xianshigoods_id);
  438. if (!$xianshigoods_info) {
  439. $data['result'] = false;
  440. $data['message'] = lang('param_error');
  441. echo json_encode($data);
  442. die;
  443. }
  444. $xianshi_info = $pxianshi_model->getXianshiInfoByID($xianshigoods_info['xianshi_id'], session('store_id'));
  445. if (!$xianshi_info) {
  446. $data['result'] = false;
  447. $data['message'] = lang('param_error');
  448. echo json_encode($data);
  449. die;
  450. }
  451. if (!$xianshigoods_model->delXianshigoods(array('xianshigoods_id' => $xianshigoods_id))) {
  452. $data['result'] = false;
  453. $data['message'] = lang('xianshi_goods_delete_fail');
  454. echo json_encode($data);
  455. die;
  456. }
  457. // 添加对列修改商品促销价格
  458. model('cron')->addCron(array('cron_exetime' => TIMESTAMP, 'cron_type' => 'updateGoodsPromotionPriceByGoodsId', 'cron_value' => serialize($xianshigoods_info['goods_id'])));
  459. $this->recordSellerlog(lang('delete_time_limited_discount_items') . $xianshi_info['xianshi_name'] . ',' . lang('goods_name') . ':' . $xianshigoods_info['goods_name']);
  460. echo json_encode($data);
  461. die;
  462. }
  463. /**
  464. * 用户中心右边,小导航
  465. *
  466. * @param string $menu_type 导航类型
  467. * @param string $name 当前导航的name
  468. * @param array $array 附加菜单
  469. * @return
  470. */
  471. protected function getSellerItemList()
  472. {
  473. $menu_array = array(
  474. array(
  475. 'name' => 'xianshi_list', 'text' => lang('promotion_active_list'),
  476. 'url' => (string) url('Sellerpromotionxianshi/index')
  477. ),
  478. );
  479. switch (request()->action()) {
  480. case 'xianshi_add':
  481. $menu_array[] = array(
  482. 'name' => 'xianshi_add', 'text' => lang('promotion_join_active'),
  483. 'url' => (string) url('Sellerpromotionxianshi/xianshi_add')
  484. );
  485. break;
  486. case 'xianshi_edit':
  487. $menu_array[] = array(
  488. 'name' => 'xianshi_edit', 'text' => lang('editing_activity'), 'url' => 'javascript:;'
  489. );
  490. break;
  491. case 'xianshi_quota_add':
  492. $menu_array[] = array(
  493. 'name' => 'xianshi_quota_add', 'text' => lang('promotion_buy_product'),
  494. 'url' => (string) url('Sellerpromotionxianshi/xianshi_quota_add')
  495. );
  496. break;
  497. case 'xianshi_manage':
  498. $menu_array[] = array(
  499. 'name' => 'xianshi_manage', 'text' => lang('promotion_goods_manage'),
  500. 'url' => (string) url('Sellerpromotionxianshi/xianshi_manage', ['xianshi_id' => input('param.xianshi_id')])
  501. );
  502. break;
  503. }
  504. return $menu_array;
  505. }
  506. }