xialei 1 gadu atpakaļ
vecāks
revīzija
d5d1dcc449

+ 5 - 73
app/common/repositories/user/UserThirdRepository.php

@@ -747,7 +747,6 @@ class UserThirdRepository extends BaseRepository
747
     /**
747
     /**
748
      * 添加预估积分记录
748
      * 添加预估积分记录
749
      */
749
      */
750
-//预估养老金
751
     public static function yuguJifen($price,$user_id,$order_sn,$type_shop)
750
     public static function yuguJifen($price,$user_id,$order_sn,$type_shop)
752
     {
751
     {
753
         if (empty($user_id)) {
752
         if (empty($user_id)) {
@@ -775,14 +774,11 @@ class UserThirdRepository extends BaseRepository
775
 
774
 
776
             $sanfangfenpei=json_decode($systemvalueObj['value'],true);
775
             $sanfangfenpei=json_decode($systemvalueObj['value'],true);
777
             $inc_score = $gongxian = round($price*$sanfangfenpei['pv'],2);//pv=佣金的50%=积分=贡献值
776
             $inc_score = $gongxian = round($price*$sanfangfenpei['pv'],2);//pv=佣金的50%=积分=贡献值
778
-//            log::info("===========dddddddddddddddddddd");
779
 
777
 
780
 
778
 
781
             //每个表的统计值
779
             //每个表的统计值
782
             $jfzongwei=Db::name('user_sign_score')->where('status', -1)->where('uid', $user_id)->sum('reward_socre');
780
             $jfzongwei=Db::name('user_sign_score')->where('status', -1)->where('uid', $user_id)->sum('reward_socre');
783
             $gxzongwei=Db::name('user_sign_gongxian')->where('status', -1)->where('uid', $user_id)->sum('number');
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
             $make="";
783
             $make="";
788
             if($type_shop==1){
784
             if($type_shop==1){
@@ -817,26 +813,12 @@ class UserThirdRepository extends BaseRepository
817
                 ];
813
                 ];
818
             log::info("{$make}==准备开始添加积分,贡献");
814
             log::info("{$make}==准备开始添加积分,贡献");
819
             Db::name("user_sign_score")->insert($data);//添加积分记录
815
             Db::name("user_sign_score")->insert($data);//添加积分记录
820
-
821
             log::info("准备开始添加积分");
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
             $gongxian_data = [
820
             $gongxian_data = [
838
                 "uid"           =>$user_id,
821
                 "uid"           =>$user_id,
839
-//                "number"  =>    $inc_score,
840
                 "number"  =>    $gongxian,
822
                 "number"  =>    $gongxian,
841
                 "addtime"       =>time(),
823
                 "addtime"       =>time(),
842
                 "status"        =>-1,
824
                 "status"        =>-1,
@@ -847,21 +829,6 @@ class UserThirdRepository extends BaseRepository
847
                 "surplus"       =>$surplusgongxian+$gxzongwei,
829
                 "surplus"       =>$surplusgongxian+$gxzongwei,
848
                 "type"          =>1
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
             Db::name("user_sign_gongxian")->insert($gongxian_data);//添加贡献记录
832
             Db::name("user_sign_gongxian")->insert($gongxian_data);//添加贡献记录
866
             log::info("===添加完积分和贡献值");
833
             log::info("===添加完积分和贡献值");
867
 
834
 
@@ -895,51 +862,20 @@ class UserThirdRepository extends BaseRepository
895
                 ];
862
                 ];
896
                 Db::name("user_sign_hongbao")->insert($hongbao_data);//添加贡献记录
863
                 Db::name("user_sign_hongbao")->insert($hongbao_data);//添加贡献记录
897
                 log::info("===添加完红包奖励");
864
                 log::info("===添加完红包奖励");
898
-
899
             }
865
             }
900
 
866
 
901
 
867
 
902
-
903
             // 添加推荐奖励
868
             // 添加推荐奖励
904
             $zijiUser=Db::name("user")->where('uid',$user_id)->find();
869
             $zijiUser=Db::name("user")->where('uid',$user_id)->find();
905
             $sprerdUser= Db::name("user")->where('uid',$zijiUser['spread_uid'])->find();
870
             $sprerdUser= Db::name("user")->where('uid',$zijiUser['spread_uid'])->find();
906
             //不为空的时候进行添加推荐奖励
871
             //不为空的时候进行添加推荐奖励
907
             if($sprerdUser){
872
             if($sprerdUser){
908
-                //奖励推广佣金
873
+                //奖励推广
909
                 $yongjinbili=0;
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
                 // @todo 用户身份比例
876
                 // @todo 用户身份比例
939
                 $yongjinbili = StoreOrderRepository::getUserGroupRate($sprerdUser['user_group']);
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
                 $tuijifendata = [
881
                 $tuijifendata = [
@@ -950,7 +886,7 @@ class UserThirdRepository extends BaseRepository
950
                     "order_type"    =>  $type_shop,
886
                     "order_type"    =>  $type_shop,
951
                     "order_id"      =>  $order_sn,
887
                     "order_id"      =>  $order_sn,
952
                     "mark"          =>  "推广消费从{$make}购买商品赠送积分",
888
                     "mark"          =>  "推广消费从{$make}购买商品赠送积分",
953
-                    "surplus"       =>  $surplus,
889
+                    "surplus"       =>  $sprerdUser['score'] + $tuiguanyongjin,
954
                     "pm"            =>  1,
890
                     "pm"            =>  1,
955
                     "source_type"   =>  4
891
                     "source_type"   =>  4
956
                 ];
892
                 ];
@@ -961,7 +897,6 @@ class UserThirdRepository extends BaseRepository
961
                 //添加推荐献值
897
                 //添加推荐献值
962
                 $tuigangongxian_data = [
898
                 $tuigangongxian_data = [
963
                     "uid"           =>$sprerdUser['uid'],
899
                     "uid"           =>$sprerdUser['uid'],
964
-//                    "number"  =>    $tuiguanyongjin,
965
                     "number"  =>    $gongxian,
900
                     "number"  =>    $gongxian,
966
                     "addtime"       =>time(),
901
                     "addtime"       =>time(),
967
                     "status"        =>-1,
902
                     "status"        =>-1,
@@ -969,15 +904,12 @@ class UserThirdRepository extends BaseRepository
969
                     "order_id"      =>$order_sn,
904
                     "order_id"      =>$order_sn,
970
                     "mark"          =>"推广消费从{$make}购商品赠送贡献值",
905
                     "mark"          =>"推广消费从{$make}购商品赠送贡献值",
971
                     "desc"          =>'',
906
                     "desc"          =>'',
972
-                    "surplus"       =>$surplusgongxian+$gxzongwei,
907
+                    "surplus"       => $sprerdUser['contribute'] + $gongxian,
973
                     "type"          =>1
908
                     "type"          =>1
974
                 ];
909
                 ];
975
 
910
 
976
                 Db::name("user_sign_gongxian")->insert($tuigangongxian_data);//添加贡献记录
911
                 Db::name("user_sign_gongxian")->insert($tuigangongxian_data);//添加贡献记录
977
                 log::info("===添加完积分和贡献值");
912
                 log::info("===添加完积分和贡献值");
978
-
979
-
980
-
981
             }
913
             }
982
 
914
 
983
 
915
 

+ 7 - 7
app/controller/api/store/service/Huafei.php

@@ -213,13 +213,13 @@ class Huafei extends BaseController
213
 			$order_sn,
213
 			$order_sn,
214
 			$type_shop
214
 			$type_shop
215
 		);						
215
 		);						
216
-		//复购金
217
-		$orderThird->yuguFugou(
218
-			$commissionMoney,
219
-			$uid,
220
-			$order_sn,
221
-			$type_shop
222
-		);	
216
+		// //复购金
217
+		// $orderThird->yuguFugou(
218
+		// 	$commissionMoney,
219
+		// 	$uid,
220
+		// 	$order_sn,
221
+		// 	$type_shop
222
+		// );	
223
 
223
 
224
 		//推送订单
224
 		//推送订单
225
 		$push = $this->pushOrder($order_sn, $phone, $money);
225
 		$push = $this->pushOrder($order_sn, $phone, $money);