Sellerpromotionxianshi.php 24 KB

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