|
@@ -19,7 +19,6 @@ class Usercenter extends Api
|
|
|
'id',
|
|
|
'username',
|
|
|
'nickname',
|
|
|
-
|
|
|
'avatar',
|
|
|
|
|
|
'mobile',
|
|
@@ -52,6 +51,22 @@ class Usercenter extends Api
|
|
|
'match_typing_price',
|
|
|
|
|
|
];
|
|
|
+ protected $allowFields_simple = [
|
|
|
+ 'id',
|
|
|
+ 'username',
|
|
|
+ 'nickname',
|
|
|
+ 'avatar',
|
|
|
+
|
|
|
+ 'idcard_status',
|
|
|
+ 'real_status',
|
|
|
+ 'gender',
|
|
|
+
|
|
|
+ 'open_match_video',
|
|
|
+ 'open_match_audio',
|
|
|
+ 'match_video_price',
|
|
|
+ 'match_audio_price',
|
|
|
+ 'match_typing_price',
|
|
|
+ ];
|
|
|
|
|
|
|
|
|
|
|
@@ -59,7 +74,7 @@ class Usercenter extends Api
|
|
|
public function getuserinfo_simple(){
|
|
|
$uid = input_post('uid',0);
|
|
|
|
|
|
- $field = $this->allowFields;
|
|
|
+ $field = $this->allowFields_simple;
|
|
|
$userinfo = Db::name('user')->field($field)->where('id',$uid)->find();
|
|
|
|
|
|
if(!$userinfo){
|
|
@@ -67,19 +82,7 @@ class Usercenter extends Api
|
|
|
}
|
|
|
|
|
|
//用户数据
|
|
|
- $userinfo = info_domain_image($userinfo,['avatar','photo_images','video_bio','audio_bio']);
|
|
|
-
|
|
|
- $new_data = [
|
|
|
- 'age' => birthtime_to_age($userinfo['birthday']),
|
|
|
- 'birthday' => date('Y-m-d',$userinfo['birthday']),
|
|
|
- ];
|
|
|
-
|
|
|
- //合并
|
|
|
- $userinfo = array_merge($userinfo,$new_data);
|
|
|
-
|
|
|
- //vip
|
|
|
- $userinfo['vip_endtime'] = Db::name('user_wallet')->where('user_id',$uid)->value('vip_endtime');
|
|
|
- $userinfo['is_vip'] = $userinfo['vip_endtime'] > time() ? 1 : 0;
|
|
|
+ $userinfo = info_domain_image($userinfo,['avatar']);
|
|
|
|
|
|
//是否喜欢和关注
|
|
|
$userinfo['is_follow'] = $this->is_follow($this->auth->id,$uid);
|
|
@@ -90,50 +93,54 @@ class Usercenter extends Api
|
|
|
$is_black = Db::name('user_black')->where(['uid'=>$this->auth->id,'black_uid'=>$uid])->find();
|
|
|
$userinfo['is_black'] = $is_black ? 1 : 0;
|
|
|
|
|
|
- //关注人数,粉丝人数
|
|
|
- $follow_num = Db::name('user_follow')->where(['uid'=>$uid])->count('id');
|
|
|
- $fans_num = Db::name('user_follow')->where(['follow_uid'=>$uid])->count('id');
|
|
|
- $userinfo['follow_num'] = $follow_num;
|
|
|
- $userinfo['fans_num'] = $fans_num;
|
|
|
-
|
|
|
//活跃,在线
|
|
|
$userinfo['active_info'] = $this->user_activeinfo($uid);
|
|
|
|
|
|
- //用户权限
|
|
|
- //$userinfo['power'] = Db::name('user_power')->where('user_id',$uid)->find();
|
|
|
+ //此用户与我的亲密度 信息
|
|
|
+ $userinfo['intimacy_info'] = $this->get_intimacy_info($uid);
|
|
|
|
|
|
- //vip如果开了隐私保护,需要隐藏距离
|
|
|
- $weizhi = $this->user_power($userinfo['id'],'weizhi');
|
|
|
- if($weizhi == 0){
|
|
|
- $userinfo['cityname'] = '';
|
|
|
- }
|
|
|
+ //我给他的备注
|
|
|
+ $nickname_remark = Db::name('nickname_remark')->where(['uid'=>$this->auth->id,'to_uid'=>$uid])->value('nickname_remark');
|
|
|
+ $userinfo['nickname_remark'] = !empty($nickname_remark) ? $nickname_remark : '';
|
|
|
|
|
|
- //追加登录用户的头像
|
|
|
- $userinfo['my_avatar'] = localpath_to_netpath($this->auth->avatar);
|
|
|
|
|
|
- //此用户与我的亲密度 信息
|
|
|
- //api/match/intimacylevel
|
|
|
+ $this->success('success',$userinfo);
|
|
|
+ }
|
|
|
|
|
|
- //最新一条动态
|
|
|
- $last_dongtai = Db::name('topic_dongtai')->field('content,images')->where('user_id',$uid)->where('type',1)->where('auditstatus',1)->order('id desc')->find();
|
|
|
- $last_dongtai = info_domain_image($last_dongtai,['images']);
|
|
|
- $userinfo['last_dongtai'] = $last_dongtai;
|
|
|
+ //两个人的亲密度
|
|
|
+ //api/match/intimacylevel
|
|
|
+ private function get_intimacy_info($user_id){
|
|
|
+ $level = 0; //当前等级
|
|
|
+ $level_name = ''; //当前等级名称
|
|
|
+ $qinmi_sum = 0; //当前亲密度
|
|
|
+
|
|
|
+ if ($this->auth->id > $user_id) { //大的在后
|
|
|
+ $where['uid'] = $user_id;
|
|
|
+ $where['other_uid'] = $this->auth->id;
|
|
|
+ } else { //小的在前
|
|
|
+ $where['uid'] = $this->auth->id;
|
|
|
+ $where['other_uid'] = $user_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ $user_intimacy_info = Db::name('user_intimacy')->where($where)->find();
|
|
|
+ if ($user_intimacy_info) {
|
|
|
+ //当前亲密度
|
|
|
+ $qinmi_sum = $user_intimacy_info['value'];
|
|
|
+
|
|
|
+ //当前等级信息
|
|
|
+ $level_info = Db::name('intimacy_level')->where(['value' => ['elt', $user_intimacy_info['value']]])->order('level desc')->find();
|
|
|
+ if ($level_info) {
|
|
|
+ $level = $level_info['level'];
|
|
|
+ $level_name = $level_info['name'];
|
|
|
+ }
|
|
|
|
|
|
- //礼物墙
|
|
|
- $userinfo['gift_wall'] = [];
|
|
|
- if($this->user_power($uid,'giftwall')==1){
|
|
|
- $gift_wall = Db::name('gift_user_typing')->alias('log')
|
|
|
- ->join('gift', 'gift.id = log.gift_id', 'LEFT')
|
|
|
- ->field('log.id,log.gift_name,sum(log.number) as number,gift.image')
|
|
|
- ->where(['log.user_to_id' => $uid])
|
|
|
- ->group('log.gift_id')
|
|
|
- ->order('gift.price desc')
|
|
|
- ->select();
|
|
|
- $gift_wall = list_domain_image($gift_wall,['image']);
|
|
|
- $userinfo['gift_wall'] = $gift_wall;
|
|
|
}
|
|
|
|
|
|
- $this->success('success',$userinfo);
|
|
|
+ $data['level'] = $level; //当前等级
|
|
|
+ $data['level_name'] = $level_name; //当前等级名称
|
|
|
+ $data['qinmi_sum'] = $qinmi_sum; //当前亲密度
|
|
|
+
|
|
|
+ return $data;
|
|
|
}
|
|
|
|
|
|
//获取他人用户信息,留下足迹
|
|
@@ -200,6 +207,13 @@ class Usercenter extends Api
|
|
|
//用户权限
|
|
|
//$userinfo['power'] = Db::name('user_power')->where('user_id',$uid)->find();
|
|
|
|
|
|
+ //此用户与我的亲密度 信息
|
|
|
+ $userinfo['intimacy_info'] = $this->get_intimacy_info($uid);
|
|
|
+
|
|
|
+ //我给他的备注
|
|
|
+ $nickname_remark = Db::name('nickname_remark')->where(['uid'=>$this->auth->id,'to_uid'=>$uid])->value('nickname_remark');
|
|
|
+ $userinfo['nickname_remark'] = !empty($nickname_remark) ? $nickname_remark : '';
|
|
|
+
|
|
|
//vip如果开了隐私保护,需要隐藏距离
|
|
|
$weizhi = $this->user_power($userinfo['id'],'weizhi');
|
|
|
if($weizhi == 0){
|