title = '卡密批次管理'; $query = $this->_query($this->table); $query->equal('status')->dateBetween('create_at'); $query->like('name'); $query->order('status desc, reorder desc, id desc')->page(); } /** * 数据列表处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ protected function _page_filter(&$data) { } /** * 表单数据处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ protected function _form_filter(&$data) { //$this->merchant = MerchantService::instance()->getAll(); $this->merchant = array(); if ($this->request->isPost()) { if (empty($data['name'])) $this->error('批次号不能为空'); } else { $this->name = date('Ymd'); } } /** * 添加批次 * @auth true * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function add() { $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->_form($this->table, 'form'); } /** * 修改批次状态 * @auth true * @throws \think\db\exception\DbException */ public function state() { $this->_save($this->table, $this->_vali([ 'status.in:0,1' => '状态值范围异常!', 'status.require' => '状态值不能为空!', ])); } /** * 删除批次 * @auth true * @throws \think\db\exception\DbException */ public function remove() { $this->_delete($this->table); } }