koishi-plugin-ggcevo-game 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +19 -22
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -413,7 +413,7 @@ ${itemDetails.join("\n")}`;
413
413
  }
414
414
  if (!latestTime) return "您还没有游玩过 咕咕虫-evolved 地图";
415
415
  const targetDateChina = new Date(latestTime);
416
- targetDateChina.setDate(targetDateChina.getDate() + 1);
416
+ targetDateChina.setUTCDate(targetDateChina.getUTCDate() + 1);
417
417
  if (!isSameDate(latestTime, currentChinaTime) && !isSameDate(targetDateChina, currentChinaTime)) {
418
418
  return "暂未查询到您最近两天内游玩过 咕咕虫-evolved 地图,请游玩1次后签到(对局记录上传有延迟)";
419
419
  }
@@ -421,14 +421,14 @@ ${itemDetails.join("\n")}`;
421
421
  const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
422
422
  if (record) {
423
423
  const lastSignChina = convertUTCtoChinaTime(record.lastSign);
424
- if (lastSignChina.getDate() === currentChinaTime.getDate()) {
424
+ if (lastSignChina.getUTCDate() === currentChinaTime.getUTCDate()) {
425
425
  return `您今天已经签到过了!本月累计签到 ${record.monthlyDays} 天`;
426
426
  }
427
427
  }
428
428
  let monthlyDays = 1;
429
429
  if (record) {
430
430
  const lastSignChina = convertUTCtoChinaTime(record.lastSign);
431
- if (currentChinaTime.getFullYear() !== lastSignChina.getFullYear() || currentChinaTime.getMonth() !== lastSignChina.getMonth()) {
431
+ if (currentChinaTime.getUTCFullYear() !== lastSignChina.getUTCFullYear() || currentChinaTime.getUTCMonth() !== lastSignChina.getUTCMonth()) {
432
432
  monthlyDays = 1;
433
433
  } else {
434
434
  monthlyDays = record.monthlyDays + 1;
@@ -480,10 +480,10 @@ ${itemDetails.join("\n")}`;
480
480
  const lastSignChina = convertUTCtoChinaTime(record.lastSign);
481
481
  const targetDateChina = new Date(lastSignChina);
482
482
  const nowChina = convertUTCtoChinaTime(/* @__PURE__ */ new Date());
483
- const currentYear = nowChina.getFullYear();
484
- const currentMonth = nowChina.getMonth();
485
- const yesterday = new Date(targetDateChina).getDate() - 1;
486
- if (targetDateChina.getFullYear() !== currentYear || targetDateChina.getMonth() !== currentMonth || // 必须当月
483
+ const currentYear = nowChina.getUTCFullYear();
484
+ const currentMonth = nowChina.getUTCMonth();
485
+ const yesterday = new Date(targetDateChina).getUTCDate() - 1;
486
+ if (targetDateChina.getUTCFullYear() !== currentYear || targetDateChina.getUTCMonth() !== currentMonth || // 必须当月
487
487
  record.monthlyDays > yesterday) {
488
488
  return "暂时没有可补签的日期。";
489
489
  }
@@ -574,15 +574,15 @@ ${itemDetails.join("\n")}`;
574
574
  }
575
575
  const now = /* @__PURE__ */ new Date();
576
576
  const chinatime = convertUTCtoChinaTime(now);
577
- const currentYear = chinatime.getFullYear();
578
- const currentMonth = chinatime.getMonth();
577
+ const currentYear = chinatime.getUTCFullYear();
578
+ const currentMonth = chinatime.getUTCMonth();
579
579
  const [adminRecord] = await ctx.database.get("ggcevo_adminbenefit", {
580
580
  userId: session.userId
581
581
  });
582
582
  if (adminRecord) {
583
583
  const lastSignTime = convertUTCtoChinaTime(adminRecord.lastSign);
584
- const lastYear = lastSignTime.getFullYear();
585
- const lastMonth = lastSignTime.getMonth();
584
+ const lastYear = lastSignTime.getUTCFullYear();
585
+ const lastMonth = lastSignTime.getUTCMonth();
586
586
  if (lastYear === currentYear && lastMonth === currentMonth) {
587
587
  return `本月管理津贴已领取,${currentMonth + 2} 月1日可再次领取`;
588
588
  }
@@ -1320,19 +1320,16 @@ ${achievementList.join("\n")}`;
1320
1320
  "──────────────"
1321
1321
  );
1322
1322
  }
1323
- const achievements = await ctx.database.get("ggcevo_achievements", { handle });
1324
- if (achievements.length > 0) {
1323
+ const [achievements] = await ctx.database.get("ggcevo_achievements", { handle });
1324
+ if (achievements) {
1325
1325
  output.push(
1326
1326
  "🏆 已获成就:",
1327
- ...achievements.map((a) => {
1328
- const date = a.gaintime.toLocaleDateString("zh-CN", {
1329
- timeZone: "Asia/Shanghai",
1330
- year: "numeric",
1331
- month: "2-digit",
1332
- day: "2-digit"
1333
- });
1334
- return `${a.achievementname} (${date})`;
1335
- }),
1327
+ `${achievements.achievementname} (${achievements.gaintime.toLocaleDateString("zh-CN", {
1328
+ timeZone: "Asia/Shanghai",
1329
+ year: "numeric",
1330
+ month: "2-digit",
1331
+ day: "2-digit"
1332
+ })})`,
1336
1333
  "──────────────"
1337
1334
  );
1338
1335
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "星际争霸2游戏大厅咕咕虫-Evo地图专属插件",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [