1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- /**
- * 小程序系统公告
- * Created by PhpStorm.
- * User: 小威
- * Date: 2020/04/16
- * Time: 17:23
- */
- namespace JinDouYun\Controller\System;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\StatusCode;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\System\MAnnouncement;
- class ApiAnnouncement extends BaseController
- {
- private $objMAnnouncement;
- public function __construct($isCheckAcl = false, $isMustLogin = false)
- {
- parent::__construct($isCheckAcl, $isMustLogin);
- $this->objMAnnouncement = new MAnnouncement($this->onlineEnterpriseId);
- }
- /**
- * 公告列表
- */
- public function getAllAnnouncement()
- {
- $params = $this->request->getRawJson();
- if( empty($params) ){
- $this->sendOutput('参数为空', ErrorCode::$paramError );
- }
- $pageParams = pageToOffset($params['page']?:1, $params['pageSize']?:10);
- $selectParams['limit'] = $pageParams['limit'];
- $selectParams['offset'] = $pageParams['offset'];
- if(isset($params['upStatus']) && !empty($params['upStatus'])){
- $selectParams['upStatus'] = $params['upStatus'];
- }
- $selectParams['type'] = StatusCode::$standard;
- $result = $this->objMAnnouncement->getAllAnnouncement($selectParams);
- if(!$result->isSuccess()){
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- $returnData = $result->getData();
- $pageData = [
- 'pageIndex' => $params['page'],
- 'pageSize' => $params['pageSize'],
- 'pageTotal' => $returnData['total'],
- ];
- parent::sendOutput($returnData['data'], 0, $pageData);
- }
- /**
- * 公告详情
- */
- public function getAnnouncementInfo()
- {
- $id = $this->request->param('request_id');
- if(empty($id)){
- $this->sendOutput('参数为空', ErrorCode::$paramError );
- }
- $where['id'] = $id;
- $where['type'] = StatusCode::$standard;
- $result = $this->objMAnnouncement->getAnnouncementInfo($where);
- if($result->isSuccess()){
- parent::sendOutput($result->getData());
- }else{
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- }
- /**
- * 弹窗公告详情
- */
- public function getupStatusAnnouncementInfo()
- {
- $where['type'] = StatusCode::$standard;
- $where['upStatus'] = StatusCode::$standard;
- $result = $this->objMAnnouncement->getAnnouncementInfo($where);
- if($result->isSuccess()){
- parent::sendOutput($result->getData());
- }else{
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- }
- }
|