model=new CgdInfo(); } public function status(){ $param= $this->request->param(['id'=>'','status'=>''],'post','trim'); $valid= $this->validate($param,[ 'id|订单编号'=>'require|number', 'status|订单状态'=>'require|number|in:0,1,2,3' ]); if($valid!==true) return error($valid); $model= $this->model->findOrEmpty($param['id']); if($model->isEmpty())return error('订单不存在'); if($model->status==$param['status']) return error('订单状态已更新'); $model->status=$param['status']; $save = $model->save(); if($save===false)return error('更新失败'); return success('更新成功'); } }