reg-service.js 1.12 KB
/**
 * 注册 model
 */
'use strict';
const passportHelper = require('./passport-helper');

const REGISTER_LEFT_BANNER_CODE = 'c479ec90120cae7f96e52922b4917064'; // 注册左边的banner
const api = global.yoho.API;

let getRegData = () => {
    return passportHelper.getLeftBannerAsync(REGISTER_LEFT_BANNER_CODE);
};

let sendCodeToMobile = (area, mobile) => {
    let params = {
        method: 'app.register.sendRegCodeToMobile',
        area: area,
        mobile: mobile
    };

    return api.post('', params);
};

let validMobileCode = (area, mobile, code) => {
    let params = {
        method: 'app.register.validRegCode',
        area: area,
        mobile: mobile,
        code: code
    };

    return api.post('', params);
};

let regMobile = (area, mobile, password, shoppingKey)=> {
    let params = {
        method: 'app.passport.register',
        area: area,
        profile: mobile,
        password: password
    };

    if (shoppingKey) {
        params.shopping_key = shoppingKey;
    }

    return api.post('', params);
};

module.exports = {
    getRegData,
    sendCodeToMobile,
    validMobileCode,
    regMobile
};