更新用户信息
This commit is contained in:
parent
2076c7e535
commit
fa79b544f8
@ -73,12 +73,8 @@ class UserLogic extends BaseLogic
|
|||||||
*/
|
*/
|
||||||
public static function info(int $userId)
|
public static function info(int $userId)
|
||||||
{
|
{
|
||||||
$user = User::where(['id' => $userId])->with(['admin' => [
|
$user = User::where(['id' => $userId])->with(['admin','company'])
|
||||||
'company' => function ($query) {
|
->field('id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money,income,admin_id,company_id')
|
||||||
$query->field('id,company_name');
|
|
||||||
}
|
|
||||||
]])
|
|
||||||
->field('id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money,income,admin_id')
|
|
||||||
->findOrEmpty();
|
->findOrEmpty();
|
||||||
// $user['avatar'] = $user['avatar'] ? Request()->host() . $user['avatar'] : $user['avatar'];
|
// $user['avatar'] = $user['avatar'] ? Request()->host() . $user['avatar'] : $user['avatar'];
|
||||||
$user['has_password'] = !empty($user['password']);
|
$user['has_password'] = !empty($user['password']);
|
||||||
|
@ -21,6 +21,7 @@ use app\common\model\auth\Admin;
|
|||||||
use app\common\model\BaseModel;
|
use app\common\model\BaseModel;
|
||||||
use app\common\service\FileService;
|
use app\common\service\FileService;
|
||||||
use think\model\concern\SoftDelete;
|
use think\model\concern\SoftDelete;
|
||||||
|
use app\common\model\Company;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户模型
|
* 用户模型
|
||||||
@ -178,4 +179,9 @@ class User extends BaseModel
|
|||||||
return $this->hasOne(Admin::class, 'id', 'admin_id')->field('id,name,company_id,avatar');
|
return $this->hasOne(Admin::class, 'id', 'admin_id')->field('id,name,company_id,avatar');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function company()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Company::class, 'id', 'company_id')->field(['id','company_name','admin_id']);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user