phone-service.js
2.14 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* eslint no-unused-vars: ["error", { "args": "none" }] */
'use strict';
const _ = require('lodash');
const FROM = require('../../../config/from');
const PAGE = 'H5';
class PhoneServiceModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
// 校验 手机 是否 已注册
// http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/校验是否是注册用户.md
checkUserPhoneExist(mobile, area) {
return this.get({
data: {
method: 'app.passport.checkUserExist',
mobile,
area
}
});
}
// 手机号 自动登录
// http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/手机号自动登录.md
autoSignin(param) {
return this.get({
data: {
method: 'app.passport.autoSignin',
profile: param.profile,
area: param.area,
code: param.code,
shopping_key: param.shopping_key,
business_line: _.get(FROM, `${param.from}.business_line`)
}
});
}
// 发送 验证码
// http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/发送验证码.md
sendSMS(params) {
return this.get({
data: {
method: 'app.message.sendSms',
mobile: params.mobile,
area: params.area,
type: params.type,
udid: params.udid,
fromPage: PAGE,
degrees: params.captcha,
superCapture: params.superCapture
}
});
}
// 校验 验证码
// http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/验证验证码.md
verifySMS(mobile, area, code, type) {
return this.get({
data: {
method: 'app.message.verifySmsCode',
mobile,
area,
code,
type
}
});
}
}
module.exports = PhoneServiceModel;