model = new SystemBannerModel(); } public function index() { if ($this->request->isAjax()) { if (input('selectFields')) { return $this->selectList(); } list($page, $limit, $where) = $this->buildTableParames(); list($count, $list) = SystemBannerLogic::getList($page, $limit, $where, $this->sort); $data = [ 'code' => 0, 'msg' => '', 'count' => $count, 'data' => $list, ]; return json($data); } return $this->fetch(); } /** * @NodeAnotation(title="修改") */ public function edit($id) { $row = $this->model->find($id); empty($row) && $this->error('数据不存在'); if ($this->request->isAjax()) { $post = $this->request->post(); $rule = []; $this->validate($post, $rule); $save = SystemBannerLogic::edit($post); $save === true ? $this->success('保存成功') : $this->error('保存失败'); } $row['img_pic'] = __HTTPGETIMGADMIN($row['img_pic']); $this->assign('row', $row); return $this->fetch(); } /** * @NodeAnotation(title="添加") */ public function add() { if ($this->request->isAjax()) { $row = request()->post(); $save = SystemBannerLogic::add($row); $save === true ? $this->success('添加成功') : $this->error('添加失败'); } return $this->fetch(); } }