|
|
@@ -527,43 +527,4 @@ class GhsController extends BaseController
|
|
|
util::success(GhsNoticeClass::getClientDetail($id));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 根据批发商 ghsId 或 shopId 解析 mainId(列表接口用,勿与公告 id 混用)
|
|
|
- */
|
|
|
- protected function resolveGhsMainId(): int
|
|
|
- {
|
|
|
- $get = Yii::$app->request->get();
|
|
|
- $ghsId = intval($get['ghsId'] ?? 0);
|
|
|
- $shopId = intval($get['shopId'] ?? 0);
|
|
|
- $ghsShopId = 0;
|
|
|
-
|
|
|
- if ($ghsId > 0) {
|
|
|
- $ghs = GhsClass::getById($ghsId);
|
|
|
- if (empty($ghs)) {
|
|
|
- util::fail('没有找到批发商');
|
|
|
- }
|
|
|
- if (!empty($this->shopId)) {
|
|
|
- GhsClass::valid($ghs, $this->shopId);
|
|
|
- }
|
|
|
- $ghsShopId = intval($ghs['shopId'] ?? 0);
|
|
|
- } elseif ($shopId > 0) {
|
|
|
- $ghsShop = ShopClass::getById($shopId, true);
|
|
|
- if (empty($ghsShop) || $ghsShop->ptStyle != dict::getDict('ptStyle', 'ghs')) {
|
|
|
- util::fail('没有找到批发店');
|
|
|
- }
|
|
|
- $ghsShopId = $shopId;
|
|
|
- } else {
|
|
|
- util::fail('参数不对');
|
|
|
- }
|
|
|
-
|
|
|
- $ghsShop = ShopClass::getById($ghsShopId, true);
|
|
|
- if (empty($ghsShop)) {
|
|
|
- util::fail('没有找到批发商');
|
|
|
- }
|
|
|
- $mainId = intval($ghsShop->mainId ?? 0);
|
|
|
- if ($mainId <= 0) {
|
|
|
- util::fail('批发商信息不完整');
|
|
|
- }
|
|
|
- return $mainId;
|
|
|
- }
|
|
|
}
|