koishi-plugin-bns-rate 1.0.0 → 1.0.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.
- package/index.js +3 -3
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -33,15 +33,15 @@ async function fetchRate(ctx, url) {
|
|
|
33
33
|
throw new Error('无法解析页面汇率数据,页面结构可能已变更')
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
// match[0] = 平台极速收货回收价, match[
|
|
37
|
-
const forward = parseFloat(forwardMatches[1][1])
|
|
36
|
+
// match[0] = 平台极速收货回收价, match[last] = 最低卖家挂单价
|
|
37
|
+
const forward = parseFloat(forwardMatches[forwardMatches.length - 1][1])
|
|
38
38
|
|
|
39
39
|
const reverseMatches = [...html.matchAll(REVERSE_RE)]
|
|
40
40
|
if (reverseMatches.length < 2) {
|
|
41
41
|
throw new Error('无法解析页面反向汇率数据')
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const reverse = parseFloat(reverseMatches[1][1])
|
|
44
|
+
const reverse = parseFloat(reverseMatches[reverseMatches.length - 1][1])
|
|
45
45
|
|
|
46
46
|
if (forward < 100 || forward > 200 || reverse < 0.001 || reverse > 0.02) {
|
|
47
47
|
throw new Error(`解析的汇率超出合理范围: forward=${forward}, reverse=${reverse}`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-bns-rate",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Fetch BNS Classic Divine Stone exchange rate from dd373.com",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"koishi": "^4.18.0"
|
|
13
13
|
},
|
|
14
|
-
"service": {
|
|
15
|
-
"required": ["http"]
|
|
16
|
-
},
|
|
17
14
|
"koishi": {
|
|
18
15
|
"description": {
|
|
19
16
|
"zh": "从 dd373.com 获取剑灵怀旧服神石实时汇率,输入命令即可查询最低比例。支持 神石/bnsrate/shenshi 命令。",
|
|
20
17
|
"en": "Fetch BNS Classic Divine Stone exchange rate from dd373.com"
|
|
18
|
+
},
|
|
19
|
+
"service": {
|
|
20
|
+
"required": ["http"]
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|