|
@@ -10,6 +10,7 @@ use app\common\enum\ShopEnum;
|
10
|
10
|
use app\common\logic\QrCodeLogic;
|
11
|
11
|
|
12
|
12
|
use app\common\model\dev\DevRegion;
|
|
13
|
+use app\common\model\shop\Shop as shopModel;
|
13
|
14
|
use app\common\model\shop\ShopAd;
|
14
|
15
|
|
15
|
16
|
use app\common\model\shop\ShopGoods as shopGoodsModel;
|
|
@@ -23,7 +24,6 @@ use app\common\model\shop\ShopFollow;
|
23
|
24
|
use app\common\model\content\ClosureCategory;
|
24
|
25
|
use app\common\model\content\Closure;
|
25
|
26
|
|
26
|
|
-use app\common\model\shop\Shop as shopModel;
|
27
|
27
|
use app\common\model\content\EquiCategory as EquiCategoryModel;
|
28
|
28
|
use app\common\model\shop\ShopHkLog;
|
29
|
29
|
use think\facade\Db;
|
|
@@ -56,15 +56,66 @@ class ShopContentLogic extends Logic
|
56
|
56
|
|
57
|
57
|
//判断商家服务
|
58
|
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
|
95
|
//dump($expire_time);
|
|
96
|
+ //echo $expire_time;die;
|
|
97
|
+
|
61
|
98
|
if($expire_time < time()){
|
|
99
|
+ //判断到期时间
|
62
|
100
|
$data = [
|
63
|
101
|
'status' => 107,
|
64
|
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
|
121
|
if(empty($item))
|
|
@@ -93,7 +144,8 @@ class ShopContentLogic extends Logic
|
93
|
144
|
if ($row == 1) {
|
94
|
145
|
$data = [
|
95
|
146
|
'status' => 100,
|
96
|
|
- 'msg' => "绑定机器码成功!"
|
|
147
|
+ 'msg' => "绑定机器码成功!",
|
|
148
|
+ 'is_gi' => $is_gi
|
97
|
149
|
];
|
98
|
150
|
} else {
|
99
|
151
|
$data = [
|
|
@@ -126,7 +178,8 @@ class ShopContentLogic extends Logic
|
126
|
178
|
}else{
|
127
|
179
|
$data = [
|
128
|
180
|
'status' => 100,
|
129
|
|
- 'msg' => "已绑定该机器码!"
|
|
181
|
+ 'msg' => "已绑定该机器码!",
|
|
182
|
+ 'is_gi' => $is_gi
|
130
|
183
|
];
|
131
|
184
|
}
|
132
|
185
|
}
|
|
@@ -784,8 +837,10 @@ class ShopContentLogic extends Logic
|
784
|
837
|
*/
|
785
|
838
|
public static function subHKSYCount($post) {
|
786
|
839
|
$code = $post["code"] ?? '';
|
787
|
|
- $count = $post["count"] ?? 0;
|
|
840
|
+ //$count = $post["count"] ?? 1; //默认就是1
|
|
841
|
+ $count = 1;
|
788
|
842
|
$remark = $post["remark"] ?? '';
|
|
843
|
+
|
789
|
844
|
if ($count <= 0 || empty($remark)) {
|
790
|
845
|
self::$errCode = 1;
|
791
|
846
|
self::$error = "参数错误";
|
|
@@ -794,12 +849,30 @@ class ShopContentLogic extends Logic
|
794
|
849
|
|
795
|
850
|
$shop = self::getShopByCode($code);
|
796
|
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
|
867
|
return false;
|
798
|
868
|
}
|
799
|
869
|
|
800
|
870
|
// 判断是否过期
|
801
|
871
|
$expire_time = $shop->expire_time;
|
|
872
|
+ //echo $expire_time;die;
|
|
873
|
+ $expire_time = strtotime($expire_time);
|
802
|
874
|
if (time() < $expire_time) {
|
|
875
|
+ //未过期 不进行扣除
|
803
|
876
|
return true;
|
804
|
877
|
}
|
805
|
878
|
|