feat & fix: GetMiniAppArk

This commit is contained in:
pk5ls20
2024-12-14 06:56:23 +08:00
parent 7b693132f9
commit 0e0d4837b8
3 changed files with 10 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ export interface MiniAppReqCustomParams {
desc: string; desc: string;
picUrl: string; picUrl: string;
jumpUrl: string; jumpUrl: string;
webUrl?: string;
} }
export interface MiniAppReqTemplateParams { export interface MiniAppReqTemplateParams {

View File

@@ -30,7 +30,7 @@ class GetMiniAppAdaptShareInfo extends PacketTransformer<typeof proto.MiniAppAda
shareType: req.shareType, shareType: req.shareType,
versionId: req.versionId, versionId: req.versionId,
withShareTicket: req.withShareTicket, withShareTicket: req.withShareTicket,
webURL: "", webURL: req.webUrl ?? "",
appidRich: Buffer.alloc(0), appidRich: Buffer.alloc(0),
template: { template: {
templateId: "", templateId: "",

View File

@@ -11,7 +11,8 @@ const SchemaData = Type.Union([
desc: Type.String(), desc: Type.String(),
picUrl: Type.String(), picUrl: Type.String(),
jumpUrl: Type.String(), jumpUrl: Type.String(),
rawArkData: Type.Optional(Type.Union([Type.Boolean(), Type.String()])) webUrl: Type.Optional(Type.String()),
rawArkData: Type.Optional(Type.Union([Type.String()]))
}), }),
Type.Object({ Type.Object({
title: Type.String(), title: Type.String(),
@@ -19,6 +20,7 @@ const SchemaData = Type.Union([
picUrl: Type.String(), picUrl: Type.String(),
jumpUrl: Type.String(), jumpUrl: Type.String(),
iconUrl: Type.String(), iconUrl: Type.String(),
webUrl: Type.Optional(Type.String()),
appId: Type.String(), appId: Type.String(),
scene: Type.Union([Type.Number(), Type.String()]), scene: Type.Union([Type.Number(), Type.String()]),
templateType: Type.Union([Type.Number(), Type.String()]), templateType: Type.Union([Type.Number(), Type.String()]),
@@ -28,7 +30,7 @@ const SchemaData = Type.Union([
versionId: Type.String(), versionId: Type.String(),
sdkId: Type.String(), sdkId: Type.String(),
withShareTicket: Type.Union([Type.Number(), Type.String()]), withShareTicket: Type.Union([Type.Number(), Type.String()]),
rawArkData: Type.Optional(Type.Union([Type.Boolean(), Type.String()])) rawArkData: Type.Optional(Type.Union([Type.String()]))
}) })
]); ]);
type Payload = Static<typeof SchemaData>; type Payload = Static<typeof SchemaData>;
@@ -45,7 +47,8 @@ export class GetMiniAppArk extends GetPacketStatusDepends<Payload, {
title: payload.title, title: payload.title,
desc: payload.desc, desc: payload.desc,
picUrl: payload.picUrl, picUrl: payload.picUrl,
jumpUrl: payload.jumpUrl jumpUrl: payload.jumpUrl,
webUrl: payload.webUrl,
} as MiniAppReqCustomParams; } as MiniAppReqCustomParams;
if ('type' in payload) { if ('type' in payload) {
reqParam = MiniAppInfoHelper.generateReq(customParams, MiniAppInfo.get(payload.type)!.template); reqParam = MiniAppInfoHelper.generateReq(customParams, MiniAppInfo.get(payload.type)!.template);
@@ -63,13 +66,13 @@ export class GetMiniAppArk extends GetPacketStatusDepends<Payload, {
verType: +verType, verType: +verType,
shareType: +shareType, shareType: +shareType,
versionId: versionId, versionId: versionId,
withShareTicket: +withShareTicket withShareTicket: +withShareTicket,
} }
); );
} }
const arkData = await this.core.apis.PacketApi.pkt.operation.GetMiniAppAdaptShareInfo(reqParam); const arkData = await this.core.apis.PacketApi.pkt.operation.GetMiniAppAdaptShareInfo(reqParam);
return { return {
data: payload.rawArkData ? arkData : MiniAppInfoHelper.RawToSend(arkData) data: payload.rawArkData === 'true' ? arkData : MiniAppInfoHelper.RawToSend(arkData)
}; };
} }
} }