function _filter($filter) { $filter['object_type'] = 'discuss'; $where[] = 'for_comment_id IS NULL'; if (is_array($filter['adm_read_status'])) { foreach ($filter['adm_read_status'] as $val) { if ($val != '_ANY_') { $aRead[] = 'adm_read_status=\'' . $val . '\''; } } if (count($aRead) > 0) { $where[] = '(' . implode($aRead, ' OR ') . ')'; } } if (isset($filter['goods_name']) && $filter['goods_name'] !== '') { $aId = array(0); foreach ($this->db->select('SELECT goods_id FROM sdb_goods WHERE name LIKE \'%' . $filter['goods_name'] . '%\'') as $rows) { $aId[] = $rows['goods_id']; } $where[] = 'goods_id IN (' . implode(',', $aId) . ')'; unset($filter['goods_name']); } if (isset($filter['mem_name']) && $filter['mem_name'] !== '') { $aId = array(0); foreach ($this->db->select('SELECT member_id FROM sdb_members WHERE uname = \'' . $filter['mem_name'] . '\'') as $rows) { $aId[] = $rows['member_id']; } $where[] = 'author_id IN (' . implode(',', $aId) . ')'; unset($filter['mem_name']); } $where = implode(' AND ', $where); return parent::_filter($filter) . " AND " . $where; }
function getColumns() { $now = parent::getColumns(); $now['author']['label'] = __("评论人"); $now['time']['label'] = __("评论时间"); $now['ip']['label'] = __("评论人IP"); return $now; }
function searchOptions() { $arr = parent::searchOptions(); return array_merge($arr, array('goods_name' => __('商品名称'))); }