Selaa lähdekoodia

修改接口问题

Your Name 2 viikkoa sitten
vanhempi
commit
31b6eea992

+ 2
- 1
app/admin/view/shop/store/lists.html Näytä tiedosto

168
             ,{field:"category", width:100, align:"center", title:"主营类目"}
168
             ,{field:"category", width:100, align:"center", title:"主营类目"}
169
             ,{field:"is_run", width:90, align:"center", title:"营业状态"}
169
             ,{field:"is_run", width:90, align:"center", title:"营业状态"}
170
             ,{field:"is_freeze", width:90, align:"center", title:"商家状态"}
170
             ,{field:"is_freeze", width:90, align:"center", title:"商家状态"}
171
-            ,{field:"is_recommend", width:90, align:"center", title:"推荐商家"}
171
+            //,{field:"is_recommend", width:90, align:"center", title:"推荐商家"}
172
+            ,{field:"hksy_count", width:90, align:"center", title:"评论次数"}
172
             ,{field:"create_time", width:160, align:"center", title:"开通日期"}
173
             ,{field:"create_time", width:160, align:"center", title:"开通日期"}
173
             ,{field:"expire_desc", width:160, align:"center", title:"到期状态"}
174
             ,{field:"expire_desc", width:160, align:"center", title:"到期状态"}
174
             ,{field:"expire_time", width:160, align:"center", title:"到期时间"}
175
             ,{field:"expire_time", width:160, align:"center", title:"到期时间"}

+ 8
- 4
app/api/controller/ShopContent.php Näytä tiedosto

32
 
32
 
33
 class ShopContent extends Api
33
 class ShopContent extends Api
