|
@@ -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();
|