request->isPost()) { $params = (new ServiceValidate())->post()->goCheck('agricultural_machinery_operator'); $userId = $this->userId; $params['user_id'] = $userId; $result = ServiceLogic::Settled($params); if (1 === $result['code']) { switch ($params['type']){ case 1 : $type_name = '农机手'; break; case 2 : $type_name = '烘干服务'; break ; case 3 : $type_name = '飞防服务'; break; default : $type_name = ''; break; } return $this->success($type_name.'入驻信息添加成功', $result['data'], 1, 1); } }else{ return $this->fail('请求方式错误'); } } public function getAreaList(){ $get = $this->request->get(); $result = ServiceLogic::getsAreaLists($get); return $this->data($result); } public function getCateList(){ $params = (new ServiceValidate())->get()->goCheck('cate'); $result = ServiceLogic::getsCateLists($params); return $this->data($result); } /** * @notes 服务商列表 * @return \think\response\Json * @author 段誉 * @date 2022/9/7 15:38 */ public function getServiceList() { return $this->dataLists(new ServiceLists()); } /** * @notes 查询服务商信息 * @return \think\response\Json * @author 段誉 * @date 2022/9/7 15:38 */ public function getServiceInfo() { $params = (new ServiceValidate())->get()->goCheck('info'); $result = ServiceLogic::getInfo($params,$this->userId); if ($result === false) { return $this->fail(ServiceLogic::getError()); } return $this->data($result); } /* * 服务商续费 * */ public function serviceRenew(){ if($this->request->isPost()) { $params = (new ServiceValidate())->post()->goCheck('serviceRenew'); $userId = $this->userId; $params['user_id'] = $userId; $result = ServiceLogic::Renew($params); if (1 === $result['code']) { switch ($params['type']){ case 1 : $type_name = '农机手'; break; case 2 : $type_name = '烘干服务'; break ; case 3 : $type_name = '飞防服务'; break; default : $type_name = ''; break; } return $this->success($type_name.'续费信息生成成功', $result['data'], 1, 1); } return $this->fail(ServiceLogic::getError()); }else{ return $this->fail('请求方式错误'); } } public function autoUpdateStatus(){ $result = ServiceLogic::updateServiceStatus(); return $this->success($result, [], 1, 1); } public function getServiceContent() { $result = ServiceLogic::getServiceContentInfo(); if ($result === false) { return $this->fail(ServiceLogic::getError()); } return $this->data($result); } public function getUserServiceInfo(){ $userId = $this->userId; $result = ServiceLogic::getUserServiceInfo($userId); if ($result === false) { return $this->fail(ServiceLogic::getError()); } return $this->data($result); } public function getServiceDisclaimer() { $result = ServiceLogic::getServiceDisclaimer(); return $this->data($result); } public function addScanLog(){ if($this->request->isPost()) { $params = (new ServiceValidate())->post()->goCheck('log'); $userId = $this->userId; $params['user_id'] = $userId; $result = ServiceLogic::addLog($params); if (true === $result) { return $this->success('日志插入成功', [], 1, 1); } return $this->fail(ServiceLogic::getError()); }else{ return $this->fail('请求方式错误'); } } public function getMechanicalCateList(){ $params = (new ServiceValidate())->get()->goCheck('mechanical'); $result = ServiceLogic::getsMechanicalCateLists($params); return $this->data($result); } }