Selaa lähdekoodia

添加包月 按量付费记录

xiaohai 1 viikko sitten
vanhempi
commit
d57be65db9

+ 25
- 1
app/shop/controller/order/OrderRenew.php Näytä tiedosto

@@ -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-17 16:24:30
6
+ * @LastEditTime: 2025-03-22 18:10:24
7 7
  * @FilePath: \opkpm\app\shop\controller\order\OrderRenew.php
8 8
  * @Description: 续费订单
9 9
  */
@@ -39,6 +39,30 @@ class OrderRenew extends ShopBase
39 39
         return view('');
40 40
     }
41 41
 
42
+    public function renewLog()
43
+    {
44
+        if ($this->request->isAjax()) {
45
+            $get = $this->request->get();
46
+            $get['shop_id'] = $this->shop_id;
47
+            $get['type_id'] = 1;
48
+            return JsonServer::success('', OrderRenewLogic::renewLog($get));
49
+        }
50
+
51
+        return view('');
52
+    }
53
+
54
+    public function renewMonthLog()
55
+    {
56
+        if ($this->request->isAjax()) {
57
+            $get = $this->request->get();
58
+            $get['shop_id'] = $this->shop_id;
59
+            $get['type_id'] = 2;
60
+            return JsonServer::success('', OrderRenewLogic::renewLog($get));
61
+        }
62
+
63
+        return view('');
64
+    }
65
+
42 66
     public function buy()
43 67
     {
44 68
         $get = $this->request->get();

+ 44
- 9
app/shop/logic/order/OrderRenewLogic.php Näytä tiedosto

@@ -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-17 18:43:05
6
+ * @LastEditTime: 2025-03-22 18:24:44
7 7
  * @FilePath: \opkpm\app\shop\logic\order\OrderRenewLogic.php
8 8
  * @Description: 续费订单逻辑处理
9 9
  */
@@ -94,7 +94,7 @@ class OrderRenewLogic extends Logic
94 94
         return $info->toArray();
95 95
     }
96 96
 
97
-    
97
+
98 98
     public static function cancel($post)
