Parcourir la source

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

xupuyuan il y a 10 mois
Parent
commit
7162a5ab34
1 fichiers modifiés avec 8 ajouts et 16 suppressions
  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
         try {
345
         try {
346
             Db::startTrans();
346
             Db::startTrans();
347
+            //查找是否有推荐人
348
+            $spreadUid = Db::name('user')->where('uid',$uid)->value('spread_uid');
347
             // 删除订单相关表 对应备份还没有创建
349
             // 删除订单相关表 对应备份还没有创建
348
             $this->backupAndDelete('store_order', ['group_order_id' => $group_order_id]);
350
             $this->backupAndDelete('store_order', ['group_order_id' => $group_order_id]);
349
             $this->backupAndDelete('store_group_order', ['group_order_id' => $group_order_id]);
351
             $this->backupAndDelete('store_group_order', ['group_order_id' => $group_order_id]);
@@ -353,25 +355,15 @@ class Order extends BaseController
353
             //取出 vr 消耗
355
             //取出 vr 消耗
354
             $payVr = $this->getValue('user_sign_vr', ['order_id' => $order_id, 'type' => 2,], 'number');
356
             $payVr = $this->getValue('user_sign_vr', ['order_id' => $order_id, 'type' => 2,], 'number');
355
             $this->backupAndDelete('user_sign_vr', ['order_id' => $order_id]);
357
             $this->backupAndDelete('user_sign_vr', ['order_id' => $order_id]);
356
- //           取出购买赠送积分 / 支出积分
358
+            //取出购买赠送积分 / 支出积分
357
                 $score = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'source_type' => 3,'uid' => $uid,'pm' => 1], 'reward_socre');
359
                 $score = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'source_type' => 3,'uid' => $uid,'pm' => 1], 'reward_socre');
358
                 $payScore = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'pm' => 2,'uid' => $uid,], 'reward_socre');
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
             $this->backupAndDelete('user_sign_score', ['order_id' => $order_id]);
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
             $spreadGongXian = 0;
367
             $spreadGongXian = 0;
376
             if ($spreadUid) {
368
             if ($spreadUid) {
377
                 $spreadGongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $spreadUid,], 'number');
369
                 $spreadGongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $spreadUid,], 'number');