|
|
@@ -19,6 +19,7 @@ use app\common\repositories\store\product\ProductRepository;
|
|
19
|
19
|
use app\model\common\TbOrderModel;
|
|
20
|
20
|
use think\exception\ValidateException;
|
|
21
|
21
|
use think\facade\Log;
|
|
|
22
|
+use think\test\queue\LoopBreakerException;
|
|
22
|
23
|
use function GuzzleHttp\Psr7\str;
|
|
23
|
24
|
|
|
24
|
25
|
use think\facade\Db;
|
|
|
@@ -196,7 +197,7 @@ class UserThirdRepository extends BaseRepository
|
|
196
|
197
|
public function yuguOrder($order_id, $commission, $pid, $order_sn, $type, $table)
|
|
197
|
198
|
{
|
|
198
|
199
|
//配置信息
|
|
199
|
|
- $config = $this->config();
|
|
|
200
|
+// $config = $this->config();
|
|
200
|
201
|
//用户pid信息
|
|
201
|
202
|
// if ($type == 6) {//京东联盟改成京推推
|
|
202
|
203
|
// $user['uid'] = intval($pid - pow(10, 5));
|
|
|
@@ -230,10 +231,10 @@ class UserThirdRepository extends BaseRepository
|
|
230
|
231
|
"type_shop"=>$type,
|
|
231
|
232
|
"table"=>$table
|
|
232
|
233
|
];
|
|
233
|
|
- return $order;
|
|
234
|
|
-// var_dump($order,$pid);exit;
|
|
|
234
|
+
|
|
235
|
235
|
$StoreOrderRepository = app()->make(StoreOrderRepository::class);
|
|
236
|
236
|
// $StoreOrderRepository->yugu_rebate($order);
|
|
|
237
|
+ log::info("===待进入养老金22222222222");
|
|
237
|
238
|
$StoreOrderRepository->yugu_rebate_gong_fu($order);
|
|
238
|
239
|
|
|
239
|
240
|
|
|
|
@@ -617,47 +618,82 @@ class UserThirdRepository extends BaseRepository
|
|
617
|
618
|
return false;
|
|
618
|
619
|
}
|
|
619
|
620
|
Db::name('log')->insert(['data' => "type_shop:{$type_shop}, $order_sn, $order_sn, 赠送积分, $price"]);
|
|
620
|
|
- Db::startTrans();
|
|
|
621
|
+
|
|
621
|
622
|
try {
|
|
622
|
623
|
//更新用户积分
|
|
|
624
|
+
|
|
623
|
625
|
$user = Db::name('user')->where('uid', $user_id)->find();
|
|
624
|
626
|
$inc_score = decimal2($price*0.5);//pv=佣金的50%=积分=贡献值
|
|
625
|
627
|
$user_score = $user['score'];
|
|
626
|
|
- $ins_data['uid'] = $user_id;
|
|
627
|
|
- $ins_data['reward_socre'] = $inc_score;
|
|
628
|
|
- $ins_data['addtime'] = time();
|
|
629
|
|
- $ins_data['status'] = -1;
|
|
630
|
|
- $ins_data['order_type'] = $type_shop;
|
|
631
|
|
- $ins_data['order_id'] = $order_sn;
|
|
632
|
|
- $ins_data['mark'] = "购买三方商品赠送积分";
|
|
633
|
|
- $ins_data['desc'] = '';
|
|
634
|
|
- $ins_data['surplus'] = $user_score + $inc_score;
|
|
635
|
|
- $ins_data['type'] = 1;
|
|
636
|
|
- $ins_data['pm'] = 1;
|
|
637
|
|
- $ins_data['source_type'] =3;
|
|
|
628
|
+ $surplus=$user_score + $inc_score;
|
|
|
629
|
+ $surplusgongxian=$user['contribute'] + $inc_score;
|
|
|
630
|
+
|
|
|
631
|
+ $data = [
|
|
|
632
|
+ "uid" => $user_id,
|
|
|
633
|
+ "reward_socre" => $inc_score,
|
|
|
634
|
+ "addtime" => time(),
|
|
|
635
|
+ "status" => -1,
|
|
|
636
|
+ "order_type" => $type_shop,
|
|
|
637
|
+ "order_id" => $order_sn,
|
|
|
638
|
+ "mark" => "购买三方商品赠送积分",
|
|
|
639
|
+ "surplus" => $surplus,
|
|
|
640
|
+ "pm" => 1,
|
|
|
641
|
+ "source_type" => 3
|
|
|
642
|
+ ];
|
|
|
643
|
+ log::info("准备开始添加积分,贡献");
|
|
|
644
|
+ Db::name("user_sign_score")->insert($data);//添加积分记录
|
|
|
645
|
+
|
|
|
646
|
+ log::info("准备开始添加积分");
|
|
|
647
|
+// $ins_data['uid'] = $user_id;
|
|
|
648
|
+// $ins_data['reward_socre'] = $inc_score;
|
|
|
649
|
+// $ins_data['addtime'] = time();
|
|
|
650
|
+// $ins_data['status'] = -1;
|
|
|
651
|
+// $ins_data['order_type'] = $type_shop;
|
|
|
652
|
+// $ins_data['order_id'] = $order_sn;
|
|
|
653
|
+// $ins_data['mark'] = "购买三方商品赠送积分";
|
|
|
654
|
+// $ins_data['desc'] = '';
|
|
|
655
|
+// $ins_data['surplus'] = $user_score + $inc_score;
|
|
|
656
|
+// $ins_data['type'] = 1;
|
|
|
657
|
+// $ins_data['pm'] = 1;
|
|
|
658
|
+// $ins_data['source_type'] =3;
|
|
638
|
659
|
|
|
639
|
660
|
|
|
640
|
661
|
//更新贡献值
|
|
641
|
|
- $gongxian_data['uid'] = $user_id;
|
|
642
|
|
- $gongxian_data['number'] = $inc_score;
|
|
643
|
|
- $gongxian_data['addtime'] = time();
|
|
644
|
|
- $gongxian_data['status'] = -1;
|
|
645
|
|
- $gongxian_data['order_type'] = $type_shop;
|
|
646
|
|
- $gongxian_data['order_id'] = $order_sn;
|
|
647
|
|
- $gongxian_data['mark'] = "购买三方商品赠送贡献值";
|
|
648
|
|
- $gongxian_data['desc'] = '';
|
|
649
|
|
- $gongxian_data['surplus'] = $user_score + $inc_score;
|
|
650
|
|
- $gongxian_data['type'] = 1;
|
|
651
|
|
- $gongxian_data['pm'] = 1;
|
|
652
|
|
- $gongxian_data['source_type'] =3;
|
|
653
|
|
-
|
|
654
|
|
- Db::name('user_sign_score')->insertGetId($ins_data);//添加积分记录
|
|
655
|
|
- Db::name('user_sign_gongxian')->insertGetId($gongxian_data);//添加贡献记录
|
|
|
662
|
+ $gongxian_data = [
|
|
|
663
|
+ "uid" =>$user_id,
|
|
|
664
|
+ "number" => $inc_score,
|
|
|
665
|
+ "addtime" =>time(),
|
|
|
666
|
+ "status" =>-1,
|
|
|
667
|
+ "order_type" =>$type_shop,
|
|
|
668
|
+ "order_id" =>$order_sn,
|
|
|
669
|
+ "mark" =>"购买三方商品赠送贡献值",
|
|
|
670
|
+ "desc" =>'',
|
|
|
671
|
+ "surplus" =>$surplusgongxian,
|
|
|
672
|
+ "type" =>1
|
|
|
673
|
+ ];
|
|
|
674
|
+
|
|
|
675
|
+// $gongxian_data['uid'] = $user_id;
|
|
|
676
|
+// $gongxian_data['number'] = $inc_score;
|
|
|
677
|
+// $gongxian_data['addtime'] = time();
|
|
|
678
|
+// $gongxian_data['status'] = -1;
|
|
|
679
|
+// $gongxian_data['order_type'] = $type_shop;
|
|
|
680
|
+// $gongxian_data['order_id'] = $order_sn;
|
|
|
681
|
+// $gongxian_data['mark'] = "购买三方商品赠送贡献值";
|
|
|
682
|
+// $gongxian_data['desc'] = '';
|
|
|
683
|
+// $gongxian_data['surplus'] = $user_score + $inc_score;
|
|
|
684
|
+// $gongxian_data['type'] = 1;
|
|
|
685
|
+// $gongxian_data['pm'] = 1;
|
|
|
686
|
+// $gongxian_data['source_type'] =3;
|
|
|
687
|
+
|
|
|
688
|
+
|
|
|
689
|
+ Db::name("user_sign_gongxian")->insert($gongxian_data);//添加贡献记录
|
|
|
690
|
+ log::info("===添加完积分和养老金");
|
|
|
691
|
+
|
|
656
|
692
|
|
|
657
|
693
|
//
|
|
658
|
694
|
// Db::name('user')->where('uid', $user_id)->inc('score', $inc_score)->update();
|
|
659
|
695
|
// Db::name('user')->where('uid', $user_id)->inc('contribute', $inc_score)->update();
|
|
660
|
|
- Db::commit();
|
|
|
696
|
+
|
|
661
|
697
|
|
|
662
|
698
|
// $now_score= Db::name('user')->where('uid',$user_id)->value('now_score_estimate');
|
|
663
|
699
|
// $now_score_no= Db::name('user')->where('uid',$user_id)->value('now_score');
|
|
|
@@ -693,8 +729,7 @@ class UserThirdRepository extends BaseRepository
|
|
693
|
729
|
// Db::name('integral_log')->insert($insertDta);
|
|
694
|
730
|
// Db::name('user_bill')->insert($billData);
|
|
695
|
731
|
|
|
696
|
|
- } catch (\Exception $e) {
|
|
697
|
|
- Db::rollback();
|
|
|
732
|
+ } catch (Exception $e) {
|
|
698
|
733
|
return app("json")->fail($e->getMessage());
|
|
699
|
734
|
}
|
|
700
|
735
|
}
|