Przeglądaj źródła

后台-订单-新增撤回功能

xupuyuan 10 miesięcy temu
rodzic
commit
7162a5ab34
1 zmienionych plików z 8 dodań i 16 usunięć
  1. 8 16
      app/controller/admin/order/Order.php

+ 8 - 16
app/controller/admin/order/Order.php

@@ -344,6 +344,8 @@ class Order extends BaseController
344 344
         }
345 345
         try {
346 346
             Db::startTrans();
347
+            //查找是否有推荐人
348
+            $spreadUid = Db::name('user')->where('uid',$uid)->value('spread_uid');
347 349
             // 删除订单相关表 对应备份还没有创建
348 350
             $this->backupAndDelete('store_order', ['group_order_id' => $group_order_id]);
349 351
             $this->backupAndDelete('store_group_order', ['group_order_id' => $group_order_id]);
@@ -353,25 +355,15 @@ class Order extends BaseController
353 355
             //取出 vr 消耗
354 356
             $payVr = $this->getValue('user_sign_vr', ['order_id' => $order_id, 'type' => 2,], 'number');
355 357
             $this->backupAndDelete('user_sign_vr', ['order_id' => $order_id]);
356
- //           取出购买赠送积分 / 支出积分
358
+            //取出购买赠送积分 / 支出积分
357 359
                 $score = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'source_type' => 3,'uid' => $uid,'pm' => 1], 'reward_socre');
358 360
                 $payScore = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'pm' => 2,'uid' => $uid,], 'reward_socre');
359
-//            // 取出推广赠送的积分和推广人的 uid
360
-//            $spreadUid = $this->getValue('user_sign_score', [
361
-//                ['order_id', '=', $order_id],
362
-//                ['status', '=', 1],
363
-//                ['pm', '=', 2],
364
-//                ['source_type', '=', 3],
365
-//                ['mark', 'like', '%' . (string) '推广' . '%'],
366
-//            ], 'uid');
367
-//            $spreadScore = $this->getValue('user_sign_score', [
368
-//                ['order_id', '=', $order_id],
369
-//                ['uid', '=', $spreadUid],
370
-//            ], 'reward_socre');
371
-//            //            // 删除所有相关积分记录
361
+            // 取出推广赠送的积分和推广人的 uid
362
+            $spreadScore = $this->getValue('user_sign_score', ['order_id', '=', $order_id, 'uid', '=', $spreadUid, 'status', '=', 1,], 'reward_socre');
363
+            // 删除所有相关积分记录
372 364
             $this->backupAndDelete('user_sign_score', ['order_id' => $order_id]);
373
-////            // 贡献值
374
-           $gongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $uid,], 'number');
365
+            // 贡献值
366
+            $gongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $uid,], 'number');
375 367
             $spreadGongXian = 0;
376 368
             if ($spreadUid) {
377 369
                 $spreadGongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $spreadUid,], 'number');