|
|
@@ -734,9 +734,9 @@ class Auth extends BaseController
|
|
734
|
734
|
}
|
|
735
|
735
|
//养老金展示
|
|
736
|
736
|
// $data['annuity'] = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',5) -> where('status',1) -> sum('number');
|
|
737
|
|
- $a = Db::name('user_bill')->where('uid', $user['uid'])->where('commission_type', 5)->where('pm', 1)->whereIn('status', [0, 1])->sum('number');
|
|
738
|
|
- $b = Db::name('user_bill')->where('uid', $user['uid'])->where('commission_type', 5)->where('pm', 0)->whereIn('status', [0, 1])->sum('number');
|
|
739
|
|
- $data['annuity'] = $a - $b;
|
|
|
737
|
+ $a = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',5) -> where('status',0) -> sum('number');
|
|
|
738
|
+ $b = Db::name('user_bill') -> where('uid',$user['uid']) -> where('commission_type',5) -> where('status',1) -> sum('number');
|
|
|
739
|
+ $data['annuity'] = $a +$b;
|
|
740
|
740
|
//上级身份是否大仓会员
|
|
741
|
741
|
$is_da_cang_vip=Db::name('da_cang_user')->where('status',1)->where('uid',$user["uid"])->find();
|
|
742
|
742
|
//渠道商
|
|
|
@@ -1401,7 +1401,7 @@ class Auth extends BaseController
|
|
1401
|
1401
|
|
|
1402
|
1402
|
public function verify(UserAuthValidate $validate)
|
|
1403
|
1403
|
{
|
|
1404
|
|
- $data = $this->request->params(['phone', 'code', 'key',"type", 'areaCode']);
|
|
|
1404
|
+ $data = $this->request->params(['phone', 'code', 'key',"type"]);
|
|
1405
|
1405
|
$validate->sceneVerify()->check($data);
|
|
1406
|
1406
|
log::info("发送短信方法");
|
|
1407
|
1407
|
if ($data['type']=="login"){
|
|
|
@@ -1442,7 +1442,7 @@ class Auth extends BaseController
|
|
1442
|
1442
|
$sms_key = 'api.auth.sms.' . $data['phone'];
|
|
1443
|
1443
|
$sms_code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT);
|
|
1444
|
1444
|
$sms_time = systemConfig('sms_time') ? systemConfig('sms_time') : 30 ;
|
|
1445
|
|
- $res = app()->make(AliYunSmsService::class)->send(($data['areaCode'] ?? '') . $data['phone'], $sms_code);
|
|
|
1445
|
+ $res = app()->make(AliYunSmsService::class)->send($data['phone'], $sms_code);
|
|
1446
|
1446
|
if($res['Code']!='OK'){
|
|
1447
|
1447
|
Db::name('log')->insert(['data'=>'幸福保短信发送失败:'.json_encode($res,256)]);
|
|
1448
|
1448
|
return app('json')->fail('操作过于频繁,请稍后重试~');
|
|
|
@@ -1759,31 +1759,33 @@ class Auth extends BaseController
|
|
1759
|
1759
|
}
|
|
1760
|
1760
|
|
|
1761
|
1761
|
|
|
1762
|
|
- /**
|
|
1763
|
|
- * 微信授权登录 一键登录
|
|
1764
|
|
- * @return mixed
|
|
1765
|
|
- * @throws DataNotFoundException
|
|
1766
|
|
- * @throws DbException
|
|
1767
|
|
- * @throws ModelNotFoundException
|
|
1768
|
|
- */
|
|
1769
|
|
- public function wechatCheck()
|
|
1770
|
|
- {
|
|
1771
|
|
- $data = $this->request->params(['openid']);
|
|
|
1762
|
+ /*微信授权登录*/
|
|
|
1763
|
+ public function wechatCheck(){
|
|
|
1764
|
+ $data = $this->request->params(['openid']);
|
|
|
1765
|
+ // , 'nickname', 'avatar'
|
|
1772
|
1766
|
$data['nickname'] = $this->request->param('nickname', null);
|
|
1773
|
1767
|
$data['avatar'] = $this->request->param('avatar', null);
|
|
1774
|
1768
|
|
|
1775
|
|
- if (!$data['openid'] || $data['openid'] == '' || $data['openid'] == 'undefined') {
|
|
|
1769
|
+ if(!$data['openid'] || $data['openid'] == '' || $data['openid'] =='undefined'){
|
|
1776
|
1770
|
return app('json')->fail("openid参数缺失");
|
|
1777
|
1771
|
}
|
|
1778
|
1772
|
|
|
1779
|
|
- /** @var UserRepository $repository */
|
|
1780
|
1773
|
$repository = app()->make(UserRepository::class);
|
|
1781
|
|
- $result = $repository->wechatCheck($data['openid'], $data['nickname'], $data['avatar']);
|
|
1782
|
|
-
|
|
1783
|
|
- if (isset($result['code']) && $result['code'] == 200) {
|
|
|
1774
|
+ if($this->source=='yhc'){
|
|
|
1775
|
+ $result = $repository ->wechatCheckYhc($data['openid']);
|
|
|
1776
|
+ }else{
|
|
|
1777
|
+ $result = $repository ->wechatCheck($data['openid'], $data['nickname'], $data['avatar']);
|
|
|
1778
|
+ }
|
|
|
1779
|
+ if(isset($result['code']) && $result['code'] == 200){
|
|
1784
|
1780
|
$user = $repository->accountByUser($result['user']['account']);
|
|
1785
|
1781
|
$tokenInfo = $repository->createToken($user);
|
|
1786
|
1782
|
$repository->loginAfter($user);
|
|
|
1783
|
+ if($this->source=='yhc'){
|
|
|
1784
|
+// $user=$user->toArray();
|
|
|
1785
|
+ $user->avatar=Db::name('enterprise_user')->where('mer_id',$this->merId)->where('uid',$user['uid'])->value('avatar');
|
|
|
1786
|
+ }
|
|
|
1787
|
+
|
|
|
1788
|
+
|
|
1787
|
1789
|
return app('json')->success($repository->returnToken($user, $tokenInfo));
|
|
1788
|
1790
|
}
|
|
1789
|
1791
|
return app("json")->fail($result['msg']);
|
|
|
@@ -2090,47 +2092,50 @@ class Auth extends BaseController
|
|
2090
|
2092
|
}
|
|
2091
|
2093
|
$user_res=Db::name('user')->where('account',$phone)->find();
|
|
2092
|
2094
|
|
|
|
2095
|
+ $isnew = false;
|
|
|
2096
|
+
|
|
2093
|
2097
|
if(!$user_res){
|
|
2094
|
2098
|
$spread_uid=Db::name('product_share')->where('id',$share_id['share_id'])->value('uid');
|
|
2095
|
2099
|
if (!intval($spread_uid)) {
|
|
2096
|
2100
|
$spread_uid = 0;
|
|
2097
|
2101
|
}
|
|
2098
|
2102
|
$repository->registr($phone, 123456,'APP','','','',$spread_uid);
|
|
|
2103
|
+
|
|
|
2104
|
+ $isnew = true;
|
|
2099
|
2105
|
}
|
|
2100
|
2106
|
$user = $repository->accountByUser($phone);
|
|
2101
|
|
- // if($this->source=='yhc' && $this->merId){
|
|
2102
|
|
- // $where=['mer_id'=>$this->merId,'uid'=>$user['uid']];
|
|
2103
|
|
- // $count=Db::name('enterprise_user')->where($where)->count();
|
|
2104
|
|
- // if($count<1){
|
|
2105
|
|
- // $insert=['mer_id'=>$this->merId,'uid'=>$user['uid']];
|
|
2106
|
|
- // $data = $this->request->params(['spread', 'share_id']);
|
|
2107
|
|
- //
|
|
2108
|
|
- // if(isset($data['spread']) && $data['spread']){
|
|
2109
|
|
- // $insert['puid']= $data['spread'];
|
|
2110
|
|
- // $insert['node_uid']= $data['spread'];
|
|
2111
|
|
- // }else if(isset($data['share_id']) && $data['share_id']){
|
|
2112
|
|
- // $spread_uid = Db::name('product_share')->where('id', $data['share_id'])->value('uid');
|
|
2113
|
|
- // $insert['puid']= $spread_uid;
|
|
2114
|
|
- // $insert['node_uid']= $spread_uid;
|
|
2115
|
|
- // }
|
|
2116
|
|
- // if(!isset($insert['node_uid']) || !$insert['node_uid']){
|
|
2117
|
|
- // return app('json')->fail('必须要有邀请人才能注册',['is'=>1]);
|
|
2118
|
|
- // }
|
|
2119
|
|
- //
|
|
2120
|
|
- // if(isset($data['spread']) && isset($zhuce)){
|
|
2121
|
|
- // $insert['puid']= $data['spread'];
|
|
2122
|
|
- // $insert['node_uid']= $data['spread'];
|
|
2123
|
|
- // }
|
|
2124
|
|
- // Db::name('enterprise_user')->insert($insert);
|
|
2125
|
|
- // }
|
|
2126
|
|
- // }
|
|
2127
|
|
- if (!empty($user) && $user instanceof User) {
|
|
2128
|
|
- $user = $repository->mainUser($user);
|
|
2129
|
|
- $tokenInfo = $repository->createToken($user);
|
|
2130
|
|
- return app('json')->success($repository->returnToken($user, $tokenInfo));
|
|
2131
|
|
- } else {
|
|
2132
|
|
- return app('json')->fail('未查询到用户信息');
|
|
|
2107
|
+ if($this->source=='yhc' && $this->merId){
|
|
|
2108
|
+ $where=['mer_id'=>$this->merId,'uid'=>$user['uid']];
|
|
|
2109
|
+ $count=Db::name('enterprise_user')->where($where)->count();
|
|
|
2110
|
+ if($count<1){
|
|
|
2111
|
+ $insert=['mer_id'=>$this->merId,'uid'=>$user['uid']];
|
|
|
2112
|
+ $data = $this->request->params(['spread', 'share_id']);
|
|
|
2113
|
+
|
|
|
2114
|
+ if(isset($data['spread']) && $data['spread']){
|
|
|
2115
|
+ $insert['puid']= $data['spread'];
|
|
|
2116
|
+ $insert['node_uid']= $data['spread'];
|
|
|
2117
|
+ }else if(isset($data['share_id']) && $data['share_id']){
|
|
|
2118
|
+ $spread_uid = Db::name('product_share')->where('id', $data['share_id'])->value('uid');
|
|
|
2119
|
+ $insert['puid']= $spread_uid;
|
|
|
2120
|
+ $insert['node_uid']= $spread_uid;
|
|
|
2121
|
+ }
|
|
|
2122
|
+ if(!isset($insert['node_uid']) || !$insert['node_uid']){
|
|
|
2123
|
+ return app('json')->fail('必须要有邀请人才能注册',['is'=>1]);
|
|
|
2124
|
+ }
|
|
|
2125
|
+
|
|
|
2126
|
+ if(isset($data['spread']) && isset($zhuce)){
|
|
|
2127
|
+ $insert['puid']= $data['spread'];
|
|
|
2128
|
+ $insert['node_uid']= $data['spread'];
|
|
|
2129
|
+ }
|
|
|
2130
|
+ Db::name('enterprise_user')->insert($insert);
|
|
|
2131
|
+ }
|
|
2133
|
2132
|
}
|
|
|
2133
|
+ $user = $repository->mainUser($user);
|
|
|
2134
|
+
|
|
|
2135
|
+ $tokenInfo = $repository->createToken($user);
|
|
|
2136
|
+
|
|
|
2137
|
+ return app('json')->success(array_merge($repository->returnToken($user, $tokenInfo), ['is_new' => $isnew ? 1 : 0]));
|
|
|
2138
|
+
|
|
2134
|
2139
|
}catch (Exception $exception){
|
|
2135
|
2140
|
Db::name('log')->insert(['data'=>'获取手机号失败--'.$exception->getFile().':'.$exception->getLine().'【'.$exception->getMessage().'】']);
|
|
2136
|
2141
|
}
|