LoginData.php
1.46 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
<?php
namespace LibModels\Web\Passport;
use Api\Sign;
use Api\Yohobuy;
/**
* 登录的数据模型
*
* @name LoginData
* @package LibModels/Web/Passport
* @copyright yoho.inc
* @version 1.0 (2015-12-30 14:05:04)
* @author xiaowei <xiaowei.gong@yoho.cn>
*/
class LoginData extends \LibModels\Wap\Passport\LoginData
{
/**
* 第三方登录接口(包括alipay,qq,sina)
* @param string $nickname 姓名
* @param string $openId 第三方唯一识别码
* @param string $sourceType 登录方式
* @param string $shoppingKey 未登录用户唯一识别码, 默认为空
* @return array 登录返回结果
*/
public static function signinByOpenID($nickname, $openId, $sourceType, $shoppingKey = null, $replaceId = '')
{
// 构建必传参数
$param = Yohobuy::param();
$param['v'] = '4';
$param['method'] = 'app.passport.signinByOpenID';
$param['openId'] = $openId;
$param['source_type'] = $sourceType;
$param['nickname'] = $nickname;
//wechat传入replace_id
if (!empty($replaceId)) {
$param['replace_id'] = $replaceId;
}
//购物车
if (!empty($shoppingKey)) {
$param['shopping_key'] = $shoppingKey;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL2, $param);
}
}