手机端用户信息添加公司信息
This commit is contained in:
parent
085324505f
commit
eb7855f721
@ -69,8 +69,12 @@ class UserLogic extends BaseLogic
|
||||
*/
|
||||
public static function info(int $userId)
|
||||
{
|
||||
$user = User::where(['id' => $userId])
|
||||
->field('id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money,income')
|
||||
$user = User::where(['id' => $userId])->with(['admin' => [
|
||||
'company' => function ($query) {
|
||||
$query->field('id,company_name');
|
||||
}
|
||||
]])
|
||||
->field('id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money,income,admin_id')
|
||||
->findOrEmpty();
|
||||
$user['has_password'] = !empty($user['password']);
|
||||
$user['has_auth'] = self::hasWechatAuth($userId);
|
||||
|
@ -17,6 +17,7 @@ namespace app\common\model\user;
|
||||
|
||||
|
||||
use app\common\enum\user\UserEnum;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\service\FileService;
|
||||
use think\model\concern\SoftDelete;
|
||||
@ -172,5 +173,9 @@ class User extends BaseModel
|
||||
return $sn;
|
||||
}
|
||||
|
||||
public function admin()
|
||||
{
|
||||
return $this->hasOne(Admin::class, 'id', 'admin_id')->field('id,name,company_id');
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user