get()->goCheck('userService'); return $this->dataLists(new UserServiceLists()); } /** * @notes 添加服务商信息 * @return \think\response\Json * @author heshihu * @date 2022/2/21 17:31 */ public function addUserService() { if($this->request->isPost()) { $params = (new UserServiceValidate())->post()->goCheck('add'); // $userId = $this->userId; // $params['user_id'] = $userId; switch ($params['type']){ case 1 : $type_name = '农机手'; break; case 2 : $type_name = '烘干服务'; break ; case 3 : $type_name = '飞防服务'; break; default : $type_name = ''; break; } $result = UserServiceLogic::add($params,$type_name); if (1 === $result['code']) { return $this->success($type_name.'入驻信息添加成功', $result['data'], 1, 1); }else{ return $this->fail(UserServiceLogic::getError()); } }else{ return $this->fail('请求方式错误'); } // // // $params = (new UserServiceValidate())->post()->goCheck('add'); // UserServiceLogic::add($params); // return $this->success('添加成功', [], 1, 1); } /** * @notes 编辑农耕分类 * @return \think\response\Json * @author heshihu * @date 2022/2/21 17:49 */ public function edit() { $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('edit'); $result = AgriculturalMachineryServiceCategoryLogic::edit($params); if (true === $result) { return $this->success('编辑成功', [], 1, 1); } return $this->fail(AgriculturalMachineryServiceCategoryLogic::getError()); } /** * @notes 删除农耕分类 * @return \think\response\Json * @author heshihu * @date 2022/2/21 17:52 */ public function delete() { $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('delete'); AgriculturalMachineryServiceCategoryLogic::delete($params); return $this->success('删除成功', [], 1, 1); } /** * @notes 农耕分类详情 * @return \think\response\Json * @author heshihu * @date 2022/2/21 17:54 */ public function detail() { $params = (new AgriculturalMachineryServiceCategoryValidate())->goCheck('detail'); $result = AgriculturalMachineryServiceCategoryLogic::detail($params); return $this->data($result); } /** * @notes 更改农耕分类状态 * @return \think\response\Json * @author heshihu * @date 2022/2/21 10:15 */ public function updateStatus() { $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('status'); $result = AgriculturalMachineryServiceCategoryLogic::updateStatus($params); if (true === $result) { return $this->success('修改成功', [], 1, 1); } return $this->fail(AgriculturalMachineryServiceCategoryLogic::getError()); } /** * @notes 获取有效农耕分类 * @return \think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author 段誉 * @date 2022/10/13 10:54 */ public function getValidCate() { $params = (new AgriculturalMachineryServiceCategoryValidate())->get()->goCheck('list'); $result = AgriculturalMachineryServiceCategoryLogic::getValidCateData($params); return $this->data($result); } /** * @notes 获取会员列表 * @return \think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author 段誉 * @date 2022/10/13 10:54 */ public function getUserList() { $result = UserServiceLogic::getValidUserData(); return $this->data($result); } }