request->params([ ["service_name",""], ["service_type",""], ["status",""] ]); return success((new ServiceService())->getPage($data)); } /** * 服务详情 * @param int $id * @return \think\Response */ public function info(int $id){ return success((new ServiceService())->getInfo($id)); } /** * 添加服务 * @return \think\Response */ public function add(){ $data = $this->request->params([ ["service_name",""], ["preview_image_url",""], ["description",""], ["service_type",""], ["execution_rules",""], ["staff_reminder",0], ["customer_reminder",0], ["customer_confirmation",0], ["customer_feedback",""], ["status",""], ]); $this->validate($data, 'app\validate\service\Service.add'); $id = (new ServiceService())->add($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 服务编辑 * @param $id 服务id * @return \think\Response */ public function edit(int $id){ $data = $this->request->params([ ["service_name",""], ["preview_image_url",""], ["description",""], ["service_type",""], ["execution_rules",""], ["staff_reminder",0], ["customer_reminder",0], ["customer_confirmation",0], ["customer_feedback",""], ["status",""], ]); $this->validate($data, 'app\validate\service\Service.edit'); (new ServiceService())->edit($id, $data); return success('EDIT_SUCCESS'); } /** * 服务删除 * @param $id 服务id * @return \think\Response */ public function del(int $id){ (new ServiceService())->del($id); return success('DELETE_SUCCESS'); } }