123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?php
- namespace JinDouYun\Controller\System;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\System\MReceiptTemplate;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\StatusCode;
- /**
- * Description:
- * Class ReceiptTemplate
- * @package JinDouYun\Controller\System
- */
- class ReceiptTemplate extends BaseController
- {
- /**
- * @var MReceiptTemplate
- */
- private $objMReceiptTemplate;
- public function __construct($isCheckAcl = true, $isMustLogin = true, $checkToken = true, $getAreaCode = false)
- {
- parent::__construct($isCheckAcl, $isMustLogin, $checkToken, $getAreaCode);
- $this->objMReceiptTemplate = new MReceiptTemplate($this->onlineEnterpriseId,$this->onlineUserId);
- }
- /**
- * Doc: (des="")
- * User: XMing
- * Date: 2020/8/26
- * Time: 10:24 上午
- */
- public function getAll()
- {
- $result = $this->objMReceiptTemplate->getAll();
- if($result->isSuccess()){
- $pageData = [
- 'pageIndex' => 1,
- 'pageSize' => 10,
- 'pageTotal' => count($result->getData()),
- ];
- parent::sendOutput($result->getData(),0,$pageData);
- }
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- /**
- * Doc: (des="")
- * User: XMing
- * Date: 2020/8/26
- * Time: 10:46 上午
- */
- public function save()
- {
- $params = $this->request->getRawJson();
- if (empty($params)) {
- parent::sendOutput('参数为空', ErrorCode::$paramError);
- }
- $data = [
- 'id' => isset($params['id']) ? $params['id'] : null,
- 'title' => isset($params['title']) ? $params['title'] : null,
- 'describe' => isset($params['describe']) ? $params['describe'] : '',
- 'fieldsData' => isset($params['fieldsData']) ? json_encode($params['fieldsData']) : [],
- ];
- foreach ($data as $key => $value) {
- if (empty($value) && $value != '') {
- parent::sendOutput($key . '参数错误', ErrorCode::$paramError);
- }
- }
- $id = $data['id'];
- unset($data['id']);
- $result = $this->objMReceiptTemplate->save($data,$id);
- if($result->isSuccess()){
- parent::sendOutput($result->getData());
- }
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- public function getInfo()
- {
- $id = $this->request->param('request_id');
- if (empty($id)){
- parent::sendOutput('id参数为空', ErrorCode::$paramError);
- }
- $result = $this->objMReceiptTemplate->getInfo($id);
- if($result->isSuccess()){
- parent::sendOutput($result->getData());
- }
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- /**
- * Doc: (des="")
- * User: XMing
- * Date: 2020/8/29
- * Time: 4:48 下午
- */
- public function getTemplateInfo()
- {
- $id = $this->request->param('request_id');
- if (empty($id)){
- parent::sendOutput('id参数为空', ErrorCode::$paramError);
- }
- $result = $this->objMReceiptTemplate->getTemplateInfo($id);
- if($result->isSuccess()){
- parent::sendOutput($result->getData());
- }
- parent::sendOutput($result->getData(), $result->getErrorCode());
- }
- }
|