CommonApp.Class.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * 常用应用控制器
  4. * Created by PhpStorm.
  5. * User: 小威
  6. * Date: 2020/01/11
  7. * Time: 10:10
  8. */
  9. namespace JinDouYun\Controller\SystemSettings;
  10. use Exception;
  11. use Mall\Framework\Core\ErrorCode;
  12. use Mall\Framework\Core\StatusCode;
  13. use JinDouYun\Controller\BaseController;
  14. use JinDouYun\Model\SystemSettings\MCommonApp;
  15. class CommonApp extends BaseController
  16. {
  17. private $objMCommonApp;
  18. public function __construct($isCheckAcl = false, $isMustLogin = true, $checkToken = true)
  19. {
  20. parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
  21. $this->objMCommonApp = new MCommonApp($this->onlineEnterpriseId,$this->onlineUserId);
  22. }
  23. /**
  24. * 修改常用应用
  25. */
  26. public function updateCommonApp()
  27. {
  28. $id = $this->request->param('request_id');
  29. $params = $this->request->getRawJson();
  30. if (empty($params)) {
  31. parent::sendOutput('参数为空', ErrorCode::$paramError);
  32. }
  33. $where = [
  34. 'userCenterId' => $id ? $id : $this->onlineUserId,
  35. 'enterpriseId' => $this->onlineEnterpriseId,
  36. ];
  37. $modelResult = $this->objMCommonApp->updateCommonApp($params, $where);
  38. if (!$modelResult->isSuccess()) {
  39. parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
  40. }
  41. parent::sendOutput($modelResult->getData());
  42. }
  43. /**
  44. * 查询常用应用
  45. */
  46. public function getCommonAppInfo()
  47. {
  48. $id = $this->request->param('request_id');
  49. $where = [
  50. 'userCenterId' => $id ? $id : $this->onlineUserId,
  51. 'enterpriseId' => $this->onlineEnterpriseId,
  52. ];
  53. $modelResult = $this->objMCommonApp->getCommonAppInfo($where);
  54. if (!$modelResult->isSuccess()) {
  55. parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
  56. }
  57. parent::sendOutput($modelResult->getData());
  58. }
  59. }