完善半自动真实履约链路及虎牙账号资料保存
This commit is contained in:
@@ -421,6 +421,10 @@ function parseProfile(reader: TafReader): HuyaUserProfile {
|
||||
return { uid, nick, avatar, passport }
|
||||
}
|
||||
|
||||
function parseProfileResponse(reader: TafReader): HuyaUserProfile | null {
|
||||
return parseProfile(reader)
|
||||
}
|
||||
|
||||
function parseProfileBatch(reader: TafReader): HuyaUserProfileResponse {
|
||||
const profiles =
|
||||
reader.readList<HuyaUserProfile>(0, (itemReader, dataType) => {
|
||||
@@ -543,6 +547,26 @@ export class HuyaRpcClient {
|
||||
return response ? readWupStruct(response, parseProfileBatch) : null
|
||||
}
|
||||
|
||||
async getUserProfile(input: {
|
||||
uid: number
|
||||
cookie: string
|
||||
targetUid: number
|
||||
}): Promise<HuyaUserProfile | null> {
|
||||
const targetUid = Math.trunc(input.targetUid)
|
||||
if (!(targetUid > 0)) return null
|
||||
const response = await this.callRpc(
|
||||
'huyauserui',
|
||||
'getUserProfile',
|
||||
input.uid,
|
||||
input.cookie,
|
||||
(writer) => {
|
||||
this.writeActivityUser(writer, 0, input.cookie)
|
||||
writer.writeInt64(1, targetUid)
|
||||
},
|
||||
)
|
||||
return response ? readWupStruct(response, parseProfileResponse) : null
|
||||
}
|
||||
|
||||
private async callRpc(
|
||||
servant: string,
|
||||
func: string,
|
||||
|
||||
Reference in New Issue
Block a user