Skip to content

Commit

Permalink
feat: oneClickSign pass signed activity
Browse files Browse the repository at this point in the history
  • Loading branch information
kuizuo committed Sep 8, 2023
1 parent 8686b47 commit 056a712
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions server/protocol/cx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ export enum SignTypeEnum {
Code = 5, // 签到码签到
}

export const signTypeMap: Record<number, string> = {
0: '普通签到',
2: '二维码签到',
3: '手势签到',
4: '位置签到',
5: '签到码签到',
} as const

export class Cx {
public http!: Got
public cookieJar: CookieJar
Expand Down Expand Up @@ -218,7 +226,7 @@ export class Cx {
const $ = cheerio.load(html)

const status = $('#statuscontent').text().trim().replaceAll(/[\n\s]/g, '')
console.log('statuscontent', status)
console.log(`${course.name} ${signTypeMap[activity.otherId]} 预签到状态: `, status)
if (status)
return status
}
Expand Down Expand Up @@ -441,6 +449,10 @@ export class Cx {
const activity = await this.getActivityDetail(a.id)
const result = await this.handleSign(a.course, activity, setting)

// 如果已签到过, 则不返回
if (result === '已签到过')
continue

signResults.push({
activity: {
...a,
Expand All @@ -455,7 +467,10 @@ export class Cx {
}

async handleSign(course: CX.Course, activity: CX.ActivityDetail, setting?: CX.Setting) {
await this.preSign(course, activity)
const status = await this.preSign(course, activity)

if (status === '签到成功')
return '已签到过'

if (setting?.signType && !setting?.signType?.map(type => Number(type))?.includes(activity.otherId))
return '该账号不支持此签到类型'
Expand Down

1 comment on commit 056a712

@vercel
Copy link

@vercel vercel bot commented on 056a712 Sep 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

chaoxing-sign – ./

cx-sign.vercel.app
chaoxing-sign-kuizuo1.vercel.app
chaoxing-sign-git-main-kuizuo1.vercel.app

Please sign in to comment.