作者 王智

文档修改

... ... @@ -892,7 +892,11 @@ class Update extends Api
}
$UserArray = Db::name('user')->field('nickname')->order('id desc')->page(1, 50)->select();
$NickNameArray = array_column($UserArray, 'nickname');
$rand_list = array_rand(array_count_values($NickNameArray), 30);
if(count($NickNameArray)<30){
$rand_list = array_rand(array_count_values($NickNameArray), count($NickNameArray));
}else{
$rand_list = array_rand(array_count_values($NickNameArray), 30);
}
foreach ($rand_list as $key) {
$RankArray[] = $NickNameArray[$key];
}
... ...