diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index e7ecffde9..1adee2af9 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -60,10 +60,9 @@ class UserLogic extends BaseLogic public static function info($uid) { - $data = User::where('id',$uid) + $data = User::with(['userShip'])->where('id',$uid) ->field('avatar,real_name,nickname,account,mobile,sex,login_ip,user_money,total_recharge_amount,user_ship') ->find(); - //判断是不是员工 if($data){ $data = $data->toArray(); diff --git a/app/common/model/user/User.php b/app/common/model/user/User.php index 5ba4141c1..6917e0c4e 100644 --- a/app/common/model/user/User.php +++ b/app/common/model/user/User.php @@ -21,6 +21,13 @@ class User extends BaseModel protected $deleteTime = 'delete_time'; + public function userShip() + { + return $this->hasOne(UserShip::class,'id','user_ship') +// return $this->hasOne(UserShip::class,'user_ship','id') + ->bind(['vip_name'=>'title','discount','limit']); + } + /** * @notes 关联用户授权模型 * @return \think\model\relation\HasOne