feature/main20240421
guojia 7 months ago
parent 91ab11708f
commit a06a47fde0
  1. 2
      app/common/model/GoodsCategoryRel.php
  2. 18
      app/common/model/Merchant.php
  3. 14
      app/store/controller/Controller.php

@ -41,7 +41,7 @@ class GoodsCategoryRel extends BaseModel
$dataset = [];
foreach ($categoryIds as $categoryId) {
$dataset[] = [
'category_id' => $categoryId,
'category_id' => $categoryId ?? 0,
'goods_id' => $goodsId,
'store_id' => $storeId ?: self::$storeId
];

@ -46,6 +46,24 @@ class Merchant extends BaseModel
return $this->HasMany('UploadFile', 'file_id', 'license_img_id');
}
/**
* 详情信息
* @param int $storeId
* @return static|array|null
*/
public static function getMerchantId(int $merchantId)
{
try {
$list = self::withoutGlobalScope()
->with(['logoImage', "licenseImage"])
->where('merchant_id', '=', $merchantId)
->find();
return $list ?? null;
} catch (\Exception $e) {
return null;
}
}
/**
* 详情信息

@ -17,6 +17,7 @@ use cores\BaseController;
use app\store\service\Auth as AuthService;
use app\common\service\store\User as StoreUserService;
use cores\exception\BaseException;
use app\common\model\Merchant as MerchantModel;
/**
* 商户后台控制器基类
@ -81,6 +82,8 @@ class Controller extends BaseController
$this->checkPrivilege();
// 强制验证当前访问的控制器方法method
$this->checkMethodRules();
$this->getMerchantId();
}
/**
@ -148,6 +151,17 @@ class Controller extends BaseController
$this->storeId = $this->request->storeId();
}
/**
* 获取当前登录的商城ID
*/
protected function getMerchantId()
{
$user = StoreUserService::getLoginInfo();
print_r($user);die;
$this->merchantId = MerchantModel::getMerchantId();
}
/**
* 强制验证当前访问的控制器方法method
* @return void

Loading…
Cancel
Save