Blame view

apps/passport/models/imgcheck.js 891 Bytes
陈轩 authored
1
'use strict';
2
const _ = require('lodash');
陈轩 authored
3
let captchaData = require('../data/captcha.json');
陈轩 authored
4
5
// let api = global.yoho.API;
陈轩 authored
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/**
 *  获取图形旋转验证码
 *  @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": "操作成功"
 *}
 */
陈轩 authored
27
exports.gen = () => {
28 29 30 31 32 33 34
    // let params = {
    //     method: 'web.register.getVerifiedGraphicCode'
    // };

    // return api.get('', params);

    let random = _.random(0, captchaData.length);
陈轩 authored
35
36 37 38
    return Promise.resolve({
        code: 200,
        data: captchaData[random]
陈轩 authored
39
    });
陈轩 authored
40
};