|
|
@@ -608,13 +608,15 @@ class UserThirdRepository extends BaseRepository
|
|
608
|
608
|
|
|
609
|
609
|
log::info("订单修改开始");
|
|
610
|
610
|
// 更新养老金
|
|
611
|
|
- Db::name("user_bill")->where("uid", $user_id)->where("order_sn", $order_sn)->update(['status'=>-1]);
|
|
|
611
|
+ Db::name("user_bill")->where("type_shop", $type_shop)->where("order_sn", $order_sn)->update(['status'=>-1]);
|
|
612
|
612
|
//更新积分
|
|
613
|
|
- Db::name("user_sign_score")->where("uid", $user_id)->where("order_id", $order_sn)->update(['status'=>0]);
|
|
|
613
|
+ Db::name("user_sign_score")->where("order_type", $type_shop)->where("order_id", $order_sn)->update(['status'=>0]);
|
|
614
|
614
|
//更新贡献值
|
|
615
|
|
- Db::name("user_sign_gongxian")->where("uid", $user_id)->where("order_id", $order_sn)->update(['status'=>0]);
|
|
616
|
|
- log::info("订单 {$order_sn} 用户id ={$user_id} 三方来源={$type_shop} 积分,贡献值,养老金更新");
|
|
617
|
|
- Db::name('log')->insert(['data' => "type_shop:{$type_shop}, $order_sn, $order_sn, 修改积分,养老金,贡献值记录, 更新成功!!!"]);
|
|
|
615
|
+ Db::name("user_sign_gongxian")->where("order_type", $type_shop)->where("order_id", $order_sn)->update(['status'=>0]);
|
|
|
616
|
+ //更新红包
|
|
|
617
|
+ Db::name("user_sign_hongbao")->where("order_type", $type_shop)->where("order_id", $order_sn)->update(['status'=>0]);
|
|
|
618
|
+ log::info("订单 {$order_sn} 用户id ={$user_id} 三方来源={$type_shop} 积分,贡献值,养老金,红包更新更新");
|
|
|
619
|
+ Db::name('log')->insert(['data' => "type_shop:{$type_shop}, $order_sn, $order_sn, 修改积分,养老金,贡献值,红包记录, 更新成功!!!"]);
|
|
618
|
620
|
}
|
|
619
|
621
|
|
|
620
|
622
|
/**
|
|
|
@@ -648,14 +650,14 @@ class UserThirdRepository extends BaseRepository
|
|
648
|
650
|
|
|
649
|
651
|
$sanfangfenpei=json_decode($systemvalueObj['value'],true);
|
|
650
|
652
|
$inc_score = round($price*$sanfangfenpei['pv'],2);//pv=佣金的50%=积分=贡献值
|
|
651
|
|
- log::info("===========dddddddddddddddddddd");
|
|
|
653
|
+// log::info("===========dddddddddddddddddddd");
|
|
652
|
654
|
|
|
653
|
655
|
|
|
654
|
656
|
//每个表的统计值
|
|
655
|
657
|
$jfzongwei=Db::name('user_sign_score')->where('status', -1)->where('uid', $user_id)->sum('reward_socre');
|
|
656
|
658
|
$gxzongwei=Db::name('user_sign_gongxian')->where('status', -1)->where('uid', $user_id)->sum('number');
|
|
657
|
659
|
// type_shop 1 拼多多 ,5淘宝
|
|
658
|
|
- log::info("==========={$jfzongwei}");
|
|
|
660
|
+// log::info("==========={$jfzongwei}");
|
|
659
|
661
|
|
|
660
|
662
|
$make="";
|
|
661
|
663
|
if($type_shop==1){
|
|
|
@@ -704,7 +706,7 @@ class UserThirdRepository extends BaseRepository
|
|
704
|
706
|
// $ins_data['source_type'] =3;
|
|
705
|
707
|
|
|
706
|
708
|
|
|
707
|
|
- //更新贡献值
|
|
|
709
|
+ //赠送贡献值
|
|
708
|
710
|
$gongxian_data = [
|
|
709
|
711
|
"uid" =>$user_id,
|
|
710
|
712
|
"number" => $inc_score,
|
|
|
@@ -735,6 +737,108 @@ class UserThirdRepository extends BaseRepository
|
|
735
|
737
|
Db::name("user_sign_gongxian")->insert($gongxian_data);//添加贡献记录
|
|
736
|
738
|
log::info("===添加完积分和贡献值");
|
|
737
|
739
|
|
|
|
740
|
+ //判断是否是老用户 is_old=1是1.0的用户,1.0的用户要总pv*45%的红包
|
|
|
741
|
+ if($user["is_old"]==1){
|
|
|
742
|
+ //添加红包
|
|
|
743
|
+ $hongbao=round($inc_score*0.45,2);
|
|
|
744
|
+ $hongbao_data = [
|
|
|
745
|
+ "uid" =>$user_id,
|
|
|
746
|
+ "number" => $hongbao,
|
|
|
747
|
+ "addtime" =>time(),
|
|
|
748
|
+ "status" =>-1,
|
|
|
749
|
+ "order_type" =>$type_shop,
|
|
|
750
|
+ "order_id" =>$order_sn,
|
|
|
751
|
+ "mark" =>"购买{$make}商品赠送红包",
|
|
|
752
|
+ "desc" =>'',
|
|
|
753
|
+ "surplus" =>$hongbao,
|
|
|
754
|
+ "type" =>1
|
|
|
755
|
+ ];
|
|
|
756
|
+ Db::name("user_sign_hongbao")->insert($hongbao_data);//添加贡献记录
|
|
|
757
|
+ log::info("===添加完红包奖励");
|
|
|
758
|
+
|
|
|
759
|
+ }
|
|
|
760
|
+
|
|
|
761
|
+
|
|
|
762
|
+
|
|
|
763
|
+ // 添加推荐奖励
|
|
|
764
|
+ $sprerdUser= Db::name("user")->where('spread_id',$user_id)->find();
|
|
|
765
|
+ //不为空的时候进行添加推荐奖励
|
|
|
766
|
+ if($sprerdUser){
|
|
|
767
|
+
|
|
|
768
|
+
|
|
|
769
|
+ //奖励推广佣金
|
|
|
770
|
+ $yongjinbili=0;
|
|
|
771
|
+ //普通用户
|
|
|
772
|
+ if($sprerdUser["user_group"]==1){
|
|
|
773
|
+ $yongjinbili=5;
|
|
|
774
|
+ }
|
|
|
775
|
+ //业务员
|
|
|
776
|
+ if($sprerdUser["user_group"]==2){
|
|
|
777
|
+ $yongjinbili=7;
|
|
|
778
|
+ }
|
|
|
779
|
+ //业务经理
|
|
|
780
|
+ if($sprerdUser["user_group"]==3){
|
|
|
781
|
+ $yongjinbili=9;
|
|
|
782
|
+ }
|
|
|
783
|
+ //初级合伙人
|
|
|
784
|
+ if($sprerdUser["user_group"]==4){
|
|
|
785
|
+ $yongjinbili=11;
|
|
|
786
|
+ }
|
|
|
787
|
+ //中级合伙人
|
|
|
788
|
+ if($sprerdUser["user_group"]==5){
|
|
|
789
|
+ $yongjinbili=13;
|
|
|
790
|
+ }
|
|
|
791
|
+ //高级合伙人
|
|
|
792
|
+ if($sprerdUser["user_group"]==6){
|
|
|
793
|
+ $yongjinbili=15;
|
|
|
794
|
+ }
|
|
|
795
|
+ //懂事
|
|
|
796
|
+ if($sprerdUser["user_group"]==7){
|
|
|
797
|
+ $yongjinbili=17;
|
|
|
798
|
+ }
|
|
|
799
|
+
|
|
|
800
|
+ $tuiguanyongjin=round($yongjinbili*$inc_score/100,2);//按照身份获得佣金
|
|
|
801
|
+
|
|
|
802
|
+
|
|
|
803
|
+ //添加推广积分
|
|
|
804
|
+ $tuijifendata = [
|
|
|
805
|
+ "uid" => $sprerdUser['uid'],
|
|
|
806
|
+ "reward_socre" => $tuiguanyongjin,
|
|
|
807
|
+ "addtime" => time(),
|
|
|
808
|
+ "status" => -1,
|
|
|
809
|
+ "order_type" => $type_shop,
|
|
|
810
|
+ "order_id" => $order_sn,
|
|
|
811
|
+ "mark" => "推广消费从{$make}购买商品赠送积分",
|
|
|
812
|
+ "surplus" => $surplus,
|
|
|
813
|
+ "pm" => 1,
|
|
|
814
|
+ "source_type" => 4
|
|
|
815
|
+ ];
|
|
|
816
|
+ log::info("{$make}==准备开始添加推广积分,贡献");
|
|
|
817
|
+ Db::name("user_sign_score")->insert($tuijifendata);//添加积分记录
|
|
|
818
|
+
|
|
|
819
|
+
|
|
|
820
|
+ //添加献值
|
|
|
821
|
+ $tuigangongxian_data = [
|
|
|
822
|
+ "uid" =>$user_id,
|
|
|
823
|
+ "number" => $tuiguanyongjin,
|
|
|
824
|
+ "addtime" =>time(),
|
|
|
825
|
+ "status" =>-1,
|
|
|
826
|
+ "order_type" =>$type_shop,
|
|
|
827
|
+ "order_id" =>$order_sn,
|
|
|
828
|
+ "mark" =>"推广消费从{$make}购商品赠送贡献值",
|
|
|
829
|
+ "desc" =>'',
|
|
|
830
|
+ "surplus" =>$surplusgongxian+$gxzongwei,
|
|
|
831
|
+ "type" =>1
|
|
|
832
|
+ ];
|
|
|
833
|
+
|
|
|
834
|
+ Db::name("user_sign_gongxian")->insert($tuigangongxian_data);//添加贡献记录
|
|
|
835
|
+ log::info("===添加完积分和贡献值");
|
|
|
836
|
+
|
|
|
837
|
+
|
|
|
838
|
+
|
|
|
839
|
+ }
|
|
|
840
|
+
|
|
|
841
|
+
|
|
738
|
842
|
|
|
739
|
843
|
//
|
|
740
|
844
|
// Db::name('user')->where('uid', $user_id)->inc('score', $inc_score)->update();
|