This commit is contained in:
mkm 2024-05-08 18:41:41 +08:00
parent 15729aacd7
commit 2ed0f06c6f
3 changed files with 9 additions and 5 deletions

View File

@ -77,7 +77,7 @@ class WechatUserService
$this->user = $user;
if(!$user->isEmpty()){
$this->user->supplier=Supplier::where('uid',$user['id'])->field('id,mer_name')->find();
$this->user->supplier=Supplier::where('uid',$user['id'])->with('userAuth')->field('id,mer_name')->find();
}
// $this->user->merchat=Merchant::where('uid',$user['id'])->find();
return $this;

View File

@ -74,12 +74,12 @@ class UserTokenCache extends BaseCache
$user = User::where('id', '=', $userSession->user_id)
->find();
$merchant=Merchant::where('uid',$userSession->user_id)->find();
$supplier=Supplier::where('uid',$userSession->user_id)->find();
// $merchant=Merchant::where('uid',$userSession->user_id)->find();
$supplier=Supplier::where('uid',$userSession->user_id)->with('userAuth')->find();
$userInfo = [
'user_id' => $user->id,
'nickname' => $user->nickname,
'merchant' => $merchant,
// 'merchant' => $merchant,
'supplier' => $supplier,
'token' => $token,
'mobile' => $user->mobile,

View File

@ -4,6 +4,7 @@ namespace app\common\model\supplier;
use app\common\model\BaseModel;
use app\common\model\user\UserAuth;
use think\model\concern\SoftDelete;
@ -18,5 +19,8 @@ class Supplier extends BaseModel
protected $name = 'supplier';
protected $deleteTime = 'delete_time';
public function userAuth()
{
return $this->hasOne(UserAuth::class, 'id', 'uid')->bind(['openid']);
}
}