From 9787fd304f775446df471b0540427f8b7ddbe9bc Mon Sep 17 00:00:00 2001 From: "DESKTOP-GG6FIN9\\Administrator" <15040771@qq.com> Date: Mon, 27 Jul 2020 10:43:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=AA=8C=E8=AF=81=E5=99=A8?= =?UTF-8?q?=20=E6=9C=8D=E5=8A=A1=E4=B8=93=E5=91=98=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E5=BF=AB=E6=8D=B7=E8=AF=84?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/ServiceEvaluateController.php | 18 +++++--- app/Request/PersonnelRequest.php | 42 +++++++++++++++++++ app/Request/UserRequest.php | 42 +++++++++++++++++++ app/Service/ServiceEvaluateService.php | 21 +++++++++- .../ServiceEvaluateServiceInterface.php | 4 +- 5 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 app/Request/PersonnelRequest.php create mode 100644 app/Request/UserRequest.php diff --git a/app/Controller/ServiceEvaluateController.php b/app/Controller/ServiceEvaluateController.php index f0f4eba..8440f30 100644 --- a/app/Controller/ServiceEvaluateController.php +++ b/app/Controller/ServiceEvaluateController.php @@ -5,6 +5,8 @@ namespace App\Controller; use App\Constants\ErrorCode; use App\Exception\BusinessException; use App\Request\EvaluateRequest; +use App\Request\UserRequest; +use App\Request\PersonnelRequest; use App\Service\ServiceEvaluateServiceInterface; use Hyperf\Di\Annotation\Inject; @@ -38,19 +40,25 @@ class ServiceEvaluateController extends BaseController /** *获取服务专员基本信息 */ - public function getPersonnelInfo() + public function getPersonnelInfo(PersonnelRequest $validator) { //根据用户iD 获取服务专员详细信息 - $user_id = $this->request->input('user_id', 0); - return $this->success($this->evaluateService->getPersonnelInfo($user_id)); + $service_personnel_id = $this->request->input('service_personnel_id', 0); + $res = $this->evaluateService->getPersonnelInfo($service_personnel_id); + //如果存在服务专员则获取默认快捷评价 + if(!empty($res)) { + $quick_evaluate = $this->evaluateService->getQuickEvaluate(); + $res->quick_evaluate = $quick_evaluate; + } + return $this->success($res); } /** *获取服务专员评价列表 */ - public function getEvaluateList() + public function getEvaluateList(PersonnelRequest $validator) { - //根据用户iD 获取服务专员详细信息 + //根据服务专员iD 获取服务专员评价列表 $service_personnel_id = $this->request->input('service_personnel_id', 0); return $this->success($this->evaluateService->getEvaluateList($service_personnel_id)); } diff --git a/app/Request/PersonnelRequest.php b/app/Request/PersonnelRequest.php new file mode 100644 index 0000000..f4afee6 --- /dev/null +++ b/app/Request/PersonnelRequest.php @@ -0,0 +1,42 @@ + 'required|nonempty|integer|exists:ims_cjdc_user,id', + ]; + } + + public function messages(): array + { + return [ + 'service_personnel_id.*' => ':attribute信息不正确', + ]; + } + + public function attributes(): array + { + return [ + 'service_personnel_id' => '服务专员', + ]; + } +} diff --git a/app/Request/UserRequest.php b/app/Request/UserRequest.php new file mode 100644 index 0000000..2eed8d4 --- /dev/null +++ b/app/Request/UserRequest.php @@ -0,0 +1,42 @@ + 'required|nonempty|integer|exists:ims_cjdc_user,id', + ]; + } + + public function messages(): array + { + return [ + 'user_id.*' => ':attribute信息不正确', + ]; + } + + public function attributes(): array + { + return [ + 'user_id' => '用户', + ]; + } +} diff --git a/app/Service/ServiceEvaluateService.php b/app/Service/ServiceEvaluateService.php index 041a304..13d26b3 100644 --- a/app/Service/ServiceEvaluateService.php +++ b/app/Service/ServiceEvaluateService.php @@ -27,10 +27,13 @@ class ServiceEvaluateService implements ServiceEvaluateServiceInterface return ServiceEvaluate::create($data); } - public function getPersonnelInfo($user_id) + public function getPersonnelInfo($service_personnel_id) { $res = Db::table('lanzu_service_personnel') - ->where(['user_id' => $user_id]) + ->where([ + ['id','=',$service_personnel_id], + ['status','=',1] + ]) ->first(); return $res; } @@ -43,4 +46,18 @@ class ServiceEvaluateService implements ServiceEvaluateServiceInterface return $res; } + public function getQuickEvaluate() + { + $data = (object)null; + $obj1 = (object)null; + $obj1->title1 = '服务态度超好'; + $obj1->title2 = '服务态度一般般'; + $data->quick_evaluate_title = $obj1; + $obj2 = (object)null; + $obj2->content1 = '超级细心'; + $obj2->content2 = '马马虎虎'; + $data->quick_evaluate_content = $obj2; + return $data; + } + } \ No newline at end of file diff --git a/app/Service/ServiceEvaluateServiceInterface.php b/app/Service/ServiceEvaluateServiceInterface.php index 22c6aa1..97ecbd6 100644 --- a/app/Service/ServiceEvaluateServiceInterface.php +++ b/app/Service/ServiceEvaluateServiceInterface.php @@ -9,8 +9,10 @@ interface ServiceEvaluateServiceInterface public function evaluate(); - public function getPersonnelInfo($user_id); + public function getPersonnelInfo($service_personnel_id); public function getEvaluateList($service_personnel_id); + public function getQuickEvaluate(); + } \ No newline at end of file