BackData.php 1.03 KB
<?php
namespace LibModels\Web\Passport;
use Api\Sign;
use Api\Yohobuy;
class BackData extends \LibModels\Wap\Passport\BackData
{
    /**
     * 验证找回邮件code
     * 
     * @param string $code
     * @return array
     */
    public static function checkEmailCode($code)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.register.checkCodeValid';
        $param['code'] = $code;
        $param['client_secret'] = Sign::getSign($param);
        return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 缓存1小时
    }
    
    /**
     * 根据邮箱code修改密码
     * 
     * @param string $code
     * @param string $password
     * @return array
     */
    public static function modifyPasswordByEmailCode($code, $password)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.register.resetPwdByCode';
        $param['code'] = $code;
        $param['newPwd'] = $password;
        $param['client_secret'] = Sign::getSign($param);
        return Yohobuy::get(Yohobuy::API_URL, $param);
    }
}