/** * 有些Model查询出来数组数据包含一些ID * 该方法指定字段,并指定查询字段,指定Model,自动进行统一查询 * */ public static function getModelExtDatas($ori_data, $data_field, $select_field, $model, $where = array()) { if (empty($ori_data)) { return array(); } $data_field_ids = Helper_Array::getColumn($ori_data, $data_field); if (empty($data_field_ids)) { return array(); } $data_field_ids = array_unique($data_field_ids); $datas = $model->selectByField($select_field, $data_field_ids); if (empty($datas)) { $datas = array(); } return $datas; }
protected function _clearCacheByCondtion($where) { if (isset($where[$this->_primary_id])) { $this->_clearItemCache($where[$this->_primary_id]); return; } //查询出id,清空缓存 $items = $this->select($where, array('select' => $this->_primary_id)); if (empty($items)) { return; } $ids = Helper_Array::getColumn($items, $this->_primary_id); $this->_clearItemCache($ids); }