account-api.js 4.87 KB
/**
 * 个人中心---账户安全
 * @author gaohongwei <hongwei.gao@yoho.cn>
 * @date: 2016/8/30
 */
'use strict';

const PAGE = 'pc';

module.exports = class extends global.yoho.BaseModel {
    constructor(ctx) {
        super(ctx);
    }

    getVerifyInfo(uid) {

        let data = {
            method: 'web.passport.getUserVerifyInfo',
            uid: uid
        };

        return this.get({
            data: data
        });

    }

    checkEmailCode(code) {

        let data = {
            method: 'web.passport.checkCodeValid',
            code: code
        };

        return this.get({
            data: data
        });

    }

    modifyVerifyEmail(code) {

        let data = {
            method: 'web.passport.changeVerifyEmail',
            code: code
        };

        return this.get({
            data: data
        });

    }

    verifyPwd(uid, password) {

        let data = {
            method: 'web.passport.verifyUserPwd',
            uid: uid,
            password: password
        };

        return this.get({
            data: data
        });

    }

    checkVerifyMsg(area, mobile, code) {

        let data = {
            method: 'web.passport.checkcode',
            area: area,
            mobile: mobile,
            code: code
        };

        return this.get({
            data: data
        });

    }

    /**
     * 邮箱身份验证--发送邮件
     * @param type $email
     * @param type $callback 成功后跳转链接
     * @return type
     */
    sendVerifyEmailForNext(email, callback, id, captcha) {

        let data = {
            method: 'web.passport.sendVerifyEmailInfo',
            email: email,
            callback: callback,
            udid: id,
            fromPage: PAGE,
            degrees: captcha
        };

        return this.get({
            data: data
        });

    }

    /**
     * 修改手机号
     * @param type $uid
     * @param type $area
     * @param type $newMobile
     * @return type
     */
    modifyVerifyMobile(uid, area, newMobile) {

        let data = {
            method: 'web.passport.changeMobileForce',
            uid: uid,
            area: area,
            newMobile: newMobile
        };

        return this.get({
            data: data
        });
    }


    /**
     * 修改邮箱前校验
     * @param type $uid
     * @param type $email
     */
    checkVerifyEmail(uid, email) {

        let data = {
            method: 'web.passport.checkVerifyEmail',
            uid: uid,
            email: email
        };

        return this.get({
            data: data
        });

    }

    /**
     * 验证邮箱--发送邮件
     * @param type $uid
     * @param type $email
     * @return type
     */
    sendVerifyEmail(uid, email) {

        let data = {
            method: 'web.passport.verifyEmail',
            uid: uid,
            email: email
        };

        return this.get({
            data: data
        });

    }

    /**
     * 修改手机号前校验
     * @param type $mobile
     * @param type $area
     * @return type
     */
    checkVerifyMobile(uid, mobile, area) {

        let data = {
            method: 'web.passport.checkVerifyMobile',
            uid: uid,
            mobile: mobile,
            area: area
        };

        return this.get({
            data: data
        });

    }

    /**
     * 修改密码
     * @param type $uid
     * @param type $newPwd
     * @return type
     */
    modifyPwd(uid, newPwd) {

        let data = {
            method: 'web.passport.changePwd',
            uid: uid,
            newPassword: newPwd
        };

        return this.get({
            data: data
        });

    }

    /**
     * 发送验证
     * @param type $uid
     * @param type $mobile
     * @param type $area
     * @return type
     */
    sendMobileMsg(uid, mobile, area, id, captcha) {

        let data = {
            method: 'web.passport.sendcode',
            uid: uid,
            mobile: mobile,
            area: area,
            udid: id,
            fromPage: PAGE,
            degrees: captcha
        };

        return this.get({
            data: data
        });

    }

    newSendMsg(area, mobile) {
        return this.get({
            data: {
                method: 'app.bind.sendChangeBindMobileCodeOnly',
                mobile: mobile,
                area: area,
            }
        });
    }

    newBindCheck(area, mobile, code) {
        return this.get({
            data: {
                method: 'app.bind.changeMobileCheck',
                mobile: mobile,
                area: area,
                code: code
            }
        });
    }

    newBindMobile(area, mobile, code, uid) {
        return this.get({
            data: {
                method: 'app.bind.changeMobileForce',
                mobile: mobile,
                area: area,
                code: code,
                uid: uid
            }
        });
    }

};