title = '站内信列表'; $query = $this->_query($this->table)->like('phone'); $query->dateBetween('add_time')->order('sort asc,id dasc')->page(); } /** * 数据列表处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ protected function _index_page_filter(&$data) { foreach($data as &$vo){ if(empty($vo['phone'])) $vo['phone'] = "所有人"; } } /** * 添加站内信 * @auth true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function add() { $this->title = '添加站内信'; $this->_form($this->table, 'form'); } /** * 编辑站内信 * @auth true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function edit() { $this->title = '编辑站内信'; $this->_form($this->table, 'form'); } /** * 删除站内信 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function remove() { $this->applyCsrfToken(); $this->_delete($this->table); } /** * 表单数据处理 * @param array $vo * @throws \ReflectionException */ protected function _form_filter(&$vo){ if ($this->request->isGet()) { if(!isset($vo['top'])) $vo['top'] = '0'; } if($this->request->isPost()) { if($vo['phone']) $vo['uid'] = Db::name('LcUser')->where("phone = '{$vo['phone']}'")->value('id'); } if (empty($vo['add_time'])) $vo['add_time'] = date("Y-m-d H:i:s"); } }