imgcheck.js
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
'use strict';
const PAGE = 'H5';
const logger = global.yoho.logger;
const serviceAPI = global.yoho.ServiceAPI.ApiUrl;
const config = global.yoho.config;
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
/**
* 获取图片
*/
gen(udid) {
let requestUrl = `${serviceAPI}passport/img-check?udid=${udid}&fromPage=${PAGE}&client_type=${config.app}&app_version=${config.appVersion}`; // eslint-disable-line
logger.info(`get verifiedGraphicCode: ${requestUrl}`);
return Promise.resolve({
code: 200,
data: {
verifiedGraphicCode: requestUrl // eslint-disable-line
}
});
}
/**
* 校验
*/
check(udid, captcha) {
return this.get({
data: {
method: 'app.verified.graphic',
udid: udid,
fromPage: PAGE,
degrees: captcha
}
}).then(result => {
logger.info(`app.verified.graphic result: ${JSON.stringify(result)}`);
return result;
});
}
/**
* 是否需要验证码
*/
isNeedImgCheck(udid) {
return this.get({
api: global.yoho.ServiceAPI,
url: 'smart/way',
data: {
udid: udid,
fromPage: PAGE
}
}).then(result => {
logger.info(`smart/way ${udid} result: ${JSON.stringify(result)}`);
return result;
});
}
};