ProcessSetting.Class.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace JinDouYun\Controller\System;
  3. use JinDouYun\Controller\BaseController;
  4. use JinDouYun\Model\System\MProcessSetting;
  5. use Mall\Framework\Core\ErrorCode;
  6. /**
  7. * @copyright Copyright (c) https://www.qianniaovip.com All rights reserved
  8. * Description: 流程设置
  9. * Class ProcessSetting
  10. * @package JinDouYun\Controller\System
  11. */
  12. class ProcessSetting extends BaseController
  13. {
  14. /**
  15. * @var MProcessSetting
  16. */
  17. private $objMProcessSetting;
  18. /**
  19. * ProcessSetting constructor.
  20. * @param bool $isCheckAcl
  21. * @param bool $isMustLogin
  22. * @param bool $checkToken
  23. * @param bool $getAreaCode
  24. */
  25. public function __construct($isCheckAcl = true, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
  26. {
  27. parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
  28. $this->objMProcessSetting = new MProcessSetting($this->onlineEnterpriseId);
  29. }
  30. /**
  31. * Doc: (des="设置")
  32. * User: XMing
  33. * Date: 2020/11/6
  34. * Time: 11:47 上午
  35. */
  36. public function set()
  37. {
  38. $params = $this->request->getRawJson();
  39. if (empty($params)) {
  40. parent::sendOutput('参数为空', ErrorCode::$paramError);
  41. }
  42. $data = [];
  43. foreach ($params as $key => $param){
  44. $data[$key] = [
  45. 'processType' => isset($param['processType']) ? $param['processType'] : null,
  46. 'content' => isset($param['content']) ? json_encode($param['content']) : null,
  47. 'enterpriseId' => $this->onlineEnterpriseId,
  48. 'id' => isset($param['id']) ? $param['id'] : null,
  49. ];
  50. foreach ($data[$key] as $k => $v) {
  51. if (is_null($v)) {
  52. parent::sendOutput($k . '参数错误', ErrorCode::$paramError);
  53. }
  54. }
  55. }
  56. $result = $this->objMProcessSetting->set($data);
  57. if ($result->isSuccess()) {
  58. parent::sendOutput($result->getData());
  59. }
  60. parent::sendOutput($result->getData(), $result->getErrorCode());
  61. }
  62. /**
  63. * Doc: (des="配置列表")
  64. * User: XMing
  65. * Date: 2020/11/6
  66. * Time: 12:16 下午
  67. */
  68. public function getAll()
  69. {
  70. $result = $this->objMProcessSetting->getAll();
  71. if ($result->isSuccess()) {
  72. parent::sendOutput($result->getData());
  73. }
  74. parent::sendOutput($result->getData(), $result->getErrorCode());
  75. }
  76. }