title = '中奖管理'; $query = $this->_query($this->table)->like('username,prize_name,prize_level'); $query->equal('uncode_status,code')->dateBetween('create_at,uncode_datetime')->page(); } /** * 页面数据处理 * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ protected function _page_filter(array &$data) { $this->prizes = $this->app->db->name('ActivityLuckdrawConfig')->where(['deleted' => 0])->order('id desc')->select()->toArray(); $members = $this->app->db->name('ActivityLuckdrawMember')->whereIn('id', array_unique(array_column($data, 'mid')))->column('*', 'mid'); $acitves = $this->app->db->name('ActivityLuckdrawConfig')->whereIn('code', array_unique(array_column($data, 'code')))->column('*', 'code'); foreach ($data as &$vo) { $vo['info'] = $acitves[$vo['code']] ?? []; $vo['member'] = $members[$vo['mid']] ?? []; } } }