fix:别处登录cookie问题
This commit is contained in:
父節點
baff19e775
當前提交
3a927408c4
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
|||||||
node_modules/*
|
node_modules/*
|
||||||
/pnpm-lock.yaml
|
/pnpm-lock.yaml
|
||||||
/arr.json
|
/arr.json
|
||||||
|
backup
|
||||||
|
@ -79,6 +79,9 @@ export async function acquireCourse(course: IJsonCourse, channel: TChannel): Pro
|
|||||||
if (resp.data.success === true) {
|
if (resp.data.success === true) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
if(resp.data.message.includes('当前账号已在别处登录')){
|
||||||
|
await resetCookie()
|
||||||
|
}
|
||||||
logAndNotifyUser(resp.data.message)
|
logAndNotifyUser(resp.data.message)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -93,6 +96,9 @@ export async function exitCourse(course: IJsonCourse): Promise<boolean> {
|
|||||||
if (resp.data.success === true) {
|
if (resp.data.success === true) {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
if(resp.data.message.includes('当前账号已在别处登录')){
|
||||||
|
await resetCookie()
|
||||||
|
}
|
||||||
logAndNotifyUser('[exitCourse]退课失败:' + resp.data.message)
|
logAndNotifyUser('[exitCourse]退课失败:' + resp.data.message)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -140,4 +146,8 @@ export async function resetCookie() {
|
|||||||
sduAxios.defaults.headers['Cookie'] = cookieString
|
sduAxios.defaults.headers['Cookie'] = cookieString
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function countStr(str: string, word: string) {
|
||||||
|
return str.split(word).length - 1
|
||||||
|
}
|
||||||
|
|
||||||
export {sduAxios}
|
export {sduAxios}
|
||||||
|
@ -22,14 +22,19 @@ async function start() {
|
|||||||
await sleep(50)
|
await sleep(50)
|
||||||
}
|
}
|
||||||
console.log('轮询进程启动完毕')
|
console.log('轮询进程启动完毕')
|
||||||
|
for (let channel of appConfig.channels) {
|
||||||
|
console.log('channel: ' + channel + ': ' + JsonCourseList[channel].length)
|
||||||
|
}
|
||||||
console.log('开始启动用户进程')
|
console.log('开始启动用户进程')
|
||||||
for (let course of appConfig.monit?.list || []) {
|
for (let course of appConfig.monit?.list || []) {
|
||||||
monitProcess(course)
|
monitProcess(course)
|
||||||
}
|
}
|
||||||
for (let course of appConfig.acquire?.list || []) {
|
for (let course of appConfig.acquire?.list || []) {
|
||||||
|
console.log('添加抢课课程:' + course.kch + ' ' + course.kxh)
|
||||||
acquireProcess(course)
|
acquireProcess(course)
|
||||||
}
|
}
|
||||||
if (appConfig.replace) {
|
if (appConfig.replace) {
|
||||||
|
console.log('添加换课课程:' + appConfig.replace.exit.kch + ' ' + appConfig.replace.exit.kxh)
|
||||||
replaceProcess(appConfig.replace.list, appConfig.replace.exit)
|
replaceProcess(appConfig.replace.list, appConfig.replace.exit)
|
||||||
}
|
}
|
||||||
console.log('用户进程启动完毕')
|
console.log('用户进程启动完毕')
|
||||||
|
載入中…
x
新增問題並參考
Block a user