From 4b5df7cbc26fe52a2509e4d7ba389345daef0c56 Mon Sep 17 00:00:00 2001 From: wang hou sheng <76928547+wanghousheng@users.noreply.github.com> Date: Sun, 21 Apr 2024 19:49:34 +0800 Subject: [PATCH] 1 --- app/api/controller/Store.php | 49 ++++++++++++---------------------- app/common/enum/ServerEnum.php | 2 +- 2 files changed, 18 insertions(+), 33 deletions(-) diff --git a/app/api/controller/Store.php b/app/api/controller/Store.php index efb97de0..79ee1935 100644 --- a/app/api/controller/Store.php +++ b/app/api/controller/Store.php @@ -12,18 +12,17 @@ declare (strict_types=1); namespace app\api\controller; +use app\api\service\Store as StoreService; use app\api\service\User as UserService; +use app\api\validate\store\Store as StoreValidte; +use app\common\model\PriceSet; +use app\common\model\Store as StoreInfoModel; use app\store\model\store\Address as AddressModel; -use think\response\Json; -use app\api\service\Store as StoreService; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; -use app\api\validate\store\Store as StoreValidte; -use \app\common\model\Store as StoreInfoModel; -use app\common\model\UploadFile; -use app\common\model\PriceSet; -use think\Db; +use think\response\Json; + /** * 商城基础信息 * Class Store @@ -107,19 +106,14 @@ class Store extends Controller if (!$upData) { return $this->renderSuccess('ok'); } - StoreInfoModel::where('store_id',$storeid)->update($upData); + StoreInfoModel::where('store_id', $storeid)->update($upData); return $this->renderSuccess('ok'); } + public function getStoreInfo(): Json { $storeid = request()->header()['storeid']; - - $info = StoreInfoModel::where('store_id',$storeid)->find()->toArray(); - $file = UploadFile::where('file_id', $info['group_share_img_id'])->field('file_path,domain')->find(); - $info['group_share_img'] = getUrl($file['file_path'], $file['domain']); - - $file1 = UploadFile::where('file_id', $info['logo_image_id'])->field('file_path,domain')->find(); - $info['logo_image'] = getUrl($file1['file_path'], $file1['domain']); + $info = StoreInfoModel::detail($storeid); return $this->renderSuccess($info); } @@ -142,7 +136,7 @@ class Store extends Controller // var_dump($params); // exit(); //先删除 - PriceSet::where('store_id', $storeid)->where('type', $params['type']??0)->delete(); + PriceSet::where('store_id', $storeid)->where('type', $params['type'] ?? 0)->delete(); $inDatas = []; foreach ($params['list'] as $value) { $categorys = explode(",", $value['category']); @@ -162,8 +156,8 @@ class Store extends Controller $inDatas[] = $temp; } } - - + + } // echo "
";
         // print_r($inDatas);
@@ -172,11 +166,12 @@ class Store extends Controller
         $model->addAll($inDatas);
         return $this->renderSuccess('ok');
     }
+
     //加个设置回显
     public function getStorePriceInfo(int $type): Json
     {
         $storeid = request()->header()['storeid'];
-        $list = PriceSet::where('store_id',$storeid)->where('type', $type)->field('category,code,min,max,add_price_rate')->group("category, min")->select()->toArray();
+        $list = PriceSet::where('store_id', $storeid)->where('type', $type)->field('category,code,min,max,add_price_rate')->group("category, min")->select()->toArray();
         $data = [];
         $arr = [];
         foreach ($list as $value) {
@@ -197,22 +192,12 @@ class Store extends Controller
     {
         $storeid = request()->header()['storeid'];
 
-        $categoryIds = [1001,1002];
+        $categoryIds = [1001, 1002];
         $list = PriceSet::distributionPrice(90, 50, $categoryIds);
-        
-        
-        return $this->renderSuccess($list);
-    }
-
-
-
-
-
-
-
-
 
 
+        return $this->renderSuccess($list);
+    }
 
 
 }
\ No newline at end of file
diff --git a/app/common/enum/ServerEnum.php b/app/common/enum/ServerEnum.php
index dc94e799..ebec63fa 100644
--- a/app/common/enum/ServerEnum.php
+++ b/app/common/enum/ServerEnum.php
@@ -4,7 +4,7 @@ namespace app\common\enum;
 
 class ServerEnum extends EnumBasics
 {
-    // 待付款
+    // 待付款 10待付款20待指派30待上门40已完成50已取消
     const APPLYPAY = 10;
     // 待派单
     const APPLYDISPATCH = 20;