get(); $list = $this->service->getList($param,'*',$param['page']??0,$param['limit']??0); return successTrans("success.data",$list); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[Route(path: "info/{id}",methods: "get")] public function info($id): Response { try { $take = $this->service->getOne(["id"=>$id,'status'=>1,'is_del'=>0]); if ($take->isEmpty()) return errorTrans("empty.error"); return successTrans("success.data",$take->toArray()); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[Route(path: "agreed/{id}",methods: "post")] public function agreed($id): Response { try { $apply = $this->service->getOne(["id"=>$id]); if ($apply->isEmpty()) return errorTrans("empty.error"); $state = $this->service->update($id,['status'=>1]) && $this->userService->update($apply['uid'],['is_cutter'=>1]); if (!$state) return errorTrans("error.data"); return successTrans("success.data"); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[Route(path: "refuse/{id}",methods: "post")] public function refuse (Request $request,$id): Response { try { $remark = $request->post('remark',''); $apply = $this->service->getOne(["id"=>$id]); if ($apply->isEmpty()) return errorTrans("empty.error"); $state = $this->service->update($id,['status'=>2,'remark'=>$remark]); if (!$state) return errorTrans("error.data"); return successTrans("success.data"); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } }