|
|
@@ -747,7 +747,6 @@ class UserThirdRepository extends BaseRepository
|
|
747
|
747
|
/**
|
|
748
|
748
|
* 添加预估积分记录
|
|
749
|
749
|
*/
|
|
750
|
|
-//预估养老金
|
|
751
|
750
|
public static function yuguJifen($price,$user_id,$order_sn,$type_shop)
|
|
752
|
751
|
{
|
|
753
|
752
|
if (empty($user_id)) {
|
|
|
@@ -775,14 +774,11 @@ class UserThirdRepository extends BaseRepository
|
|
775
|
774
|
|
|
776
|
775
|
$sanfangfenpei=json_decode($systemvalueObj['value'],true);
|
|
777
|
776
|
$inc_score = $gongxian = round($price*$sanfangfenpei['pv'],2);//pv=佣金的50%=积分=贡献值
|
|
778
|
|
-// log::info("===========dddddddddddddddddddd");
|
|
779
|
777
|
|
|
780
|
778
|
|
|
781
|
779
|
//每个表的统计值
|
|
782
|
780
|
$jfzongwei=Db::name('user_sign_score')->where('status', -1)->where('uid', $user_id)->sum('reward_socre');
|
|
783
|
781
|
$gxzongwei=Db::name('user_sign_gongxian')->where('status', -1)->where('uid', $user_id)->sum('number');
|
|
784
|
|
-// type_shop 1 拼多多 ,5淘宝
|
|
785
|
|
-// log::info("==========={$jfzongwei}");
|
|
786
|
782
|
|
|
787
|
783
|
$make="";
|
|
788
|
784
|
if($type_shop==1){
|
|
|
@@ -817,26 +813,12 @@ class UserThirdRepository extends BaseRepository
|
|
817
|
813
|
];
|
|
818
|
814
|
log::info("{$make}==准备开始添加积分,贡献");
|
|
819
|
815
|
Db::name("user_sign_score")->insert($data);//添加积分记录
|
|
820
|
|
-
|
|
821
|
816
|
log::info("准备开始添加积分");
|
|
822
|
|
-// $ins_data['uid'] = $user_id;
|
|
823
|
|
-// $ins_data['reward_socre'] = $inc_score;
|
|
824
|
|
-// $ins_data['addtime'] = time();
|
|
825
|
|
-// $ins_data['status'] = -1;
|
|
826
|
|
-// $ins_data['order_type'] = $type_shop;
|
|
827
|
|
-// $ins_data['order_id'] = $order_sn;
|
|
828
|
|
-// $ins_data['mark'] = "购买三方商品赠送积分";
|
|
829
|
|
-// $ins_data['desc'] = '';
|
|
830
|
|
-// $ins_data['surplus'] = $user_score + $inc_score;
|
|
831
|
|
-// $ins_data['type'] = 1;
|
|
832
|
|
-// $ins_data['pm'] = 1;
|
|
833
|
|
-// $ins_data['source_type'] =3;
|
|
834
|
817
|
|
|
835
|
818
|
|
|
836
|
819
|
//赠送贡献值
|
|
837
|
820
|
$gongxian_data = [
|
|
838
|
821
|
"uid" =>$user_id,
|
|
839
|
|
-// "number" => $inc_score,
|
|
840
|
822
|
"number" => $gongxian,
|
|
841
|
823
|
"addtime" =>time(),
|
|
842
|
824
|
"status" =>-1,
|
|
|
@@ -847,21 +829,6 @@ class UserThirdRepository extends BaseRepository
|
|
847
|
829
|
"surplus" =>$surplusgongxian+$gxzongwei,
|
|
848
|
830
|
"type" =>1
|
|
849
|
831
|
];
|
|
850
|
|
-
|
|
851
|
|
-// $gongxian_data['uid'] = $user_id;
|
|
852
|
|
-// $gongxian_data['number'] = $inc_score;
|
|
853
|
|
-// $gongxian_data['addtime'] = time();
|
|
854
|
|
-// $gongxian_data['status'] = -1;
|
|
855
|
|
-// $gongxian_data['order_type'] = $type_shop;
|
|
856
|
|
-// $gongxian_data['order_id'] = $order_sn;
|
|
857
|
|
-// $gongxian_data['mark'] = "购买三方商品赠送贡献值";
|
|
858
|
|
-// $gongxian_data['desc'] = '';
|
|
859
|
|
-// $gongxian_data['surplus'] = $user_score + $inc_score;
|
|
860
|
|
-// $gongxian_data['type'] = 1;
|
|
861
|
|
-// $gongxian_data['pm'] = 1;
|
|
862
|
|
-// $gongxian_data['source_type'] =3;
|
|
863
|
|
-
|
|
864
|
|
-
|
|
865
|
832
|
Db::name("user_sign_gongxian")->insert($gongxian_data);//添加贡献记录
|
|
866
|
833
|
log::info("===添加完积分和贡献值");
|
|
867
|
834
|
|
|
|
@@ -895,51 +862,20 @@ class UserThirdRepository extends BaseRepository
|
|
895
|
862
|
];
|
|
896
|
863
|
Db::name("user_sign_hongbao")->insert($hongbao_data);//添加贡献记录
|
|
897
|
864
|
log::info("===添加完红包奖励");
|
|
898
|
|
-
|
|
899
|
865
|
}
|
|
900
|
866
|
|
|
901
|
867
|
|
|
902
|
|
-
|
|
903
|
868
|
// 添加推荐奖励
|
|
904
|
869
|
$zijiUser=Db::name("user")->where('uid',$user_id)->find();
|
|
905
|
870
|
$sprerdUser= Db::name("user")->where('uid',$zijiUser['spread_uid'])->find();
|
|
906
|
871
|
//不为空的时候进行添加推荐奖励
|
|
907
|
872
|
if($sprerdUser){
|
|
908
|
|
- //奖励推广佣金
|
|
|
873
|
+ //奖励推广
|
|
909
|
874
|
$yongjinbili=0;
|
|
910
|
|
- //普通用户
|
|
911
|
|
- if($sprerdUser["user_group"]==1){
|
|
912
|
|
- $yongjinbili=5;
|
|
913
|
|
- }
|
|
914
|
|
- //业务员
|
|
915
|
|
- if($sprerdUser["user_group"]==2){
|
|
916
|
|
- $yongjinbili=7;
|
|
917
|
|
- }
|
|
918
|
|
- //业务经理
|
|
919
|
|
- if($sprerdUser["user_group"]==3){
|
|
920
|
|
- $yongjinbili=9;
|
|
921
|
|
- }
|
|
922
|
|
- //初级合伙人
|
|
923
|
|
- if($sprerdUser["user_group"]==4){
|
|
924
|
|
- $yongjinbili=11;
|
|
925
|
|
- }
|
|
926
|
|
- //中级合伙人
|
|
927
|
|
- if($sprerdUser["user_group"]==5){
|
|
928
|
|
- $yongjinbili=13;
|
|
929
|
|
- }
|
|
930
|
|
- //高级合伙人
|
|
931
|
|
- if($sprerdUser["user_group"]==6){
|
|
932
|
|
- $yongjinbili=15;
|
|
933
|
|
- }
|
|
934
|
|
- //懂事
|
|
935
|
|
- if($sprerdUser["user_group"]==7){
|
|
936
|
|
- $yongjinbili=17;
|
|
937
|
|
- }
|
|
|
875
|
+
|
|
938
|
876
|
// @todo 用户身份比例
|
|
939
|
877
|
$yongjinbili = StoreOrderRepository::getUserGroupRate($sprerdUser['user_group']);
|
|
940
|
|
-
|
|
941
|
|
- $tuiguanyongjin=round($yongjinbili*$inc_score/100,2);//按照身份获得佣金
|
|
942
|
|
-
|
|
|
878
|
+ $tuiguanyongjin=round($yongjinbili*$inc_score,2);//按照身份获得佣金
|
|
943
|
879
|
|
|
944
|
880
|
//添加推广积分
|
|
945
|
881
|
$tuijifendata = [
|
|
|
@@ -950,7 +886,7 @@ class UserThirdRepository extends BaseRepository
|
|
950
|
886
|
"order_type" => $type_shop,
|
|
951
|
887
|
"order_id" => $order_sn,
|
|
952
|
888
|
"mark" => "推广消费从{$make}购买商品赠送积分",
|
|
953
|
|
- "surplus" => $surplus,
|
|
|
889
|
+ "surplus" => $sprerdUser['score'] + $tuiguanyongjin,
|
|
954
|
890
|
"pm" => 1,
|
|
955
|
891
|
"source_type" => 4
|
|
956
|
892
|
];
|
|
|
@@ -961,7 +897,6 @@ class UserThirdRepository extends BaseRepository
|
|
961
|
897
|
//添加推荐献值
|
|
962
|
898
|
$tuigangongxian_data = [
|
|
963
|
899
|
"uid" =>$sprerdUser['uid'],
|
|
964
|
|
-// "number" => $tuiguanyongjin,
|
|
965
|
900
|
"number" => $gongxian,
|
|
966
|
901
|
"addtime" =>time(),
|
|
967
|
902
|
"status" =>-1,
|
|
|
@@ -969,15 +904,12 @@ class UserThirdRepository extends BaseRepository
|
|
969
|
904
|
"order_id" =>$order_sn,
|
|
970
|
905
|
"mark" =>"推广消费从{$make}购商品赠送贡献值",
|
|
971
|
906
|
"desc" =>'',
|
|
972
|
|
- "surplus" =>$surplusgongxian+$gxzongwei,
|
|
|
907
|
+ "surplus" => $sprerdUser['contribute'] + $gongxian,
|
|
973
|
908
|
"type" =>1
|
|
974
|
909
|
];
|
|
975
|
910
|
|
|
976
|
911
|
Db::name("user_sign_gongxian")->insert($tuigangongxian_data);//添加贡献记录
|
|
977
|
912
|
log::info("===添加完积分和贡献值");
|
|
978
|
|
-
|
|
979
|
|
-
|
|
980
|
|
-
|
|
981
|
913
|
}
|
|
982
|
914
|
|
|
983
|
915
|
|