AccountData.php 5.73 KB
<?php

namespace LibModels\Web\Home;

use Api\Yohobuy;
use Api\Sign;

class AccountData
{

    /**
     * 获取用户验证信息
     * @param type $uid
     * @return type
     */
    public static function getVerifyInfo($uid)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.getUserVerifyInfo';
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 验证用户登录密码是否正确
     * @param type $uid
     * @param type $password
     * @return type
     */
    public static function verifyPwd($uid, $password)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.verifyUserPwd';
        $param['uid'] = $uid;
        $param['password'] = $password;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 修改密码
     * @param type $uid
     * @param type $newPwd
     * @return type
     */
    public static function modifyPwd($uid, $newPwd)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.changePwd';
        $param['uid'] = $uid;
        $param['newPassword'] = $newPwd;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 发送验证
     * @param type $uid
     * @param type $mobile
     * @param type $area
     * @return type
     */
    public static function sendMobileMsg($uid, $mobile, $area)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.sendcode';
        $param['mobile'] = $mobile;
        $param['area'] = $area;
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 验证短信验证码
     * @param type $area
     * @param type $mobile
     * @param type $code 短信验证码
     * @return type
     */
    public static function checkVerifyMsg($area, $mobile, $code)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.checkcode';
        $param['mobile'] = $mobile;
        $param['area'] = $area;
        $param['code'] = $code;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 修改手机号前校验
     * @param type $mobile
     * @param type $area
     * @return type
     */
    public static function checkVerifyMobile($uid, $mobile, $area)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.checkVerifyMobile';
        $param['mobile'] = $mobile;
        $param['area'] = $area;
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 修改验证手机号
     * @param type $uid
     * @param type $area
     * @param type $newMobile
     * @return type
     */
    public static function modifyVerifyMobile($uid, $area, $newMobile)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.changeVerifyMobile';
        $param['newMobile'] = $newMobile;
        $param['area'] = $area;
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 验证邮箱--发送邮件
     * @param type $uid
     * @param type $email
     * @return type
     */
    public static function sendVerifyEmail($uid, $email)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.verifyEmail';
        $param['email'] = $email;
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 邮箱身份验证--发送邮件
     * @param type $email
     * @param type $callback 成功后跳转链接
     * @return type
     */
    public static function sendVerifyEmailForNext($email, $callback)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.sendVerifyEmailInfo';
        $param['email'] = $email;
        $param['callback'] = $callback;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 修改邮箱前校验
     * @param type $uid
     * @param type $email
     */
    public static function checkVerifyEmail($uid, $email)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.checkVerifyEmail';
        $param['email'] = $email;
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 修改邮箱-校验验证url里的code
     */
    public static function checkEmailCode($code)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.checkCodeValid';
        $param['code'] = $code;
        $param['client_secret'] = Sign::getSign($param);
        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /**
     * 修改邮箱
     * @param type $code
     * @return type
     */
    public static function modifyVerifyEmail($code)
    {
        $param = Yohobuy::param();
        $param['method'] = 'web.passport.changeVerifyEmail';
        $param['code'] = $code;
        $param['client_secret'] = Sign::getSign($param);
        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

}