|
@@ -8,6 +8,9 @@ use App\Models\User;
|
|
use App\Models\UserInfoModel;
|
|
use App\Models\UserInfoModel;
|
|
use App\Models\UserInviteLog;
|
|
use App\Models\UserInviteLog;
|
|
use App\Models\UserVipLimit;
|
|
use App\Models\UserVipLimit;
|
|
|
|
+use App\Models\UserBlacklistModel;
|
|
|
|
+use App\Models\UserLikeModel;
|
|
|
|
+use App\Models\UserLookModel;
|
|
use App\Services\JPushService;
|
|
use App\Services\JPushService;
|
|
use App\Services\SmsService;
|
|
use App\Services\SmsService;
|
|
use App\Services\TencentImAccountService;
|
|
use App\Services\TencentImAccountService;
|
|
@@ -186,12 +189,13 @@ class AuthorizationsController extends Controller
|
|
$resdata['ycode'] =$user->ycode;
|
|
$resdata['ycode'] =$user->ycode;
|
|
$resdata['online'] =$user->online;
|
|
$resdata['online'] =$user->online;
|
|
$resdata['notice_status'] =$user->notice_status;
|
|
$resdata['notice_status'] =$user->notice_status;
|
|
|
|
+ $resdata['userinfo'] = $this->getinfo($user->id);
|
|
return $resdata;
|
|
return $resdata;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
public function captcha(){
|
|
public function captcha(){
|
|
- return response(captcha_src());
|
|
|
|
|
|
+ return response(captcha_src());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -199,12 +203,12 @@ class AuthorizationsController extends Controller
|
|
* @param $user_id
|
|
* @param $user_id
|
|
* @return string
|
|
* @return string
|
|
*/
|
|
*/
|
|
- public function create_code() {
|
|
|
|
- $code = create_invite_code();
|
|
|
|
- if(User::where(['ycode'=>$code])->first()){
|
|
|
|
- $code = create_invite_code();
|
|
|
|
- }
|
|
|
|
- return $code;
|
|
|
|
|
|
+ public function create_code() {
|
|
|
|
+ $code = create_invite_code();
|
|
|
|
+ if(User::where(['ycode'=>$code])->first()){
|
|
|
|
+ $code = create_invite_code();
|
|
|
|
+ }
|
|
|
|
+ return $code;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -418,4 +422,60 @@ class AuthorizationsController extends Controller
|
|
'expires_in' => Auth::guard('api')->factory()->getTTL() * 60
|
|
'expires_in' => Auth::guard('api')->factory()->getTTL() * 60
|
|
]);
|
|
]);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取个人资料
|
|
|
|
+ */
|
|
|
|
+ public function getinfo($user_id){
|
|
|
|
+ $user = User::where(['id'=>$user_id])->first();
|
|
|
|
+ $userinfo = UserInfoModel::query()->where('user_id', $user->id)->first();
|
|
|
|
+
|
|
|
|
+ //不看拉黑用户
|
|
|
|
+ $black_list = UserBlacklistModel::query()
|
|
|
|
+ ->where('user_id',$user->id)
|
|
|
|
+ ->orWhere('black_id',$user->id)
|
|
|
|
+ ->select(['black_id'])
|
|
|
|
+ ->get()
|
|
|
|
+ ->toArray();
|
|
|
|
+ $ids = array_column($black_list,'black_id');
|
|
|
|
+ $ids[]= $user->id;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $userinfo['hobby'] = !empty($userinfo['hobby'])?explode(',',$userinfo['hobby']):[];
|
|
|
|
+ $userinfo['photo'] = !empty($userinfo['photo'])?json_decode($userinfo['photo'],true):[];
|
|
|
|
+ $video_info = !empty($userinfo['video'])?json_decode($userinfo['video'],true):[];
|
|
|
|
+ $userinfo['video'] = array_column($video_info,'url');
|
|
|
|
+ $userinfo['like_num'] = $user->like_num;
|
|
|
|
+ $userinfo['like_me_num'] = $user->like_me_num;
|
|
|
|
+ $userinfo['look_num'] = UserLookModel::query()
|
|
|
|
+ ->with(['user'=>function($query){
|
|
|
|
+ $query->select('id','sex','is_vip','tencent_im_user_id');
|
|
|
|
+ },'user_info'])
|
|
|
|
+ ->where(['look_id'=>$user->id])
|
|
|
|
+ ->whereNotIn('user_id',$ids)
|
|
|
|
+ ->whereHas("user",function($query){
|
|
|
|
+ $query->where('is_distory',0)->select();
|
|
|
|
+ })->count();
|
|
|
|
+ $userinfo['look_num_red'] = UserLookModel::query()
|
|
|
|
+ ->with(['user'=>function($query){
|
|
|
|
+ $query->select('id','sex','is_vip','tencent_im_user_id');
|
|
|
|
+ },'user_info'])
|
|
|
|
+ ->where(['look_id'=>$user->id,'status'=>0])
|
|
|
|
+ ->whereNotIn('user_id',$ids)
|
|
|
|
+ ->whereHas("user",function($query){
|
|
|
|
+ $query->where('is_distory',0)->select();
|
|
|
|
+ })
|
|
|
|
+ ->count();
|
|
|
|
+ $userinfo['sex'] = $user->sex;
|
|
|
|
+ $userinfo['mobile'] = $user->mobile;
|
|
|
|
+ $userinfo['is_auth'] = $user->is_auth;
|
|
|
|
+ $userinfo['is_vip'] = $user->is_vip;
|
|
|
|
+ $userinfo['ycode'] = $user->ycode;
|
|
|
|
+ $userinfo['notice_status'] = $user->notice_status;
|
|
|
|
+ $userinfo['update_num'] = UserVipLimit::query()->where('user_id',$user->id)->value('user_info');
|
|
|
|
+ $userinfo['see_user_num'] = UserVipLimit::query()->where('user_id',$user->id)->value("user_detail");
|
|
|
|
+ return $userinfo;
|
|
|
|
+ }
|
|
}
|
|
}
|