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