/** * 缓存首页根据疾病查找的最新疾病资讯模块 * lc@2016-7-8 * @param type $cacheKey * @param type $parms * @return array */ public static function cacheIndexTopNews($cacheKey, $parms) { $result = array(); $newWords = $parms['newWords']; $rel_obj = new \common\models\Relate(); /*方法2*/ /** * 经测试方法2运行效率是方法1的5倍+ */ foreach ($newWords as $kk => $vv) { $diseaseid[] = $vv['id']; } $diseaseids = implode(',', $diseaseid); $ret = $rel_obj->getArticlesGroupBy($diseaseids); foreach ($ret as $k => $v) { $res[$v['tmp_diseaseid']] = $v; } foreach ($newWords as $kk => $vv) { if (isset($res[$vv['id']])) { $result[$kk] = $res[$vv['id']]; } } return $result; }