99 99
     {
100 100
         try {
@@ -140,7 +140,7 @@ class OrderRenewLogic extends Logic
140 140
         $name = $model->getName();
141 141
         $post['order_sn'] = createSn($name, 'order_sn');
142 142
         $post['renew_name'] = $post['name'];
143
-        $post['renew_image'] = $post['image']??"";
143
+        $post['renew_image'] = $post['image'] ?? "";
144 144
         $post['renew_desc'] = $post['desc'];
145 145
         $post['renew_type_id'] = $post['type_id'];
146 146
         $post['renew_price'] = $post['price'];
@@ -241,10 +241,16 @@ class OrderRenewLogic extends Logic
241 241
 
242 242
     private static function changeHkCount($info, $time)
243 243
     {
244
-        // 添加用户套餐时间或者数量
245 244
         // 操作数量
246 245
         $op_count = $info['renew_op_count'] * $info['total_num'];
247 246
         $shop = Shop::find($info['shop_id']);
247
+
248
+        // 添加用户套餐时间或者数量
249
+        $hk = new ShopHkLog();
250
+        $hk->shop_id = $shop['id'];
251
+        $hk->source_id = $info->id;
252
+        $hk->change_count = $op_count;
253
+
248 254
         // 包月
249 255
         if ($info['renew_type_id'] == 0) {
250 256
             $old_expire_time = $shop['expire_time'];
@@ -256,16 +262,20 @@ class OrderRenewLogic extends Logic
256 262
             $dt = date_create_from_format('Y-m-d H:i:s', date('Y-m-d H:i:s', $old_expire_time))->add($di);
257 263
             $dt_str = $dt->format('Y-m-d 00:00:00');
258 264
             $shop->expire_time = strtotime($dt_str);
265
+
266
+            $hk->source_type = 200;
267
+            $hk->before_date = date('Y-m-d H:i:s', $old_expire_time);
268
+            $hk->after_date = date('Y-m-d H:i:s', $shop->expire_time);
269
+
270
+            $hk->remark = '[' . $info->renew_name . '],订单号:' . $info->order_sn . ',增加月份数:' . $op_count;
271
+            $hk->save();
259 272
         } else {
260 273
             // 按量付费
261 274
             // 添加数量记录
262 275
             $old_hksy_count = $shop->hksy_count;
263
-            $hk = new ShopHkLog();
264
-            $hk->shop_id = $shop['id'];
265
-            $hk->source_id = $info->id;
266
-            $hk->change_count = $op_count;
276
+
267 277
             $hk->left_count = $op_count + $old_hksy_count;
268
-            $hk->remark = '[' . $info->renew_name . '],订单号:' . $info->order_sn;
278
+            $hk->remark = '[' . $info->renew_name . '],订单号:' . $info->order_sn . ',增加总数:' . $op_count;
269 279
             $hk->save();
270 280
 
271 281
             $shop->hksy_count += $op_count;
@@ -276,6 +286,31 @@ class OrderRenewLogic extends Logic
276 286
         return true;
277 287
     }
278 288
 
289
+    public static function renewLog($get)
290
+    {
291
+        $page = $get['page'] ?? 1;
292
+        $limit = $get['limit'] ?? 10;
293
+
294
+        $where = [];
295
+        $where[] = ['shop_id', '=', $get['shop_id']];
296
+        $type_id = $get['type_id'] ?? 1;
297
+        if ($type_id == 1) {
298
+            $where[] = ['source_type', '>=', 100];
299
+            $where[] = ['source_type', '<', 200];
300
+        } else {
301
+            $where[] = ['source_type', '>=', 200];
302
+            $where[] = ['source_type', '<', 300];
303
+        }
304
+
305
+        $count = ShopHkLog::where($where)->count();
306
+        $lists = ShopHkLog::where($where)
307
+            ->page($page, $limit)
308
+            ->order('id', 'desc')
309
+            ->select()->toArray();
310
+
311
+        return ['count' => $count, 'lists' => $lists];
312
+    }
313
+
279 314
     private static function aliPaySucc($order_sn, $result)
280 315
     {
281 316
         $time = time();

+ 47
- 0
app/shop/view/order/order_renew/renew_log.html Näytä tiedosto

@@ -0,0 +1,47 @@
1
+<!--
2
+ * @Author: xiaohai zmhwork@qq.com
3
+ * @Date: 2025-03-22 18:02:49
4
+ * @LastEditors: xiaohai zmhwork@qq.com
5
+ * @LastEditTime: 2025-03-22 18:07:46
6
+ * @FilePath: \opkpm\app\shop\view\order\order_renew\renew_log.html
7
+ * @Description: 记录
8
+-->
9
+{layout name="layout1" /}
10
+
11
+<div class="wrapper">
12
+    <div class="layui-card">
13
+        <!-- 操作提示 -->
14
+        <div class="layui-card-body">
15
+            <div class="layui-collapse" style="border:1px dashed #c4c4c4">
16
+                <div class="layui-colla-item">
17
+                    <h2 class="layui-colla-title like-layui-colla-title">操作提示</h2>
18
+                    <div class="layui-colla-content layui-show">
19
+                        <p>*按量付费-续费套餐日志记录。</p>
20
+                    </div>
21
+                </div>
22
+            </div>
23
+        </div>
24
+
25
+        <!-- 主体区域 -->
26
+        <div class="layui-card-body">
27
+            <table id="like-table-lists" lay-filter="like-table-lists"></table>
28
+        </div>
29
+
30
+    </div>
31
+</div>
32
+
33
+<script>
34
+    layui.use(["table", "form"], function () {
35
+        var table = layui.table;
36
+        var form = layui.form;
37
+
38
+
39
+        like.tableLists("#like-table-lists", "{:url()}", [
40
+            { field: "id", width: 80, title: "ID" }
41
+            , { field: "change_count", width: 200, align: "center", title: "变动数量" }
42
+            , { field: "left_count", width: 200, align: "center", title: "变动后总数" }
43
+            , { field: "remark", width: 300, align: "center", title: "备注" }
44
+            , { field: "create_time", width: 200, align: "center", title: "变动时间" }
45
+        ]);
46
+    })
47
+</script>

+ 48
- 0
app/shop/view/order/order_renew/renew_month_log.html Näytä tiedosto

@@ -0,0 +1,48 @@
1
+<!--
2
+ * @Author: xiaohai zmhwork@qq.com
3
+ * @Date: 2025-03-22 18:02:49
4
+ * @LastEditors: xiaohai zmhwork@qq.com
5
+ * @LastEditTime: 2025-03-22 18:22:14
6
+ * @FilePath: \opkpm\app\shop\view\order\order_renew\renew_month_log.html
7
+ * @Description: 记录
8
+-->
9
+{layout name="layout1" /}
10
+
11
+<div class="wrapper">
12
+    <div class="layui-card">
13
+        <!-- 操作提示 -->
14
+        <div class="layui-card-body">
15
+            <div class="layui-collapse" style="border:1px dashed #c4c4c4">
16
+                <div class="layui-colla-item">
17
+                    <h2 class="layui-colla-title like-layui-colla-title">操作提示</h2>
18
+                    <div class="layui-colla-content layui-show">
19
+                        <p>*包月-续费套餐日志记录。</p>
20
+                    </div>
21
+                </div>
22
+            </div>
23
+        </div>
24
+
25
+        <!-- 主体区域 -->
26
+        <div class="layui-card-body">
27
+            <table id="like-table-lists" lay-filter="like-table-lists"></table>
28
+        </div>
29
+
30
+    </div>
31
+</div>
32
+
33
+<script>
34
+    layui.use(["table", "form"], function () {
35
+        var table = layui.table;
36
+        var form = layui.form;
37
+
38
+
39
+        like.tableLists("#like-table-lists", "{:url()}", [
40
+            { field: "id", width: 80, title: "ID" }
41
+            , { field: "change_count", width: 200, align: "center", title: "变动数量" }
42
+            , { field: "before_date", width: 200, align: "center", title: "变动前到期时间" }
43
+            , { field: "after_date", width: 200, align: "center", title: "变动后到期时间" }
44
+            , { field: "remark", width: 300, align: "center", title: "备注" }
45
+            , { field: "create_time", width: 200, align: "center", title: "变动时间" }
46
+        ]);
47
+    })
48
+</script>

+ 0
- 7
public/.htaccess Näytä tiedosto

@@ -1,7 +0,0 @@
1
-<IfModule mod_rewrite.c>
2
-   Options +FollowSymlinks
3
-   RewriteEngine On
4
-   RewriteCond %{REQUEST_FILENAME} !-d
5
-   RewriteCond %{REQUEST_FILENAME} !-f
6
-   RewriteRule ^(.*)$ index.php [E=PATH_INFO:$1,QSA,PT,L]
7
-</IfModule>

Loading…
Peruuta
Tallenna