|
|
<?php
|
|
|
|
|
|
namespace LibModels\Wap\Passport;
|
|
|
|
|
|
use Api\Sign;
|
|
|
use Api\Yohobuy;
|
|
|
|
|
|
/**
|
|
|
* 绑定手机号 数据模型
|
|
|
*
|
|
|
* @name BindData
|
|
|
* @package LibModels/Wap/Passport
|
|
|
* @copyright yoho.inc
|
|
|
* @version 1.0 (2015-12-14 10:00:00)
|
|
|
* @author xiaowei
|
|
|
*/
|
|
|
class BindData
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
* 绑定前检查
|
|
|
* @param string $openId 第三方唯一识别码
|
|
|
* @param string $sourceType 登录方式
|
|
|
* @param string $clientType 所属客户端类型
|
|
|
* @return array 登录返回结果
|
|
|
*/
|
|
|
public static function bindCheck($openId, $sourceType)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
|
|
|
$param['v'] = '7';
|
|
|
$param['method'] = 'app.passport.check';
|
|
|
$param['open_id'] = $openId;
|
|
|
$param['source_type'] = $sourceType;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送、重发送验证码
|
|
|
* @param string $mobile 手机号
|
|
|
*
|
|
|
*/
|
|
|
public static function sendBindMsg($mobile)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
|
|
|
$param['v'] = '7';
|
|
|
$param['method'] = 'app.passport.smsbind';
|
|
|
$param['mobile'] = $mobile;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 验证验证码是否正确
|
|
|
*
|
|
|
*/
|
|
|
public static function checkBindCode($mobile, $code)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
|
|
|
$param['v'] = '7';
|
|
|
$param['method'] = 'app.register.validRegCode';
|
|
|
$param['mobile'] = $mobile;
|
|
|
$param['code'] = $code;
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 第三方绑定手机号
|
|
|
* @param string $nickname 姓名
|
|
|
* @param string $openId 第三方唯一识别码
|
|
|
* @param string $sourceType 登录方式
|
|
|
* @param string $mobile 手机号
|
|
|
* @param string $password 密码
|
|
|
*/
|
|
|
public static function bindMobile($openId, $nickname, $sourceType, $mobile, $password)
|
|
|
{
|
|
|
$param = Yohobuy::param();
|
|
|
|
|
|
$param['v'] = '7';
|
|
|
$param['method'] = 'app.passport.bind';
|
|
|
$param['mobile'] = $mobile;
|
|
|
$param['passport'] = $password;
|
|
|
$param['open_id'] = $openId;
|
|
|
$param['nickname'] = $nickname;
|
|
|
$param['source_type'] = $sourceType;
|
|
|
|
|
|
$param['client_secret'] = Sign::getSign($param);
|
|
|
|
|
|
return Yohobuy::get(Yohobuy::API_URL, $param);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|