From b47600bc9d42940f0ece6113533060b0ce217b7a Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Wed, 6 Mar 2024 15:15:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E5=95=86=E6=88=B7?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E7=99=BB=E5=BD=95=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=8E=E8=BF=94=E5=9B=9E=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../merchant/MerchantAdminRepository.php | 12 +++++++----- app/controller/api/store/merchant/Merchant.php | 18 +++++++++--------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/app/common/repositories/system/merchant/MerchantAdminRepository.php b/app/common/repositories/system/merchant/MerchantAdminRepository.php index 124c557..1e39884 100644 --- a/app/common/repositories/system/merchant/MerchantAdminRepository.php +++ b/app/common/repositories/system/merchant/MerchantAdminRepository.php @@ -204,17 +204,19 @@ class MerchantAdminRepository extends BaseRepository */ $merchantRepository = app()->make(MerchantRepository::class); $merchant = $merchantRepository->get($adminInfo->mer_id); - if (!$merchant) - throw new ValidateException('商户不存在'); - if (!$merchant['status']) - throw new ValidateException('商户已被锁定'); + if (!$merchant) throw new ValidateException('商户不存在'); + if (!$merchant['status']) throw new ValidateException('商户已被锁定'); - $adminInfo->merchant_type = $merchant->merchant_type ?? 0; $adminInfo->last_time = date('Y-m-d H:i:s'); $adminInfo->last_ip = app('request')->ip(); $adminInfo->login_count++; $adminInfo->save(); event('admin.merLogin',compact('adminInfo')); + $adminInfo->merchant_type = $merchant->merchant_type ?? 0; + $adminInfo->mer_name = $merchant->mer_name ?? ''; + $adminInfo->mer_avatar = $merchant->mer_avatar ?? ''; + + return $adminInfo; } diff --git a/app/controller/api/store/merchant/Merchant.php b/app/controller/api/store/merchant/Merchant.php index 0e5c48f..dadf081 100644 --- a/app/controller/api/store/merchant/Merchant.php +++ b/app/controller/api/store/merchant/Merchant.php @@ -6,6 +6,7 @@ namespace app\controller\api\store\merchant; use app\common\repositories\store\service\StoreServiceRepository; use app\common\repositories\system\merchant\MerchantAdminRepository; +use app\common\repositories\system\merchant\MerchantRepository; use app\common\repositories\user\UserMerchantRepository; use crmeb\services\QrcodeService; use think\App; @@ -168,16 +169,15 @@ class Merchant extends BaseController $admin = $adminInfo->toArray(); // 判断:这里仅允许酒道馆和普通商户登录 if($admin['merchant_type'] == 2) throw new ValidateException('当前账号禁止登录!'); - // unset($admin['pwd']); - // $data = [ - // 'token' => $tokenInfo['token'], - // 'exp' => $tokenInfo['out'], - // 'admin' => $admin - // ]; + + return app('json')->success([ - 'token' => $tokenInfo['token'], - 'exp' => $tokenInfo['out'], - 'mer_id' => $admin['mer_id'] + 'token' => $tokenInfo['token'], + 'exp' => $tokenInfo['out'], + 'mer_id' => $admin['mer_id'], + 'merchant_type' => $admin['merchant_type'], + 'mer_name' => $admin['mer_name'], + 'mer_avatar' => $admin['mer_avatar'] ]); }