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()); } }