title = '公户账单管理'; $query = $this->_query($this->table); $query->where(array('type' => 3))->equal('day,oper')->dateBetween('create_at'); $field = '*,(replace(day, "-", "")+0) as day_num'; $order = 'day_num desc,id desc'; $query->field($field); if (input('output') === 'json') { $result = $query->order($order)->page(true, false); $this->success('获取数据列表成功', $result); } else { $query->order($order)->page(); } } /** * 数据列表处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ protected function _page_filter(&$data) { $this->day = date('Y-m-d'); } /** * 添加公户账单 * @auth true * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function add() { $this->day = date('Y-m-d'); $this->_form($this->table, 'form'); } /** * 编辑公户账单 * @auth true * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function edit() { $this->day = date('Y-m-d'); $this->_form($this->table, 'form'); } /** * 删除公户账单 * @auth true * @throws \think\db\exception\DbException */ public function remove() { $this->_delete($this->table); } }