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 * @param int $storeId
* @return static|array|null * @return static|array|null
*/ */
public static function getMerchantId(int $merchantId) public static function getMerchantId(String $userName)
{ {
try { try {
$list = self::withoutGlobalScope() $info = self::withoutGlobalScope()
->with(['logoImage', "licenseImage"]) ->where('user_name', '=', $userName)
->where('merchant_id', '=', $merchantId)
->find(); ->find();
return $list ?? null; return $info['merchant_id'] ?? 0;
} catch (\Exception $e) { } catch (\Exception $e) {
return null; return 0;
} }
} }

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

Loading…
Cancel
Save