|
|
@@ -188,8 +188,8 @@ class Auth extends BaseController
|
|
188
|
188
|
{
|
|
189
|
189
|
|
|
190
|
190
|
$this->importExcel();
|
|
191
|
|
-echo '导入成功';
|
|
192
|
|
- die;
|
|
|
191
|
+ echo '导入成功';
|
|
|
192
|
+ die;
|
|
193
|
193
|
$storeOrderRepository = app()->make(StoreOrderRepository::class);
|
|
194
|
194
|
// $storeOrderRepository->yihuchashengji();//一壶茶身份升级
|
|
195
|
195
|
// $storeOrderRepository->yunyingjiangli();//运营中心奖励
|
|
|
@@ -445,12 +445,12 @@ echo '导入成功';
|
|
445
|
445
|
public function login(UserRepository $repository)
|
|
446
|
446
|
{
|
|
447
|
447
|
$account = $this->request->param('phone');
|
|
448
|
|
-
|
|
449
|
|
- if (!$account)
|
|
|
448
|
+
|
|
|
449
|
+ if (!$account)
|
|
450
|
450
|
return app('json')->fail('请输入账号');
|
|
451
|
|
- $user = $repository->accountByUser($this->request->param('phone'));
|
|
452
|
|
-
|
|
453
|
|
- if($account != 15528079265){
|
|
|
451
|
+ $user = $repository->accountByUser($this->request->param('phone'));
|
|
|
452
|
+ //13231658486 周总
|
|
|
453
|
+ if($account != 15528079265){
|
|
454
|
454
|
if (!$user)
|
|
455
|
455
|
return app('json')->fail('账号或密码错误');
|
|
456
|
456
|
if (!password_verify($pwd = (string)$this->request->param('password'), $user['pwd']))
|
|
|
@@ -462,7 +462,7 @@ echo '导入成功';
|
|
462
|
462
|
}
|
|
463
|
463
|
}
|
|
464
|
464
|
}
|
|
465
|
|
-
|
|
|
465
|
+
|
|
466
|
466
|
$user = $repository->mainUser($user);
|
|
467
|
467
|
$pid = $this->request->param('spread', 0);
|
|
468
|
468
|
$repository->bindSpread($user, intval($pid));
|
|
|
@@ -552,6 +552,7 @@ echo '导入成功';
|
|
552
|
552
|
];
|
|
553
|
553
|
Db::name("MarketingUser") -> insert($data);
|
|
554
|
554
|
}
|
|
|
555
|
+
|
|
555
|
556
|
return app('json')->success($repository->returnToken($user, $tokenInfo));
|
|
556
|
557
|
}
|
|
557
|
558
|
|
|
|
@@ -665,8 +666,8 @@ echo '导入成功';
|
|
665
|
666
|
{
|
|
666
|
667
|
$user = $this->request->userInfo()
|
|
667
|
668
|
->hidden(['account','label_id', 'group_id', 'pwd', 'card_id', 'last_time', 'last_ip', 'status', 'spread_time', 'real_name']);
|
|
668
|
|
- $user->append(['service', 'user_group','total_consume', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread']);
|
|
669
|
|
-$data=$user->toArray();
|
|
|
669
|
+ $user->append(['service', 'user_group','total_consume', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread']);
|
|
|
670
|
+ $data=$user->toArray();
|
|
670
|
671
|
|
|
671
|
672
|
|
|
672
|
673
|
$is_merchant=Db::name("merchant_intention")->where(["uid"=>$user["uid"],"is_branch"=>0])->order("mer_intention_id desc")->value("status");
|
|
|
@@ -690,11 +691,11 @@ $data=$user->toArray();
|
|
690
|
691
|
}
|
|
691
|
692
|
}
|
|
692
|
693
|
//养老金展示
|
|
693
|
|
- // $data['annuity'] = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',5) -> where('status',1) -> sum('number');
|
|
694
|
|
- $a = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',5) -> where('status',0) -> sum('number');
|
|
695
|
|
- $b = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',5) -> where('status',1) -> sum('number');
|
|
696
|
|
- $data['annuity'] = $a +$b;
|
|
697
|
|
- //上级身份是否大仓会员
|
|
|
694
|
+ // $data['annuity'] = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',5) -> where('status',1) -> sum('number');
|
|
|
695
|
+ $a = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',5) -> where('status',0) -> sum('number');
|
|
|
696
|
+ $b = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',5) -> where('status',1) -> sum('number');
|
|
|
697
|
+ $data['annuity'] = $a +$b;
|
|
|
698
|
+ //上级身份是否大仓会员
|
|
698
|
699
|
$is_da_cang_vip=Db::name('da_cang_user')->where('status',1)->where('uid',$user["uid"])->find();
|
|
699
|
700
|
//渠道商
|
|
700
|
701
|
$is_channel = Db::name('channel_user') -> where('uid',$user["uid"])->where('status',1)->find();
|
|
|
@@ -712,7 +713,12 @@ $data=$user->toArray();
|
|
712
|
713
|
if ($red){
|
|
713
|
714
|
$data['red'] = $red;
|
|
714
|
715
|
}
|
|
715
|
|
- $data['team_number'] = $this->getBreak($user['uid']);
|
|
|
716
|
+ $aa = Db::name('user') -> where('uid',$user['uid'])->find();//查询用户个人数据
|
|
|
717
|
+
|
|
|
718
|
+ $teamsnums = $this->getteamsnum($user['uid']);
|
|
|
719
|
+ //$team_userinfo_old_jbp1 = $this->getPerformance($teamid);//获取旧表总大小部门人数
|
|
|
720
|
+ //$data['team_number'] = $this->getBreak($user['uid']);//获取新表大小部门总人数
|
|
|
721
|
+ $data['team_number'] = $teamsnums;
|
|
716
|
722
|
|
|
717
|
723
|
$data['is_bangfu'] = Db::name('user_bangfu') -> where('uid',$user["uid"])->value('status')==1;
|
|
718
|
724
|
|
|
|
@@ -745,9 +751,10 @@ $data=$user->toArray();
|
|
745
|
751
|
//$data['brokerage_price']=set_price_rtrim($data['brokerage_price']);//养老金
|
|
746
|
752
|
$a = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',3) -> where('status',0) -> sum('number');
|
|
747
|
753
|
$b = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',3) -> where('status',1) -> sum('number');
|
|
748
|
|
- $data['brokerage_price'] = $a +$b;
|
|
749
|
|
-
|
|
750
|
|
-
|
|
|
754
|
+ // $data['brokerage_price'] = $a +$b;
|
|
|
755
|
+
|
|
|
756
|
+ $data['brokerage_price'] = $aa['brokerage_price'];
|
|
|
757
|
+
|
|
751
|
758
|
$data['isOld']=($data['is_old']);//
|
|
752
|
759
|
$data['exchange']=0;
|
|
753
|
760
|
$data['withdraw']=0;
|
|
|
@@ -761,6 +768,168 @@ $data=$user->toArray();
|
|
761
|
768
|
}
|
|
762
|
769
|
return app('json')->success($data );
|
|
763
|
770
|
}
|
|
|
771
|
+
|
|
|
772
|
+ public function getteamsnum($teamid){
|
|
|
773
|
+
|
|
|
774
|
+ $subordinate_members = Db::name('user')
|
|
|
775
|
+ ->alias('u')
|
|
|
776
|
+ ->join('store_order so', 'u.uid = so.uid', 'LEFT')
|
|
|
777
|
+ ->where("u.spread_uid", $teamid)
|
|
|
778
|
+ ->where("so.mer_id", 496)
|
|
|
779
|
+ ->group('u.uid')
|
|
|
780
|
+
|
|
|
781
|
+ ->select();
|
|
|
782
|
+
|
|
|
783
|
+
|
|
|
784
|
+ $total_amount_pv_team = 0;
|
|
|
785
|
+ $team_count_total = 0;
|
|
|
786
|
+
|
|
|
787
|
+ foreach ($subordinate_members as $k => $v) {
|
|
|
788
|
+ $t_teams_pv = $this->calculatePerformance($v['uid']);
|
|
|
789
|
+ $total_amount_pv_team += $t_teams_pv['total_performance'];
|
|
|
790
|
+ $team_count_total += $t_teams_pv['team_count'];
|
|
|
791
|
+
|
|
|
792
|
+
|
|
|
793
|
+ }
|
|
|
794
|
+
|
|
|
795
|
+ return $team_count_total;
|
|
|
796
|
+
|
|
|
797
|
+ }
|
|
|
798
|
+
|
|
|
799
|
+ //计算自己和自己团队下面的业绩。新表
|
|
|
800
|
+ public function calculatePerformance($uid)
|
|
|
801
|
+ {
|
|
|
802
|
+ // 初始化业绩数组
|
|
|
803
|
+ $performance = [
|
|
|
804
|
+
|
|
|
805
|
+ 'personal_performance' => 0, // 个人业绩
|
|
|
806
|
+ 'team_performance' => 0, // 团队业绩
|
|
|
807
|
+ 'total_performance' => 0, // 总业绩
|
|
|
808
|
+ 'team_count' => 0, // 加上自己的团队数量
|
|
|
809
|
+
|
|
|
810
|
+ ];
|
|
|
811
|
+
|
|
|
812
|
+ // 定义业绩换算规则
|
|
|
813
|
+ $performanceMapping = [
|
|
|
814
|
+ 1180 => 700,
|
|
|
815
|
+ 10620 => 6300,
|
|
|
816
|
+ 11800 => 7000
|
|
|
817
|
+ ];
|
|
|
818
|
+
|
|
|
819
|
+ // 计算个人业绩
|
|
|
820
|
+ $personalOrder = Db::name('store_order')->where("uid", $uid)->find();
|
|
|
821
|
+
|
|
|
822
|
+ if ($personalOrder) {
|
|
|
823
|
+ // 将浮点数转换为整数
|
|
|
824
|
+ $totalPrice = (int)$personalOrder['total_price'];
|
|
|
825
|
+ if (isset($performanceMapping[$totalPrice])) {
|
|
|
826
|
+ $performance['personal_performance'] = $performanceMapping[$totalPrice];
|
|
|
827
|
+ }
|
|
|
828
|
+ }
|
|
|
829
|
+
|
|
|
830
|
+ // 计算旗下团队成员的业绩
|
|
|
831
|
+ $teamOrders = Db::name('user')
|
|
|
832
|
+ ->alias('u')
|
|
|
833
|
+ ->join('store_order so', 'u.uid = so.uid', 'LEFT')
|
|
|
834
|
+ ->where("u.spread_uid", $uid) // 查询旗下会员
|
|
|
835
|
+ ->where("so.mer_id", 496)
|
|
|
836
|
+ // ->where("so.douhuomall", 1)
|
|
|
837
|
+ // ->where("so.douhuomall_status", 9)
|
|
|
838
|
+ // ->where("so.status", 0)
|
|
|
839
|
+ ->select();
|
|
|
840
|
+
|
|
|
841
|
+ $teamOrders_count = Db::name('user')
|
|
|
842
|
+ ->alias('u')
|
|
|
843
|
+ ->join('store_order so', 'u.uid = so.uid', 'LEFT')
|
|
|
844
|
+ ->where("u.spread_uid", $uid) // 查询旗下会员
|
|
|
845
|
+ ->where("so.mer_id", 496)
|
|
|
846
|
+ // ->where("so.douhuomall", 1)
|
|
|
847
|
+ // ->where("so.douhuomall_status", 9)
|
|
|
848
|
+ // ->where("so.status", 0)
|
|
|
849
|
+ ->count();
|
|
|
850
|
+
|
|
|
851
|
+ $performance['team_count'] = $teamOrders_count + 1; // 赋值团队数量
|
|
|
852
|
+
|
|
|
853
|
+ foreach ($teamOrders as $order) {
|
|
|
854
|
+ if ($order['total_price']) {
|
|
|
855
|
+ // 将浮点数转换为整数
|
|
|
856
|
+ $totalPrice = (int)$order['total_price'];
|
|
|
857
|
+ if (isset($performanceMapping[$totalPrice])) {
|
|
|
858
|
+ $performance['team_performance'] += $performanceMapping[$totalPrice];
|
|
|
859
|
+ }
|
|
|
860
|
+ }
|
|
|
861
|
+ }
|
|
|
862
|
+
|
|
|
863
|
+ // 计算总业绩
|
|
|
864
|
+ $performance['total_performance'] = $performance['personal_performance'] + $performance['team_performance'];
|
|
|
865
|
+
|
|
|
866
|
+ // 假设总业绩最大值需要通过后续逻辑判断,这里暂时设置为 false
|
|
|
867
|
+ return $performance;
|
|
|
868
|
+ }
|
|
|
869
|
+
|
|
|
870
|
+//获取大小部门业绩(新表)
|
|
|
871
|
+ public function getbig_samll_datas($subordinate_members){
|
|
|
872
|
+ //单独写一个方法获取大小部门的数据
|
|
|
873
|
+ $arr_team = [];
|
|
|
874
|
+ foreach ($subordinate_members as $k => $v) {
|
|
|
875
|
+
|
|
|
876
|
+ //计算自己和旗下的业绩
|
|
|
877
|
+ $arr_team[] = $this->calculatePerformance($v['uid']);
|
|
|
878
|
+ }
|
|
|
879
|
+
|
|
|
880
|
+ // 初始化变量
|
|
|
881
|
+ $maxPerformance = 0;
|
|
|
882
|
+ $maxIndex = -1;
|
|
|
883
|
+
|
|
|
884
|
+ // 找出 total_performance 最高的记录
|
|
|
885
|
+ foreach ($arr_team as $index => $item) {
|
|
|
886
|
+ if ($item['total_performance'] > $maxPerformance) {
|
|
|
887
|
+ $maxPerformance = $item['total_performance'];
|
|
|
888
|
+ $maxIndex = $index;
|
|
|
889
|
+ }
|
|
|
890
|
+ }
|
|
|
891
|
+
|
|
|
892
|
+ // 如果找到了最高记录
|
|
|
893
|
+ if ($maxIndex !== -1) {
|
|
|
894
|
+ // 提取最高记录
|
|
|
895
|
+ $maxRecord = $arr_team[$maxIndex];
|
|
|
896
|
+ // 从原数组中移除该记录
|
|
|
897
|
+ unset($arr_team[$maxIndex]);
|
|
|
898
|
+ // 重新索引数组
|
|
|
899
|
+ $arr_team = array_values($arr_team);
|
|
|
900
|
+ } else {
|
|
|
901
|
+ // 如果没有找到记录,可以设置一个默认值
|
|
|
902
|
+ $maxRecord = null;
|
|
|
903
|
+ }
|
|
|
904
|
+
|
|
|
905
|
+ // 计算大部门和小部门的汇总信息
|
|
|
906
|
+ $majorDepartmentSummary = [
|
|
|
907
|
+ "total_person_performance" => $maxRecord ? $maxRecord['personal_performance'] : 0,
|
|
|
908
|
+ "total_team_performance" => $maxRecord ? $maxRecord['team_performance'] : 0,
|
|
|
909
|
+ "total_performance" => $maxRecord ? $maxRecord['total_performance'] : 0,
|
|
|
910
|
+ "team_count" => $maxRecord ? $maxRecord['team_count'] : 0,
|
|
|
911
|
+ "data" => $maxRecord ? [$maxRecord] : []
|
|
|
912
|
+ ];
|
|
|
913
|
+
|
|
|
914
|
+ $minorDepartmentSummary = [
|
|
|
915
|
+ "total_person_performance" => array_sum(array_column($arr_team, 'personal_performance')),
|
|
|
916
|
+ "total_team_performance" => array_sum(array_column($arr_team, 'team_performance')),
|
|
|
917
|
+ "total_performance" => array_sum(array_column($arr_team, 'total_performance')),
|
|
|
918
|
+ "team_count" => array_sum(array_column($arr_team, 'team_count')),
|
|
|
919
|
+ "data" => $arr_team
|
|
|
920
|
+ ];
|
|
|
921
|
+
|
|
|
922
|
+ // 输出结果
|
|
|
923
|
+ // echo "大部门汇总信息:\n";
|
|
|
924
|
+ // print_r($majorDepartmentSummary);
|
|
|
925
|
+ // echo "小部门汇总信息:\n";
|
|
|
926
|
+ // print_r($minorDepartmentSummary);
|
|
|
927
|
+
|
|
|
928
|
+ return array($majorDepartmentSummary,$minorDepartmentSummary);
|
|
|
929
|
+ }
|
|
|
930
|
+
|
|
|
931
|
+
|
|
|
932
|
+
|
|
764
|
933
|
public function getBreak($uid,$list=[],$count=0){
|
|
765
|
934
|
$sql = "select getUserLevelId($uid) as count";
|
|
766
|
935
|
$count = Db::query($sql);
|
|
|
@@ -778,7 +947,7 @@ $data=$user->toArray();
|
|
778
|
947
|
public function tokenList()
|
|
779
|
948
|
{
|
|
780
|
949
|
$user = $this->request->userInfo()->hidden(['account','label_id', 'group_id', 'pwd', 'card_id', 'last_time', 'last_ip', 'status', 'spread_time', 'real_name']);
|
|
781
|
|
- $user->append(['service', 'user_group','total_consume', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread']);
|
|
|
950
|
+ $user->append(['service', 'user_group','total_consume', 'total_collect_product', 'total_collect_store', 'total_coupon', 'total_visit_product', 'total_unread']);
|
|
782
|
951
|
$userInfo = $user->toArray();
|
|
783
|
952
|
|
|
784
|
953
|
$data['mweb_info'] = $this->curl_java_login($userInfo['phone'])['data'];
|
|
|
@@ -792,18 +961,18 @@ $data=$user->toArray();
|
|
792
|
961
|
function curl_java_login($phone){
|
|
793
|
962
|
$curl = curl_init();
|
|
794
|
963
|
curl_setopt_array($curl, array(
|
|
795
|
|
- CURLOPT_URL => 'http://shop.gdjbp.com/gateway/userCenter_service/userLogOnService/userPhoneLogOn',
|
|
796
|
|
- CURLOPT_RETURNTRANSFER => true,
|
|
797
|
|
- CURLOPT_ENCODING => '',
|
|
798
|
|
- CURLOPT_MAXREDIRS => 10,
|
|
799
|
|
- CURLOPT_TIMEOUT => 0,
|
|
800
|
|
- CURLOPT_FOLLOWLOCATION => true,
|
|
801
|
|
- CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
802
|
|
- CURLOPT_CUSTOMREQUEST => 'POST',
|
|
803
|
|
- CURLOPT_POSTFIELDS =>'{"phone":'.$phone.',"sms_code":"9527","type":"1"}',
|
|
804
|
|
- CURLOPT_HTTPHEADER => array(
|
|
805
|
|
- 'Content-Type: application/json'
|
|
806
|
|
- ),
|
|
|
964
|
+ CURLOPT_URL => 'http://shop.gdjbp.com/gateway/userCenter_service/userLogOnService/userPhoneLogOn',
|
|
|
965
|
+ CURLOPT_RETURNTRANSFER => true,
|
|
|
966
|
+ CURLOPT_ENCODING => '',
|
|
|
967
|
+ CURLOPT_MAXREDIRS => 10,
|
|
|
968
|
+ CURLOPT_TIMEOUT => 0,
|
|
|
969
|
+ CURLOPT_FOLLOWLOCATION => true,
|
|
|
970
|
+ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
|
|
971
|
+ CURLOPT_CUSTOMREQUEST => 'POST',
|
|
|
972
|
+ CURLOPT_POSTFIELDS =>'{"phone":'.$phone.',"sms_code":"9527","type":"1"}',
|
|
|
973
|
+ CURLOPT_HTTPHEADER => array(
|
|
|
974
|
+ 'Content-Type: application/json'
|
|
|
975
|
+ ),
|
|
807
|
976
|
));
|
|
808
|
977
|
$response = curl_exec($curl);
|
|
809
|
978
|
curl_close($curl);
|
|
|
@@ -1035,9 +1204,9 @@ $data=$user->toArray();
|
|
1035
|
1204
|
return app('json')->fail('操作过于频繁,请稍后重试~');
|
|
1036
|
1205
|
}
|
|
1037
|
1206
|
|
|
1038
|
|
- log::info("sms_key==={$sms_key}" );
|
|
1039
|
|
- log::info("sms_code==={$sms_code}" );
|
|
1040
|
|
- log::info("sms_time==={$sms_time}" );
|
|
|
1207
|
+ log::info("sms_key==={$sms_key}" );
|
|
|
1208
|
+ log::info("sms_code==={$sms_code}" );
|
|
|
1209
|
+ log::info("sms_time==={$sms_time}" );
|
|
1041
|
1210
|
Cache::set($sms_key, $sms_code,$sms_time * 60);
|
|
1042
|
1211
|
Cache::set($sms_num_key, $num + 1, 300);
|
|
1043
|
1212
|
//'短信发送成功'
|
|
|
@@ -1141,7 +1310,7 @@ $data=$user->toArray();
|
|
1141
|
1310
|
}
|
|
1142
|
1311
|
public function smsLogin(UserAuthValidate $validate, UserRepository $repository)
|
|
1143
|
1312
|
{
|
|
1144
|
|
- $data = $this->request->params(['phone', 'sms_code', 'spread', 'share_id']);
|
|
|
1313
|
+ $data = $this->request->params(['phone', 'sms_code', 'spread', 'share_id']);
|
|
1145
|
1314
|
// $data = $this->request->params(['phone', 'sms_code']);
|
|
1146
|
1315
|
|
|
1147
|
1316
|
$validate->sceneSmslogin()->check($data);
|
|
|
@@ -1184,11 +1353,11 @@ $data=$user->toArray();
|
|
1184
|
1353
|
// }
|
|
1185
|
1354
|
|
|
1186
|
1355
|
|
|
1187
|
|
- // $insert['puid']= $spread_uid;
|
|
1188
|
|
- // $insert['node_uid']= $spread_uid;
|
|
1189
|
|
- // Db::name('enterprise_user')->insert($insert);
|
|
1190
|
|
- // }
|
|
1191
|
|
- // }
|
|
|
1356
|
+ // $insert['puid']= $spread_uid;
|
|
|
1357
|
+ // $insert['node_uid']= $spread_uid;
|
|
|
1358
|
+ // Db::name('enterprise_user')->insert($insert);
|
|
|
1359
|
+ // }
|
|
|
1360
|
+ // }
|
|
1192
|
1361
|
|
|
1193
|
1362
|
// $repository->bindSpread($user, intval($data['spread']));
|
|
1194
|
1363
|
$tokenInfo = $repository->createToken($user);
|
|
|
@@ -1228,9 +1397,9 @@ $data=$user->toArray();
|
|
1228
|
1397
|
public function checkSmsCode($phone, $code)
|
|
1229
|
1398
|
{
|
|
1230
|
1399
|
$sms_key = 'api.auth.sms.' . $phone;
|
|
1231
|
|
- //log::info("缓存===code=={$sms_key}");
|
|
1232
|
|
- //log::info( Cache::get($sms_key));
|
|
1233
|
|
- //log::info("页面传值==={$code}");
|
|
|
1400
|
+ //log::info("缓存===code=={$sms_key}");
|
|
|
1401
|
+ //log::info( Cache::get($sms_key));
|
|
|
1402
|
+ //log::info("页面传值==={$code}");
|
|
1234
|
1403
|
if (!$cache_code = Cache::get($sms_key)) return false;
|
|
1235
|
1404
|
if ($code != $cache_code) return false;
|
|
1236
|
1405
|
Cache::delete($sms_key);
|
|
|
@@ -1482,14 +1651,55 @@ $data=$user->toArray();
|
|
1482
|
1651
|
|
|
1483
|
1652
|
}
|
|
1484
|
1653
|
|
|
|
1654
|
+ /**
|
|
|
1655
|
+ * @param int $uid 用户ID
|
|
|
1656
|
+ * @param string $score 积分
|
|
|
1657
|
+ * @param int $status 积分状态
|
|
|
1658
|
+ * @param string $mark 备注
|
|
|
1659
|
+ * @param string $has_qian 连续签到天数
|
|
|
1660
|
+ * @param string $today_signintime 签到时间
|
|
|
1661
|
+ * @param int $order_id 订单ID
|
|
|
1662
|
+ * @param int $pm 1-收入。2-支出
|
|
|
1663
|
+ * @param string $order_type
|
|
|
1664
|
+ * @throws DbException
|
|
|
1665
|
+ */
|
|
|
1666
|
+ public function sign_add($uid, $score, $status, $mark, $has_qian = '', $today_signintime = '', $order_id = 0, $pm = 1, $order_type = '',$type='',$settlement_time = '')
|
|
|
1667
|
+ {
|
|
|
1668
|
+ if(!in_array($type,[1,2])){
|
|
|
1669
|
+ // 其他情况都直接返回,因为目前只有365专区购买才可以获得
|
|
|
1670
|
+ return false;
|
|
|
1671
|
+ }
|
|
|
1672
|
+
|
|
|
1673
|
+ $ins_data['uid'] = $uid;
|
|
|
1674
|
+ $ins_data['continuity_day'] = $has_qian;
|
|
|
1675
|
+ $ins_data['reward_socre'] = $score;
|
|
|
1676
|
+ $ins_data['signin_time'] = $today_signintime;
|
|
|
1677
|
+ $ins_data['addtime'] = time();
|
|
|
1678
|
+ $ins_data['status'] = $status;
|
|
|
1679
|
+ $ins_data['mark'] = $mark;
|
|
|
1680
|
+ $ins_data['type'] = $type;
|
|
|
1681
|
+ $ins_data['settlement_time'] = $settlement_time;// 结算时间 真正到了结算时间会结算
|
|
|
1682
|
+ $ins_data['order_id'] = $order_id;
|
|
|
1683
|
+ $ins_data['pm'] = $pm;
|
|
|
1684
|
+ $ins_data['order_type'] = $order_type;
|
|
|
1685
|
+ Db::name('user_sign_score')->insertGetId($ins_data);
|
|
|
1686
|
+
|
|
|
1687
|
+ if($pm == 1 && $status == 1){
|
|
|
1688
|
+ Db::name('user')->where('uid',$uid)->inc('score', $score)->update();
|
|
|
1689
|
+ }
|
|
|
1690
|
+ if($pm == 2){
|
|
|
1691
|
+ Db::name('user')->where('uid', $uid)->dec('score', $score)->update();
|
|
|
1692
|
+ }
|
|
|
1693
|
+ }
|
|
|
1694
|
+
|
|
1485
|
1695
|
public function yijianlogin(UserRepository $repository)
|
|
1486
|
1696
|
{
|
|
1487
|
1697
|
try {
|
|
1488
|
1698
|
// Db::name('log')->insert(['data'=>'一键登录进来了']);
|
|
1489
|
|
- $token = $this->request->params(['token'])['token'];
|
|
1490
|
|
- AlibabaCloud::accessKeyClient('LTAI5tAzGzm3Kjp8pzn7hHmx', '8ILb06tO6X7xxQk2uj2CDwFNbVWQei')
|
|
1491
|
|
- ->regionId('cn-hangzhou')
|
|
1492
|
|
- ->asDefaultClient();
|
|
|
1699
|
+ $token = $this->request->params(['token'])['token'];
|
|
|
1700
|
+ AlibabaCloud::accessKeyClient('LTAI5tAzGzm3Kjp8pzn7hHmx', '8ILb06tO6X7xxQk2uj2CDwFNbVWQei')
|
|
|
1701
|
+ ->regionId('cn-hangzhou')
|
|
|
1702
|
+ ->asDefaultClient();
|
|
1493
|
1703
|
|
|
1494
|
1704
|
$result = AlibabaCloud::rpc()
|
|
1495
|
1705
|
->product('Dypnsapi')
|
|
|
@@ -1622,17 +1832,17 @@ $data=$user->toArray();
|
|
1622
|
1832
|
try {
|
|
1623
|
1833
|
|
|
1624
|
1834
|
|
|
1625
|
|
- $phone=$this->request->params(['phone']);
|
|
1626
|
|
- if(empty($phone['phone'])){
|
|
1627
|
|
- return app('json')->fail('请填写手机号码');
|
|
1628
|
|
- }
|
|
1629
|
|
- $phone=$phone['phone'];
|
|
1630
|
|
- $uid=Db::name('user')->where('account',$phone)->find();
|
|
1631
|
|
- $user_name=Db::name('merchant')->where('uid',$uid['uid'])->value('mer_name');
|
|
1632
|
|
- if(!$user_name){
|
|
1633
|
|
- $user_name=$uid['nickname'];
|
|
1634
|
|
- }
|
|
1635
|
|
- return app('json')->success($user_name);
|
|
|
1835
|
+ $phone=$this->request->params(['phone']);
|
|
|
1836
|
+ if(empty($phone['phone'])){
|
|
|
1837
|
+ return app('json')->fail('请填写手机号码');
|
|
|
1838
|
+ }
|
|
|
1839
|
+ $phone=$phone['phone'];
|
|
|
1840
|
+ $uid=Db::name('user')->where('account',$phone)->find();
|
|
|
1841
|
+ $user_name=Db::name('merchant')->where('uid',$uid['uid'])->value('mer_name');
|
|
|
1842
|
+ if(!$user_name){
|
|
|
1843
|
+ $user_name=$uid['nickname'];
|
|
|
1844
|
+ }
|
|
|
1845
|
+ return app('json')->success($user_name);
|
|
1636
|
1846
|
}catch (\Exception $e) {
|
|
1637
|
1847
|
Db::name('log')->insert(['data'=>'订单支付出错:'.$e->getFile().':'.$e->getLine().'【'.$e->getMessage().'】']);
|
|
1638
|
1848
|
}
|