浏览代码

0720-0033-h01

Zory 2 周之前
父节点
当前提交
ef1e70f942

+ 2 - 0
app/controller/admin/Upload.php

@@ -20,6 +20,8 @@ class Upload extends Base
     public function upload2image(Request $request): Response
     {
         try {
+            [$state,$msg] = $this->checkDeposit($request->user['store_id']);
+            if (!$state) return error($msg);
             $resp = UploadExtend::uploadFile();
             if (!isset($resp[0]['url'])) return errorTrans(40010);
             return successTrans("success.data",[

+ 11 - 9
app/controller/api/Goods.php

@@ -48,15 +48,17 @@ class Goods extends Base
             }])->findOrEmpty();
             if ($data->isEmpty()) return errorTrans("empty.data");
             if ($data['poi']['status'] <> 1) return error("该店铺已关闭,请联系管理员");
-            $data['content'] = filterHtmlTags($data['content'],[
-                'img' => [
-                    'remove' => ['width', 'height'],
-                    'style'  => ['width' => '100%']
-                ],
-                'p' => [
-                    'style'  => ['margin' => '0']
-                ]
-            ]);
+            if (!empty($data['content'])) {
+                $data['content'] = filterHtmlTags($data['content'],[
+                    'img' => [
+                        'remove' => ['width', 'height'],
+                        'style'  => ['width' => '100%']
+                    ],
+                    'p' => [
+                        'style'  => ['margin' => '0']
+                    ]
+                ]);
+            }
             return $this->encode("success",$data->toArray());
         } catch (\Throwable $th) {
             return error($th->getMessage());

+ 2 - 0
app/controller/merchant/Complaint.php

@@ -63,6 +63,8 @@ class Complaint extends Base
     public function setDataDetail(Request $request): Response
     {
         try {
+            [$state,$msg] = $this->checkDeposit($request->user['store_id']);
+            if (!$state) return error($msg);
             $param = $this->_valid([
                 "id.require"        => trans("empty.require"),
                 "remark.require"    => trans("empty.require")

+ 30 - 6
app/controller/merchant/Goods.php

@@ -6,8 +6,10 @@ use app\extra\basic\Base;
 use app\extra\dyLife\data\BaseData;
 use app\extra\tools\CodeExtend;
 use app\middleware\AuthMiddleware;
+use app\middleware\DepositMiddleware;
 use app\model\saas\SaasGoods;
 use app\model\saas\SaasGoodsSku;
+use app\model\saas\SaasOrder;
 use app\model\saas\SaasStore;
 use app\service\saas\GoodsService;
 use DI\Attribute\Inject;
@@ -132,12 +134,14 @@ class Goods extends Base
     public function saveGoods(Request $request): Response
     {
         try {
+            [$state,$msg] = $this->checkDeposit($request->user['store_id']);
+            if (!$state) return error($msg);
             $param = $request->post();
             if (empty($param['auto_renew'])) $param['auto_renew'] = 0;
             $param['image_list'] = empty($param['image_list']) ? [] : json_encode($param['image_list']);
             $param['detail_image_list'] = empty($param['detail_image_list']) ? [] : json_encode($param['detail_image_list']);
             $param['environment_image_list'] = empty($param['environment_image_list']) ? [] : json_encode($param['environment_image_list']);
-            $param['notification'] = empty($param['notification']) ? [] : json_encode($param['notification']);
+//            $param['notification'] = empty($param['notification']) ? [] : json_encode($param['notification']);
             if (empty($param['specs'])) return error("至少添加一组搭配信息");
             if (is_array($param['specs'])) $param['specs'] = json_encode($param['specs']);
             if (is_array($param['category'])) {
@@ -165,11 +169,11 @@ class Goods extends Base
             }
             unset($param['skuSpecs']);
             $param['line_price'] = $param['line_price'] * 100;
-            if (empty($param['notification']))  return error("请最少添加一组添加使用规则");
-            foreach (json_decode($param['notification'],true) as $key => $value) {
-                if (empty($value['title'])) return error("规则标题不能为空");
-                if (empty($value['content'])) return error("规则内容不能为空");
-            }
+//            if (empty($param['notification']))  return error("请最少添加一组添加使用规则");
+//            foreach (json_decode($param['notification'],true) as $key => $value) {
+//                if (empty($value['title'])) return error("规则标题不能为空");
+//                if (empty($value['content'])) return error("规则内容不能为空");
+//            }
             $store = (new SaasStore)->where("poi_id",$request->user['store_id'])->findOrEmpty();
             if ($store->isEmpty()) return errorTrans("error.data");
             // 获取attr_key_value_map参数
@@ -258,5 +262,25 @@ class Goods extends Base
         }
     }
 
+    #[PostMapping("del")]
+    public function delGoods(Request $request)
+    {
+        try {
+            $param = $this->_valid([
+                "id.require"            => trans("empty.require"),
+            ],$request->method());
+            if (!is_array($param)) return error($param);
+            $detail = $this->model->where("id",$param["id"])->findOrEmpty();
+            if ($detail->isEmpty()) return errorTrans("empty.data");
+            if ($detail['poi_id'] <> $request->user['store_id']) return error("非法操作");
+            $state = $detail->delete();
+            if (!$state) return errorTrans("error.data");
+            (new SaasOrder)->where("product_id",$detail["product_id"])->delete();
+            return successTrans("success.data");
+        } catch (\Throwable $throwable) {
+            return error($throwable->getMessage());
+        }
+    }
+
 
 }

+ 2 - 0
app/controller/merchant/Plan.php

@@ -56,6 +56,8 @@ class Plan extends Base
     public function addPlanData(Request $request): Response
     {
         try {
+            [$state,$msg] = $this->checkDeposit($request->user['store_id']);
+            if (!$state) return error($msg);
             $param = $this->_valid([
                 "plan_name.require"         => trans("empty.require"),
                 "merchant_phone.require"    => trans("empty.require"),

+ 2 - 0
app/controller/merchant/Star.php

@@ -43,6 +43,8 @@ class Star extends Base
     public function getStarData(Request $request): Response
     {
         try {
+            [$state,$msg] = $this->checkDeposit($request->user['store_id']);
+            if (!$state) return error($msg);
             $param = $this->_valid([
                 "name.require"  => trans("empty.require"),
                 "status.require" => trans("empty.status"),

+ 4 - 1
app/controller/merchant/User.php

@@ -5,6 +5,7 @@ namespace app\controller\merchant;
 use app\extra\basic\Base;
 use app\extra\tools\CodeExtend;
 use app\middleware\AuthMiddleware;
+use app\model\saas\SaasStore;
 use app\model\system\SystemUser;
 use app\service\system\UserService;
 use DI\Attribute\Inject;
@@ -39,6 +40,7 @@ class User extends Base
             return error($th->getMessage());
         }
     }
+
     /**
      * 账户列表
      * @param Request $request
@@ -48,6 +50,8 @@ class User extends Base
     public function setUserData(Request $request): Response
     {
         try {
+            [$state,$msg] = $this->checkDeposit($request->user['store_id']);
+            if (!$state) return error($msg);
             $param = $request->post();
             if(!isset($param['id'])) // 新增
             {
@@ -73,5 +77,4 @@ class User extends Base
             return error($throwable->getMessage());
         }
     }
-
 }

+ 13 - 0
app/extra/basic/Base.php

@@ -2,6 +2,7 @@
 
 namespace app\extra\basic;
 
+use app\model\saas\SaasStore;
 use support\Response;
 use think\contract\Arrayable;
 use think\Validate;
@@ -24,6 +25,18 @@ class Base
     }
 
 
+    /**
+     * 保证金检测
+     */
+    protected function checkDeposit(string $poiId = ""): array
+    {
+        if ($poiId == 0) return [1,'ok'];
+        $deposit = (new SaasStore)->where("poi_id",$poiId)->findOrEmpty();
+        if ($deposit->isEmpty()) return [0,"非法操作"];
+        if ($deposit['deposit'] == 0) return [0,'抖音来客保证金未缴纳,请联系渠道进行保证金缴纳,充值成功后自动开放权限'];
+        return [1,'ok'];
+    }
+
     protected function getDyConfig(): array
     {
         return ["appid" => sConf('wechat.mini_appid'),'secret' => sConf('wechat.mini_secret')];

+ 7 - 1
app/extra/dyLife/data/BaseData.php

@@ -205,7 +205,13 @@ class BaseData extends BasicLife
                 ]);
                 break;
             case "Notification": // 使用规则
-                $return = $data['notification'];
+//                $return = $data['notification'];
+                $return = json_encode([
+                    [
+                        "title"     => "适用门店",
+                        "content"   => "全场通用",
+                    ]
+                ]);
                 break;
             case "RefundPolicy": // 退款政策 1-允许退款 2-不可退款 3-有条件退
                 $return = "1";

+ 1 - 0
app/service/saas/GoodsService.php

@@ -44,6 +44,7 @@ class GoodsService extends Service
     {
         $filter = [];
         !empty($param['status']) && $filter[] = ["status", '=', ($param['status']-1)];
+        !empty($param['exstatus']) && $filter[] = ["status", '=', ($param['exstatus']-1)];
         !empty($param['poi_id']) && $filter[] = ["poi_id", '=', $param['poi_id']];
         !empty($param['name']) && $filter[] = ["product_name", 'like', "%{$param['name']}%"];
         return $filter;