feature/main20240421
guojia 7 months ago
parent a06a47fde0
commit d8b29c7a0d
  1. 11
      app/common/model/Merchant.php
  2. 3
      app/store/controller/Controller.php

@ -51,16 +51,15 @@ class Merchant extends BaseModel
* @param int $storeId
* @return static|array|null
*/
public static function getMerchantId(int $merchantId)
public static function getMerchantId(String $userName)
{
try {
$list = self::withoutGlobalScope()
->with(['logoImage', "licenseImage"])
->where('merchant_id', '=', $merchantId)
$info = self::withoutGlobalScope()
->where('user_name', '=', $userName)
->find();
return $list ?? null;
return $info['merchant_id'] ?? 0;
} catch (\Exception $e) {
return null;
return 0;
}
}

@ -157,9 +157,8 @@ class Controller extends BaseController
protected function getMerchantId()
{
$user = StoreUserService::getLoginInfo();
print_r($user);die;
$this->merchantId = MerchantModel::getMerchantId();
$this->merchantId = MerchantModel::getMerchantId($user['user']['user_name']);
}
/**

Loading…
Cancel
Save