BindData.php
2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?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 登录方式 qq,sina,alipay,wechat
* @param string $mobile 绑定输入手机号
* @return array 登录返回结果
*/
public static function bindCheck($mobile, $openId, $sourceType)
{
$param = Yohobuy::param();
$param['method'] = 'app.passport.check';
$param['mobile'] = $mobile;
$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($area,$mobile)
{
$param = Yohobuy::param();
$param['method'] = 'app.passport.smsbind';
$param['mobile'] = $mobile;
$param['area'] = $area;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 验证验证码是否正确
*
*/
public static function checkBindCode($area,$mobile, $code)
{
$param = Yohobuy::param();
$param['method'] = 'app.register.validRegCode';
$param['mobile'] = $mobile;
$param['code'] = $code;
$param['area'] = $area;
$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 $area 国别码
* @param string $password 密码
*/
public static function bindMobile($openId, $nickname, $sourceType, $mobile, $area, $password = '')
{
$param = Yohobuy::param();
$param['method'] = 'app.passport.bind';
$param['mobile'] = $mobile;
$param['open_id'] = $openId;
$param['nickname'] = $nickname;
$param['source_type'] = $sourceType;
$param['area'] = $area;
if (!empty($password))
{
$param['passport'] = $password;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}