Sellergoodsoffline.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. * DSMall多用户商城
  8. * ============================================================================
  9. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  10. * 网站地址: http://www.csdeshang.com
  11. * ----------------------------------------------------------------------------
  12. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  13. * 不允许对程序代码以任何形式任何目的的再发布。
  14. * ============================================================================
  15. * 控制器
  16. */
  17. class Sellergoodsoffline extends BaseSeller {
  18. public function initialize() {
  19. parent::initialize();
  20. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/sellergoodsadd.lang.php');
  21. $this->template_dir = 'default/seller/sellergoodsadd/';
  22. }
  23. public function index() {
  24. $this->goods_storage();
  25. }
  26. /**
  27. * 仓库中的商品列表
  28. */
  29. public function goods_storage() {
  30. $goods_model = model('goods');
  31. $where = array();
  32. $where[] = array('store_id', '=', session('store_id'));
  33. $storegc_id = intval(input('get.storegc_id'));
  34. if ($storegc_id > 0) {
  35. $where[] = array('goods_stcids', 'like', '%,' . $storegc_id . ',%');
  36. }
  37. $keyword = input('get.keyword');
  38. $search_type = input('get.search_type');
  39. if (trim($keyword) != '') {
  40. switch ($search_type) {
  41. case 0:
  42. $where[] = array('goods_name', 'like', '%' . trim($keyword) . '%');
  43. break;
  44. case 1:
  45. $where[] = array('goods_serial', 'like', '%' . trim($keyword) . '%');
  46. break;
  47. case 2:
  48. $where[] = array('goods_commonid', '=', intval($keyword));
  49. break;
  50. }
  51. }
  52. $type = input('param.type');
  53. $verify = input('get.verify');
  54. switch ($type) {
  55. // 违规的商品
  56. case 'lock_up':
  57. /* 设置卖家当前菜单 */
  58. $this->setSellerCurMenu('sellergoodsoffline');
  59. $this->setSellerCurItem('goods_lockup');
  60. $goods_list = $goods_model->getGoodsCommonLockUpList($where);
  61. break;
  62. // 等待审核或审核失败的商品
  63. case 'wait_verify':
  64. /* 设置卖家当前菜单 */
  65. $this->setSellerCurMenu('sellergoodsoffline');
  66. $this->setSellerCurItem('goods_verify');
  67. if (isset($verify) && in_array($verify, array('0', '10'))) {
  68. $where[] = array('goods_verify', '=', $verify);
  69. }
  70. $goods_list = $goods_model->getGoodsCommonWaitVerifyList($where);
  71. break;
  72. // 仓库中的商品
  73. default:
  74. /* 设置卖家当前菜单 */
  75. $this->setSellerCurMenu('sellergoodsoffline');
  76. $this->setSellerCurItem('goods_storage');
  77. $goods_list = $goods_model->getGoodsCommonOfflineList($where);
  78. break;
  79. }
  80. View::assign('show_page', $goods_model->page_info->render());
  81. View::assign('goods_list', $goods_list);
  82. // 计算库存
  83. $storage_array = $goods_model->calculateStorage($goods_list);
  84. View::assign('storage_array', $storage_array);
  85. // 商品分类
  86. $store_goods_class = model('storegoodsclass')->getClassTree(array('store_id' => session('store_id'), 'storegc_state' => '1'));
  87. View::assign('store_goods_class', $store_goods_class);
  88. switch ($type) {
  89. // 违规的商品
  90. case 'lock_up':
  91. echo View::fetch($this->template_dir . 'store_goods_list_offline_lockup');
  92. break;
  93. // 等待审核或审核失败的商品
  94. case 'wait_verify':
  95. View::assign('verify', array('0' => lang('wait_verify_0'), '10' => lang('wait_verify_10')));
  96. echo View::fetch($this->template_dir . 'store_goods_list_offline_waitverify');
  97. break;
  98. // 仓库中的商品
  99. default:
  100. echo View::fetch($this->template_dir . 'store_goods_list_offline');
  101. break;
  102. }
  103. exit;
  104. }
  105. /**
  106. * 商品上架
  107. */
  108. public function goods_show() {
  109. $commonid = input('param.commonid');
  110. if (!preg_match('/^[\d,]+$/i', $commonid)) {
  111. ds_json_encode(10001, lang('param_error'));
  112. }
  113. $commonid_array = explode(',', $commonid);
  114. if ($this->store_info['store_state'] != 1) {
  115. ds_json_encode(10001, lang(lang('store_goods_index_goods_show_fail') . ',店铺正在审核中或已经关闭'));
  116. }
  117. $return = model('goods')->editProducesOnline(array(array('goods_commonid', 'in', $commonid_array), array('store_id', '=', session('store_id'))));
  118. if ($return) {
  119. // 添加操作日志
  120. $this->recordSellerlog('商品上架,平台货号:' . $commonid);
  121. ds_json_encode(10000, lang('store_goods_index_goods_show_success'));
  122. } else {
  123. ds_json_encode(10001, lang('store_goods_index_goods_show_fail'));
  124. }
  125. }
  126. /**
  127. * 栏目菜单
  128. */
  129. function getSellerItemList() {
  130. $item_list = array(
  131. array(
  132. 'name' => 'goods_storage',
  133. 'text' => lang('ds_member_path_goods_storage'),
  134. 'url' => (string) url('Sellergoodsoffline/index'),
  135. ),
  136. array(
  137. 'name' => 'goods_lockup',
  138. 'text' => lang('ds_member_path_goods_state'),
  139. 'url' => (string) url('Sellergoodsoffline/index', ['type' => 'lock_up']),
  140. ),
  141. array(
  142. 'name' => 'goods_verify',
  143. 'text' => lang('ds_member_path_goods_verify'),
  144. 'url' => (string) url('Sellergoodsoffline/index', ['type' => 'wait_verify']),
  145. ),
  146. );
  147. return $item_list;
  148. }
  149. }
  150. ?>