作者 王智

文档修改

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