Authored by wuxiao

修复列表数据为空时错误调用redis mget的问题

@@ -100,7 +100,7 @@ class LivingController extends BaseController @@ -100,7 +100,7 @@ class LivingController extends BaseController
100 $keys[] = sprintf("%s:online_nums_room_%s",Yii::$app->params['cache_prefix'],$row['room_id']); 100 $keys[] = sprintf("%s:online_nums_room_%s",Yii::$app->params['cache_prefix'],$row['room_id']);
101 } 101 }
102 102
103 - $values = call_user_func_array(array(Yii::$app->redisIm,'mget'), $keys); 103 + $values = $keys ? call_user_func_array(array(Yii::$app->redisIm,'mget'), $keys) : [];
104 foreach ($values as $k=>$value){ 104 foreach ($values as $k=>$value){
105 $_ret[$k]['audience_num'] = (int)($value ? : $_ret[$k]['audience_num']); 105 $_ret[$k]['audience_num'] = (int)($value ? : $_ret[$k]['audience_num']);
106 } 106 }
@@ -183,7 +183,7 @@ class LivingController extends BaseController @@ -183,7 +183,7 @@ class LivingController extends BaseController
183 foreach ($_ret as $k=>$row){ 183 foreach ($_ret as $k=>$row){
184 $keys[] = sprintf("%svideo_id_%s_audience_num",Yii::$app->params['cache_prefix'],$row['video_id']); 184 $keys[] = sprintf("%svideo_id_%s_audience_num",Yii::$app->params['cache_prefix'],$row['video_id']);
185 } 185 }
186 - $values = call_user_func_array(array(Yii::$app->redis,'mget'), $keys); 186 + $values = $keys ? call_user_func_array(array(Yii::$app->redis,'mget'), $keys) : [];
187 foreach ($values as $k=>$value){ 187 foreach ($values as $k=>$value){
188 $_ret[$k]['audience_num'] = (int)($value ? : $_ret[$k]['audience_num']); 188 $_ret[$k]['audience_num'] = (int)($value ? : $_ret[$k]['audience_num']);
189 } 189 }