fix: address P0 and P1 issues from code review

- P0-1: restore customExt field in SetStatusReqSchema
- P0-2: remove duplicate setGroupAvatar implementation
- P1-3: add attach_info pagination support for get_group_album_media_list
- P1-5: clean up commented console.log statements
- P1-6: remove raw field from GroupAlbumMediaResult
This commit is contained in:
H3CoF6 committed 2026-05-16 14:33:42 +08:00
1 parent c58f4d4085
commit e2ee528939
9 files changed
+9 -43

No files matched your search

@@ -214,32 +214,3 @@ export async function getGroupAtAllRemain(
};
}
// ─────────────── group avatar ───────────────
export async function setGroupAvatar(
bridge: Bridge,
groupId: number,
source: string,
): Promise<void> {
const { loadBinarySource, computeHashes } = await import('../highway/utils');
const { fetchHighwaySession, uploadHighwayHttp } = await import('../highway/highway-client');
const { protoEncode } = await import('../../protobuf/decode');
const { GroupAvatarUploadExtSchema } = await import('../proto/highway');
const loaded = await loadBinarySource(source, 'group avatar');
if (!loaded.bytes.length) throw new Error('group avatar file is empty');
const extend = protoEncode({
field1: 101,
groupId: BigInt(groupId),
field3: new Uint8Array([0x08, 0x01, 0x12, 0x00]),
field5: 3,
field6: 0,
}, GroupAvatarUploadExtSchema);
const hashes = computeHashes(loaded.bytes);
const session = await fetchHighwaySession(bridge);
await uploadHighwayHttp(bridge, session, 3000, loaded.bytes, hashes.md5, extend);
}
@@ -7,7 +7,6 @@ import { GetMediaListRequestSchema, GetMediaListResponseSchema } from '../proto/
export interface GroupAlbumMediaResult {
mediaList: any[];
nextAttachInfo: string;
raw: any;
}
function convertBigIntToString(obj: any): any {
@@ -40,7 +39,7 @@ export async function getGroupAlbumMediaList(
groupId: groupId.toString(),
albumId: albumId,
field3: 0,
attachInfo: attachInfo, // 填入翻页游标
attachInfo: attachInfo,
field5: '',
},
traceId: traceId,
@@ -59,7 +58,6 @@ export async function getGroupAlbumMediaList(
const resp = protoDecode(result.responseData, GetMediaListResponseSchema);
// 校验外层 TRPC 状态码
if (!resp || (resp as any).field1 !== 0) {
throw new Error(`fetch album media list error: retCode ${(resp as any)?.field1 || 'unknown'}`);
}
@@ -71,6 +69,5 @@ export async function getGroupAlbumMediaList(
return convertBigIntToString({
mediaList,
nextAttachInfo,
raw: resp
});
}