123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- /**
- * 加盟管理Controller
- * Created by PhpStorm.
- * User: 小威
- * Date: 2020/03/25
- * Time: 16:16
- */
- namespace JinDouYun\Controller\Manage;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\StatusCode;
- use JinDouYun\Controller\BaseController;
- use JinDouYun\Model\Manage\MJoin;
- class Join extends BaseController
- {
- private $objMJoin;
- public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = false)
- {
- parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
- $this->objMJoin = new MJoin();
- }
- /**
- * 获取所有加盟列表
- * @throws \Exception
- */
- public function getAllJoin()
- {
- $result = $this->objMJoin->getAllJoin();
- if ($result->isSuccess()) {
- parent::sendOutput($result->getData());
- } else {
- parent::sendOutput($result->getData(), ErrorCode::$dberror);
- }
- }
- /**
- * 加盟添加
- */
- public function addJoin()
- {
- $params = $this->request->getRawJson();
- $data = [
- 'name' => isset($params['name']) ? $params['name'] : '',
- 'enterpriseName' => isset($params['enterpriseName']) ? $params['enterpriseName'] : '',
- 'position' => isset($params['position']) ? $params['position'] : '',
- 'mobile' => isset($params['mobile']) ? $params['mobile'] : '',
- 'provinceCode' => isset($params['provinceCode']) ? $params['provinceCode'] : '',
- 'cityCode' => isset($params['cityCode']) ? $params['cityCode'] : '',
- 'districtCode' => isset($params['districtCode']) ? $params['districtCode'] : '',
- 'address' => isset($params['address']) ? $params['address'] : '',
- 'createTime' => time(),
- 'updateTime' => time(),
- ];
- foreach($data as $key => $value){
- if(empty($value)){
- parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
- }
- }
- $modelResult = $this->objMJoin->addJoin($data);
- if(!$modelResult->isSuccess()){
- parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
- }
- parent::sendOutput($modelResult->getData());
- }
- /**
- * 预约列表
- * @throws \Exception
- */
- public function getAllReservation()
- {
- $result = $this->objMJoin->getAllReservation();
- if ($result->isSuccess()) {
- parent::sendOutput($result->getData());
- } else {
- parent::sendOutput($result->getData(), ErrorCode::$dberror);
- }
- }
- /**
- * 预约添加
- */
- public function addReservation()
- {
- $params = $this->request->getRawJson();
- $data = [
- 'mobile' => isset($params['mobile']) ? $params['mobile'] : '',
- 'createTime' => time(),
- ];
- foreach($data as $key => $value){
- if(empty($value)){
- parent::sendOutput($key.'参数错误', ErrorCode::$paramError);
- }
- }
- $modelResult = $this->objMJoin->addReservation($data);
- if(!$modelResult->isSuccess()){
- parent::sendOutput($modelResult->getData(), $modelResult->getErrorCode());
- }
- parent::sendOutput($modelResult->getData());
- }
- }
|