cert-service.js
888 Bytes
'use strict';
const CertApi = require('./cert-api');
const CaptchaImgService = require('./captcha-img-service');
const _ = require('lodash');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.api = new CertApi(ctx);
this.captchaService = new CaptchaImgService(ctx);
this.certCheck = this.api.certCheck.bind(this.api);
this.certMobile = this.api.certMobile.bind(this.api);
this.relateMobile = this.api.relateMobile.bind(this.api);
this.checkEmailCertTip = this.api.checkEmailCertTip.bind(this.api);
}
async sendCertMsg(mobile, area, id, captcha) {
let result = await this.api.sendCertMsg(mobile, area, id, captcha);
let captchaNeed = await this.captchaService.try();
_.set(result, 'data.needCaptcha', captchaNeed);
return result;
}
};