修复兑换码获取报错导致无法处理完整数据的问题

更新 #电脑帮助 文案
This commit is contained in:
Anno_Lawl 2024-01-04 17:50:50 +08:00
parent b659655dca
commit 2e877a11b4
2 changed files with 18 additions and 9 deletions

View File

@ -42,7 +42,9 @@ export class exchange extends plugin {
/** index info */
let index = await this.getData('index')
if (!index || !index.data) { return true }
if (!index || !index.data) {
return true
}
if (index.data === null) {
return await this.reply(`错误:\n${index.message}`)
}
@ -104,13 +106,19 @@ export class exchange extends plugin {
// 获取 "act_id"
async getActId () {
let ret = await this.getData('actId')
let ret = await this.getData('actId');
if (ret.error || ret.retcode !== 0) {
return "";
}
for (const p of ret.data.list) {
const post = p.post.post;
let post;
try {
post = p.post.post;
} catch (e) {
logger.error("活动数据获取异常");
logger.error(e);
}
if (!post) {
continue;
}
@ -124,6 +132,7 @@ export class exchange extends plugin {
}
}
}
// 兑换码使用
async useCode () {
let cdkCode = this.e.message[0].text.split(/#(兑换码使用|cdk-u) /, 3)[2];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 KiB

After

Width:  |  Height:  |  Size: 457 KiB