request->params([ ["contract_status",""], ["contract_type",""], ["created_at",["",""]] ]); return success((new ContractService())->getPage($data)); } /** * 合同详情 * @param int $id * @return \think\Response */ public function info(int $id){ return success((new ContractService())->getInfo($id)); } /** * 添加合同 * @return \think\Response */ public function add(){ $data = $this->request->params([ ["contract_name",""], ["contract_template",""], ["contract_status",""], ["contract_type",""], ["remarks",""], ]); $this->validate($data, 'app\validate\contract\Contract.add'); $id = (new ContractService())->add($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 合同编辑 * @param $id 合同id * @return \think\Response */ public function edit(int $id){ $data = $this->request->params([ ["contract_name",""], ["contract_template",""], ["contract_status",""], ["contract_type",""], ["remarks",""], ]); $this->validate($data, 'app\validate\contract\Contract.edit'); (new ContractService())->edit($id, $data); return success('EDIT_SUCCESS'); } /** * 合同删除 * @param $id 合同id * @return \think\Response */ public function del(int $id){ (new ContractService())->del($id); return success('DELETE_SUCCESS'); } }