34
 {
34
 {
35
-    public $like_not_need_login = ['getShopInfo', 'getShopList','getNearbyShops','smsCode','getShopConfig','getXpath','getAppService','getRunNum','getShopConfig2'];
35
+    public $like_not_need_login = ['getShopInfo', 'getShopList','getNearbyShops','smsCode','getShopConfig','getXpath','getAppService','getRunNum','getShopConfig2','subHKSYCount'];
36
 
36
 
37
     /**
37
     /**
38
      * 店铺信息
38
      * 店铺信息
106
         $data = ShopContentLogic::codeInfo($code,$mcode);
106
         $data = ShopContentLogic::codeInfo($code,$mcode);
107
         if($data['status'] == 100){
107
         if($data['status'] == 100){
108
             //通过
108
             //通过
109
-            $respon = [];
109
+            $respon = [
110
+                    'is_gi' => $data['is_gi']  //是否到期  0未到期 或者 1 是到期(但评论数量存在>10条)
111
+                ];
110
             return JsonServer::success($data['msg'], $respon);
112
             return JsonServer::success($data['msg'], $respon);
111
         }else{
113
         }else{
112
             //失败
114
             //失败
340
 
342
 
341
     /**
343
     /**
342
      * 查询获客剩余数量
344
      * 查询获客剩余数量
345
+     * 暂时弃用
343
      */
346
      */
344
     public function getHKSYCount() {
347
     public function getHKSYCount() {
345
         if ($this->request->isGet()) {
348
         if ($this->request->isGet()) {
357
 
360
 
358
     /**
361
     /**
359
      * 减少获客剩余数量
362
      * 减少获客剩余数量
363
+     * subHKSYCount
360
      */
364
      */
361
     public function subHKSYCount() {
365
     public function subHKSYCount() {
366
+
362
         if ($this->request->isPost()) {
367
         if ($this->request->isPost()) {
363
             $post = $this->request->post();
368
             $post = $this->request->post();
364
             $count = ShopContentLogic::subHKSYCount($post);
369
             $count = ShopContentLogic::subHKSYCount($post);
365
             if ($count === false) {
370
             if ($count === false) {
366
-                return JsonServer::error(ShopContentLogic::getError(), ['err_code' => ShopContentLogic::getErrCode()]);
371
+               return JsonServer::error(ShopContentLogic::getError(), ['err_code' => ShopContentLogic::getErrCode()]);
367
             }
372
             }
368
-
369
             return JsonServer::success('操作成功', ['count' => $count]);
373
             return JsonServer::success('操作成功', ['count' => $count]);
370
         }
374
         }
371
 
375
 

+ 79
- 6
app/api/logic/ShopContentLogic.php Näytä tiedosto

10
 use app\common\logic\QrCodeLogic;
10
 use app\common\logic\QrCodeLogic;
11
 
11
 
12
 use app\common\model\dev\DevRegion;
12
 use app\common\model\dev\DevRegion;
13
+use app\common\model\shop\Shop as shopModel;
13
 use app\common\model\shop\ShopAd;
14
 use app\common\model\shop\ShopAd;
14
 
15
 
15
 use app\common\model\shop\ShopGoods as shopGoodsModel;
16
 use app\common\model\shop\ShopGoods as shopGoodsModel;
23
 use app\common\model\content\ClosureCategory;
24
 use app\common\model\content\ClosureCategory;
24
 use app\common\model\content\Closure;
25
 use app\common\model\content\Closure;
25
 
26
 
26
-use app\common\model\shop\Shop as shopModel;
27
 use app\common\model\content\EquiCategory as EquiCategoryModel;
27
 use app\common\model\content\EquiCategory as EquiCategoryModel;
28
 use app\common\model\shop\ShopHkLog;
28
 use app\common\model\shop\ShopHkLog;
29
 use think\facade\Db;
29
 use think\facade\Db;
56
 
56
 
57
         //判断商家服务
57
         //判断商家服务
58
         if(!empty($item)) {
58
         if(!empty($item)) {
59
-            $expire_time = shopModel::where('id', $item['shop_id'])->value('expire_time');
59
+
60
+            //判断商户
61
+            $shop = shopModel::where('id', $item['shop_id'])->find();
62
+            if(empty($shop)){
63
+                $data = [
64
+                    'status' => 110,
65
+                    'msg' => "商户信息不存在!"
66
+                ];
67
+                return $data;
68
+            }
69
+
70
+            //不需要转数组
71
+            //echo $shop['id'];
72
+            //$shop = $shop->toArray();
73
+            //var_dump($shop);die;
74
+
75
+            //判断 商家状态 is_freeze
76
+            if((int)$shop['is_freeze'] === 1){
77
+                $data = [
78
+                    'status' => 111,
79
+                    'msg' => "商家冻结中!"
80
+                ];
81
+                return $data;
82
+            }
83
+
84
+            //判断 营业状态  is_run
85
+            if((int)$shop['is_run'] === 0){
86
+                $data = [
87
+                    'status' => 112,
88
+                    'msg' => "商家暂停营业中!"
89
+                ];
90
+                return $data;
91
+            }
92
+
93
+            //模型调用出来的 与 直接查询字段出来的值 不一样
94
+            $expire_time = strtotime($shop['expire_time']);
60
             //dump($expire_time);
95
             //dump($expire_time);
96
+            //echo $expire_time;die;
97
+
61
             if($expire_time < time()){
98
             if($expire_time < time()){
99
+                //判断到期时间
62
                 $data = [
100
                 $data = [
63
                    'status' => 107,
101
                    'status' => 107,
64
                    'msg' => "商户服务当前套餐到期,到期时间".date('Y-m-d H:i:s',$expire_time)."!"
102
                    'msg' => "商户服务当前套餐到期,到期时间".date('Y-m-d H:i:s',$expire_time)."!"
65
                 ];
103
                 ];
66
-                return $data;
104
+                //判断剩余数量  hksy_count  当商家已到期
105
+                if((int)$shop['hksy_count'] < 10){
106
+                    //判断到期时间
107
+                    $data = [
108
+                        'status' => 113,
109
+                        'msg' => "商户服务可评论次数不足,剩余".$shop['hksy_count']."条,请充值后再使用 或 开通商户包年包月服务!"
110
+                    ];
111
+                    return $data;
112
+                }
113
+                //可评论次数大于10 即使到期 也继续执行
114
+                $is_gi = 1;
115
+            }else{
116
+                $is_gi = 0;
67
             }
117
             }
118
+            //未到期 不需要扣次数 继续执行即可
68
         }
119
         }
69
 
120
 
70
         if(empty($item))
121
         if(empty($item))
93
                 if ($row == 1) {
144
                 if ($row == 1) {
94
                     $data = [
145
                     $data = [
95
                         'status' => 100,
146
                         'status' => 100,
96
-                        'msg' => "绑定机器码成功!"
147
+                        'msg' => "绑定机器码成功!",
148
+                        'is_gi' => $is_gi
97
                     ];
149
                     ];
98
                 } else {
150
                 } else {
99
                     $data = [
151
                     $data = [
126
                 }else{
178
                 }else{
127
                     $data = [
179
                     $data = [
128
                         'status' => 100,
180
                         'status' => 100,
129
-                        'msg' => "已绑定该机器码!"
181
+                        'msg' => "已绑定该机器码!",
182
+                        'is_gi' => $is_gi
130
                     ];
183
                     ];
131
                 }
184
                 }
132
             }
185
             }
784
      */
837
      */
785
     public static function subHKSYCount($post) {
838
     public static function subHKSYCount($post) {
786
         $code = $post["code"] ?? '';
839
         $code = $post["code"] ?? '';
787
-        $count = $post["count"] ?? 0;
840
+        //$count = $post["count"] ?? 1; //默认就是1
841
+        $count = 1;
788
         $remark = $post["remark"] ?? '';
842
         $remark = $post["remark"] ?? '';
843
+
789
         if ($count <= 0 || empty($remark)) {
844
         if ($count <= 0 || empty($remark)) {
790
             self::$errCode = 1;
845
             self::$errCode = 1;
791
             self::$error = "参数错误";
846
             self::$error = "参数错误";
794
 
849
 
795
         $shop = self::getShopByCode($code);
850
         $shop = self::getShopByCode($code);
796
         if (empty($shop)) {
851
         if (empty($shop)) {
852
+            self::$errCode = 9;
853
+            self::$error = "商家不存在";
854
+            return false;
855
+        }
856
+
857
+        if((int)$shop->is_freeze === 1){
858
+            self::$errCode = 7;
859
+            self::$error = "商家冻结中";
860
+            return false;
861
+        }
862
+
863
+        //判断 营业状态  is_run
864
+        if((int)$shop->is_run === 0){
865
+            self::$errCode = 8;
866
+            self::$error = "商家暂停营业中";
797
             return false;
867
             return false;
798
         }
868
         }
799
 
869
 
800
         // 判断是否过期
870
         // 判断是否过期
801
         $expire_time = $shop->expire_time;
871
         $expire_time = $shop->expire_time;
872
+        //echo $expire_time;die;
873
+        $expire_time = strtotime($expire_time);
802
         if (time() < $expire_time) {
874
         if (time() < $expire_time) {
875
+            //未过期 不进行扣除
803
            return true;
876
            return true;
804
         }
877
         }
805
 
878
 

Loading…
Peruuta
Tallenna