imgcheck.js
891 Bytes
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
'use strict';
const _ = require('lodash');
let captchaData = require('../data/captcha.json');
// let api = global.yoho.API;
/**
* 获取图形旋转验证码
* @return Promise
* {
* "alg": "SALT_MD5",
* "code": 200,
* "data":
* {
* "degrees":
* [
* 90,
* 270,
* 90,
* 0
* ],
* "verifiedGraphicCode": "http://img11.static.yhbimg.com/yhb-img01/2016/12/09/09/011c1ef761ab6f0cdb9fbd116f409a6e52.png"
* },
* "md5": "25d3e6b030a142c32d246322e6884080",
* "message": "操作成功"
*}
*/
exports.gen = () => {
// let params = {
// method: 'web.register.getVerifiedGraphicCode'
// };
// return api.get('', params);
let random = _.random(0, captchaData.length);
return Promise.resolve({
code: 200,
data: captchaData[random]
});
};