Browse Source

Merge branch 'develop' of yituan/opkpm into master

zhengxifeng 1 week ago
parent
commit
a47b4f1424

+ 6
- 1
app/admin/controller/shop/Store.php View File

@@ -44,8 +44,13 @@ class Store extends AdminBase
44 44
     public function add()
45 45
     {
46 46
         if ($this->request->isAjax()) {
47
-            (new StoreLValidate())->goCheck('add');
48 47
             $post = $this->request->post();
48
+            if (empty($post['expire_time'])) {
49
+                $post['expire_time'] = time();
50
+            }
51
+
52
+            (new StoreLValidate())->goCheck('add', $post);
53
+
49 54
             $lists = StoreLogic::add($post);
50 55
             if ($lists === false) {
51 56
                 $error = StoreLogic::getError() ?: '新增失败';

+ 46
- 2
app/admin/logic/shop/StoreLogic.php View File

@@ -9,6 +9,7 @@ use app\common\enum\ShopEnum;
9 9
 use app\common\model\shop\Shop;
10 10
 use app\common\model\shop\ShopAdmin;
11 11
 use app\common\model\shop\ShopGoods;
12
+use app\common\model\shop\ShopHkLog;
12 13
 use app\common\server\UrlServer;
13 14
 use Exception;
14 15
 use think\facade\Db;
@@ -40,6 +41,9 @@ class StoreLogic extends Logic
40 41
             if (isset($get['is_recommend']) && $get['is_recommend'] != '')
41 42
                 $where[] = ['is_recommend', '=', $get['is_recommend']];
42 43
 
44
+            if (isset($get['hksy_type']) && $get['hksy_type'] != '')
45
+                $where[] = ['hksy_type', '=', $get['hksy_type']];
46
+
43 47
             if (isset($get['is_run']) && $get['is_run'] != '')
44 48
                 $where[] = ['is_run', '=', $get['is_run']];
45 49
 
@@ -152,6 +156,20 @@ class StoreLogic extends Logic
152 156
             // 校验配送方式
153 157
             self::checkDeliveryType($post);
154 158
 
159
+            $hksy_type = $post['hksy_type'] ?? 1;
160
+            $hksy_count = $post['hksy_count'] ?? 0;
161
+            $op_count = $post['months'] ?? 0;
162
+
163
+            if ($hksy_type == 1) {
164
+                $op_count = 12;
165
+            } else {
166
+                $hksy_count = 0;
167
+            }
168
+
169
+            $di = \DateInterval::createFromDateString(strval($op_count) . ' months');
170
+            $dt = date_create_from_format('Y-m-d H:i:s', date('Y-m-d 00:00:00', time()))->add($di);
171
+            $expire_time = $dt->getTimestamp();
172
+
155 173
             // 创建商家
156 174
             $shop = Shop::create([
157 175
                 'cid'               => $post['cid'],
@@ -170,14 +188,17 @@ class StoreLogic extends Logic
170 188
                 'is_freeze'         => $post['is_freeze'],
171 189
                 'is_product_audit'  => $post['is_product_audit'],
172 190
                 'is_recommend'      => $post['is_recommend'] ?? 0,
173
-                'expire_time'       => !empty($post['expire_time']) ? strtotime($post['expire_time']) : 0,
191
+                // 'expire_time'       => !empty($post['expire_time']) ? strtotime($post['expire_time']) : 0,
192
+                'expire_time'       => $expire_time,
174 193
                 'province_id'    => $post['province_id'] ?? 0,
175 194
                 'city_id'        => $post['city_id'] ?? 0,
176 195
                 'district_id'    => $post['district_id'] ?? 0,
177 196
                 'address'        => $post['address'] ?? '',
178 197
                 'longitude'      => $post['longitude'] ?? '',
179 198
                 'latitude'       => $post['latitude'] ?? '',
180
-                'delivery_type'  => $post['delivery_type'] ?? [1]
199
+                'delivery_type'  => $post['delivery_type'] ?? [1],
200
+                'hksy_type'      => $hksy_type,
201
+                'hksy_count'    => $hksy_count,
181 202
             ]);
182 203
             // 创建账号
183 204
             // 新增商家登录账号
@@ -197,6 +218,29 @@ class StoreLogic extends Logic
197 218
                 'del' => 0
198 219
             ]);
199 220
 
221
+            // 添加用户套餐时间或者数量日志 ZMH 2025-03-24
222
+            if ($hksy_type >= 0) {
223
+                // 添加用户套餐时间或者数量
224
+                $hk = new ShopHkLog();
225
+                $hk->shop_id = $shop['id'];
226
+                $hk->source_id = 0;
227
+                if ($hksy_type == 1) {
228
+                    $hk->source_type = 100;
229
+                    $hk->change_count = $hksy_count;
230
+                    $hk->left_count = $hksy_count;
231
+                    $hk->remark = '[初始化],赠送操作数量:' . $hksy_count;
232
+                } else {
233
+                    $hk->source_type = 200;
234
+                    $hk->change_count = $op_count;
235
+
236
+                    $hk->before_date = date('Y-m-d H:i:s', time());
237
+                    $hk->after_date = date('Y-m-d H:i:s', $dt->getTimestamp());
238
+                    $hk->remark = '[初始化],赠送月份数量:' . $op_count;
239
+                }
240
+
241
+                $hk->save();
242
+            }
243
+
200 244
             Db::commit();
201 245
             return true;
202 246
         } catch (Exception $e) {

+ 92
- 39
app/admin/view/shop/store/add.html View File

@@ -1,8 +1,20 @@
1 1
 {layout name="layout2" /}
2 2
 <style>
3
-    .layui-form-item .layui-form-label { width: 95px; }
4
-    .layui-form-item .layui-input-inline { width: 240px; }
5
-    .layui-form-item .map-container{ width: 600px; height: 400px; margin-left: 100px; margin-top: 20px; }
3
+    .layui-form-item .layui-form-label {
4
+        width: 95px;
5
+    }
6
+
7
+    .layui-form-item .layui-input-inline {
8
+        width: 240px;
9
+    }
10
+
11
+    .layui-form-item .map-container {
12
+        width: 600px;
13
+        height: 400px;
14
+        margin-left: 100px;
15
+        margin-top: 20px;
16
+    }
17
+
6 18
     .layui-form-select dl {
7 19
         z-index: 1001;
8 20
     }
@@ -21,23 +33,25 @@
21 33
                 <div class="layui-form-item">
22 34
                     <label for="name" class="layui-form-label"><span style="color:red;">*</span>商家名称:</label>
23 35
                     <div class="layui-input-inline">
24
-                        <input type="text" name="name" id="name" lay-verType="tips" lay-verify="name"
25
-                               switch-tab="0" autocomplete="off" class="layui-input">
36
+                        <input type="text" name="name" id="name" lay-verType="tips" lay-verify="name" switch-tab="0"
37
+                            autocomplete="off" class="layui-input">
26 38
                     </div>
27 39
                 </div>
28 40
                 <div class="layui-form-item" style="display: none;">
29 41
                     <label class="layui-form-label"><span style="color:red;">*</span>商家类型:</label>
30 42
                     <div class="layui-input-inline">
31
-                        <input type="radio" name="type" value="1" title="官方自营" >
43
+                        <input type="radio" name="type" value="1" title="官方自营">
32 44
                         <input type="radio" name="type" value="2" title="入驻商家" checked>
33 45
                     </div>
34 46
                 </div>
35 47
                 <div class="layui-form-item" style="display: none;">
36 48
                     <label class="layui-form-label"><span style="color:red;">*</span>配送方式:</label>
37 49
                     <div class="layui-input-inline">
38
-                        <input type="checkbox" name="delivery_type[]" value="1" title="快递发货" lay-skin="primary" checked disabled>
39
-                        <input type="checkbox" name="delivery_type[]" value="2" title="线下自提" lay-skin="primary" >
40
-                        <div class="layui-form-mid layui-word-aux" style="white-space:nowrap;">实物商品的配送方式【快递发货】默认为必选,虚拟商品默认为虚拟发货,不受配送方式限制</div>
50
+                        <input type="checkbox" name="delivery_type[]" value="1" title="快递发货" lay-skin="primary" checked
51
+                            disabled>
52
+                        <input type="checkbox" name="delivery_type[]" value="2" title="线下自提" lay-skin="primary">
53
+                        <div class="layui-form-mid layui-word-aux" style="white-space:nowrap;">
54
+                            实物商品的配送方式【快递发货】默认为必选,虚拟商品默认为虚拟发货,不受配送方式限制</div>
41 55
                     </div>
42 56
                 </div>
43 57
                 <div class="layui-form-item">
@@ -46,7 +60,7 @@
46 60
                         <select name="cid" id="cid" lay-verType="tips" lay-verify="cid" switch-tab="0">
47 61
                             <option value=""></option>
48 62
                             {volist name="category" id="vo"}
49
-                                <option value="{$vo.id}">{$vo.name}</option>
63
+                            <option value="{$vo.id}">{$vo.name}</option>
50 64
                             {/volist}
51 65
                         </select>
52 66
                     </div>
@@ -55,14 +69,14 @@
55 69
                     <label for="nickname" class="layui-form-label"><span style="color:red;">*</span>联系人:</label>
56 70
                     <div class="layui-input-inline">
57 71
                         <input type="text" name="nickname" id="nickname" lay-verType="tips" lay-verify="nickname"
58
-                               switch-tab="0" autocomplete="off" class="layui-input" value="wuwu">
72
+                            switch-tab="0" autocomplete="off" class="layui-input" value="wuwu">
59 73
                     </div>
60 74
                 </div>
61 75
                 <div class="layui-form-item" style="display: none;">
62 76
                     <label for="mobile" class="layui-form-label"><span style="color:red;">*</span>联系手机:</label>
63 77
                     <div class="layui-input-inline">
64 78
                         <input type="number" name="mobile" id="mobile" lay-verType="tips" lay-verify="mobile"
65
-                               switch-tab="0" autocomplete="off" class="layui-input" value="13268119865">
79
+                            switch-tab="0" autocomplete="off" class="layui-input" value="13268119865">
66 80
                     </div>
67 81
                 </div>
68 82
                 <div class="layui-form-item" style="display: none;">
@@ -76,7 +90,7 @@
76 90
                     <input type="hidden" name="logo" value="./uploads/images/20250221/202502211625593cc9c0131.png">
77 91
                 </div>
78 92
 
79
-                <div class="layui-form-item"  style="display: none;">
93
+                <div class="layui-form-item" style="display: none;">
80 94
                     <label class="layui-form-label">商家地址:</label>
81 95
                     <div class="layui-input-block">
82 96
                         <div class="layui-input-inline" style="width:120px;">
@@ -96,10 +110,10 @@
96 110
                         </div>
97 111
                     </div>
98 112
                 </div>
99
-                <div class="layui-form-item"  style="display: none;">
113
+                <div class="layui-form-item" style="display: none;">
100 114
                     <label class="layui-form-label">地图定位:</label>
101 115
                     <div class="layui-input-block">
102
-                        <div class="layui-inline" >
116
+                        <div class="layui-inline">
103 117
                             <div class="layui-input-inline" style="width:120px;margin-right:5px;">
104 118
                                 <input type="text" name="longitude" autocomplete="off" class="layui-input">
105 119
                             </div>
@@ -119,7 +133,7 @@
119 133
                         <div id="map-container" style="width: 700px;height: 400px;margin-left: 115px;"></div>
120 134
                     </div>
121 135
                 </div>
122
-                <div class="layui-form-item"  style="display: none;">
136
+                <div class="layui-form-item" style="display: none;">
123 137
                     <label for="keywords" class="layui-form-label">商家关键字:</label>
124 138
                     <div class="layui-input-inline">
125 139
                         <input type="text" name="keywords" id="keywords" autocomplete="off" class="layui-input">
@@ -134,21 +148,48 @@
134 148
             </div>
135 149
             <!-- 2、经营设置 -->
136 150
             <div class="layui-tab-item">
137
-                <div class="layui-form-item">
151
+                <div class="layui-form-item" style="display: none;">
138 152
                     <label for="expire_time" class="layui-form-label"><span style="color:red;">*</span>到期时间:</label>
139 153
                     <div class="layui-input-inline">
140
-                        <input type="text" name="expire_time" id="expire_time" lay-verType="tips" lay-verify="expire_time"
141
-                               switch-tab="1" autocomplete="off" class="layui-input">
154
+                        <input type="text" name="expire_time" id="expire_time" lay-verType="tips"
155
+                            lay-verify="expire_time" switch-tab="1" autocomplete="off" class="layui-input">
156
+                    </div>
157
+                </div>
158
+
159
+                <div class="layui-form-item">
160
+                    <label class="layui-form-label"><span style="color:red;">*</span>获客类型:</label>
161
+                    <div class="layui-input-inline">
162
+                        <input type="radio" name="hksy_type" value="0" title="包月" lay-filter="hksy_type">
163
+                        <input type="radio" name="hksy_type" value="1" title="按量付费" lay-filter="hksy_type" checked>
142 164
                     </div>
143 165
                 </div>
166
+
167
+                <div class="layui-form-item hksy_type_item">
168
+                    <label for="hksy_count" class="layui-form-label"><span style="color:red;">*</span>赠送评论数:</label>
169
+                    <div class="layui-input-inline">
170
+                        <input type="number" name="hksy_count" id="hksy_count" value="1000" lay-verType="tips"
171
+                            lay-verify="hksy_count" switch-tab="1" autocomplete="off" class="layui-input">
172
+                    </div>
173
+                </div>
174
+
175
+                <div class="layui-form-item hksy_type_item2" style="display: none;">
176
+                    <label for="months" class="layui-form-label"><span style="color:red;">*</span>赠送月份数:</label>
177
+                    <div class="layui-input-inline">
178
+                        <input type="number" name="months" id="months" value="12" lay-verType="tips"
179
+                            lay-verify="months" switch-tab="1" autocomplete="off" class="layui-input">
180
+                    </div>
181
+                </div>
182
+
144 183
                 <div class="layui-form-item" style="display: none;">
145
-                    <label for="trade_service_fee" class="layui-form-label"><span style="color:red;">*</span>交易服务费:</label>
184
+                    <label for="trade_service_fee" class="layui-form-label"><span
185
+                            style="color:red;">*</span>交易服务费:</label>
146 186
                     <div class="layui-input-inline">
147 187
                         <input type="number" min="0" max="100" name="trade_service_fee" id="trade_service_fee"
148
-                               lay-verType="tips" lay-verify="trade_service_fee"
149
-                               onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"
150
-                               switch-tab="1" autocomplete="off" class="layui-input" value="0">
151
-                        <div class="layui-form-mid layui-word-aux" style="white-space:nowrap;">平台每笔交易收取的服务费用。请填写百分比,填0表示不收取服务费</div>
188
+                            lay-verType="tips" lay-verify="trade_service_fee"
189
+                            onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" switch-tab="1"
190
+                            autocomplete="off" class="layui-input" value="0">
191
+                        <div class="layui-form-mid layui-word-aux" style="white-space:nowrap;">
192
+                            平台每笔交易收取的服务费用。请填写百分比,填0表示不收取服务费</div>
152 193
                     </div>
153 194
                     <div class="layui-form-mid layui-word-aux">%</div>
154 195
                 </div>
@@ -183,7 +224,7 @@
183 224
                     <label for="account" class="layui-form-label"><span style="color:red;">*</span>商家账号:</label>
184 225
                     <div class="layui-input-inline">
185 226
                         <input type="text" name="account" id="account" lay-verType="tips" lay-verify="account"
186
-                               switch-tab="2" autocomplete="off" class="layui-input">
227
+                            switch-tab="2" autocomplete="off" class="layui-input">
187 228
                         <div class="layui-form-mid layui-word-aux" style="white-space:nowrap;">商家账号和密码用于登录商家后台</div>
188 229
                     </div>
189 230
                 </div>
@@ -191,7 +232,7 @@
191 232
                     <label for="password" class="layui-form-label"><span style="color:red;">*</span>登录密码:</label>
192 233
                     <div class="layui-input-inline">
193 234
                         <input type="text" name="password" id="password" lay-verType="tips" lay-verify="password"
194
-                               switch-tab="2" autocomplete="off" class="layui-input">
235
+                            switch-tab="2" autocomplete="off" class="layui-input">
195 236
                         <div class="layui-form-mid layui-word-aux" style="white-space:nowrap;">商家账号和密码用于登录商家后台</div>
196 237
                     </div>
197 238
                 </div>
@@ -199,7 +240,7 @@
199 240
                     <label for="okPassword" class="layui-form-label"><span style="color:red;">*</span>确认密码:</label>
200 241
                     <div class="layui-input-inline">
201 242
                         <input type="text" name="okPassword" id="okPassword" lay-verType="tips" lay-verify="pwd"
202
-                               switch-tab="2" autocomplete="off" class="layui-input">
243
+                            switch-tab="2" autocomplete="off" class="layui-input">
203 244
                         <div class="layui-form-mid layui-word-aux" style="white-space:nowrap;">商家账号和密码用于登录商家后台</div>
204 245
                     </div>
205 246
                 </div>
@@ -222,8 +263,8 @@
222 263
     }).extend({
223 264
         likeArea: "likeArea/likeArea",
224 265
         txMap: "likeMap/txMap",
225
-        customTxMap:'likeMap/customTxMap',
226
-    }).use(["form", "laydate", "likeArea", "txMap",'customTxMap'], function(){
266
+        customTxMap: 'likeMap/customTxMap',
267
+    }).use(["form", "laydate", "likeArea", "txMap", 'customTxMap'], function () {
227 268
         var $ = layui.$;
228 269
         var form = layui.form;
229 270
         var likeArea = layui.likeArea;
@@ -231,7 +272,7 @@
231 272
         var txMap = layui.txMap;
232 273
         var customTxMap = layui.customTxMap;
233 274
 
234
-        laydate.render({type:"datetime", elem:"#expire_time", trigger:"click",min:0});
275
+        laydate.render({ type: "datetime", elem: "#expire_time", trigger: "click", min: 0 });
235 276
 
236 277
 
237 278
         like.delUpload();
@@ -243,6 +284,18 @@
243 284
             });
