| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\modules\admin\controllers\jushuitan;
- use app\models\Store;
- use app\models\Option;
- use app\models\Order;
- use app\constants\OptionSetting;
- use app\modules\admin\models\jushuitan\JuShuiTanForm;
- /**
- * Class GoodsController
- * @package app\modules\admin\controllers
- */
- class IndexController extends BaseController
- {
- public $supplier_id = 0;
- public function actionTest() {
- $isopen = JuShuiTanForm::queryJstGoodsList(304);
- return $this->asJson($isopen);
- var_dump($isopen);
- return;
- $isopen = JuShuiTanForm::orderSingleQuery(1, 'ML20230713153002573520');
- var_dump($isopen);
- return;
- $isopen = JuShuiTanForm::orderLabelUpload(1, 'ML20230713153002573520', ['转单']);
- var_dump($isopen);
- return;
- $isopen = JuShuiTanForm::supplierOrder2Jst(40, 0);
- var_dump($isopen);
- return;
- $store_id = get_store_id();
- $isopen = JuShuiTanForm::order2Jst(304, 5216);
- var_dump($isopen);
- }
- public function beforeAction($action) {
- if (parent::beforeAction($action)) {
- $this->supplier_id = get_supplier_id();
- if($this->supplier_id){
- JuShuiTanForm::initStoreType(JuShuiTanForm::STORE_TYPE_SUPPLIER);
- }
- return true;
- }
- return false;
- }
- public function actionConf() {
- $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
- $isopen = JuShuiTanForm::isopen($store_id);
- $conf = JuShuiTanForm::conf($store_id);
- $expires_time = 0;
- if($conf['token_info']){
- $expires_time = $conf['token_info']['refresh_time'] + $conf['token_info']['expires_in'];
- }
- return $this->asJson([
- 'code' => 0,
- 'data' => [
- 'conf' => $conf,
- 'isopen' => $isopen,
- 'expires_time' => $expires_time,
- '$store_id' => $store_id,
- '$supplier_id' => get_supplier_id(),
- ],
- ]);
- }
- public function actionSaveConf(){
- $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
- $conf = input_params('conf');
- if(!is_array($conf)){
- $conf = json_decode($conf, true);
- }
- JuShuiTanForm::saveConf($store_id, $conf);
- return $this->asJson([
- 'code'=>0,
- 'msg'=>'保存成功'
- ]);
- }
-
- public function actionCreateUrl() {
- $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
- $res = JuShuiTanForm::createUrl($store_id);
- return $this->asJson($res);
- }
-
- public function actionQueryJstGoods() {
- $store_id = get_store_id();
- $res = JuShuiTanForm::queryJstGoods($store_id);
- return $this->asJson($res);
- }
-
- public function actionGoods2Jst() {
- $goods_id = input_params('goods_id');
- $store_id = get_store_id();
- if($goods_id){
- $res = JuShuiTanForm::goods2Jst($store_id, $goods_id);
- }else{
- $res = JuShuiTanForm::goods2Jst($store_id, 0, 1);
- }
- return $this->asJson($res);
- }
-
- public function actionCat2Jst() {
- $cat_id = input_params('cat_id');
- $store_id = get_store_id();
- if($cat_id){
- $res = JuShuiTanForm::cat2Jst($store_id, $cat_id);
- }else{
- $res = JuShuiTanForm::cat2Jst($store_id, 0, -1);
- }
- return $this->asJson($res);
- }
-
- public function actionQueryJstGoodsList() {
- $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
- $i_id = input_params('i_id', '');
- $query = [
- 'page_index' => input_params('page', 1),
- 'page_size' => input_params('limit', 10),
- 'modified_begin' => input_params('modified_begin', null),
- 'modified_end' => input_params('modified_end', null),
- ];
- $i_id && $query['i_ids'] = explode(',', $i_id);
- $get_qty = input_params('get_qty', 0);
- $res = JuShuiTanForm::queryJstGoodsList($store_id, $query, $get_qty);
- return $this->asJson($res);
- }
-
- public function actionQueryJstSupplierGoodsList() {
- $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
- $item_name = input_params('item_name', '');
- $style_code_list = input_params('style_code_list', '');
- $jst_supplier_name = input_params('jst_supplier_name', '');
- $query = [
- 'page_num' => input_params('page', 1),
- 'page_size' => input_params('limit', 10),
- ];
- $item_name && $query['item_name'] = $item_name;
- $style_code_list && $query['style_code_list'] = explode(',', $style_code_list);
- $get_qty = input_params('get_qty', 0);
- $get_goods_info = input_params('get_goods_info', 0);
- $res = JuShuiTanForm::queryJstSupplierGoodsList($store_id, $jst_supplier_name, $query, $get_goods_info, $get_qty);
- return $this->asJson($res);
- }
-
- public function actionQueryJstSupplierGoods() {
- $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
- $style_code = input_params('style_code', '');
- $res = JuShuiTanForm::queryJstSupplierGoods($store_id, $style_code);
- return $this->asJson($res);
- }
-
- public function actionQueryJstSupplierGoodsQty() {
- $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
- $style_code = input_params('style_code', '');
- $item_code = input_params('item_code', '');
- $supplier_co_id = input_params('supplier_co_id', '');
- $query = [
- 'page_num' => input_params('page', 1),
- 'page_size' => input_params('limit', 500),
- ];
- $style_code && $query['style_codes'] = $style_code;
- $item_code && $query['item_codes'] = $item_code;
- $supplier_co_id && $query['supplier_co_id'] = $supplier_co_id;
- $res = JuShuiTanForm::queryJstSupplierGoodsQty($store_id, $query);
- return $this->asJson($res);
- }
-
- public function actionQueryJstSupplierList() {
- $store_id = $this->supplier_id ? $this->supplier_id : get_store_id();
- $query = [
- 'page_num' => input_params('page', 1),
- 'page_size' => input_params('limit', 100),
- ];
- $res = JuShuiTanForm::queryJstSupplierList($store_id, $query);
- return $this->asJson($res);
- }
-
- public function actionJstGoods2Store() {
- $params = all_params();
- $store_id = get_store_id();
- $res = JuShuiTanForm::jstGoods2Store($store_id, $params);
- return $this->asJson($res);
- }
-
- public function actionJstGoods2StoreBatch() {
- $params = all_params();
- $store_id = get_store_id();
- $res = JuShuiTanForm::jstGoods2StoreBatch($store_id, $params);
- return $this->asJson($res);
- }
-
- public function actionCheckGoodsImport2Store() {
- $params = all_params();
- $store_id = get_store_id();
- $res = JuShuiTanForm::checkGoodsImport2Store($store_id, $params);
- return $this->asJson($res);
- }
-
- public function actionJstGoods2Supplier() {
- $params = all_params();
- $store_id = $this->supplier_id;
- $res = JuShuiTanForm::jstGoods2Supplier($store_id, $params);
- return $this->asJson($res);
- }
-
- public function actionJstGoods2SupplierBatch() {
- $params = all_params();
- $store_id = $this->supplier_id;
- $res = JuShuiTanForm::jstGoods2SupplierBatch($store_id, $params);
- return $this->asJson($res);
- }
-
- public function actionJstSupplierGoods2Supplier() {
- $params = all_params();
- $store_id = $this->supplier_id;
- $res = JuShuiTanForm::jstSupplierGoods2Supplier($store_id, $params);
- return $this->asJson($res);
- }
-
- public function actionJstSupplierGoods2SupplierBatch() {
- $params = all_params();
- $store_id = $this->supplier_id;
- $res = JuShuiTanForm::jstSupplierGoods2SupplierBatch($store_id, $params);
- return $this->asJson($res);
- }
-
- public function actionJstSupplierGoods2Store() {
- $params = all_params();
- $store_id = get_store_id();
- $res = JuShuiTanForm::jstSupplierGoods2Store($store_id, $params);
- return $this->asJson($res);
- }
-
- public function actionJstSupplierGoods2StoreBatch() {
- $params = all_params();
- $store_id = get_store_id();
- $res = JuShuiTanForm::jstSupplierGoods2StoreBatch($store_id, $params);
- return $this->asJson($res);
- }
-
- public function actionCheckGoodsImport2Supplier() {
- $params = all_params();
- $res = JuShuiTanForm::checkGoodsImport2Supplier($params);
- return $this->asJson($res);
- }
- }
|