IndexController.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\admin\controllers\jushuitan;
  8. use app\models\Store;
  9. use app\models\Option;
  10. use app\models\Order;
  11. use app\constants\OptionSetting;
  12. use app\modules\admin\models\jushuitan\JuShuiTanForm;
  13. /**
  14. * Class GoodsController
  15. * @package app\modules\admin\controllers
  16. */
  17. class IndexController extends BaseController
  18. {
  19. public $supplier_id = 0;
  20. public function actionTest() {
  21. $isopen = JuShuiTanForm::queryJstGoodsList(304);
  22. return $this->asJson($isopen);
  23. var_dump($isopen);
  24. return;
  25. $isopen = JuShuiTanForm::orderSingleQuery(1, 'ML20230713153002573520');
  26. var_dump($isopen);
  27. return;
  28. $isopen = JuShuiTanForm::orderLabelUpload(1, 'ML20230713153002573520', ['转单']);
  29. var_dump($isopen);
  30. return;
  31. $isopen = JuShuiTanForm::supplierOrder2Jst(40, 0);
  32. var_dump($isopen);
  33. return;
  34. $store_id = get_store_id();
  35. $isopen = JuShuiTanForm::order2Jst(304, 5216);
  36. var_dump($isopen);
  37. }
  38. public function beforeAction($action) {
  39. if (parent::beforeAction($action)) {
  40. $this->supplier_id = get_supplier_id();
  41. if($this->supplier_id){
  42. JuShuiTanForm::initStoreType(JuShuiTanForm::STORE_TYPE_SUPPLIER);
  43. }
  44. return true;
  45. }
  46. return false;
  47. }
  48. public function actionConf() {
  49. $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
  50. $isopen = JuShuiTanForm::isopen($store_id);
  51. $conf = JuShuiTanForm::conf($store_id);
  52. $expires_time = 0;
  53. if($conf['token_info']){
  54. $expires_time = $conf['token_info']['refresh_time'] + $conf['token_info']['expires_in'];
  55. }
  56. return $this->asJson([
  57. 'code' => 0,
  58. 'data' => [
  59. 'conf' => $conf,
  60. 'isopen' => $isopen,
  61. 'expires_time' => $expires_time,
  62. '$store_id' => $store_id,
  63. '$supplier_id' => get_supplier_id(),
  64. ],
  65. ]);
  66. }
  67. public function actionSaveConf(){
  68. $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
  69. $conf = input_params('conf');
  70. if(!is_array($conf)){
  71. $conf = json_decode($conf, true);
  72. }
  73. JuShuiTanForm::saveConf($store_id, $conf);
  74. return $this->asJson([
  75. 'code'=>0,
  76. 'msg'=>'保存成功'
  77. ]);
  78. }
  79. public function actionCreateUrl() {
  80. $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
  81. $res = JuShuiTanForm::createUrl($store_id);
  82. return $this->asJson($res);
  83. }
  84. public function actionQueryJstGoods() {
  85. $store_id = get_store_id();
  86. $res = JuShuiTanForm::queryJstGoods($store_id);
  87. return $this->asJson($res);
  88. }
  89. public function actionGoods2Jst() {
  90. $goods_id = input_params('goods_id');
  91. $store_id = get_store_id();
  92. if($goods_id){
  93. $res = JuShuiTanForm::goods2Jst($store_id, $goods_id);
  94. }else{
  95. $res = JuShuiTanForm::goods2Jst($store_id, 0, 1);
  96. }
  97. return $this->asJson($res);
  98. }
  99. public function actionCat2Jst() {
  100. $cat_id = input_params('cat_id');
  101. $store_id = get_store_id();
  102. if($cat_id){
  103. $res = JuShuiTanForm::cat2Jst($store_id, $cat_id);
  104. }else{
  105. $res = JuShuiTanForm::cat2Jst($store_id, 0, -1);
  106. }
  107. return $this->asJson($res);
  108. }
  109. public function actionQueryJstGoodsList() {
  110. $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
  111. $i_id = input_params('i_id', '');
  112. $query = [
  113. 'page_index' => input_params('page', 1),
  114. 'page_size' => input_params('limit', 10),
  115. 'modified_begin' => input_params('modified_begin', null),
  116. 'modified_end' => input_params('modified_end', null),
  117. ];
  118. $i_id && $query['i_ids'] = explode(',', $i_id);
  119. $get_qty = input_params('get_qty', 0);
  120. $res = JuShuiTanForm::queryJstGoodsList($store_id, $query, $get_qty);
  121. return $this->asJson($res);
  122. }
  123. public function actionQueryJstSupplierGoodsList() {
  124. $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
  125. $item_name = input_params('item_name', '');
  126. $style_code_list = input_params('style_code_list', '');
  127. $jst_supplier_name = input_params('jst_supplier_name', '');
  128. $query = [
  129. 'page_num' => input_params('page', 1),
  130. 'page_size' => input_params('limit', 10),
  131. ];
  132. $item_name && $query['item_name'] = $item_name;
  133. $style_code_list && $query['style_code_list'] = explode(',', $style_code_list);
  134. $get_qty = input_params('get_qty', 0);
  135. $get_goods_info = input_params('get_goods_info', 0);
  136. $res = JuShuiTanForm::queryJstSupplierGoodsList($store_id, $jst_supplier_name, $query, $get_goods_info, $get_qty);
  137. return $this->asJson($res);
  138. }
  139. public function actionQueryJstSupplierGoods() {
  140. $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
  141. $style_code = input_params('style_code', '');
  142. $res = JuShuiTanForm::queryJstSupplierGoods($store_id, $style_code);
  143. return $this->asJson($res);
  144. }
  145. public function actionQueryJstSupplierGoodsQty() {
  146. $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
  147. $style_code = input_params('style_code', '');
  148. $item_code = input_params('item_code', '');
  149. $supplier_co_id = input_params('supplier_co_id', '');
  150. $query = [
  151. 'page_num' => input_params('page', 1),
  152. 'page_size' => input_params('limit', 500),
  153. ];
  154. $style_code && $query['style_codes'] = $style_code;
  155. $item_code && $query['item_codes'] = $item_code;
  156. $supplier_co_id && $query['supplier_co_id'] = $supplier_co_id;
  157. $res = JuShuiTanForm::queryJstSupplierGoodsQty($store_id, $query);
  158. return $this->asJson($res);
  159. }
  160. public function actionQueryJstSupplierList() {
  161. $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
  162. $query = [
  163. 'page_num' => input_params('page', 1),
  164. 'page_size' => input_params('limit', 100),
  165. ];
  166. $res = JuShuiTanForm::queryJstSupplierList($store_id, $query);
  167. return $this->asJson($res);
  168. }
  169. public function actionJstGoods2Store() {
  170. $params = all_params();
  171. $store_id = get_store_id();
  172. $res = JuShuiTanForm::jstGoods2Store($store_id, $params);
  173. return $this->asJson($res);
  174. }
  175. public function actionJstGoods2StoreBatch() {
  176. $params = all_params();
  177. $store_id = get_store_id();
  178. $res = JuShuiTanForm::jstGoods2StoreBatch($store_id, $params);
  179. return $this->asJson($res);
  180. }
  181. public function actionCheckGoodsImport2Store() {
  182. $params = all_params();
  183. $store_id = get_store_id();
  184. $res = JuShuiTanForm::checkGoodsImport2Store($store_id, $params);
  185. return $this->asJson($res);
  186. }
  187. public function actionJstGoods2Supplier() {
  188. $params = all_params();
  189. $store_id = $this->supplier_id;
  190. $res = JuShuiTanForm::jstGoods2Supplier($store_id, $params);
  191. return $this->asJson($res);
  192. }
  193. public function actionJstGoods2SupplierBatch() {
  194. $params = all_params();
  195. $store_id = $this->supplier_id;
  196. $res = JuShuiTanForm::jstGoods2SupplierBatch($store_id, $params);
  197. return $this->asJson($res);
  198. }
  199. public function actionJstSupplierGoods2Supplier() {
  200. $params = all_params();
  201. $store_id = $this->supplier_id;
  202. $res = JuShuiTanForm::jstSupplierGoods2Supplier($store_id, $params);
  203. return $this->asJson($res);
  204. }
  205. public function actionJstSupplierGoods2SupplierBatch() {
  206. $params = all_params();
  207. $store_id = $this->supplier_id;
  208. $res = JuShuiTanForm::jstSupplierGoods2SupplierBatch($store_id, $params);
  209. return $this->asJson($res);
  210. }
  211. public function actionJstSupplierGoods2Store() {
  212. $params = all_params();
  213. $store_id = get_store_id();
  214. $res = JuShuiTanForm::jstSupplierGoods2Store($store_id, $params);
  215. return $this->asJson($res);
  216. }
  217. public function actionJstSupplierGoods2StoreBatch() {
  218. $params = all_params();
  219. $store_id = get_store_id();
  220. $res = JuShuiTanForm::jstSupplierGoods2StoreBatch($store_id, $params);
  221. return $this->asJson($res);
  222. }
  223. public function actionCheckGoodsImport2Supplier() {
  224. $params = all_params();
  225. $res = JuShuiTanForm::checkGoodsImport2Supplier($params);
  226. return $this->asJson($res);
  227. }
  228. }