From 07103bbf651f23bc08ed52f960d4234376d41660 Mon Sep 17 00:00:00 2001 From: liuchaofu <1873441552@qq.com> Date: Wed, 5 Jun 2024 23:00:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/user/UserLogic.php | 3 +-- app/common/model/user/User.php | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) 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