12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- /**
- * 推送消息
- * Created by PhpStorm.
- * User: phperstar
- * Date: 2021/05/08
- * Time: 12:15
- */
- namespace JinDouYun\Controller\System;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\System\MPage;
- use Mall\Framework\Core\ErrorCode;
- use JinDouYun\Model\System\MSystemPushMessage;
- use Mall\Framework\Core\StatusCode;
- class ApiPushMessage extends BaseController
- {
- private $objMSystemPushMessage;
- /**
- * ApiTemplate constructor.
- * @param bool $isCheckAcl
- * @param bool $isMustLogin
- * @param bool $checkToken
- * @param bool $getAreaCode
- */
- public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = true,$getAreaCode=true)
- {
- parent::__construct($isCheckAcl, $isMustLogin, $checkToken,$getAreaCode);
- $authorization = $this->request->getServerParam('HTTP_AUTHORIZATION');
- if (!empty($authorization)) {
- self::getUserIdByAuthorization();
- }
- $this->objMSystemPushMessage = new MSystemPushMessage($this->onlineUserId, $this->onlineEnterpriseId);
- }
- /**
- * 获取对应推送模板的推送信息
- */
- public function getSettingDataByMessageIds()
- {
- $params = $this->request->getRawJson();
- if (empty($params)) {
- $this->sendOutput('参数为空', ErrorCode::$paramError);
- }
- $selectParams = [
- 'id' => getArrayItem($params, 'id', []),
- ];
- foreach ($selectParams as $key => $value) {
- if (empty($value)) {
- $this->sendOutput($key . '参数错误', ErrorCode::$paramError);
- }
- }
- $result = $this->objMSystemPushMessage->getSettingDataByMessageIds($selectParams);
- if($result->isSuccess()){
- $this->sendOutput($result->getData());
- }else{
- $this->sendOutput($result->getData(), $result->getErrorCode());
- }
- }
- }
|