Просмотр исходного кода

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

xupuyuan месяцев назад: 10
Родитель
Сommit
da94f17773
1 измененных файлов с 36 добавлено и 30 удалено
  1. 36 30
      app/controller/admin/order/Order.php

+ 36 - 30
app/controller/admin/order/Order.php

@@ -345,41 +345,47 @@ class Order extends BaseController
345
         try {
345
         try {
346
             Db::startTrans();
346
             Db::startTrans();
347
             // 删除订单相关表 对应备份还没有创建
347
             // 删除订单相关表 对应备份还没有创建
348
-            $this->backupAndDelete('store_order', ['group_order_id' => $group_order_id]);
349
-            $this->backupAndDelete('store_group_order', ['group_order_id' => $group_order_id]);
348
+            $this->backupAndDelete('store_order', ['group_order_id' => $group_order_id]);  //可以
349
+            $this->backupAndDelete('store_group_order', ['group_order_id' => $group_order_id]);//可以
350
 //             取出并删除 pv
350
 //             取出并删除 pv
351
-                $pv = $this->getValue('user_pv_log', ['order_id' => $order_id, 'status' => 1,], 'pv');
352
-                $this->backupAndDelete('user_pv_log', ['order_id' => $order_id]); //status状态判断还没
351
+                $pv = $this->getValue('user_pv_log', ['order_id' => $order_id, 'status' => 1,], 'pv');  //可以
352
+            Db::name('user')->where('uid', $uid)->dec('pv', $pv)->update();
353
+            $user = Db::name('user')->where('uid', $uid)->find();
354
+                       if ($user) {
355
+                           Db::name('backup_user')->insert($user);
356
+                       }
357
+                $this->backupAndDelete('user_pv_log', ['order_id' => $order_id]); //status状态判断还没   //可以
353
 //            取出 vr 消耗
358
 //            取出 vr 消耗
354
            $payVr = $this->getValue('user_sign_vr', ['order_id' => $order_id, 'type' => 2,], 'number');
359
            $payVr = $this->getValue('user_sign_vr', ['order_id' => $order_id, 'type' => 2,], 'number');
355
            $this->backupAndDelete('user_sign_vr', ['order_id' => $order_id]);
360
            $this->backupAndDelete('user_sign_vr', ['order_id' => $order_id]);
361
+            Db::name('user')->where('uid', $uid)->inc('vr', $payVr)->update();
356
  //           取出购买赠送积分 / 支出积分
362
  //           取出购买赠送积分 / 支出积分
357
-                $score = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'source_type' => 3,'uid' => $uid,], 'reward_score');
358
-                $payScore = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'pm' => 2,'uid' => $uid,], 'reward_score');
359
-//            // 取出推广赠送的积分和推广人的 uid
360
-            $spreadScore = $this->getValue('user_sign_score', [
361
-                ['order_id', '=', $order_id],
362
-                ['status', '=', 1],
363
-                ['pm', '=', 2],
364
-                ['source_type', '=', 3],
365
-                ['mark', 'like', '%推广%'],
366
-            ], 'reward_score');
367
-            $spreadUid = $this->getValue('user_sign_score', [
368
-                ['order_id', '=', $order_id],
369
-                ['status', '=', 1],
370
-                ['pm', '=', 2],
371
-                ['source_type', '=', 3],
372
-                ['mark', 'like', '%推广%'],
373
-            ], 'uid');
374
-            //            // 删除所有相关积分记录
375
-            $this->backupAndDelete('user_sign_score', ['order_id' => $order_id]);
376
-//            // 贡献值
377
-           $gongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $uid,], 'number');
378
-            $spreadGongXian = 0;
379
-            if ($spreadUid) {
380
-                $spreadGongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $spreadUid,], 'number');
381
-            }
382
-            $this->backupAndDelete('user_sign_gongxian', ['order_id' => $order_id]);
363
+   //             $score = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'source_type' => 3,'uid' => $uid,], 'reward_score');
364
+    //            $payScore = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'pm' => 2,'uid' => $uid,], 'reward_score');
365
+////            // 取出推广赠送的积分和推广人的 uid
366
+// //           $spreadScore = $this->getValue('user_sign_score', [
367
+//                ['order_id', '=', $order_id],
368
+//                ['status', '=', 1],
369
+//                ['pm', '=', 2],
370
+//                ['source_type', '=', 3],
371
+//                ['mark', 'like', '%推广%'],
372
+//            ], 'reward_score');
373
+//            $spreadUid = $this->getValue('user_sign_score', [
374
+//                ['order_id', '=', $order_id],
375
+//                ['status', '=', 1],
376
+//                ['pm', '=', 2],
377
+//                ['source_type', '=', 3],
378
+//                ['mark', 'like', '%推广%'],
379
+//            ], 'uid');
380
+//            //            // 删除所有相关积分记录
381
+//            $this->backupAndDelete('user_sign_score', ['order_id' => $order_id]);
382
+////            // 贡献值
383
+//           $gongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $uid,], 'number');
384
+//            $spreadGongXian = 0;
385
+//            if ($spreadUid) {
386
+//                $spreadGongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $spreadUid,], 'number');
387
+//            }
388
+//            $this->backupAndDelete('user_sign_gongxian', ['order_id' => $order_id]);
383
 //            // 养老金 / 推广养老金 / 推广佣金
389
 //            // 养老金 / 推广养老金 / 推广佣金
384
 //            $yangLaoJin = $this->getValue('user_bill', ['link_id' => $order_id, 'status' => 1,'pm' => 1,'uid' => $uid,], 'number');
390
 //            $yangLaoJin = $this->getValue('user_bill', ['link_id' => $order_id, 'status' => 1,'pm' => 1,'uid' => $uid,], 'number');
385
 //            $spreadYlj = 0;
391
 //            $spreadYlj = 0;