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'] ]); }