| 30 | |
| 31 | |
| 32 | class Task { |
| 33 | constructor(env) { |
| 34 | this.index = $.userIdx++ |
| 35 | this.token = env.split(strSplitor)[0]; //单账号多变量分隔符 |
| 36 | |
| 37 | this.userId = env.split(strSplitor)[1]; |
| 38 | this.uDate = env.split(strSplitor)[2]; |
| 39 | |
| 40 | } |
| 41 | |
| 42 | async run() { |
| 43 | |
| 44 | await this.getSignInId() |
| 45 | } |
| 46 | |
| 47 | getSign(s) { |
| 48 | const crypto = require("crypto");//SIGN TYPE 1是签到 2是补签 |
| 49 | return crypto.createHash('md5').update(s).digest('hex'); |
| 50 | } |
| 51 | getTime() { |
| 52 | var now = new Date(); |
| 53 | var year = now.getFullYear() |
| 54 | , month = now.getMonth() + 1 |
| 55 | , day = now.getDate() |
| 56 | , hours = now.getHours() |
| 57 | , minutes = now.getMinutes() |
| 58 | , seconds = now.getSeconds(); |
| 59 | return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds; |
| 60 | } |
| 61 | getSignDay() { |
| 62 | var now = new Date(); |
| 63 | var year = now.getFullYear() |
| 64 | , month = now.getMonth() + 1 |
| 65 | , day = now.getDate() |
| 66 | return year + '-' + month + '-' + day |
| 67 | } |
| 68 | async getSignInId() { |
| 69 | const time = this.getTime() |
| 70 | const method = `ddky.promotion.signin.pageinfo` |
| 71 | const signDay = this.getSignDay() |
| 72 | const str = method + |
| 73 | `loginToken${this.token}` + |
| 74 | `method${method}` + |
| 75 | `platH5` + |
| 76 | `platformH5` + |
| 77 | `signDay${signDay}` + |
| 78 | `t${time}` + |
| 79 | `uDate${this.uDate}` + |
| 80 | `userId${this.userId}` + |
| 81 | `v1.0` + |
| 82 | `versionName4.9.0` + |
| 83 | `6C57AB91A1308E26B797F4CD382AC79D` |
| 84 | let sign = (this.getSign(str)).toUpperCase(); |
| 85 | let callbackStr = new Date().getTime() |
| 86 | try { |
| 87 | let options = { |
| 88 | url: `https://hapi.ddky.com/mcp/weixin/rest.htm?sign=${sign}&loginToken=${this.token}&method=${method}&plat=H5&platform=H5&signDay=${signDay}&t=${time}&uDate=${this.uDate}&userId=${this.userId}&v=1.0&versionName=4.9.0&callback=Zepto${callbackStr}`, |
| 89 | headers: {}, |
nothing calls this directly
no outgoing calls
no test coverage detected