ClassSetting.Class.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * 分类设置
  4. * Created by PhpStorm.
  5. * User: 小威
  6. * Date: 2020/03/10
  7. * Time: 09:45
  8. */
  9. namespace JinDouYun\Controller\System;
  10. use JinDouYun\Controller\BaseController;
  11. use Mall\Framework\Core\ErrorCode;
  12. use Mall\Framework\Core\StatusCode;
  13. use JinDouYun\Model\System\MClassSetting;
  14. class ClassSetting extends BaseController
  15. {
  16. private $objMClassSetting;
  17. /**
  18. * TemplateModule constructor.
  19. * @param bool $isCheckAcl
  20. * @param bool $isMustLogin
  21. */
  22. public function __construct($isCheckAcl = true, $isMustLogin = true)
  23. {
  24. parent::__construct($isCheckAcl, $isMustLogin);
  25. $this->objMClassSetting = new MClassSetting($this->onlineUserId, $this->onlineEnterpriseId);
  26. }
  27. /**
  28. * 添加,编辑分类设置
  29. */
  30. public function setClassSetting()
  31. {
  32. $params = $this->request->getRawJson();
  33. if (empty($params)) {
  34. $this->sendOutput('参数为空', ErrorCode::$paramError);
  35. }
  36. $data = [
  37. 'enterpriseId' => $this->onlineEnterpriseId,
  38. 'content' => isset($params) ? $params : '',
  39. ];
  40. foreach ($data as $key => $value) {
  41. if (empty($value) && $value !== 0) {
  42. $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
  43. }
  44. }
  45. $modelResult = $this->objMClassSetting->setClassSetting($data);
  46. if(!$modelResult->isSuccess()){
  47. parent::sendOutput($modelResult->getData(), ErrorCode::$dberror);
  48. }
  49. parent::sendOutput($modelResult->getData());
  50. }
  51. /**
  52. * 获取分类设置
  53. */
  54. public function getClassSettingInfo()
  55. {
  56. $selectParams = [
  57. 'enterpriseId' => $this->onlineEnterpriseId,
  58. ];
  59. $modelResult = $this->objMClassSetting->getClassSettingInfo($selectParams);
  60. if (!$modelResult->isSuccess()) {
  61. parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
  62. }
  63. parent::sendOutput($modelResult->getData());
  64. }
  65. }