'内团', 1 => '外团', 2 => '外团-分发', 3 => '无', ]; public function getOutBelongs() { return [ self::BELONG_OUTSIDE => self::$belongs[self::BELONG_OUTSIDE], self::BELONG_OUTSIDE_SP => self::$belongs[self::BELONG_OUTSIDE_SP], ]; } public function getCompanies(array $ids = null, $fields = '*') { $map = []; if (is_null($ids)) { $map['_string'] = '1=1'; } elseif (count($ids) == 0) { return []; } else { $map['id'] = ['in', $ids]; } $rules = M('promote_company', 'tab_')->field($fields)->where($map)->select(); return index_by_column('id', $rules); } public function getCompaniesByBelong($belong = null, $fields = '*') { $map = []; if (is_null($belong)) { $map['_string'] = '1=1'; } else { $map['company_belong'] = $belong; } $rules = M('promote_company', 'tab_')->field($fields)->where($map)->select(); return index_by_column('id', $rules); } }