bind-service.js
1.13 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
/**
* 注册数据接口
*
* @author JiangFeng<jeff.jiang@yoho.cn>
* @date 2016/06/21
*/
'use strict';
const _ = require('lodash');
const BindApi = require('./bind-api');
const CaptchaImgService = require('./captcha-img-service');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.captchaService = new CaptchaImgService(ctx);
this.bindApi = new BindApi(ctx);
this.bindCheck = this.bindApi.bindCheck.bind(this.bindApi);
this.checkBindCode = this.bindApi.checkBindCode.bind(this.bindApi);
this.bindMobile = this.bindApi.bindMobile.bind(this.bindApi);
this.relateMobile = this.bindApi.relateMobile.bind(this.bindApi);
this.changeCheck = this.bindApi.changeCheck.bind(this.bindApi);
this.changeMobile = this.bindApi.changeCheck.bind(this.bindApi);
}
async sendBindMsg(area, mobile, id, captcha) {
let result = await this.bindApi.sendBindMsg(area, mobile, id, captcha);
let captchaNeed = await this.captchaService.try();
_.set(result, 'data.needCaptcha', captchaNeed);
return result;
}
};