|
@@ -62,30 +62,34 @@ class User extends Api
|
|
|
public function index()
|
|
|
{
|
|
|
$uid = $this->auth->id;
|
|
|
- $userinfo = UserModel::where('id',$uid)
|
|
|
- ->with('userObject.education,education')
|
|
|
- ->find();
|
|
|
- $userinfo = $userinfo?$userinfo->toArray():[];
|
|
|
- $userinfo['integrity'] = $this->integrity();
|
|
|
- $userinfo['ilike'] = Like::where(['uid'=>$uid,'type'=>1])->count();
|
|
|
- $userinfo['likeme'] = Like::where(['nid'=>$uid,'type'=>1])->count();
|
|
|
- $userinfo['apply'] = Apply::where('nid',$uid)->count();
|
|
|
- $userinfo['lookme'] = Like::where(['nid'=>$uid,'type'=>2])->count();
|
|
|
- //未解锁数量
|
|
|
- $userinfo['likeme_subscript'] = Like::where(['nid'=>$uid,'type'=>1,'is_read'=>0])->count();
|
|
|
- $userinfo['apply_subscript'] = Apply::where(['nid'=>$uid,'n_is_read'=>0])->count();
|
|
|
- $userinfo['lookme_subscript'] = Like::where(['nid'=>$uid,'type'=>2,'is_read'=>0])->count();
|
|
|
+ if($this->auth->is_info){
|
|
|
+ $userinfo = UserModel::where('id',$uid)
|
|
|
+ ->with('userObject.education,education')
|
|
|
+ ->find();
|
|
|
+ $userinfo = $userinfo?$userinfo->toArray():[];
|
|
|
+ $userinfo['integrity'] = $this->integrity();
|
|
|
+ $userinfo['ilike'] = Like::where(['uid'=>$uid,'type'=>1])->count();
|
|
|
+ $userinfo['likeme'] = Like::where(['nid'=>$uid,'type'=>1])->count();
|
|
|
+ $userinfo['apply'] = Apply::where('nid',$uid)->count();
|
|
|
+ $userinfo['lookme'] = Like::where(['nid'=>$uid,'type'=>2])->count();
|
|
|
+ //未解锁数量
|
|
|
+ $userinfo['likeme_subscript'] = Like::where(['nid'=>$uid,'type'=>1,'is_read'=>0])->count();
|
|
|
+ $userinfo['apply_subscript'] = Apply::where(['nid'=>$uid,'n_is_read'=>0])->count();
|
|
|
+ $userinfo['lookme_subscript'] = Like::where(['nid'=>$uid,'type'=>2,'is_read'=>0])->count();
|
|
|
|
|
|
- $userinfo['authentication'] = 0;
|
|
|
- $userinfo['id_authentication']?$userinfo['authentication']++:'';
|
|
|
- $userinfo['work_authentication']?$userinfo['authentication']++:'';
|
|
|
- $userinfo['education_authentication']?$userinfo['authentication']++:'';
|
|
|
- $userinfo['photo'] = explode(',',$userinfo['photo']);
|
|
|
- $userinfo['age'] = getAge($userinfo['birthday']);;
|
|
|
- //城市
|
|
|
- $userinfo['province_name'] = Area::where('id',$userinfo['province'])->value('name');
|
|
|
- $userinfo['city_name'] = Area::where('id',$userinfo['city'])->value('name');
|
|
|
- $userinfo['area_name'] = Area::where('id',$userinfo['area'])->value('name');
|
|
|
+ $userinfo['authentication'] = 0;
|
|
|
+ $userinfo['id_authentication']?$userinfo['authentication']++:'';
|
|
|
+ $userinfo['work_authentication']?$userinfo['authentication']++:'';
|
|
|
+ $userinfo['education_authentication']?$userinfo['authentication']++:'';
|
|
|
+ $userinfo['photo'] = explode(',',$userinfo['photo']);
|
|
|
+ $userinfo['age'] = getAge($userinfo['birthday']);;
|
|
|
+ //城市
|
|
|
+ $userinfo['province_name'] = Area::where('id',$userinfo['province'])->value('name');
|
|
|
+ $userinfo['city_name'] = Area::where('id',$userinfo['city'])->value('name');
|
|
|
+ $userinfo['area_name'] = Area::where('id',$userinfo['area'])->value('name');
|
|
|
+ }else{
|
|
|
+ $userinfo['is_info'] = 0;
|
|
|
+ }
|
|
|
$this->success('', ['welcome' => $userinfo]);
|
|
|
}
|
|
|
//计算信息完整度百分比
|