Blame view

apps/passport/models/phone-service.js 1.57 KB
陈轩 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* eslint no-unused-vars: ["error", { "args": "none" }] */
'use strict';
const API = global.yoho.API;

class PhoneService {
    // 校验 手机 是否 已注册
    // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/校验是否是注册用户.md
    static checkUserPhoneExist(mobile, area) {
        return API.get('', {
            method: 'app.passport.checkUserExist',
            mobile,
            area
        });
    }

    // 手机号 自动登录
    // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/手机号自动登录.md
陈轩 authored
18
    static autoSignin(param) {
陈轩 authored
19 20
        return API.get('', {
            method: 'app.passport.autoSignin',
陈轩 authored
21 22 23 24
            profile: param.profile,
            area: param.area,
            code: param.code,
            shopping_key: param.shopping_key
陈轩 authored
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
        });
    }

    // 发送 验证码
    // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/发送验证码.md
    static sendSMS(mobile, area, type) {
        return API.get('', {
            method: 'app.message.sendSms',
            mobile,
            area,
            type
        });
    }

    // 校验 验证码
    // http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/验证验证码.md
陈轩 authored
41
    static verifySMS(mobile, area, code, type) {
陈轩 authored
42
        return API.get('', {
陈轩 authored
43
            method: 'app.message.verifySmsCode',
陈轩 authored
44 45
            mobile,
            area,
陈轩 authored
46 47
            code,
            type
陈轩 authored
48 49 50 51 52
        });
    }
}

module.exports = PhoneService;