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

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

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

+ 60 - 60
app/controller/admin/order/Order.php

@@ -354,70 +354,70 @@ class Order extends BaseController
354 354
             $payVr = $this->getValue('user_sign_vr', ['order_id' => $order_id, 'type' => 2,], 'number');
355 355
             $this->backupAndDelete('user_sign_vr', ['order_id' => $order_id]);
356 356
  //           取出购买赠送积分 / 支出积分
357
-                $score = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'source_type' => 3,'uid' => $uid,'pm' => 1], 'reward_score');
358
-                $payScore = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'pm' => 2,'uid' => $uid,], 'reward_score');
357
+                $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');
359 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');
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_socre');
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 374
 //            //            // 删除所有相关积分记录
375 375
             $this->backupAndDelete('user_sign_score', ['order_id' => $order_id]);
376 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]);
383
-//            // 养老金 / 推广养老金 / 推广佣金
384
-//            $yangLaoJin = $this->getValue('user_bill', ['link_id' => $order_id, 'status' => 1,'pm' => 1,'uid' => $uid,], 'number');
385
-//            $spreadYlj = 0;
386
-//            $spreadYongJin = 0;
387
-//            if ($spreadUid) {
388
-//                $spreadYlj = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 5,'uid' => $spreadUid,], 'number'); //推荐获得养老金
389
-//                $spreadYongJin = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 3,'uid' => $spreadUid,], 'number');  //推荐获得佣金
390
-//            }
391
-//            $spreadYongJinTwo = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type'  => 3, ['uid', '<>', $spreadUid],],'number');
392
-//            $spreadYongJinTwoUid = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type'  => 3, ['uid', '<>', $spreadUid],],'uid');
393
-//            $this->backupAndDelete('user_bill', ['link_id' => $order_id]);
394
-//            $this->backupAndDelete('gz_logs', ['link_id' => $order_id]);
395
-//            //更新对应的user表
396
-//            $user = Db::name('user')->where('uid', $uid)->find();
397
-//            if ($user) {
398
-//                Db::name('backup_user')->insert($user);
399
-//            }
400
-//            Db::name('user')->where('uid', $uid)->dec('pv', $pv)->update();
401
-//            Db::name('user')->where('uid', $uid)->inc('vr', $payVr)->update();
402
-//            Db::name('user')->where('uid', $uid)->inc('score', $payScore)->update();
403
-//            Db::name('user')->where('uid', $uid)->dec('score', $score)->update();
404
-//            Db::name('user')->where('uid', $uid)->dec('contribute', $gongXian)->update();
405
-//            Db::name('user')->where('uid', $uid)->dec('annuity', $yangLaoJin)->update();
406
-//            //推荐人user表
407
-//            $spreadUser = Db::name('user')->where('uid', $spreadUid)->find();
408
-//            if ($spreadUser) {
409
-//                Db::name('backup_user')->insert($spreadUser);
410
-//            }
411
-//            Db::name('user')->where('uid', $spreadUid)->dec('score', $spreadScore)->update();
412
-//            Db::name('user')->where('uid', $spreadUid)->dec('per_contribute', $spreadGongXian)->update();
413
-//            Db::name('user')->where('uid', $spreadUid)->dec('annuity', $spreadYlj)->update();
414
-//            Db::name('user')->where('uid', $spreadUid)->dec('brokerage_price', $spreadYongJin)->update();
415
-//            //第二个推荐人
416
-//            $spreadUserTwo = Db::name('user')->where('uid', $spreadYongJinTwoUid)->find();
417
-//            if ($spreadUserTwo) {
418
-//                Db::name('backup_user')->insert($spreadUserTwo);
419
-//            }
420
-//            Db::name('user')->where('uid', $spreadYongJinTwoUid)->dec('brokerage_price', $spreadYongJinTwo)->update();
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]);
383
+            // 养老金 / 推广养老金 / 推广佣金
384
+            $yangLaoJin = $this->getValue('user_bill', ['link_id' => $order_id, 'status' => 1,'pm' => 1,'uid' => $uid,], 'number');
385
+            $spreadYlj = 0;
386
+            $spreadYongJin = 0;
387
+            if ($spreadUid) {
388
+                $spreadYlj = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 5,'uid' => $spreadUid,], 'number'); //推荐获得养老金
389
+                $spreadYongJin = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 3,'uid' => $spreadUid,], 'number');  //推荐获得佣金
390
+            }
391
+            $spreadYongJinTwo = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type'  => 3, ['uid', '<>', $spreadUid],],'number');
392
+            $spreadYongJinTwoUid = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type'  => 3, ['uid', '<>', $spreadUid],],'uid');
393
+            $this->backupAndDelete('user_bill', ['link_id' => $order_id]);
394
+            $this->backupAndDelete('gz_logs', ['link_id' => $order_id]);
395
+            //更新对应的user表
396
+            $user = Db::name('user')->where('uid', $uid)->find();
397
+            if ($user) {
398
+                Db::name('backup_user')->insert($user);
399
+            }
400
+            Db::name('user')->where('uid', $uid)->dec('pv', $pv)->update();
401
+            Db::name('user')->where('uid', $uid)->inc('vr', $payVr)->update();
402
+            Db::name('user')->where('uid', $uid)->inc('score', $payScore)->update();
403
+            Db::name('user')->where('uid', $uid)->dec('score', $score)->update();
404
+            Db::name('user')->where('uid', $uid)->dec('contribute', $gongXian)->update();
405
+            Db::name('user')->where('uid', $uid)->dec('annuity', $yangLaoJin)->update();
406
+            //推荐人user表
407
+            $spreadUser = Db::name('user')->where('uid', $spreadUid)->find();
408
+            if ($spreadUser) {
409
+                Db::name('backup_user')->insert($spreadUser);
410
+            }
411
+            Db::name('user')->where('uid', $spreadUid)->dec('score', $spreadScore)->update();
412
+            Db::name('user')->where('uid', $spreadUid)->dec('per_contribute', $spreadGongXian)->update();
413
+            Db::name('user')->where('uid', $spreadUid)->dec('annuity', $spreadYlj)->update();
414
+            Db::name('user')->where('uid', $spreadUid)->dec('brokerage_price', $spreadYongJin)->update();
415
+            //第二个推荐人
416
+            $spreadUserTwo = Db::name('user')->where('uid', $spreadYongJinTwoUid)->find();
417
+            if ($spreadUserTwo) {
418
+                Db::name('backup_user')->insert($spreadUserTwo);
419
+            }
420
+            Db::name('user')->where('uid', $spreadYongJinTwoUid)->dec('brokerage_price', $spreadYongJinTwo)->update();
421 421
             Db::commit();
422 422
         } catch (\Exception $e) {
423 423
             Db::rollback();