|
|
@@ -232,9 +232,9 @@ class UserThirdRepository extends BaseRepository
|
|
232
|
232
|
];
|
|
233
|
233
|
return $order;
|
|
234
|
234
|
// var_dump($order,$pid);exit;
|
|
235
|
|
-// $StoreOrderRepository = app()->make(StoreOrderRepository::class);
|
|
|
235
|
+ $StoreOrderRepository = app()->make(StoreOrderRepository::class);
|
|
236
|
236
|
// $StoreOrderRepository->yugu_rebate($order);
|
|
237
|
|
-// $StoreOrderRepository->yugu_rebate_gong_fu($order);
|
|
|
237
|
+ $StoreOrderRepository->yugu_rebate_gong_fu($order);
|
|
238
|
238
|
|
|
239
|
239
|
|
|
240
|
240
|
// $money_hui = 0;
|
|
|
@@ -596,45 +596,67 @@ class UserThirdRepository extends BaseRepository
|
|
596
|
596
|
return $data;
|
|
597
|
597
|
}
|
|
598
|
598
|
/**
|
|
599
|
|
- * 预估积分
|
|
|
599
|
+ * 添加预估积分记录
|
|
600
|
600
|
*/
|
|
|
601
|
+
|
|
601
|
602
|
//预估养老金
|
|
602
|
|
- public static function yuguJifen($price, $user_id, $table, $table_id, $type_shop, $order_sn)
|
|
|
603
|
+ public static function yuguJifen($price,$user_id,$order_sn,$type_shop)
|
|
603
|
604
|
{
|
|
604
|
605
|
if (empty($user_id)) {
|
|
605
|
|
- Db::name('log')->insert(['data' => "type_shop:{$type_shop}, $order_sn, $table_id, 赠送积分, 不存在用户ID"]);
|
|
|
606
|
+ Db::name('log')->insert(['data' => "type_shop:{$type_shop}, $order_sn, $order_sn, 赠送积分, 不存在用户ID"]);
|
|
606
|
607
|
return false;
|
|
607
|
608
|
}
|
|
608
|
609
|
//查询用户是否已经存在该订单
|
|
609
|
610
|
$user_sign_score_list = Db::name('user_sign_score')
|
|
610
|
611
|
->where('uid', $user_id)
|
|
611
|
|
- ->where('order_type', $table)
|
|
612
|
|
- ->where('order_id', $table_id)
|
|
|
612
|
+ ->where('order_type', $type_shop)
|
|
|
613
|
+ ->where('order_id', $order_sn)
|
|
613
|
614
|
->find();
|
|
614
|
615
|
if (!empty($user_sign_score_list)) {
|
|
615
|
|
- Db::name('log')->insert(['data' => "type_shop:{$type_shop}, $order_sn, $table_id, 赠送积分, 订单已存在积分发放记录"]);
|
|
|
616
|
+ Db::name('log')->insert(['data' => "type_shop:{$type_shop}, $order_sn, $order_sn, 赠送积分, 订单已存在积分发放记录"]);
|
|
616
|
617
|
return false;
|
|
617
|
618
|
}
|
|
618
|
|
- Db::name('log')->insert(['data' => "type_shop:{$type_shop}, $order_sn, $table_id, 赠送积分, $price"]);
|
|
|
619
|
+ Db::name('log')->insert(['data' => "type_shop:{$type_shop}, $order_sn, $order_sn, 赠送积分, $price"]);
|
|
619
|
620
|
Db::startTrans();
|
|
620
|
621
|
try {
|
|
621
|
622
|
//更新用户积分
|
|
622
|
623
|
$user = Db::name('user')->where('uid', $user_id)->find();
|
|
623
|
|
- $inc_score = $price;
|
|
|
624
|
+ $inc_score = decimal2($price*0.5);//pv=佣金的50%=积分=贡献值
|
|
624
|
625
|
$user_score = $user['score'];
|
|
625
|
626
|
$ins_data['uid'] = $user_id;
|
|
626
|
627
|
$ins_data['reward_socre'] = $inc_score;
|
|
627
|
628
|
$ins_data['addtime'] = time();
|
|
628
|
629
|
$ins_data['status'] = -1;
|
|
629
|
|
- $ins_data['order_type'] = $table;
|
|
630
|
|
- $ins_data['order_id'] = $table_id;
|
|
|
630
|
+ $ins_data['order_type'] = $type_shop;
|
|
|
631
|
+ $ins_data['order_id'] = $order_sn;
|
|
631
|
632
|
$ins_data['mark'] = "购买三方商品赠送积分";
|
|
632
|
633
|
$ins_data['desc'] = '';
|
|
633
|
634
|
$ins_data['surplus'] = $user_score + $inc_score;
|
|
634
|
635
|
$ins_data['type'] = 1;
|
|
635
|
636
|
$ins_data['pm'] = 1;
|
|
636
|
|
- Db::name('user_sign_score')->insertGetId($ins_data);
|
|
637
|
|
- Db::name('user')->where('uid', $user_id)->inc('score', $inc_score)->update();
|
|
|
637
|
+ $ins_data['source_type'] =3;
|
|
|
638
|
+
|
|
|
639
|
+
|
|
|
640
|
+ //更新贡献值
|
|
|
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);//添加贡献记录
|
|
|
656
|
+
|
|
|
657
|
+//
|
|
|
658
|
+// Db::name('user')->where('uid', $user_id)->inc('score', $inc_score)->update();
|
|
|
659
|
+// Db::name('user')->where('uid', $user_id)->inc('contribute', $inc_score)->update();
|
|
638
|
660
|
Db::commit();
|
|
639
|
661
|
|
|
640
|
662
|
// $now_score= Db::name('user')->where('uid',$user_id)->value('now_score_estimate');
|