-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
222 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import _ from 'lodash' | ||
import { utils } from '#models' | ||
|
||
/** | ||
* 获取用户相关信息 | ||
* @param {string} accessToken | ||
* @param {string|string[]} steamIds | ||
* @returns {Promise<{ | ||
* steamid: string, | ||
* communityvisibilitystate: number, | ||
* profilestate: number, | ||
* personaname: string, | ||
* profileurl: string, | ||
* avatar: string, | ||
* avatarmedium: string, | ||
* avatarfull: string, | ||
* lastlogoff?: number, | ||
* personastate: number, | ||
* timecreated: string, | ||
* gameid?: string, | ||
* gameextrainfo?: string, | ||
* }[]>} | ||
*/ | ||
export async function GetUserSummaries (accessToken, steamIds) { | ||
!Array.isArray(steamIds) && (steamIds = [steamIds]) | ||
const result = [] | ||
// 一次只能获取100个用户信息 | ||
for (const items of _.chunk(steamIds, 100)) { | ||
const res = await utils.request.get('ISteamUserOAuth/GetUserSummaries/v2', { | ||
params: { | ||
access_token: accessToken, | ||
steamIds: items.join(',') | ||
} | ||
}) | ||
if (res.players?.length) { | ||
result.push(...res.players) | ||
} | ||
} | ||
return result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters