koishi-plugin-ets2-tools-tmp 2.4.0 → 2.4.2

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.
@@ -234,11 +234,19 @@ module.exports = async (ctx, cfg, session, targetTeamId, password) => {
234
234
  if (!teamId) return "未找到您的信息,请联系管理员";
235
235
  } else {
236
236
  // 有目标编号时验证权限
237
+ log(`用户 ${currentUserQQ} 尝试重置车队编号 ${targetTeamId} 的密码`);
237
238
  const userInfo = await getUserInfo({ teamId: targetTeamId });
238
- if (!isAdmin && userInfo.qq !== currentUserQQ) {
239
+
240
+ if (!isAdmin && String(userInfo.qq) !== String(currentUserQQ)) {
239
241
  return "您没有权限重置其他成员的密码,请联系管理员";
240
242
  }
243
+
241
244
  teamId = targetTeamId;
245
+ if (isAdmin) {
246
+ log(`管理员 ${currentUserQQ} 重置车队编号 ${targetTeamId} 的密码`);
247
+ } else {
248
+ log(`验证通过,车队编号 ${targetTeamId} 对应的QQ ${userInfo.qq} 与当前用户QQ ${currentUserQQ} 一致`);
249
+ }
242
250
  }
243
251
  } else {
244
252
  // 非私聊场景(仅管理员可操作)
@@ -246,7 +254,7 @@ module.exports = async (ctx, cfg, session, targetTeamId, password) => {
246
254
 
247
255
  teamId = targetTeamId;
248
256
  log(`管理员 ${currentUserQQ} 重置车队: ${teamId} 密码`);
249
- await getUserInfo({ teamId }); // 验证车队存在性
257
+ await getUserInfo({ teamId });
250
258
  }
251
259
  }
252
260
 
@@ -44,7 +44,7 @@ module.exports = async (ctx, cfg, session, tmpId) => {
44
44
  // 查询玩家信息
45
45
  let playerInfo = await truckersMpApi.player(ctx.http, tmpId)
46
46
  if (playerInfo.error) {
47
- return '查询玩家信息失败,请重试'
47
+ return '查询玩家位置信息失败,请重试'
48
48
  }
49
49
 
50
50
  // 查询线上信息
@@ -74,52 +74,54 @@ module.exports = async (ctx, cfg, session, tmpId) => {
74
74
  message += '\n💼所属分组: ' + (userGroup[playerInfo.data.groupName] || playerInfo.data.groupName);
75
75
  if (playerInfo.data.isJoinVtc) {
76
76
  message += '\n🚚所属车队: ' + playerInfo.data.vtcName;
77
- if(cfg.commands?.tmpQueryHistory){
77
+ if (cfg.commands?.tmpQueryHistory) {
78
78
  if (playerInfo.data.vtcHistory && playerInfo.data.vtcHistory.length > 0) {
79
79
  message += `\n📜历史车队:\n${playerInfo.data.vtcHistory.map(vtc => `- ${vtc.vtcName}\n(加入时间: ${dayjs(vtc.joinDate).format('YYYY年MM月DD日')}, 离开日期: ${dayjs(vtc.quitDate).format('YYYY年MM月DD日')})`).join('\n')}`
80
80
  }
81
81
  }
82
82
  message += '\n🚚车队角色: ' + playerInfo.data.vtcRole;
83
- if (playerInfo.data.vtcId == vtcId) {
84
- const { url, token, logOutput, platformVersion } = cfg.mainSettings?.settings || {};
85
- const platform = (platformVersion || "v1").toLowerCase();
86
- try {
87
- let rewardPoints = 0;
88
- if (platform === "v2") {
89
- const baseUrl = url;
90
- const userInfoUrl = `https://${baseUrl}/members/get?token=${token}&tmpId=${tmpId}`;
91
- if (logOutput) {
92
- ctx.logger.info(`[TMP_BOT] tmpQuery:开始查询TmpID ${tmpId} 的V2.0积分`);
93
- ctx.logger.info(`[TMP_BOT] 请求V2.0用户信息: ${userInfoUrl}`);
83
+ if (cfg.commands?.mainSettings) {
84
+ if (playerInfo.data.vtcId == vtcId) {
85
+ const { url, token, logOutput, platformVersion } = cfg.mainSettings?.settings || {};
86
+ const platform = (platformVersion || "v1").toLowerCase();
87
+ try {
88
+ let rewardPoints = 0;
89
+ if (platform === "v2") {
90
+ const baseUrl = url;
91
+ const userInfoUrl = `https://${baseUrl}/members/get?token=${token}&tmpId=${tmpId}`;
92
+ if (logOutput) {
93
+ ctx.logger.info(`[TMP_BOT] tmpQuery:开始查询TmpID ${tmpId} 的V2.0积分`);
94
+ ctx.logger.info(`[TMP_BOT] 请求V2.0用户信息: ${userInfoUrl}`);
95
+ }
96
+ const userInfoResponse = await ctx.http.get(userInfoUrl);
97
+ if (logOutput) {
98
+ ctx.logger.info(`[TMP_BOT] V2.0用户信息响应: ${JSON.stringify(userInfoResponse)}`);
99
+ }
100
+ if (userInfoResponse.code === 200 && userInfoResponse.data) {
101
+ rewardPoints = userInfoResponse.data.point || 0;
102
+ }
103
+ } else {
104
+ if (logOutput) {
105
+ ctx.logger.info(`[TMP_BOT] tmpQuery:开始查询TmpID ${tmpId} 的V1.0积分`);
106
+ }
107
+ const userInfoUrl = `https://${url}/api/user/info/list?token=${token}&page=0&limit=7&tmpId=${tmpId}&tmpName=&teamId=&qq=&state=0&teamRole=`;
108
+ if (logOutput) {
109
+ ctx.logger.info(`[TMP_BOT] 请求V1.0用户信息: ${userInfoUrl}`);
110
+ }
111
+ const userInfoResponse = await ctx.http.post(userInfoUrl);
112
+ if (logOutput) {
113
+ ctx.logger.info(`[TMP_BOT] V1.0用户信息响应: ${JSON.stringify(userInfoResponse)}`);
114
+ }
115
+ const userList = userInfoResponse.page?.list || [];
116
+ const userInfo = userList[0];
117
+ rewardPoints = userInfo.rewardPoints || 0;
94
118
  }
95
- const userInfoResponse = await ctx.http.get(userInfoUrl);
96
- if (logOutput) {
97
- ctx.logger.info(`[TMP_BOT] V2.0用户信息响应: ${JSON.stringify(userInfoResponse)}`);
119
+ message += `\n⭐ 当前车队积分: ${rewardPoints}`;
120
+ } catch (error) {
121
+ ctx.logger.error(`积分查询过程出错: ${error}`);
122
+ if (error.response) {
123
+ message += '查询出错';
98
124
  }
99
- if (userInfoResponse.code === 200 && userInfoResponse.data) {
100
- rewardPoints = userInfoResponse.data.point || 0;
101
- }
102
- } else {
103
- if (logOutput) {
104
- ctx.logger.info(`[TMP_BOT] tmpQuery:开始查询TmpID ${tmpId} 的V1.0积分`);
105
- }
106
- const userInfoUrl = `https://${url}/api/user/info/list?token=${token}&page=0&limit=7&tmpId=${tmpId}&tmpName=&teamId=&qq=&state=0&teamRole=`;
107
- if (logOutput) {
108
- ctx.logger.info(`[TMP_BOT] 请求V1.0用户信息: ${userInfoUrl}`);
109
- }
110
- const userInfoResponse = await ctx.http.post(userInfoUrl);
111
- if (logOutput) {
112
- ctx.logger.info(`[TMP_BOT] V1.0用户信息响应: ${JSON.stringify(userInfoResponse)}`);
113
- }
114
- const userList = userInfoResponse.page?.list || [];
115
- const userInfo = userList[0];
116
- rewardPoints = userInfo.rewardPoints || 0;
117
- }
118
- message += `\n⭐ 当前车队积分: ${rewardPoints}`;
119
- } catch (error) {
120
- ctx.logger.error(`积分查询过程出错: ${error}`);
121
- if (error.response) {
122
- message += '查询出错';
123
125
  }
124
126
  }
125
127
  }
@@ -14,14 +14,14 @@
14
14
  font-family: "微软雅黑", serif;
15
15
  }
16
16
  #container {
17
- width: 500px;
18
- height: 320px;
17
+ width: 720px;
18
+ height: 500px;
19
19
  position: relative;
20
20
  }
21
21
  .map {
22
22
  width: 100%;
23
23
  height: 100%;
24
- background-color: #5d5d5d;
24
+ background: linear-gradient(135deg, #1f2f54, #0f2c2a);
25
25
  }
26
26
  .user-info-box {
27
27
  width: 100%;
@@ -29,7 +29,7 @@
29
29
  position: absolute;
30
30
  bottom: 0;
31
31
  z-index: 999;
32
- background-color: rgba(100, 100, 100, 0.4);
32
+ background-color: rgba(0, 0, 0, 0.4);
33
33
  backdrop-filter: blur(6px);
34
34
  display: flex;
35
35
  flex-direction: row;
@@ -44,23 +44,23 @@
44
44
  }
45
45
  .user {
46
46
  height: 56px;
47
- width: 220px;
47
+ flex: 1;
48
+ margin-left: 10px;
49
+ box-sizing: border-box;
50
+ font-size: 16px;
51
+ color: #eeeeee;
48
52
  display: flex;
49
53
  flex-direction: column;
50
54
  justify-content: center;
51
55
  }
52
- .user {
53
- font-size: 16px;
54
- color: #eeeeee;
55
- margin-left: 10px;
56
- box-sizing: border-box;
57
- }
58
56
  .user .server-name-box {
59
57
  display: flex;
60
58
  align-items: center;
61
59
  margin-top: 4px;
60
+ opacity: 0.85;
62
61
  }
63
62
  .user .username {
63
+ font-weight: 600;
64
64
  white-space: nowrap;
65
65
  overflow: hidden;
66
66
  text-overflow: ellipsis;
@@ -75,7 +75,7 @@
75
75
  box-sizing: border-box;
76
76
  }
77
77
  .location-box {
78
- flex-grow: 1;
78
+ flex: 1;
79
79
  color: #eeeeee;
80
80
  font-size: 16px;
81
81
  height: 56px;
@@ -88,11 +88,17 @@
88
88
  justify-content: center;
89
89
  }
90
90
  .location-box>* {
91
- width: 174px;
91
+ max-width: 100%;
92
92
  white-space: nowrap;
93
93
  overflow: hidden;
94
94
  text-overflow: ellipsis;
95
95
  }
96
+ .location-box .country {
97
+ font-weight: 600;
98
+ }
99
+ .location-box .real-name {
100
+ opacity: 0.85;
101
+ }
96
102
  </style>
97
103
  </head>
98
104
  <body>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ets2-tools-tmp",
3
3
  "description": "欧卡2 TruckersMP信息查询、车队平台查询及活动提醒",
4
- "version": "2.4.0",
4
+ "version": "2.4.2",
5
5
  "contributors": [
6
6
  "opwop <slhp1013@qq.com>",
7
7
  "bot_actions <168329908@qq.com>"