| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace mall\controllers;
- use bizHd\goods\classes\CategorySettingClass;
- use common\components\util;
- use Yii;
- /**
- * 商城客户端:分类页配置(xhCategorySetting)
- */
- class CategorySettingController extends BaseController
- {
- /** 分类页配置允许未登录读取,便于访客浏览分类菜单 */
- public $guestAccess = ['detail'];
- /**
- * 读取当前门店分类页配置(花材展示名、置顶、广告等)
- * GET /category-setting/detail
- * 未登录也可读:只要带 account 解析出 mainId/shopId 即可(getOrInit 只读不写库)
- */
- public function actionDetail()
- {
- // 无店铺上下文时返回默认空配置,避免游客误报登录
- if (empty($this->mainId) || empty($this->shopId)) {
- util::success([
- 'id' => 0,
- 'mainId' => intval($this->mainId),
- 'shopId' => intval($this->shopId),
- 'itemCateName' => '',
- 'isItemCateTop' => 0,
- 'isItemCateShow' => 0,
- 'advertisement' => '',
- ]);
- }
- $info = CategorySettingClass::getOrInit($this->mainId, $this->shopId);
- util::success($info);
- }
- }
|