CategorySettingController.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace hd\controllers;
  3. use bizHd\goods\classes\CategorySettingClass;
  4. use common\components\util;
  5. use Yii;
  6. /**
  7. * 商品分类配置:商城花材分类设置
  8. */
  9. class CategorySettingController extends BaseController
  10. {
  11. /**
  12. * 读取当前门店商城分类设置
  13. */
  14. public function actionDetail()
  15. {
  16. $info = CategorySettingClass::getOrInit($this->mainId, $this->shopId);
  17. util::success($info);
  18. }
  19. /**
  20. * 保存商城分类设置
  21. */
  22. public function actionSave()
  23. {
  24. $post = Yii::$app->request->post();
  25. $info = CategorySettingClass::saveSetting($this->mainId, $this->shopId, $post);
  26. util::success($info, '保存成功');
  27. }
  28. /**
  29. * 保存分类广告(仅 advertisement 字段)
  30. */
  31. public function actionSaveAdvertisement()
  32. {
  33. $post = Yii::$app->request->post();
  34. $advertisement = $post['advertisement'] ?? '';
  35. $info = CategorySettingClass::saveAdvertisement($this->mainId, $this->shopId, $advertisement);
  36. util::success($info, '保存成功');
  37. }
  38. }