Authored by htoooth

Merge branch 'hotfix/universe' into gray

const CaptchaApi = require('./captcha-api');
const logger = global.yoho.logger;
const config = global.yoho.config;
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -16,8 +17,16 @@ module.exports = class extends global.yoho.BaseModel {
});
}
_checkUniverse(captcha) {
return captcha === config.UNIVERSAL_CAPTCHA ?
Promise.resolve({code: 200}) :
Promise.reject();
}
check(id, captcha) {
return this.api.check(id, captcha).then((result) => {
return this._checkUniverse(captcha)
.catch(() => this.api.check(id, captcha))
.then((result) => {
if (result.code === 200) {
return {
code: 200,
... ...
... ... @@ -136,6 +136,7 @@ module.exports = {
id: '356b333091cdb78cd788e7bdd5f05c9f',
key: '6fef8ee77e41429de68455eeb052ce37'
},
UNIVERSAL_CAPTCHA: 'yoho4946abcdef#$%&!@',
apiCache: {
cache: false
},
... ...