phone-service.js 1.68 KB
/* eslint no-unused-vars: ["error", { "args": "none" }] */
'use strict';
const API = global.yoho.API;
const FROM = require('../../../config/from');

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
    static autoSignin(param) {
        return API.get('', {
            method: 'app.passport.autoSignin',
            profile: param.profile,
            area: param.area,
            code: param.code,
            shopping_key: param.shopping_key,
            business_line: FROM[param.from].business_line
        });
    }

    // 发送 验证码
    // 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
    static verifySMS(mobile, area, code, type) {
        return API.get('', {
            method: 'app.message.verifySmsCode',
            mobile,
            area,
            code,
            type
        });
    }
}

module.exports = PhoneService;