Skip to content

Commit

Permalink
fix error in gi & hsr: always return success 200
Browse files Browse the repository at this point in the history
  • Loading branch information
ihsangan committed Oct 29, 2024
1 parent 6fd11f0 commit 3404322
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
24 changes: 16 additions & 8 deletions src/router/gi.ts
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default async function gi(id: number): Promise<Result> {
default:
return {
success: false,
message: 'Bad request'
message: 'Not found'
};
}
const body = `voucherPricePoint.id=116054&voucherPricePoint.price=16500&voucherPricePoint.variablePrice=0&user.userId=${id}&user.zoneId=${sv}&voucherTypeName=GENSHIN_IMPACT&shopLang=id_ID`;
Expand All @@ -34,11 +34,19 @@ export default async function gi(id: number): Promise<Result> {
body
});
const data = await response.json();
return {
success: true,
game: 'Genshin Impact',
id,
server: sn,
name: data.confirmationFields.username
};
if (data.confirmationFields.username) {
return {
success: true,
game: 'Genshin Impact',
id,
server: sn,
name: data.confirmationFields.username
};
}
else {
return {
success: false,
message: 'Not found'
}
}
}
24 changes: 16 additions & 8 deletions src/router/hsr.ts
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default async function hsr(id: number): Promise<Result> {
default:
return {
success: false,
message: 'Bad request',
message: 'Not found',
};
}
const body = `voucherPricePoint.id=855316&voucherPricePoint.price=16000&voucherPricePoint.variablePrice=0&user.userId=${id}&user.zoneId=${sv}&voucherTypeName=HONKAI_STAR_RAIL&shopLang=id_ID`;
Expand All @@ -34,11 +34,19 @@ export default async function hsr(id: number): Promise<Result> {
body
});
const data = await response.json();
return {
success: true,
game: 'Honkai: Star Rail',
id,
server: sn,
name: data.confirmationFields.username
};
if (data.confirmationFields.username) {
return {
success: true,
game: 'Honkai: Star Rail',
id,
server: sn,
name: data.confirmationFields.username
}
}
else {
return {
success: false,
message: 'Not found'
}
}
}

0 comments on commit 3404322

Please sign in to comment.