model=new \app\admin\model\GoodChange(); } //列表详情 public function list(){ $params = $this->request->param(['spuCode'=>'','page' => 1,'size' => 15],'post','trim'); $where = []; if($params['spuCode'] !== '') { $where[] = ['spuCode','like',"%{$params['spuCode']}%"]; } $list = $this->model ->where($where)->json(['before','after']) ->order('id desc') ->paginate(["page"=>$params['page'],"list_rows"=>$params["size"]]); $this->success('获取成功',['list' => $list->items(),'count' => $list->total()]); } //详情 public function info(){ $params=$this->request->param(['id'=>''],'post','trim'); $valid=Validate::rule(['id|修改记录ID'=>'require']); if($valid->check($params)==false){ $this->error($valid->getError()); } $changeInfo = $this->model ->json(['before','after']) ->where(["id"=>$params['id']]) ->findOrEmpty(); if($changeInfo->isEmpty()){ $this->error("修改记录不存在"); } $this->success("获取成功",$changeInfo); } }