作者 王智

文档修改

@@ -892,9 +892,7 @@ class Update extends Api @@ -892,9 +892,7 @@ 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 - dump($UserArray);  
896 - die;  
897 - $rand_list = array_rand($NickNameArray, 30); 895 + $rand_list = array_rand(array_count_values($NickNameArray), 30);
898 foreach ($rand_list as $key) { 896 foreach ($rand_list as $key) {
899 $RankArray[] = $NickNameArray[$key]; 897 $RankArray[] = $NickNameArray[$key];
900 } 898 }