244 285
         });
245 286
 
287
+        form.on('radio(hksy_type)', function (data) {
288
+            // console.log(data.elem); //得到radio原始DOM对象
289
+            // console.log(data.value); //被点击的radio的value值
290
+            if (data.value == 1) {
291
+                $(".hksy_type_item").show();
292
+                $(".hksy_type_item2").hide();
293
+            } else {
294
+                $(".hksy_type_item").hide();
295
+                $(".hksy_type_item2").show();
296
+            }
297
+        });
298
+
246 299
 
247 300
         form.verify({
248 301
             name: function (value, item) {
@@ -277,12 +330,12 @@
277 330
                     }*/
278 331
                 }
279 332
             },
280
-            expire_time: function (value, item) {
281
-                if (!value) {
282
-                    switchTab($(item).attr("switch-tab"));
283
-                    return "请选择到期时间";
284
-                }
285
-            },
333
+            // expire_time: function (value, item) {
334
+            //     if (!value) {
335
+            //         switchTab($(item).attr("switch-tab"));
336
+            //         return "请选择到期时间";
337
+            //     }
338
+            // },
286 339
             trade_service_fee: function (value, item) {
287 340
                 if (!value && parseInt(value) !== 0) {
288 341
                     switchTab($(item).attr("switch-tab"));
@@ -336,15 +389,15 @@
336 389
             var city = $("#city");
337 390
             var district = $("#district");
338 391
             var address = $("input[name='address']").val();
339
-            if(!province.val()){
392
+            if (!province.val()) {
340 393
                 layer.msg("请选择省份");
341 394
                 return;
342 395
             }
343
-            if(!city.val()){
396
+            if (!city.val()) {
344 397
                 layer.msg("请选择市");
345 398
                 return;
346 399
             }
347
-            if(!district.val()){
400
+            if (!district.val()) {
348 401
                 layer.msg("请选择镇/区");
349 402
                 return;
350 403
             }

+ 1
- 1
app/admin/view/shop/store/edit.html View File

@@ -143,7 +143,7 @@
143 143
             </div>
144 144
             <!-- 2、经营设置 -->
145 145
             <div class="layui-tab-item">
146
-                <div class="layui-form-item">
146
+                <div class="layui-form-item" style="display: none;">
147 147
                     <label for="expire_time" class="layui-form-label"><span style="color:red;">*</span>到期时间:</label>
148 148
                     <div class="layui-input-inline">
149 149
                         <input type="text" name="expire_time" id="expire_time" value="{$detail.expire_time}"

+ 22
- 2
app/admin/view/shop/store/lists.html View File

@@ -82,6 +82,16 @@
82 82
                         </select>
83 83
                     </div>
84 84
                 </div>
85
+                <div class="layui-inline">
86
+                    <label for="hksy_type" class="layui-form-label">商家套餐:</label>
87
+                    <div class="layui-input-inline">
88
+                        <select name="hksy_type" id="hksy_type">
89
+                            <option value="">全部</option>
90
+                            <option value="0">包月</option>
91
+                            <option value="1">按量付费</option>
92
+                        </select>
93
+                    </div>
94
+                </div>
85 95
                 <div class="layui-inline">
86 96
                     <label for="is_freeze" class="layui-form-label">到期状态:</label>
87 97
                     <div class="layui-input-inline">
@@ -135,6 +145,16 @@
135 145
                 <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="set">设置</a>
136 146
                 <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="account">账号管理</a>
137 147
             </script>
148
+
149
+            <script type="text/html" id="table-store">
150
+                <p>账号:{{ d.account }}</p>
151
+                {{# if(d.hksy_type == 0){ }}
152
+                    <p>类型:<font style="color: red;">包月</font></p>
153
+                {{# } }}
154
+                {{# if(d.hksy_type == 1){ }}
155
+                    <p>类型:<font style="color: blue;">按量付费</font></p>
156
+                {{# } }}
157
+            </script>
138 158
         </div>
139 159
 
140 160
     </div>
@@ -164,14 +184,14 @@
164 184
             {type: 'checkbox'}
165 185
             ,{field:"id", width:60, title:"ID"}
166 186
             ,{field:"storeInfo", width:250, title:"商家信息", templet:"#table-storeInfo"}
167
-            ,{field:"account", width:100, align:"center",title:"商家账号"}
187
+            ,{field:"account", width:100, align:"center",title:"商家账号", templet:"#table-store"}
168 188
             ,{field:"category", width:100, align:"center", title:"主营类目"}
169 189
             ,{field:"is_run", width:90, align:"center", title:"营业状态"}
170 190
             ,{field:"is_freeze", width:90, align:"center", title:"商家状态"}
171 191
             //,{field:"is_recommend", width:90, align:"center", title:"推荐商家"}
192
+            ,{field:"expire_desc", width:160, align:"center", title:"到期状态"}
172 193
             ,{field:"hksy_count", width:90, align:"center", title:"评论次数"}
173 194
             ,{field:"create_time", width:160, align:"center", title:"开通日期"}
174
-            ,{field:"expire_desc", width:160, align:"center", title:"到期状态"}
175 195
             ,{field:"expire_time", width:160, align:"center", title:"到期时间"}
176 196
             ,{title:"操作", width:250, align:"center", fixed:"right", toolbar:"#table-operation"}
177 197
         ]);

+ 41
- 2
app/api/logic/ShopContentLogic.php View File

@@ -96,15 +96,18 @@ class ShopContentLogic extends Logic
96 96
             //dump($expire_time);
97 97
             //echo $expire_time;die;
98 98
 
99
+            /***
100
+             * 原先这是 先判断是否到期 未到期 不扣次数  已到期 判断剩余数量
101
+             *
99 102
             if($expire_time < time()){
100 103
                 //判断到期时间
101 104
                 $data = [
102 105
                    'status' => 107,
103 106
                    'msg' => "商户服务当前套餐到期,到期时间".date('Y-m-d H:i:s',$expire_time)."!"
104 107
                 ];
105
-                //判断剩余数量  hksy_count  当商家已到期
108
+                //当商家已到期
106 109
                 if((int)$shop['hksy_count'] < 10){
107
-                    //判断到期时间
110
+                    //判断剩余数量  hksy_count
108 111
                     $data = [
109 112
                         'status' => 113,
110 113
                         'msg' => "商户服务可评论次数不足,剩余".$shop['hksy_count']."条,请充值后再使用 或 开通商户包年包月服务!"
@@ -117,6 +120,34 @@ class ShopContentLogic extends Logic
117 120
                 $is_gi = 0;
118 121
             }
119 122
             //未到期 不需要扣次数 继续执行即可
123
+             * */
124
+
125
+            //判断类型
126
+            if((int)$shop['hksy_type'] === 0){
127
+                //包月
128
+                if($expire_time < time()){
129
+                    //判断到期时间
130
+                    $data = [
131
+                        'status' => 107,
132
+                        'msg' => "商户服务当前套餐到期,到期时间".date('Y-m-d H:i:s',$expire_time)."!"
133
+                    ];
134
+                    return $data;
135
+                }
136
+                //包月 未过期  = 前端会按包月模式 运行
137
+                $is_gi = 0;
138
+            }else{
139
+                //按量
140
+                if((int)$shop['hksy_count'] < 5){
141
+                    //判断剩余数量  hksy_count
142
+                    $data = [
143
+                        'status' => 113,
144
+                        'msg' => "商户服务可评论次数不足,剩余".$shop['hksy_count']."条,请充值次数后再使用!"
145
+                    ];
146
+                    return $data;
147
+                }
148
+                //按量 统一按过期处理 = 前端会按按量模式 运行
149
+                $is_gi = 1;
150
+            }
120 151
         }
121 152
 
122 153
         if(empty($item))
@@ -881,6 +912,7 @@ class ShopContentLogic extends Logic
881 912
             return false;
882 913
         }
883 914
 
915
+        /*
884 916
         // 判断是否过期
885 917
         $expire_time = $shop->expire_time;
886 918
         //echo $expire_time;die;
@@ -888,6 +920,13 @@ class ShopContentLogic extends Logic
888 920
         if (time() < $expire_time) {
889 921
             //未过期 不进行扣除
890 922
            return true;
923
+        }*/
924
+
925
+        //判断类型
926
+        if((int)$shop->hksy_type === 0){
927
+            self::$errCode = 10;
928
+            self::$error = "商家类型是包月,不允许使用次数!";
929
+            return false;
891 930
         }
892 931
 
893 932
         if ($shop->hksy_count < $count) {

+ 3
- 1
app/shop/controller/content/EquiCategory.php View File

@@ -77,11 +77,13 @@ class EquiCategory extends ShopBase
77 77
 
78 78
         // 获取剩余评论数
79 79
         $shop = EquiCategoryLogic::getShop($this->shop_id);
80
-        $hksy_count =$shop->hksy_count;
80
+        $hksy_count = $shop->hksy_count;
81
+        $hksy_type = $shop->hksy_type;
81 82
 
82 83
         return view('lists',['end_time' => $end_time,
83 84
             'edui_info' => $str,
84 85
             'hksy_count' => $hksy_count,
86
+            'hksy_type' => $hksy_type,
85 87
             'server_info' => $res]);
86 88
     }
87 89
 

+ 2
- 1
app/shop/controller/order/OrderRenew.php View File

@@ -3,7 +3,7 @@
3 3
  * @Author: xiaohai zmhwork@qq.com
4 4
  * @Date: 2025-03-14 17:27:51
5 5
  * @LastEditors: xiaohai zmhwork@qq.com
6
- * @LastEditTime: 2025-03-22 18:10:24
6
+ * @LastEditTime: 2025-03-24 20:54:33
7 7
  * @FilePath: \opkpm\app\shop\controller\order\OrderRenew.php
8 8
  * @Description: 续费订单
9 9
  */
@@ -38,6 +38,7 @@ class OrderRenew extends ShopBase
38 38
         if ($this->request->isAjax()) {
39 39
             $get = $this->request->get();
40 40
             $get['shop_id'] = $this->shop_id;
41
+            $get['type_id'] = $this->shop['hksy_type'];
41 42
             return JsonServer::success('', OrderRenewLogic::renewLists($get));
42 43
         }
43 44
 

+ 9
- 1
app/shop/logic/LoginLogic.php View File

@@ -1,4 +1,12 @@
1 1
 <?php
2
+/*
3
+ * @Author: xiaohai zmhwork@qq.com
4
+ * @Date: 2025-03-13 18:17:49
5
+ * @LastEditors: xiaohai zmhwork@qq.com
6
+ * @LastEditTime: 2025-03-24 21:19:27
7
+ * @FilePath: \opkpm\app\shop\logic\LoginLogic.php
8
+ * @Description: 
9
+ */
2 10
 // +----------------------------------------------------------------------
3 11
 // | likeshop开源商城系统
4 12
 // +----------------------------------------------------------------------
@@ -45,7 +53,7 @@ class LoginLogic extends Logic
45 53
         $adminModel = new ShopAdmin();
46 54
         $admin_info = $adminModel->alias('a')
47 55
             ->join('shop s', 's.id = a.shop_id')
48
-            ->field(['a.id', 'a.account', 'a.name', 'role_id', 'shop_id', 's.name' => 'shop_name'])
56
+            ->field(['a.id', 'a.account', 'a.name', 'role_id', 'shop_id', 's.name' => 'shop_name', 's.hksy_type'])
49 57
             ->where(['a.account' => $post['account'], 'a.del' => 0])
50 58
             ->findOrEmpty()->toArray();
51 59
 

+ 2
- 2
app/shop/logic/order/OrderRenewLogic.php View File

@@ -3,7 +3,7 @@
3 3
  * @Author: xiaohai zmhwork@qq.com
4 4
  * @Date: 2025-03-14 17:38:50
5 5
  * @LastEditors: xiaohai zmhwork@qq.com
6
- * @LastEditTime: 2025-03-23 21:29:28
6
+ * @LastEditTime: 2025-03-24 21:14:25
7 7
  * @FilePath: \opkpm\app\shop\logic\order\OrderRenewLogic.php
8 8
  * @Description: 续费订单逻辑处理
9 9
  */
@@ -57,7 +57,7 @@ class OrderRenewLogic extends Logic
57 57
 
58 58
         $where = [
59 59
             ['del', '=', 0],
60
-            //['status', '=', 1]
60
+            ['type_id', '=', $get['type_id']]
61 61
         ];
62 62
 
63 63
         if (!empty($get['name']) && $get['name']) {

+ 30
- 16
app/shop/view/content/equi_category/lists.html View File

@@ -12,16 +12,6 @@
12 12
   }
13 13
 </style>
14 14
 
15
-<!-- 操作提示 -->
16
-<div class="layui-fluid">
17
-  <div class="layui-card" style="margin-top: 15px;">
18
-    <div class="layui-card-body">
19
-      <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
20
-        <div class="layui-colla-item">
21
-          <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">商户套餐:</h2>
22
-          <div class="layui-colla-content layui-show">
23
-            <p>
24
-
25 15
 {php}
26 16
 $date1 = time();
27 17
 $date2 = strtotime($end_time);
@@ -29,18 +19,42 @@ $date2 = strtotime($end_time);
29 19
 $days = abs($date2 - $date1) / (60 * 60 * 24);
30 20
 $days = intval($days); //取整
31 21
 if($date1 > $date2){
32
-    $days_desc = "已过期".$days."天";
22
+$days_desc = "已过期".$days."天";
33 23
 }else if($days == 0){
34
-    $days_desc = "今天已到期";
24
+$days_desc = "今天已到期";
35 25
 }else{
36
-    $days_desc = "剩余".$days."天";
26
+$days_desc = "剩余".$days."天";
37 27
 }
38 28
 //echo "相差天数:".intval($days); // 输出相差天数,使用intval确保得到整数结果
39 29
 {/php}
40 30
 
41
-                <b>套餐包含:</b> 电脑 <b style="color:#000;">{$server_info.pc_num}</b> 台,每台电脑可添加手机 <b style="color:#000;">{$server_info.mobile_num}</b> 台,可同时运行手机 <b style="color:#000;">{$server_info.run_num}</b> 台。
42
-              <br/>
43
-              总电脑数量:<b style="color:#000;">{$edui_info[0][0]??"0"}</b> 台 &nbsp;&nbsp;&nbsp;&nbsp;<b style="color:red;">服务到期时间:</b>  <span style="color:red;">{$end_time} ({$days_desc})</span> &nbsp;&nbsp;&nbsp;&nbsp;<b style="color:red;">评论次数剩余数量:</b>  <span style="color:red;">{$hksy_count}</span> <br/>
31
+<!-- 操作提示 -->
32
+<div class="layui-fluid">
33
+  <div class="layui-card" style="margin-top: 15px;">
34
+    <div class="layui-card-body">
35
+      <div class="layui-collapse like-layui-collapse" lay-accordion="" style="border:1px dashed #c4c4c4">
36
+        <div class="layui-colla-item">
37
+          <h2 class="layui-colla-title like-layui-colla-title" style="background-color: #fff">
38
+              商户套餐:
39
+              {eq name="hksy_type" value="1"}
40
+              <b style="color:red;">评论次数剩余数量:</b>  <span style="color:red;">{$hksy_count}</span>
41
+              {/eq}
42
+
43
+              {eq name="hksy_type" value="0"}
44
+              <b style="color:red;">服务到期时间:</b>  <span style="color:red;">{$end_time} ({$days_desc})</span>
45
+              {/eq}
46
+          </h2>
47
+          <div class="layui-colla-content layui-show">
48
+            <p>
49
+
50
+                <b>商户类型:</b>{eq name="hksy_type" value="1"}按量付费{/eq} {eq name="hksy_type" value="0"}包月{/eq}
51
+                <b style="margin-left:20px;">套餐包含:</b> 电脑 <b style="color:#000;">{$server_info.pc_num}</b> 台,每台电脑可添加手机 <b style="color:#000;">{$server_info.mobile_num}</b> 台,可同时运行手机 <b style="color:#000;">{$server_info.run_num}</b> 台。
52
+              <hr/>
53
+
54
+              <b>总电脑数量:</b><b style="color:#000;">{$edui_info[0][0]??"0"}</b> 台 &nbsp;&nbsp;&nbsp;&nbsp;
55
+
56
+              <br>
57
+
44 58
               {volist name="edui_info" id="vo"}
45 59
                 第 <b style="color:#000;">{$vo[1]}</b> 台电脑,总共 <b style="color:#000;">{$vo[2]}</b> 台手机设备,已启用 <b style="color:#000;">{$vo[3]}</b> 台手机设备,未启用 <b style="color:#000;">{$vo[4]}</b> 台手机设备,可同时运行手机 <b style="color:#000;">{$server_info.run_num}</b> 台。 <br/>
46 60
               {/volist}

Loading…
Cancel
Save