完成第三方登录,完善一些缺失的接口(品牌,品类)
Showing
14 changed files
with
273 additions
and
59 deletions
@@ -16,6 +16,7 @@ class Yohobuy | @@ -16,6 +16,7 @@ class Yohobuy | ||
16 | 16 | ||
17 | const API_URL = 'http://api2.open.yohobuy.com/'; | 17 | const API_URL = 'http://api2.open.yohobuy.com/'; |
18 | const SERVICE_URL = 'http://service.api.yohobuy.com/'; | 18 | const SERVICE_URL = 'http://service.api.yohobuy.com/'; |
19 | + const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
19 | 20 | ||
20 | /** | 21 | /** |
21 | * 私钥列表 | 22 | * 私钥列表 |
@@ -49,4 +49,81 @@ class BrandData | @@ -49,4 +49,81 @@ class BrandData | ||
49 | 49 | ||
50 | return Yohobuy::get(Yohobuy::SERVICE_URL.'operations/api/v5/resource/get', $param); | 50 | return Yohobuy::get(Yohobuy::SERVICE_URL.'operations/api/v5/resource/get', $param); |
51 | } | 51 | } |
52 | + | ||
53 | + /** | ||
54 | + * 获取品牌介绍 | ||
55 | + * | ||
56 | + * @param integer $brandId 品牌ID | ||
57 | + * @return array 品牌介绍信息 | ||
58 | + */ | ||
59 | + public static function getBrandIntro($brandId) | ||
60 | + { | ||
61 | + // 构建必传参数 | ||
62 | + $param = Yohobuy::param(); | ||
63 | + | ||
64 | + $param['brand_id'] = '$brandId'; | ||
65 | + $param['method'] = 'app.brand.getBrandIntro'; | ||
66 | + $param['client_secret'] = Sign::getSign($param); | ||
67 | + | ||
68 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * 获取品牌banner数据 | ||
73 | + * @param integer $brandId 品牌ID | ||
74 | + * @return array banner数据 | ||
75 | + */ | ||
76 | + public static function getBrandBanner($brandId) | ||
77 | + { | ||
78 | + // 构建必传参数 | ||
79 | + $param = Yohobuy::param(); | ||
80 | + | ||
81 | + $param['brand_id'] = '$brandId'; | ||
82 | + $param['method'] = 'app.brand.banner'; | ||
83 | + $param['client_secret'] = Sign::getSign($param); | ||
84 | + | ||
85 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * 查询品牌数据 | ||
90 | + * | ||
91 | + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | ||
92 | + * @param integer $brand 品牌Id | ||
93 | + * @param integer $sort 品类Id | ||
94 | + * @param integer $color 颜色Id | ||
95 | + * @param integer $size 尺码Id | ||
96 | + * @param string $price 价格 | ||
97 | + * @param string $p_d 折扣 | ||
98 | + * @param string $order 排序方式,默认s_t_desc | ||
99 | + * @param integer $limit 限制查询的数目,默认为60 | ||
100 | + * @param integer $page 查询第几页,默认为第1页 | ||
101 | + * @param integer $channel 表示频道号,1位男生,2为女生 | ||
102 | + * @return array 品牌数据 | ||
103 | + */ | ||
104 | + public static function selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d, $channel = 1, $order = 's_t_desc', $limit = 60, $page = 1) | ||
105 | + { | ||
106 | + $selectItems = array( | ||
107 | + 'gender' => $gender, | ||
108 | + 'brand' => $brand, | ||
109 | + 'sort' => $sort, | ||
110 | + 'color' => $color, | ||
111 | + 'size' => $size, | ||
112 | + 'price' => $price, | ||
113 | + 'p_d' => $p_d | ||
114 | + ); | ||
115 | + // 拉取筛选参数 | ||
116 | + $queriedParams = array_filter($selectItems, function($v) {return $v !== null;}); | ||
117 | + | ||
118 | + // 构建必传参数 | ||
119 | + $param = Yohobuy::param(); | ||
120 | + | ||
121 | + $param['method'] = 'app.search.brand'; | ||
122 | + $param['page'] = $page; | ||
123 | + $param['limit'] = $limit; | ||
124 | + $param['yh_channel'] = $channel; | ||
125 | + $param['client_secret'] = Sign::getSign($param); | ||
126 | + | ||
127 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
128 | + } | ||
52 | } | 129 | } |
@@ -30,4 +30,46 @@ class ClassData | @@ -30,4 +30,46 @@ class ClassData | ||
30 | 30 | ||
31 | return Yohobuy::get(Yohobuy::API_URL, $param); | 31 | return Yohobuy::get(Yohobuy::API_URL, $param); |
32 | } | 32 | } |
33 | + | ||
34 | + /** | ||
35 | + * 查询品类商品数据 | ||
36 | + * | ||
37 | + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | ||
38 | + * @param integer $brand 品牌Id | ||
39 | + * @param integer $sort 品类Id | ||
40 | + * @param integer $color 颜色Id | ||
41 | + * @param integer $size 尺码Id | ||
42 | + * @param string $price 价格 | ||
43 | + * @param string $p_d 折扣 | ||
44 | + * @param string $order 排序方式,默认s_t_desc | ||
45 | + * @param integer $limit 限制查询的数目,默认为60 | ||
46 | + * @param integer $page 查询第几页,默认为第1页 | ||
47 | + * @param integer $channel 表示频道号,1位男生,2为女生 | ||
48 | + * @return array 品类商品数据 | ||
49 | + */ | ||
50 | + public static function selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d, $channel = 1, $order = 's_t_desc', $limit = 60, $page = 1) | ||
51 | + { | ||
52 | + $selectItems = array( | ||
53 | + 'gender' => $gender, | ||
54 | + 'brand' => $brand, | ||
55 | + 'sort' => $sort, | ||
56 | + 'color' => $color, | ||
57 | + 'size' => $size, | ||
58 | + 'price' => $price, | ||
59 | + 'p_d' => $p_d | ||
60 | + ); | ||
61 | + // 拉取筛选参数 | ||
62 | + $queriedParams = array_filter($selectItems, function($v) {return $v !== null;}); | ||
63 | + | ||
64 | + // 构建必传参数 | ||
65 | + $param = Yohobuy::param(); | ||
66 | + | ||
67 | + $param['method'] = 'app.search.category'; | ||
68 | + $param['page'] = $page; | ||
69 | + $param['limit'] = $limit; | ||
70 | + $param['yh_channel'] = $channel; | ||
71 | + $param['client_secret'] = Sign::getSign($param); | ||
72 | + | ||
73 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
74 | + } | ||
33 | } | 75 | } |
@@ -50,6 +50,24 @@ class BackData | @@ -50,6 +50,24 @@ class BackData | ||
50 | } | 50 | } |
51 | 51 | ||
52 | /** | 52 | /** |
53 | + * 根据邮箱验证码修改密码(调用www.yohobuy.com接口) | ||
54 | + * | ||
55 | + * @param string $pwd 新密码 | ||
56 | + * @param string $code 邮箱验证码 | ||
57 | + * @return array 返回状态数据 | ||
58 | + */ | ||
59 | + public static function modifyPasswordByEmail($pwd, $code) | ||
60 | + { | ||
61 | + $param['pwd'] = $pwd; | ||
62 | + $param['re-input'] = $pwd; | ||
63 | + $param['code'] = $code; | ||
64 | + | ||
65 | + return Yohobuy::post(Yohobuy::YOHOBUY_URL.'passport/back/update', $param); | ||
66 | + } | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + /** | ||
53 | * 通过手机找回密码 | 71 | * 通过手机找回密码 |
54 | * | 72 | * |
55 | * @param string $mobile 手机号 | 73 | * @param string $mobile 手机号 |
1 | <?php | 1 | <?php |
2 | +namespace LibModels\Wap\Passport; | ||
2 | 3 | ||
3 | -/* | ||
4 | - * To change this license header, choose License Headers in Project Properties. | ||
5 | - * To change this template file, choose Tools | Templates | ||
6 | - * and open the template in the editor. | ||
7 | - */ | 4 | +use Api\Yohobuy; |
5 | +use Api\Sign; | ||
8 | 6 | ||
7 | +class LoginData | ||
8 | +{ | ||
9 | + /** | ||
10 | + * 第三方登录接口(包括alipay,qq,sina) | ||
11 | + * @param string $nickname 姓名 | ||
12 | + * @param string $openId 第三方唯一识别码 | ||
13 | + * @param string $sourceType 登录方式 | ||
14 | + * @return array 登录返回结果 | ||
15 | + */ | ||
16 | + public static function signinByOpenID($nickname, $openId, $sourceType) | ||
17 | + { | ||
18 | + // 构建必传参数 | ||
19 | + $param = Yohobuy::param(); | ||
20 | + | ||
21 | + $param['method'] = 'app.passport.signinByOpenID'; | ||
22 | + $param['openId'] = $openId; | ||
23 | + $param['source_type'] = $sourceType; | ||
24 | + $param['client_secret'] = Sign::getSign($param); | ||
25 | + | ||
26 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
27 | + } | ||
28 | +} |
@@ -70,14 +70,14 @@ class NewsaleData | @@ -70,14 +70,14 @@ class NewsaleData | ||
70 | /** | 70 | /** |
71 | * 筛选新品到着、折扣专区商品 | 71 | * 筛选新品到着、折扣专区商品 |
72 | * | 72 | * |
73 | - * @param string gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | 73 | + * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 |
74 | * @param integer $brand 品牌Id | 74 | * @param integer $brand 品牌Id |
75 | * @param integer $sort 品类Id | 75 | * @param integer $sort 品类Id |
76 | * @param integer $color 颜色Id | 76 | * @param integer $color 颜色Id |
77 | * @param integer $size 尺码Id | 77 | * @param integer $size 尺码Id |
78 | * @param string $price 价格 | 78 | * @param string $price 价格 |
79 | * @param string $p_d 折扣 | 79 | * @param string $p_d 折扣 |
80 | - * @param string $channel 1表示男, 2表示女 | 80 | + * @param integer $channel 表示频道号,1位男生,2为女生 |
81 | * @param integer $dayLimit 限制读取多少天,默认为1天 | 81 | * @param integer $dayLimit 限制读取多少天,默认为1天 |
82 | * @param integer $limit 查询返回的最大限制数, 默认为50 | 82 | * @param integer $limit 查询返回的最大限制数, 默认为50 |
83 | * @param integer $page 分页第几页, 默认第1页 | 83 | * @param integer $page 分页第几页, 默认第1页 |
@@ -92,14 +92,14 @@ class NewsaleData | @@ -92,14 +92,14 @@ class NewsaleData | ||
92 | 'color' => $color, | 92 | 'color' => $color, |
93 | 'size' => $size, | 93 | 'size' => $size, |
94 | 'price' => $price, | 94 | 'price' => $price, |
95 | - 'p_d' => $p_d | 95 | + 'p_d' => $p_d, |
96 | + 'dayLimit' => $dayLimit | ||
96 | ); | 97 | ); |
97 | // 拉取筛选参数 | 98 | // 拉取筛选参数 |
98 | $queriedParams = array_filter($selectItems, function($v) {return $v !== null;}); | 99 | $queriedParams = array_filter($selectItems, function($v) {return $v !== null;}); |
99 | 100 | ||
100 | $param = Yohobuy::param(); | 101 | $param = Yohobuy::param(); |
101 | $param['method'] = 'app.search.newProduct'; | 102 | $param['method'] = 'app.search.newProduct'; |
102 | - $param['dayLimit'] = $dayLimit; | ||
103 | $param['page'] = $page; | 103 | $param['page'] = $page; |
104 | $param['limit'] = $limit; | 104 | $param['limit'] = $limit; |
105 | $param['yh_channel'] = $channel; | 105 | $param['yh_channel'] = $channel; |
@@ -27,10 +27,10 @@ class Helpers | @@ -27,10 +27,10 @@ class Helpers | ||
27 | * @param array|string $keys 指定键值,数组或者字符串 | 27 | * @param array|string $keys 指定键值,数组或者字符串 |
28 | * @return array 获取的数据 | 28 | * @return array 获取的数据 |
29 | */ | 29 | */ |
30 | - /*public static function array_get($array, $keys) | 30 | + public static function array_get($array, $keys) |
31 | { | 31 | { |
32 | return array_intersect_key($array, array_flip((array) $keys)); | 32 | return array_intersect_key($array, array_flip((array) $keys)); |
33 | } | 33 | } |
34 | - */ | 34 | + |
35 | 35 | ||
36 | } | 36 | } |
@@ -15,5 +15,5 @@ return array( | @@ -15,5 +15,5 @@ return array( | ||
15 | // 访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http | 15 | // 访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http |
16 | 'transport' => 'http', | 16 | 'transport' => 'http', |
17 | // 页面跳转同步通知页面路径 (需http://格式的完整路径,不允许加?id=123这类自定义参数) | 17 | // 页面跳转同步通知页面路径 (需http://格式的完整路径,不允许加?id=123这类自定义参数) |
18 | - 'return_url' => SITE_MAIN . '/passport/sso/partnercallback/partner/alipay', | 18 | + 'return_url' => SITE_MAIN . '/passport/login/alipaycallback', |
19 | ); | 19 | ); |
@@ -73,7 +73,7 @@ class Call extends Factory | @@ -73,7 +73,7 @@ class Call extends Factory | ||
73 | 73 | ||
74 | if (is_array($token) && isset($token['openid'])) | 74 | if (is_array($token) && isset($token['openid'])) |
75 | { | 75 | { |
76 | - $this->qc = new QC($token['access_token'], $token['openid']); | 76 | + $this->qc = new \QC($token['access_token'], $token['openid']); |
77 | 77 | ||
78 | $userInfo = $this->qc->get_user_info(); | 78 | $userInfo = $this->qc->get_user_info(); |
79 | 79 | ||
@@ -110,7 +110,7 @@ class Call extends Factory | @@ -110,7 +110,7 @@ class Call extends Factory | ||
110 | 110 | ||
111 | if (is_array($token) && isset($token['openid'])) | 111 | if (is_array($token) && isset($token['openid'])) |
112 | { | 112 | { |
113 | - $this->qc = new QC($token['access_token'], $token['openid']); | 113 | + $this->qc = new \QC($token['access_token'], $token['openid']); |
114 | 114 | ||
115 | $friends = $this->qc->get_idollist($params); | 115 | $friends = $this->qc->get_idollist($params); |
116 | 116 | ||
@@ -138,7 +138,7 @@ class Call extends Factory | @@ -138,7 +138,7 @@ class Call extends Factory | ||
138 | 138 | ||
139 | if (is_array($token) && isset($token['openid'])) | 139 | if (is_array($token) && isset($token['openid'])) |
140 | { | 140 | { |
141 | - $this->qc = new QC($token['access_token'], $token['openid']); | 141 | + $this->qc = new \QC($token['access_token'], $token['openid']); |
142 | 142 | ||
143 | $param = array('title' => '来自YOHO.CN的分享', 'url' => $link, 'summary' => $content, | 143 | $param = array('title' => '来自YOHO.CN的分享', 'url' => $link, 'summary' => $content, |
144 | 'images' => $image, 'site' => 'yoho.cn', 'fromurl' => SITE_MAIN,); | 144 | 'images' => $image, 'site' => 'yoho.cn', 'fromurl' => SITE_MAIN,); |
1 | <?php | 1 | <?php |
2 | -defined('SITE_MAIN') || define('SITE_MAIN', 'http://www.yoho.cn'); | 2 | +defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']); |
3 | 3 | ||
4 | return array( | 4 | return array( |
5 | 'appid' => '100229394', | 5 | 'appid' => '100229394', |
6 | 'appkey' => 'c0af9c29e0900813028c2ccb42021792', | 6 | 'appkey' => 'c0af9c29e0900813028c2ccb42021792', |
7 | - 'callback' => SITE_MAIN . '/passport/sso/partnercallback/partner/qqconnect', | 7 | + 'callback' => SITE_MAIN . '/passport/login/qqcallback', |
8 | 'scope' => 'get_user_info,add_share,upload_pic,get_idollist,get_fanslist', | 8 | 'scope' => 'get_user_info,add_share,upload_pic,get_idollist,get_fanslist', |
9 | 'errorReport' => false, | 9 | 'errorReport' => false, |
10 | ); | 10 | ); |
1 | <?php | 1 | <?php |
2 | -defined('SITE_MAIN') || define('SITE_MAIN', 'http://www.yoho.cn'); | 2 | +defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']); |
3 | 3 | ||
4 | return array( | 4 | return array( |
5 | 'appId' => '2707954749', | 5 | 'appId' => '2707954749', |
6 | 'appKey' => '431730e25a8a0983964a740731c3cb7d', | 6 | 'appKey' => '431730e25a8a0983964a740731c3cb7d', |
7 | - 'appCallbackUrl' => SITE_MAIN . '/passport/sso/partnercallback/partner/sinaweibo', | 7 | + 'appCallbackUrl' => SITE_MAIN . '/passport/login/sinacallback', |
8 | ); | 8 | ); |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | use LibModels\Wap\Passport\BackData; | 4 | use LibModels\Wap\Passport\BackData; |
5 | +use Hood\Core\Security\AuthCode; | ||
5 | /** | 6 | /** |
6 | * 频道选择 | 7 | * 频道选择 |
7 | */ | 8 | */ |
@@ -37,7 +38,7 @@ class BackController extends AbstractAction | @@ -37,7 +38,7 @@ class BackController extends AbstractAction | ||
37 | // 发送邮箱验证码 | 38 | // 发送邮箱验证码 |
38 | $result = BackData::sendCodeToEmail($email); | 39 | $result = BackData::sendCodeToEmail($email); |
39 | 40 | ||
40 | - $this->echoJson($result); | 41 | + $this->returnJson($result['code'], $result['message'], $result['data']); |
41 | } | 42 | } |
42 | } | 43 | } |
43 | 44 | ||
@@ -63,13 +64,15 @@ class BackController extends AbstractAction | @@ -63,13 +64,15 @@ class BackController extends AbstractAction | ||
63 | */ | 64 | */ |
64 | public function passwordByEmailAction() | 65 | public function passwordByEmailAction() |
65 | { | 66 | { |
66 | - // host是www.yohobuy.com ,只需要code,然后再输入新密码即可 | ||
67 | - $code = $this->get('code', ''); | 67 | + if($this->isAjax()) |
68 | + { | ||
69 | + $pwd = $this->get('pwd', ''); | ||
70 | + $code = $this->get('code', ''); | ||
68 | 71 | ||
69 | - // 根据邮箱修改密码(接口待定) | ||
70 | - // $result = BackData::validateMobileCode($mobile, $code, $area); | 72 | + $data = BackData::modifyPasswordByEmail($pwd, $code); |
71 | 73 | ||
72 | - $this->echoJson($data); | 74 | + $this->returnJson(200, '成功', '');// 前端不需要判断结果 |
75 | + } | ||
73 | } | 76 | } |
74 | 77 | ||
75 | 78 | ||
@@ -127,7 +130,7 @@ class BackController extends AbstractAction | @@ -127,7 +130,7 @@ class BackController extends AbstractAction | ||
127 | // 发送手机验证码 | 130 | // 发送手机验证码 |
128 | $result = BackData::sendCodeToMobile($mobile, $area); | 131 | $result = BackData::sendCodeToMobile($mobile, $area); |
129 | 132 | ||
130 | - $this->echoJson($result); | 133 | + $this->returnJson($result['code'], $result['message'], $result['data']); |
131 | } | 134 | } |
132 | } | 135 | } |
133 | 136 | ||
@@ -152,7 +155,7 @@ class BackController extends AbstractAction | @@ -152,7 +155,7 @@ class BackController extends AbstractAction | ||
152 | /** | 155 | /** |
153 | * 校验手机验证码 | 156 | * 校验手机验证码 |
154 | * | 157 | * |
155 | - * @return array 校验手机验证码的结果 | 158 | + * @return array 校验手机验证码的结果(token) |
156 | */ | 159 | */ |
157 | public function mobilecodeValidateAction() | 160 | public function mobilecodeValidateAction() |
158 | { | 161 | { |
@@ -165,7 +168,7 @@ class BackController extends AbstractAction | @@ -165,7 +168,7 @@ class BackController extends AbstractAction | ||
165 | // 校验手机验证码 | 168 | // 校验手机验证码 |
166 | $result = BackData::validateMobileCode($mobile, $code, $area); | 169 | $result = BackData::validateMobileCode($mobile, $code, $area); |
167 | 170 | ||
168 | - $this->echoJson($data); | 171 | + $this->returnJson($result['code'], $result['message'], $result['data']); |
169 | } | 172 | } |
170 | } | 173 | } |
171 | 174 | ||
@@ -212,7 +215,7 @@ class BackController extends AbstractAction | @@ -212,7 +215,7 @@ class BackController extends AbstractAction | ||
212 | // 根据手机验证码修改密码 | 215 | // 根据手机验证码修改密码 |
213 | $result = BackData::modifyPasswordByMobile($mobile, $token, $newpwd, $area); | 216 | $result = BackData::modifyPasswordByMobile($mobile, $token, $newpwd, $area); |
214 | 217 | ||
215 | - $this->echoJson($data); | 218 | + $this->returnJson($result['code'], $result['message'], $result['data']); |
216 | } | 219 | } |
217 | } | 220 | } |
218 | } | 221 | } |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | use Plugin\Partner\Factory; | 4 | use Plugin\Partner\Factory; |
5 | +use LibModels\Wap\Passport\LoginData; | ||
5 | 6 | ||
6 | class LoginController extends AbstractAction | 7 | class LoginController extends AbstractAction |
7 | { | 8 | { |
@@ -75,4 +76,83 @@ class LoginController extends AbstractAction | @@ -75,4 +76,83 @@ class LoginController extends AbstractAction | ||
75 | 76 | ||
76 | exit(); | 77 | exit(); |
77 | } | 78 | } |
79 | + | ||
80 | + /** | ||
81 | + * 支付宝账号登录:回调方法 | ||
82 | + */ | ||
83 | + public function alipaycallbackAction() | ||
84 | + { | ||
85 | + $nickname = ''; | ||
86 | + $alipay = Factory::create('alipay'); | ||
87 | + $access = $alipay->getAccessToken(); | ||
88 | + | ||
89 | + if (!isset($_GET['real_name'])) | ||
90 | + { | ||
91 | + /* 获取支付宝用户的详细信息 */ | ||
92 | + $userInfo = $alipay->getUserInfo($access); | ||
93 | + if ($userInfo && $userInfo['is_success'] === 'T' && isset($userInfo['response']['user_info']['user_name'])) | ||
94 | + { | ||
95 | + $nickname = $userInfo['response']['user_info']['user_name']; | ||
96 | + $alipayEmail = $userInfo['response']['user_info']['email']; | ||
97 | + } | ||
98 | + var_dump($userInfo); | ||
99 | + } | ||
100 | + else | ||
101 | + { | ||
102 | + $nickname = $_GET['real_name']; | ||
103 | + $alipayEmail = isset($_GET['email']) ? $_GET['email'] : ''; | ||
104 | + } | ||
105 | + var_dump($access); | ||
106 | + | ||
107 | + $result = LoginData::signinByOpenID($nickname, $access['user_id'], 'qq'); | ||
108 | + | ||
109 | + if($result['code'] == 200) | ||
110 | + { | ||
111 | + echo '登陆成功'; | ||
112 | + } | ||
113 | + } | ||
114 | + | ||
115 | + /** | ||
116 | + * QQ账号登录:回调方法 | ||
117 | + */ | ||
118 | + public function qqcallbackAction() | ||
119 | + { | ||
120 | + $qqconnect = Factory::create('qqconnect'); | ||
121 | + $access = $qqconnect->getAccessToken(); | ||
122 | + /* 获取QQ腾讯用户的详细信息 */ | ||
123 | + $partnerInfo = $qqconnect->getUserInfo($access); | ||
124 | + var_dump($access, $partnerInfo); | ||
125 | + | ||
126 | + if ($partnerInfo && is_array($partnerInfo)) | ||
127 | + { | ||
128 | + $result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq'); | ||
129 | + | ||
130 | + if($result['code'] == 200) | ||
131 | + { | ||
132 | + echo '登陆成功'; | ||
133 | + } | ||
134 | + } | ||
135 | + } | ||
136 | + | ||
137 | + /** | ||
138 | + * 新浪微博账号登录:回调方法 | ||
139 | + */ | ||
140 | + public function sinacallbackAction() | ||
141 | + { | ||
142 | + $sina = Factory::create('sina'); | ||
143 | + $access = $sina->getAccessToken(); | ||
144 | + /* 获取QQ腾讯用户的详细信息 */ | ||
145 | + $partnerInfo = $sina->getUserInfo($access); | ||
146 | + var_dump($access, $partnerInfo); | ||
147 | + | ||
148 | + if ($partnerInfo && is_array($partnerInfo)) | ||
149 | + { | ||
150 | + $result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina'); | ||
151 | + | ||
152 | + if($result['code'] == 200) | ||
153 | + { | ||
154 | + echo '登陆成功'; | ||
155 | + } | ||
156 | + } | ||
157 | + } | ||
78 | } | 158 | } |
@@ -36,7 +36,7 @@ class NewsaleController extends AbstractAction | @@ -36,7 +36,7 @@ class NewsaleController extends AbstractAction | ||
36 | 36 | ||
37 | 37 | ||
38 | /** | 38 | /** |
39 | - * Ajax方式筛选新品到着商品 | 39 | + * Ajax方式筛选新品到着、折扣专区商品 |
40 | * | 40 | * |
41 | * @return array 根据指定条件筛选之后的商品 | 41 | * @return array 根据指定条件筛选之后的商品 |
42 | */ | 42 | */ |
@@ -56,9 +56,9 @@ class NewsaleController extends AbstractAction | @@ -56,9 +56,9 @@ class NewsaleController extends AbstractAction | ||
56 | $limit = $this->get('limit', 50); | 56 | $limit = $this->get('limit', 50); |
57 | $page = $this->get('page', 1); | 57 | $page = $this->get('page', 1); |
58 | 58 | ||
59 | - $data = Newsale::selectNewProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page); | 59 | + $data = Newsale::selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page); |
60 | 60 | ||
61 | - $this->echoJson($data); | 61 | + $this->returnJson(200, '获取成功', $data); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
@@ -88,31 +88,4 @@ class NewsaleController extends AbstractAction | @@ -88,31 +88,4 @@ class NewsaleController extends AbstractAction | ||
88 | 88 | ||
89 | $this->_view->display('new', compact('focus', 'products')); | 89 | $this->_view->display('new', compact('focus', 'products')); |
90 | } | 90 | } |
91 | - | ||
92 | - /** | ||
93 | - * Ajax方式筛选折扣专区商品 | ||
94 | - * | ||
95 | - * @return array 根据指定条件筛选之后的商品 | ||
96 | - */ | ||
97 | - public function selectSaleAction() | ||
98 | - { | ||
99 | - if($this->isAjax()) | ||
100 | - { | ||
101 | - $gender = $this->get('gender', '1,3'); | ||
102 | - $brand = $this->get('brand', null); | ||
103 | - $sort = $this->get('sort', null); | ||
104 | - $color = $this->get('color', null); | ||
105 | - $size = $this->get('size', null); | ||
106 | - $price = $this->get('price', null); | ||
107 | - $p_d = $this->get('p_d', null); | ||
108 | - $channel = $this->get('channel', '1'); | ||
109 | - $dayLimit = $this->get('dayLimit', '1'); | ||
110 | - $limit = $this->get('limit', 50); | ||
111 | - $page = $this->get('page', 1); | ||
112 | - | ||
113 | - $data = Newsale::selectSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page); | ||
114 | - | ||
115 | - $this->echoJson($data); | ||
116 | - } | ||
117 | - } | ||
118 | } | 91 | } |
-
Please register or login to post a comment