Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f8263f5

Browse files
author
lowking
committed
change holiday api
1 parent 4101349 commit f8263f5

File tree

6 files changed

+32
-14
lines changed

6 files changed

+32
-14
lines changed

Scriptable/10000.js

+1-1
Large diffs are not rendered by default.

Scriptable/10086.js

+1-1
Large diffs are not rendered by default.

Scriptable/ScriptableToolKit.js

+27-9
Original file line numberDiff line numberDiff line change
@@ -368,30 +368,48 @@ function ScriptableToolKit(scriptName, scriptId, options) {
368368

369369
isWorkingDays(now){
370370
return new Promise(async (resolve, reject) => {
371-
const d = this.formatDate(now, 'yyyyMMdd')
371+
let sp = "≈"
372+
const d = this.formatDate(now, 'yyyy-MM-dd')
372373
// 0工作日 1休息日 2节假日
374+
// enum(0, 1, 2, 3), // 节假日类型,分别表示 工作日、周末、节日、调休。
373375
let result = 0
374376
try {
375377
let curDate = await this.getVal('curDateCache', 'local', 'fff')
376-
if (d == curDate.split("-")[0] && curDate.split("-")[1].length == 1) {
378+
if (d == curDate.split(sp)[0] && curDate.split(sp)[1].length == 1) {
377379
//日期相同说明当天请求过,直接使用上次请求的值
378-
result = curDate.split("-")[1]
380+
result = curDate.split(sp)[1]
379381
this.log('already request')
380382
} else {
381383
this.log('send request')
382384
const url = {
383-
url: 'http://tool.bitefu.net/jiari/?d=' + d
385+
url: 'http://timor.tech/api/holiday/info/' + d
384386
}
385-
await this.post(url, (resp, data) => {
386-
result = data
387-
// 写入文件系统
388-
this.setVal('curDateCache', `${d + "-" + result}`, 'local')
387+
await this.get(url, (resp, data) => {
388+
if (data.indexOf("<") == 0) {
389+
result = "❌"
390+
} else {
391+
result = JSON.parse(data)
392+
if (result.code == -1) {
393+
// 接口错误
394+
result = "❌"
395+
} else {
396+
result = result.type.type
397+
}
398+
}
389399
})
390400
}
391401
} catch (e) {
402+
result = "❌"
392403
this.logErr(e)
393404
} finally {
394-
resolve(result == 0 ? workingDaysFlag : holidayFlag)
405+
this.log(JSON.stringify(result))
406+
// 写入文件系统
407+
this.setVal('curDateCache', `${d + sp + result}`, 'local')
408+
if (result == "❌") {
409+
resolve(result)
410+
} else {
411+
resolve(result == 0 ? workingDaysFlag : holidayFlag)
412+
}
395413
}
396414

397415
})

Scriptable/ScriptableToolKit.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Scriptable/example/ScriptableToolKitDemo.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

douyu/yubaSign.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
按下面配置完之后,打开https://yuba.douyu.com/homepage/hotwbs并登陆,打开获取cookie,刷新页面,提示获取鱼吧关注列表成功🎉
77
88
************************
9-
Surge 4.2.0+ 脚本配置:
9+
Surge 脚本配置:
1010
************************
1111
1212
[Script]

0 commit comments

Comments
 (0)