|
|
@@ -348,63 +348,63 @@ class Order extends BaseController
|
|
348
|
348
|
$this->backupAndDelete('store_order', ['group_order_id' => $group_order_id]);
|
|
349
|
349
|
$this->backupAndDelete('store_group_order', ['group_order_id' => $group_order_id]);
|
|
350
|
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]);
|
|
353
|
|
- // 取出 vr 消耗
|
|
354
|
|
- $payVr = $this->getValue('user_sign_vr', ['order_id' => $order_id, 'type' => 2,], 'number');
|
|
355
|
|
- // 取出购买赠送积分 / 支出积分
|
|
356
|
|
- $score = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'source_type' => 3,'uid' => $uid,], 'reward_score');
|
|
357
|
|
- $payScore = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'pm' => 2,'uid' => $uid,], 'reward_score');
|
|
358
|
|
- // 取出推广赠送的积分和推广人的 uid
|
|
359
|
|
- $spreadScore = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'pm' => 2,'source_type' => 3,['mark','like','%推广%'],], 'reward_score');
|
|
360
|
|
- $spreadUid = $this->getValue('user_sign_score', [['order_id' => $order_id], ['status' => 1],['pm' => 2],['source_type' => 3],['mark','like','%推广%'],], 'uid');
|
|
361
|
|
- // 删除所有相关积分记录
|
|
362
|
|
- $this->backupAndDelete('user_sign_score', ['order_id' => $order_id]);
|
|
363
|
|
- // 贡献值
|
|
364
|
|
- $gongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $uid,], 'number');
|
|
365
|
|
- $spreadGongXian = 0;
|
|
366
|
|
- if ($spreadUid) {
|
|
367
|
|
- $spreadGongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $spreadUid,], 'number');
|
|
368
|
|
- }
|
|
369
|
|
- $this->backupAndDelete('user_sign_gongxian', ['order_id' => $order_id]);
|
|
370
|
|
- // 养老金 / 推广养老金 / 推广佣金
|
|
371
|
|
- $yangLaoJin = $this->getValue('user_bill', ['link_id' => $order_id, 'status' => 1,'pm' => 1,'uid' => $uid,], 'number');
|
|
372
|
|
- $spreadYlj = 0;
|
|
373
|
|
- $spreadYongJin = 0;
|
|
374
|
|
- if ($spreadUid) {
|
|
375
|
|
- $spreadYlj = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 5,'uid' => $spreadUid,], 'number'); //推荐获得养老金
|
|
376
|
|
- $spreadYongJin = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 3,'uid' => $spreadUid,], 'number'); //推荐获得佣金
|
|
377
|
|
- }
|
|
378
|
|
- $spreadYongJinTwo = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 3, ['uid', '<>', $spreadUid],],'number');
|
|
379
|
|
- $spreadYongJinTwoUid = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 3, ['uid', '<>', $spreadUid],],'uid');
|
|
380
|
|
- $this->backupAndDelete('user_bill', ['link_id' => $order_id]);
|
|
381
|
|
- $this->backupAndDelete('gz_logs', ['link_id' => $order_id]);
|
|
382
|
|
- //更新对应的user表
|
|
383
|
|
- $user = Db::name('user')->where('uid', $uid)->find();
|
|
384
|
|
- if ($user) {
|
|
385
|
|
- Db::name('backup_user')->insert($user);
|
|
386
|
|
- }
|
|
387
|
|
- Db::name('user')->where('uid', $uid)->dec('pv', $pv)->update();
|
|
388
|
|
- Db::name('user')->where('uid', $uid)->inc('vr', $payVr)->update();
|
|
389
|
|
- Db::name('user')->where('uid', $uid)->inc('score', $payScore)->update();
|
|
390
|
|
- Db::name('user')->where('uid', $uid)->dec('score', $score)->update();
|
|
391
|
|
- Db::name('user')->where('uid', $uid)->dec('contribute', $gongXian)->update();
|
|
392
|
|
- Db::name('user')->where('uid', $uid)->dec('annuity', $yangLaoJin)->update();
|
|
393
|
|
- //推荐人user表
|
|
394
|
|
- $spreadUser = Db::name('user')->where('uid', $spreadUid)->find();
|
|
395
|
|
- if ($spreadUser) {
|
|
396
|
|
- Db::name('backup_user')->insert($spreadUser);
|
|
397
|
|
- }
|
|
398
|
|
- Db::name('user')->where('uid', $spreadUid)->dec('score', $spreadScore)->update();
|
|
399
|
|
- Db::name('user')->where('uid', $spreadUid)->dec('per_contribute', $spreadGongXian)->update();
|
|
400
|
|
- Db::name('user')->where('uid', $spreadUid)->dec('annuity', $spreadYlj)->update();
|
|
401
|
|
- Db::name('user')->where('uid', $spreadUid)->dec('brokerage_price', $spreadYongJin)->update();
|
|
402
|
|
- //第二个推荐人
|
|
403
|
|
- $spreadUserTwo = Db::name('user')->where('uid', $spreadYongJinTwoUid)->find();
|
|
404
|
|
- if ($spreadUserTwo) {
|
|
405
|
|
- Db::name('backup_user')->insert($spreadUserTwo);
|
|
406
|
|
- }
|
|
407
|
|
- Db::name('user')->where('uid', $spreadYongJinTwoUid)->dec('brokerage_price', $spreadYongJinTwo)->update();
|
|
|
351
|
+// $pv = $this->getValue('user_pv_log', ['order_id' => $order_id, 'status' => 1,], 'pv');
|
|
|
352
|
+// $this->backupAndDelete('user_pv_log', ['order_id' => $order_id]);
|
|
|
353
|
+// // 取出 vr 消耗
|
|
|
354
|
+// $payVr = $this->getValue('user_sign_vr', ['order_id' => $order_id, 'type' => 2,], 'number');
|
|
|
355
|
+// // 取出购买赠送积分 / 支出积分
|
|
|
356
|
+// $score = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'source_type' => 3,'uid' => $uid,], 'reward_score');
|
|
|
357
|
+// $payScore = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'pm' => 2,'uid' => $uid,], 'reward_score');
|
|
|
358
|
+// // 取出推广赠送的积分和推广人的 uid
|
|
|
359
|
+// $spreadScore = $this->getValue('user_sign_score', ['order_id' => $order_id, 'status' => 1,'pm' => 2,'source_type' => 3,['mark','like','%推广%'],], 'reward_score');
|
|
|
360
|
+// $spreadUid = $this->getValue('user_sign_score', [['order_id' => $order_id], ['status' => 1],['pm' => 2],['source_type' => 3],['mark','like','%推广%'],], 'uid');
|
|
|
361
|
+// // 删除所有相关积分记录
|
|
|
362
|
+// $this->backupAndDelete('user_sign_score', ['order_id' => $order_id]);
|
|
|
363
|
+// // 贡献值
|
|
|
364
|
+// $gongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $uid,], 'number');
|
|
|
365
|
+// $spreadGongXian = 0;
|
|
|
366
|
+// if ($spreadUid) {
|
|
|
367
|
+// $spreadGongXian = $this->getValue('user_sign_gongxian', ['order_id' => $order_id, 'status' => 1,'type' => 1,'uid' => $spreadUid,], 'number');
|
|
|
368
|
+// }
|
|
|
369
|
+// $this->backupAndDelete('user_sign_gongxian', ['order_id' => $order_id]);
|
|
|
370
|
+// // 养老金 / 推广养老金 / 推广佣金
|
|
|
371
|
+// $yangLaoJin = $this->getValue('user_bill', ['link_id' => $order_id, 'status' => 1,'pm' => 1,'uid' => $uid,], 'number');
|
|
|
372
|
+// $spreadYlj = 0;
|
|
|
373
|
+// $spreadYongJin = 0;
|
|
|
374
|
+// if ($spreadUid) {
|
|
|
375
|
+// $spreadYlj = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 5,'uid' => $spreadUid,], 'number'); //推荐获得养老金
|
|
|
376
|
+// $spreadYongJin = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 3,'uid' => $spreadUid,], 'number'); //推荐获得佣金
|
|
|
377
|
+// }
|
|
|
378
|
+// $spreadYongJinTwo = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 3, ['uid', '<>', $spreadUid],],'number');
|
|
|
379
|
+// $spreadYongJinTwoUid = $this->getValue('user_bill', ['link_id' => $order_id, 'commission_type' => 3, ['uid', '<>', $spreadUid],],'uid');
|
|
|
380
|
+// $this->backupAndDelete('user_bill', ['link_id' => $order_id]);
|
|
|
381
|
+// $this->backupAndDelete('gz_logs', ['link_id' => $order_id]);
|
|
|
382
|
+// //更新对应的user表
|
|
|
383
|
+// $user = Db::name('user')->where('uid', $uid)->find();
|
|
|
384
|
+// if ($user) {
|
|
|
385
|
+// Db::name('backup_user')->insert($user);
|
|
|
386
|
+// }
|
|
|
387
|
+// Db::name('user')->where('uid', $uid)->dec('pv', $pv)->update();
|
|
|
388
|
+// Db::name('user')->where('uid', $uid)->inc('vr', $payVr)->update();
|
|
|
389
|
+// Db::name('user')->where('uid', $uid)->inc('score', $payScore)->update();
|
|
|
390
|
+// Db::name('user')->where('uid', $uid)->dec('score', $score)->update();
|
|
|
391
|
+// Db::name('user')->where('uid', $uid)->dec('contribute', $gongXian)->update();
|
|
|
392
|
+// Db::name('user')->where('uid', $uid)->dec('annuity', $yangLaoJin)->update();
|
|
|
393
|
+// //推荐人user表
|
|
|
394
|
+// $spreadUser = Db::name('user')->where('uid', $spreadUid)->find();
|
|
|
395
|
+// if ($spreadUser) {
|
|
|
396
|
+// Db::name('backup_user')->insert($spreadUser);
|
|
|
397
|
+// }
|
|
|
398
|
+// Db::name('user')->where('uid', $spreadUid)->dec('score', $spreadScore)->update();
|
|
|
399
|
+// Db::name('user')->where('uid', $spreadUid)->dec('per_contribute', $spreadGongXian)->update();
|
|
|
400
|
+// Db::name('user')->where('uid', $spreadUid)->dec('annuity', $spreadYlj)->update();
|
|
|
401
|
+// Db::name('user')->where('uid', $spreadUid)->dec('brokerage_price', $spreadYongJin)->update();
|
|
|
402
|
+// //第二个推荐人
|
|
|
403
|
+// $spreadUserTwo = Db::name('user')->where('uid', $spreadYongJinTwoUid)->find();
|
|
|
404
|
+// if ($spreadUserTwo) {
|
|
|
405
|
+// Db::name('backup_user')->insert($spreadUserTwo);
|
|
|
406
|
+// }
|
|
|
407
|
+// Db::name('user')->where('uid', $spreadYongJinTwoUid)->dec('brokerage_price', $spreadYongJinTwo)->update();
|
|
408
|
408
|
Db::commit();
|
|
409
|
409
|
} catch (\Exception $e) {
|
|
410
|
410
|
Db::rollback();
|