dataLimit = $config['diyformdatalimit']; } $this->assignconfig('spiderRecord', intval($config['spiderrecord']?? 0)); $this->model = new \app\admin\model\cms\Diyform; $this->view->assign("statusList", $this->model->getStatusList()); } /** * 查看 */ public function index() { //设置过滤方法 $this->request->filter(['strip_tags', 'trim']); if ($this->request->isAjax()) { //如果发送的来源是Selectpage,则转发到Selectpage if ($this->request->request('keyField')) { return $this->selectpage(); } list($where, $sort, $order, $offset, $limit) = $this->buildparams(); $list = $this->model ->where($where) ->order($sort, $order) ->paginate($limit); \app\admin\model\cms\SpiderLog::render($list, 'diyform'); $result = array("total" => $list->total(), "rows" => $list->items()); return json($result); } return $this->view->fetch(); } public function add() { if ($this->request->isAjax()){ $params = $this->request->post('row/a'); if ($params['notice'] == 1 && empty($params['notice_mobile'])){ $this->error("通知人手机号不能为空!"); } parent::add(); } return $this->view->fetch(); } public function edit($ids = null) { if ($this->request->isAjax()){ $params = $this->request->post('row/a'); if ($params['notice'] == 1 && empty($params['notice_mobile'])){ $this->error("通知人手机号不能为空!"); } } parent::edit($ids); return $this->view->fetch(); } /** * 检测元素是否可用 * @internal */ public function check_element_available() { $id = $this->request->request('id'); $name = $this->request->request('name'); $value = $this->request->request('value'); $name = substr($name, 4, -1); if (!$name) { $this->error(__('Parameter %s can not be empty', 'name')); } if ($id) { $this->model->where('id', '<>', $id); } $exist = $this->model->where($name, $value)->find(); if ($exist) { $this->error(__('The data already exist')); } else { $this->success(); } } }