Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
12 changed files
with
537 additions
and
526 deletions
@@ -299,7 +299,7 @@ class AbstractAction extends Controller_Abstract | @@ -299,7 +299,7 @@ class AbstractAction extends Controller_Abstract | ||
299 | if (!$this->_useSession) { | 299 | if (!$this->_useSession) { |
300 | $useSession = false; | 300 | $useSession = false; |
301 | } | 301 | } |
302 | - $useSession = false; | 302 | + //$useSession = false; |
303 | 303 | ||
304 | if (!$this->_uid) { | 304 | if (!$this->_uid) { |
305 | $cookie = $this->getCookie('_UID'); | 305 | $cookie = $this->getCookie('_UID'); |
@@ -17,186 +17,186 @@ use Api\Yohobuy; | @@ -17,186 +17,186 @@ use Api\Yohobuy; | ||
17 | class CartData | 17 | class CartData |
18 | { | 18 | { |
19 | 19 | ||
20 | - /** | ||
21 | - * 加入购物车接口 | ||
22 | - * | ||
23 | - * @param int $productSku 商品SKU | ||
24 | - * @param int $buyNumber 购买数量 | ||
25 | - * @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品 | ||
26 | - * @param int $isEdit 是否是编辑商品SKU,0表示不是编辑 | ||
27 | - * @param null|int $promotionId 促销id,默认null(加价购有关) | ||
28 | - * @param null|int $uid 用户UID,可以不传 | 20 | + /** |
21 | + * 加入购物车接口 | ||
22 | + * | ||
23 | + * @param int $productSku 商品SKU | ||
24 | + * @param int $buyNumber 购买数量 | ||
25 | + * @param int $goodsType 商品类型,0表示普通商品,1表示加价购商品 | ||
26 | + * @param int $isEdit 是否是编辑商品SKU,0表示不是编辑 | ||
27 | + * @param null|int $promotionId 促销id,默认null(加价购有关) | ||
28 | + * @param null|int $uid 用户UID,可以不传 | ||
29 | * @param string $shoppingKey 未登录用户唯一识别码,可以不传 | 29 | * @param string $shoppingKey 未登录用户唯一识别码,可以不传 |
30 | - * @return array 加入购物车接口返回的数据 | ||
31 | - */ | ||
32 | - public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit = 0, $promotionId = null, $uid = null, $shoppingKey = null) | ||
33 | - { | ||
34 | - $param = Yohobuy::param(); | ||
35 | - $param['method'] = 'app.Shopping.add'; | ||
36 | - $param['product_sku'] = $productSku; | ||
37 | - $param['buy_number'] = $buyNumber; | ||
38 | - $param['goods_type'] = $goodsType; | ||
39 | - $param['edit_product_sku'] = $isEdit; | ||
40 | - $param['selected'] = 'Y'; | ||
41 | - $param['promotion_id'] = $promotionId; | ||
42 | - | ||
43 | - if ($uid !== null) { | ||
44 | - $param['uid'] = $uid; | ||
45 | - } | ||
46 | - if ($shoppingKey !== null) { | ||
47 | - $param['shoppingKey'] = $shoppingKey; | ||
48 | - } | ||
49 | - $param['client_secret'] = Sign::getSign($param); | ||
50 | - | ||
51 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
52 | - } | ||
53 | - | ||
54 | - /** | ||
55 | - * 购物车商品选择与取消接口 | ||
56 | - * | ||
57 | - * @param int $uid 用户ID | ||
58 | - * @param string $sku 商品sku列表 | ||
59 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
60 | - * @return array 购物车接口返回的数据 | ||
61 | - */ | ||
62 | - public static function selectGoods($uid, $sku, $shoppingKey) | ||
63 | - { | ||
64 | - $param = Yohobuy::param(); | ||
65 | - $param['method'] = 'app.Shopping.selected'; | ||
66 | - $param['product_sku_list'] = $sku; | ||
67 | - | ||
68 | - if (!empty($uid)) { | ||
69 | - $param['uid'] = $uid; | ||
70 | - } | ||
71 | - if (!empty($shoppingKey)) { | ||
72 | - $param['shopping_key'] = $shoppingKey; | ||
73 | - } | ||
74 | - | ||
75 | - $param['client_secret'] = Sign::getSign($param); | ||
76 | - | ||
77 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
78 | - } | ||
79 | - | ||
80 | - /** | ||
81 | - * 购物车数据 | ||
82 | - * | ||
83 | - * @param int $uid 用户ID | ||
84 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
85 | - * @return array 购物车接口返回的数据 | ||
86 | - */ | ||
87 | - public static function cartData($uid, $shoppingKey) | ||
88 | - { | ||
89 | - $param = Yohobuy::param(); | ||
90 | - $param['method'] = 'app.Shopping.cart'; | ||
91 | - | ||
92 | - if (!empty($uid)) { | ||
93 | - $param['uid'] = $uid; | ||
94 | - } | ||
95 | - if (!empty($shoppingKey)) { | ||
96 | - $param['shopping_key'] = $shoppingKey; | ||
97 | - } | ||
98 | - | ||
99 | - $param['client_secret'] = Sign::getSign($param); | ||
100 | - | ||
101 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
102 | - } | ||
103 | - | ||
104 | - /** | ||
105 | - * 移出购物车 | ||
106 | - * | ||
107 | - * @param int $uid 用户ID | ||
108 | - * @param string $sku 商品sku列表 | ||
109 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
110 | - * @return array 接口返回的数据 | ||
111 | - */ | ||
112 | - public static function removeFromCart($uid, $sku, $shoppingKey) | ||
113 | - { | ||
114 | - $param = Yohobuy::param(); | ||
115 | - $param['method'] = 'app.Shopping.remove'; | ||
116 | - $param['product_sku_list'] = $sku; | ||
117 | - | ||
118 | - if (!empty($uid)) { | ||
119 | - $param['uid'] = $uid; | ||
120 | - } | ||
121 | - if (!empty($shoppingKey)) { | ||
122 | - $param['shopping_key'] = $shoppingKey; | ||
123 | - } | ||
124 | - | ||
125 | - $param['client_secret'] = Sign::getSign($param); | ||
126 | - | ||
127 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
128 | - } | ||
129 | - | ||
130 | - /** | ||
131 | - * 移入收藏夹 | ||
132 | - * | ||
133 | - * @param int $uid 用户ID | ||
134 | - * @param string $sku 商品sku列表 | ||
135 | - * @return array 接口返回的数据 | ||
136 | - */ | ||
137 | - public static function addToFav($uid, $sku) | ||
138 | - { | ||
139 | - $param = Yohobuy::param(); | ||
140 | - $param['method'] = 'app.Shopping.addfavorite'; | ||
141 | - $param['product_sku_list'] = $sku; | ||
142 | - $param['uid'] = $uid; | ||
143 | - $param['client_secret'] = Sign::getSign($param); | ||
144 | - | ||
145 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
146 | - } | ||
147 | - | ||
148 | - /** | ||
149 | - * 获取购物车商品数据 | ||
150 | - * | ||
151 | - * @param int $uid 用户ID | ||
152 | - * @param int $skn 商品skn | ||
153 | - * @return array 接口返回的数据 | ||
154 | - */ | ||
155 | - public static function cartProductData($uid, $skn) | ||
156 | - { | ||
157 | - $param = Yohobuy::param(); | ||
158 | - $param['method'] = 'app.product.data'; | ||
159 | - $param['product_skn'] = $skn; | ||
160 | - $param['showcomment'] = 'N'; | ||
161 | - $param['uid'] = $uid; | ||
162 | - $param['client_secret'] = Sign::getSign($param); | ||
163 | - | ||
164 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
165 | - } | ||
166 | - | ||
167 | - /** | ||
168 | - * 获取加价购商品数据 | ||
169 | - * | ||
170 | - * @param int $skn 商品skn | ||
171 | - * @param int $promotionId 加价购商品促销ID | ||
172 | - * @return array 接口返回的数据 | ||
173 | - */ | ||
174 | - public static function giftProductData($skn, $promotionId) | ||
175 | - { | ||
176 | - $param = Yohobuy::param(); | ||
177 | - $param['method'] = 'app.product.gift'; | ||
178 | - $param['product_skn'] = $skn; | ||
179 | - $param['promotion_id'] = $promotionId; | ||
180 | - $param['client_secret'] = Sign::getSign($param); | ||
181 | - | ||
182 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
183 | - } | ||
184 | - | ||
185 | - /** | ||
186 | - * 增减购物车商品数量 | ||
187 | - * | ||
188 | - * @param int $uid 用户ID | ||
189 | - * @param string $sku 商品SKU | ||
190 | - * @param int $increaseNum 增加的数目 | ||
191 | - * @param int $decreaseNum 减少的数目 | ||
192 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
193 | - * @return array 接口返回的数据 | ||
194 | - */ | ||
195 | - public static function modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey) | ||
196 | - { | ||
197 | - $param = Yohobuy::param(); | ||
198 | - $param['method'] = 'app.Shopping.increase'; | ||
199 | - $param['product_sku'] = $sku; | 30 | + * @return array 加入购物车接口返回的数据 |
31 | + */ | ||
32 | + public static function addToCart($productSku, $buyNumber, $goodsType, $isEdit = 0, $promotionId = null, $uid = null, $shoppingKey = null) | ||
33 | + { | ||
34 | + $param = Yohobuy::param(); | ||
35 | + $param['method'] = 'app.Shopping.add'; | ||
36 | + $param['product_sku'] = $productSku; | ||
37 | + $param['buy_number'] = $buyNumber; | ||
38 | + $param['goods_type'] = $goodsType; | ||
39 | + $param['edit_product_sku'] = $isEdit; | ||
40 | + $param['selected'] = 'Y'; | ||
41 | + $param['promotion_id'] = $promotionId; | ||
42 | + | ||
43 | + if ($uid !== null) { | ||
44 | + $param['uid'] = $uid; | ||
45 | + } | ||
46 | + if ($shoppingKey !== null) { | ||
47 | + $param['shoppingKey'] = $shoppingKey; | ||
48 | + } | ||
49 | + $param['client_secret'] = Sign::getSign($param); | ||
50 | + | ||
51 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * 购物车商品选择与取消接口 | ||
56 | + * | ||
57 | + * @param int $uid 用户ID | ||
58 | + * @param string $sku 商品sku列表 | ||
59 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
60 | + * @return array 购物车接口返回的数据 | ||
61 | + */ | ||
62 | + public static function selectGoods($uid, $sku, $shoppingKey) | ||
63 | + { | ||
64 | + $param = Yohobuy::param(); | ||
65 | + $param['method'] = 'app.Shopping.selected'; | ||
66 | + $param['product_sku_list'] = $sku; | ||
67 | + | ||
68 | + if (!empty($uid)) { | ||
69 | + $param['uid'] = $uid; | ||
70 | + } | ||
71 | + if (!empty($shoppingKey)) { | ||
72 | + $param['shopping_key'] = $shoppingKey; | ||
73 | + } | ||
74 | + | ||
75 | + $param['client_secret'] = Sign::getSign($param); | ||
76 | + | ||
77 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * 购物车数据 | ||
82 | + * | ||
83 | + * @param int $uid 用户ID | ||
84 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
85 | + * @return array 购物车接口返回的数据 | ||
86 | + */ | ||
87 | + public static function cartData($uid, $shoppingKey) | ||
88 | + { | ||
89 | + $param = Yohobuy::param(); | ||
90 | + $param['method'] = 'app.Shopping.cart'; | ||
91 | + | ||
92 | + if (!empty($uid)) { | ||
93 | + $param['uid'] = $uid; | ||
94 | + } | ||
95 | + if (!empty($shoppingKey)) { | ||
96 | + $param['shopping_key'] = $shoppingKey; | ||
97 | + } | ||
98 | + | ||
99 | + $param['client_secret'] = Sign::getSign($param); | ||
100 | + | ||
101 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
105 | + * 移出购物车 | ||
106 | + * | ||
107 | + * @param int $uid 用户ID | ||
108 | + * @param string $sku 商品sku列表 | ||
109 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
110 | + * @return array 接口返回的数据 | ||
111 | + */ | ||
112 | + public static function removeFromCart($uid, $sku, $shoppingKey) | ||
113 | + { | ||
114 | + $param = Yohobuy::param(); | ||
115 | + $param['method'] = 'app.Shopping.remove'; | ||
116 | + $param['product_sku_list'] = $sku; | ||
117 | + | ||
118 | + if (!empty($uid)) { | ||
119 | + $param['uid'] = $uid; | ||
120 | + } | ||
121 | + if (!empty($shoppingKey)) { | ||
122 | + $param['shopping_key'] = $shoppingKey; | ||
123 | + } | ||
124 | + | ||
125 | + $param['client_secret'] = Sign::getSign($param); | ||
126 | + | ||
127 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
128 | + } | ||
129 | + | ||
130 | + /** | ||
131 | + * 移入收藏夹 | ||
132 | + * | ||
133 | + * @param int $uid 用户ID | ||
134 | + * @param string $sku 商品sku列表 | ||
135 | + * @return array 接口返回的数据 | ||
136 | + */ | ||
137 | + public static function addToFav($uid, $sku) | ||
138 | + { | ||
139 | + $param = Yohobuy::param(); | ||
140 | + $param['method'] = 'app.Shopping.addfavorite'; | ||
141 | + $param['product_sku_list'] = $sku; | ||
142 | + $param['uid'] = $uid; | ||
143 | + $param['client_secret'] = Sign::getSign($param); | ||
144 | + | ||
145 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
146 | + } | ||
147 | + | ||
148 | + /** | ||
149 | + * 获取购物车商品数据 | ||
150 | + * | ||
151 | + * @param int $uid 用户ID | ||
152 | + * @param int $skn 商品skn | ||
153 | + * @return array 接口返回的数据 | ||
154 | + */ | ||
155 | + public static function cartProductData($uid, $skn) | ||
156 | + { | ||
157 | + $param = Yohobuy::param(); | ||
158 | + $param['method'] = 'app.product.data'; | ||
159 | + $param['product_skn'] = $skn; | ||
160 | + $param['showcomment'] = 'N'; | ||
161 | + $param['uid'] = $uid; | ||
162 | + $param['client_secret'] = Sign::getSign($param); | ||
163 | + | ||
164 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
165 | + } | ||
166 | + | ||
167 | + /** | ||
168 | + * 获取加价购商品数据 | ||
169 | + * | ||
170 | + * @param int $skn 商品skn | ||
171 | + * @param int $promotionId 加价购商品促销ID | ||
172 | + * @return array 接口返回的数据 | ||
173 | + */ | ||
174 | + public static function giftProductData($skn, $promotionId) | ||
175 | + { | ||
176 | + $param = Yohobuy::param(); | ||
177 | + $param['method'] = 'app.product.gift'; | ||
178 | + $param['product_skn'] = $skn; | ||
179 | + $param['promotion_id'] = $promotionId; | ||
180 | + $param['client_secret'] = Sign::getSign($param); | ||
181 | + | ||
182 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
183 | + } | ||
184 | + | ||
185 | + /** | ||
186 | + * 增减购物车商品数量 | ||
187 | + * | ||
188 | + * @param int $uid 用户ID | ||
189 | + * @param string $sku 商品SKU | ||
190 | + * @param int $increaseNum 增加的数目 | ||
191 | + * @param int $decreaseNum 减少的数目 | ||
192 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
193 | + * @return array 接口返回的数据 | ||
194 | + */ | ||
195 | + public static function modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey) | ||
196 | + { | ||
197 | + $param = Yohobuy::param(); | ||
198 | + $param['method'] = 'app.Shopping.increase'; | ||
199 | + $param['product_sku'] = $sku; | ||
200 | 200 | ||
201 | if (!empty($increaseNum)) { | 201 | if (!empty($increaseNum)) { |
202 | $param['increase_number'] = $increaseNum; | 202 | $param['increase_number'] = $increaseNum; |
@@ -205,175 +205,199 @@ class CartData | @@ -205,175 +205,199 @@ class CartData | ||
205 | $param['decrease_number'] = $decreaseNum; | 205 | $param['decrease_number'] = $decreaseNum; |
206 | } | 206 | } |
207 | 207 | ||
208 | - if (!empty($uid)) { | ||
209 | - $param['uid'] = $uid; | ||
210 | - } | ||
211 | - if ($shoppingKey !== null) { | ||
212 | - $param['shopping_key'] = $shoppingKey; | ||
213 | - } | ||
214 | - | ||
215 | - $param['client_secret'] = Sign::getSign($param); | ||
216 | - | ||
217 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
218 | - } | ||
219 | - | ||
220 | - /** | ||
221 | - * 修改购物车商品数据 | ||
222 | - * | ||
223 | - * @param int $uid 用户ID | ||
224 | - * @param string $swapData 商品数据 | ||
225 | - * @param string $shoppingKey 未登录用户唯一识别码 | ||
226 | - * @return array 接口返回的数据 | ||
227 | - */ | ||
228 | - public static function modifyCartProduct($uid, $swapData, $shoppingKey) | ||
229 | - { | ||
230 | - $param = Yohobuy::param(); | ||
231 | - $param['method'] = 'app.Shopping.swap'; | ||
232 | - $param['swap_data'] = $swapData; | ||
233 | - | ||
234 | - if (!empty($uid)) { | ||
235 | - $param['uid'] = $uid; | ||
236 | - } | ||
237 | - if ($shoppingKey !== null) { | ||
238 | - $param['shopping_key'] = $shoppingKey; | ||
239 | - } | ||
240 | - | ||
241 | - $param['client_secret'] = Sign::getSign($param); | ||
242 | - | ||
243 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
244 | - } | ||
245 | - | ||
246 | - /** | ||
247 | - * 购物车结算 | ||
248 | - * | ||
249 | - * @param int $uid 用户ID | ||
250 | - * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
251 | - * @return array 接口返回的数据 | ||
252 | - */ | ||
253 | - public static function cartPay($uid, $cartType) | ||
254 | - { | ||
255 | - $param = Yohobuy::param(); | ||
256 | - $param['method'] = 'app.Shopping.payment'; | ||
257 | - $param['cart_type'] = $cartType; | ||
258 | - $param['uid'] = $uid; | ||
259 | - $param['client_secret'] = Sign::getSign($param); | ||
260 | - | ||
261 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
262 | - } | ||
263 | - | ||
264 | - /** | ||
265 | - * 购物车结算--支付方式和配送方式选择 | ||
266 | - * | ||
267 | - * @param int $uid 用户ID | ||
268 | - * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
269 | - * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 | ||
270 | - * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 | ||
271 | - * @param string $couponCode 优惠券码 | ||
272 | - * @param mixed $yohoCoin 使用的YOHO币数量 | ||
273 | - * @return array 接口返回的数据 | ||
274 | - */ | ||
275 | - public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin) | ||
276 | - { | ||
277 | - $param = Yohobuy::param(); | ||
278 | - $param['method'] = 'app.Shopping.compute'; | ||
279 | - $param['cart_type'] = $cartType; | ||
280 | - $param['delivery_way'] = $deliveryWay; | ||
281 | - $param['payment_type'] = $paymentType; | ||
282 | - if (!empty($couponCode)) { | ||
283 | - $param['coupon_code'] = $couponCode; | ||
284 | - } | ||
285 | - if (!empty($yohoCoin)) { | ||
286 | - $param['use_yoho_coin'] = $yohoCoin; | ||
287 | - } | ||
288 | - | ||
289 | - $param['uid'] = $uid; | ||
290 | - $param['client_secret'] = Sign::getSign($param); | ||
291 | - | ||
292 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
293 | - } | ||
294 | - | ||
295 | - /** | ||
296 | - * 购物车结算--使用优惠券 | ||
297 | - * | ||
298 | - * @param int $uid 用户ID | ||
299 | - * @param string $couponCode 优惠券代码 | ||
300 | - * @return array 接口返回的数据 | ||
301 | - */ | ||
302 | - public static function searchCoupon($uid, $couponCode) | ||
303 | - { | ||
304 | - $param = Yohobuy::param(); | ||
305 | - $param['method'] = 'app.Shopping.useCoupon'; | ||
306 | - $param['coupon_code'] = $couponCode; | ||
307 | - $param['uid'] = $uid; | ||
308 | - $param['client_secret'] = Sign::getSign($param); | ||
309 | - | ||
310 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
311 | - } | ||
312 | - | ||
313 | - /** | ||
314 | - * 购物车结算--获取优惠券列表 | ||
315 | - * | ||
316 | - * @param int $uid 用户ID | ||
317 | - * @return array 接口返回的数据 | ||
318 | - */ | ||
319 | - public static function getCouponList($uid) | ||
320 | - { | ||
321 | - $param = Yohobuy::param(); | ||
322 | - $param['method'] = 'app.coupons.lists'; | ||
323 | - $param['type'] = 'notuse'; | ||
324 | - $param['page'] = 1; | ||
325 | - $param['limit'] = 1000; | ||
326 | - $param['uid'] = $uid; | ||
327 | - $param['client_secret'] = Sign::getSign($param); | ||
328 | - | ||
329 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
330 | - } | ||
331 | - | ||
332 | - /** | ||
333 | - * 购物车结算--提交结算信息 | ||
334 | - * | ||
335 | - * @param int $uid 用户ID | ||
336 | - * @param int $addressId 地址ID | ||
337 | - * @param int $cartType 购物车类型ID | ||
338 | - * @param int $deliveryTime 寄送时间ID | ||
339 | - * @param int $deliveryWay 寄送方式ID | ||
340 | - * @param string $invoiceTitle 发票说明 | ||
341 | - * @param int $invoiceId 发票类型ID | ||
342 | - * @param int $paymentId 支付方式ID | ||
343 | - * @param int $paymentType 支付类型ID | ||
344 | - * @param string $remark 留言 | ||
345 | - * @param string $couponCode 优惠券码 | ||
346 | - * @param mixed $yohoCoin 使用的YOHO币数量或为空 | ||
347 | - * @return array 接口返回的数据 | ||
348 | - */ | ||
349 | - public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin) | ||
350 | - { | ||
351 | - $param = Yohobuy::param(); | ||
352 | - $param['method'] = 'app.Shopping.submit'; | ||
353 | - $param['address_id'] = $addressId; | ||
354 | - $param['cart_type'] = $cartType; | ||
355 | - $param['delivery_time'] = $deliveryTime; | ||
356 | - $param['delivery_way'] = $deliveryWay; | ||
357 | - if (!empty($invoiceTitle)) { | ||
358 | - $param['invoices_title'] = $invoiceTitle; | ||
359 | - } | ||
360 | - if (!empty($invoiceId)) { | ||
361 | - $param['invoices_type_id'] = $invoiceId; | ||
362 | - } | ||
363 | - | ||
364 | - $param['payment_id'] = $paymentId; | ||
365 | - $param['payment_type'] = $paymentType; | ||
366 | - $param['remark'] = $remark; | ||
367 | - if (!empty($couponCode)) { | ||
368 | - $param['coupon_code'] = $couponCode; | ||
369 | - } | ||
370 | - if (!empty($yohoCoin)) { | ||
371 | - $param['use_yoho_coin'] = $yohoCoin; | ||
372 | - } | ||
373 | - $param['uid'] = $uid; | ||
374 | - $param['client_secret'] = Sign::getSign($param); | ||
375 | - | ||
376 | - return Yohobuy::get(Yohobuy::API_URL, $param); | ||
377 | - } | 208 | + if (!empty($uid)) { |
209 | + $param['uid'] = $uid; | ||
210 | + } | ||
211 | + if ($shoppingKey !== null) { | ||
212 | + $param['shopping_key'] = $shoppingKey; | ||
213 | + } | ||
214 | + | ||
215 | + $param['client_secret'] = Sign::getSign($param); | ||
216 | + | ||
217 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
218 | + } | ||
219 | + | ||
220 | + /** | ||
221 | + * 修改购物车商品数据 | ||
222 | + * | ||
223 | + * @param int $uid 用户ID | ||
224 | + * @param string $swapData 商品数据 | ||
225 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
226 | + * @return array 接口返回的数据 | ||
227 | + */ | ||
228 | + public static function modifyCartProduct($uid, $swapData, $shoppingKey) | ||
229 | + { | ||
230 | + $param = Yohobuy::param(); | ||
231 | + $param['method'] = 'app.Shopping.swap'; | ||
232 | + $param['swap_data'] = $swapData; | ||
233 | + | ||
234 | + if (!empty($uid)) { | ||
235 | + $param['uid'] = $uid; | ||
236 | + } | ||
237 | + if ($shoppingKey !== null) { | ||
238 | + $param['shopping_key'] = $shoppingKey; | ||
239 | + } | ||
240 | + | ||
241 | + $param['client_secret'] = Sign::getSign($param); | ||
242 | + | ||
243 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
244 | + } | ||
245 | + | ||
246 | + /** | ||
247 | + * 购物车结算 | ||
248 | + * | ||
249 | + * @param int $uid 用户ID | ||
250 | + * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
251 | + * @return array 接口返回的数据 | ||
252 | + */ | ||
253 | + public static function cartPay($uid, $cartType) | ||
254 | + { | ||
255 | + $param = Yohobuy::param(); | ||
256 | + $param['method'] = 'app.Shopping.payment'; | ||
257 | + $param['cart_type'] = $cartType; | ||
258 | + $param['uid'] = $uid; | ||
259 | + $param['client_secret'] = Sign::getSign($param); | ||
260 | + | ||
261 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
262 | + } | ||
263 | + | ||
264 | + /** | ||
265 | + * 购物车结算--支付方式和配送方式选择 | ||
266 | + * | ||
267 | + * @param int $uid 用户ID | ||
268 | + * @param string $cartType 购物车类型,ordinary表示普通购物车 | ||
269 | + * @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运 | ||
270 | + * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 | ||
271 | + * @param string $couponCode 优惠券码 | ||
272 | + * @param mixed $yohoCoin 使用的YOHO币数量 | ||
273 | + * @return array 接口返回的数据 | ||
274 | + */ | ||
275 | + public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin) | ||
276 | + { | ||
277 | + $param = Yohobuy::param(); | ||
278 | + $param['method'] = 'app.Shopping.compute'; | ||
279 | + $param['cart_type'] = $cartType; | ||
280 | + $param['delivery_way'] = $deliveryWay; | ||
281 | + $param['payment_type'] = $paymentType; | ||
282 | + if (!empty($couponCode)) { | ||
283 | + $param['coupon_code'] = $couponCode; | ||
284 | + } | ||
285 | + if (!empty($yohoCoin)) { | ||
286 | + $param['use_yoho_coin'] = $yohoCoin; | ||
287 | + } | ||
288 | + | ||
289 | + $param['uid'] = $uid; | ||
290 | + $param['client_secret'] = Sign::getSign($param); | ||
291 | + | ||
292 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
293 | + } | ||
294 | + | ||
295 | + /** | ||
296 | + * 购物车结算--使用优惠券 | ||
297 | + * | ||
298 | + * @param int $uid 用户ID | ||
299 | + * @param string $couponCode 优惠券代码 | ||
300 | + * @return array 接口返回的数据 | ||
301 | + */ | ||
302 | + public static function searchCoupon($uid, $couponCode) | ||
303 | + { | ||
304 | + $param = Yohobuy::param(); | ||
305 | + $param['method'] = 'app.Shopping.useCoupon'; | ||
306 | + $param['coupon_code'] = $couponCode; | ||
307 | + $param['uid'] = $uid; | ||
308 | + $param['client_secret'] = Sign::getSign($param); | ||
309 | + | ||
310 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
311 | + } | ||
312 | + | ||
313 | + /** | ||
314 | + * 购物车结算--获取优惠券列表 | ||
315 | + * | ||
316 | + * @param int $uid 用户ID | ||
317 | + * @return array 接口返回的数据 | ||
318 | + */ | ||
319 | + public static function getCouponList($uid) | ||
320 | + { | ||
321 | + $param = Yohobuy::param(); | ||
322 | + $param['method'] = 'app.coupons.lists'; | ||
323 | + $param['type'] = 'notuse'; | ||
324 | + $param['page'] = 1; | ||
325 | + $param['limit'] = 1000; | ||
326 | + $param['uid'] = $uid; | ||
327 | + $param['client_secret'] = Sign::getSign($param); | ||
328 | + | ||
329 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
330 | + } | ||
331 | + | ||
332 | + /** | ||
333 | + * 购物车结算--提交结算信息 | ||
334 | + * | ||
335 | + * @param int $uid 用户ID | ||
336 | + * @param int $addressId 地址ID | ||
337 | + * @param int $cartType 购物车类型ID | ||
338 | + * @param int $deliveryTime 寄送时间ID | ||
339 | + * @param int $deliveryWay 寄送方式ID | ||
340 | + * @param string $invoiceTitle 发票说明 | ||
341 | + * @param int $invoiceId 发票类型ID | ||
342 | + * @param int $paymentId 支付方式ID | ||
343 | + * @param int $paymentType 支付类型ID | ||
344 | + * @param string $remark 留言 | ||
345 | + * @param string $couponCode 优惠券码 | ||
346 | + * @param mixed $yohoCoin 使用的YOHO币数量或为空 | ||
347 | + * @return array 接口返回的数据 | ||
348 | + */ | ||
349 | + public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin) | ||
350 | + { | ||
351 | + $param = Yohobuy::param(); | ||
352 | + $param['method'] = 'app.Shopping.submit'; | ||
353 | + $param['address_id'] = $addressId; | ||
354 | + $param['cart_type'] = $cartType; | ||
355 | + $param['delivery_time'] = $deliveryTime; | ||
356 | + $param['delivery_way'] = $deliveryWay; | ||
357 | + if (!empty($invoiceTitle)) { | ||
358 | + $param['invoices_title'] = $invoiceTitle; | ||
359 | + } | ||
360 | + if (!empty($invoiceId)) { | ||
361 | + $param['invoices_type_id'] = $invoiceId; | ||
362 | + } | ||
363 | + | ||
364 | + $param['payment_id'] = $paymentId; | ||
365 | + $param['payment_type'] = $paymentType; | ||
366 | + $param['remark'] = $remark; | ||
367 | + if (!empty($couponCode)) { | ||
368 | + $param['coupon_code'] = $couponCode; | ||
369 | + } | ||
370 | + if (!empty($yohoCoin)) { | ||
371 | + $param['use_yoho_coin'] = $yohoCoin; | ||
372 | + } | ||
373 | + $param['uid'] = $uid; | ||
374 | + $param['client_secret'] = Sign::getSign($param); | ||
375 | + | ||
376 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
377 | + } | ||
378 | + | ||
379 | + /** | ||
380 | + * 购物车数量 | ||
381 | + * | ||
382 | + * @param int $uid 用户ID | ||
383 | + * @param string $shoppingKey 未登录用户唯一识别码 | ||
384 | + * @return array 购物车接口返回的数据 | ||
385 | + */ | ||
386 | + public static function cartCount($uid, $shoppingKey) | ||
387 | + { | ||
388 | + $param = Yohobuy::param(); | ||
389 | + $param['method'] = 'app.Shopping.count'; | ||
390 | + | ||
391 | + if (!empty($uid)) { | ||
392 | + $param['uid'] = $uid; | ||
393 | + } | ||
394 | + if (!empty($shoppingKey)) { | ||
395 | + $param['shopping_key'] = $shoppingKey; | ||
396 | + } | ||
397 | + | ||
398 | + $param['client_secret'] = Sign::getSign($param); | ||
399 | + | ||
400 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
401 | + } | ||
378 | 402 | ||
379 | } | 403 | } |
@@ -129,7 +129,7 @@ class Helpers | @@ -129,7 +129,7 @@ class Helpers | ||
129 | */ | 129 | */ |
130 | public static function getShoppingKeyByCookie() | 130 | public static function getShoppingKeyByCookie() |
131 | { | 131 | { |
132 | - $cookie = isset($_COOKIE['_spk']) ? $_COOKIE['_spk'] : ''; | 132 | + $cookie = isset($_COOKIE['_Spk']) ? $_COOKIE['_Spk'] : ''; |
133 | return $cookie; | 133 | return $cookie; |
134 | } | 134 | } |
135 | 135 |
@@ -26,6 +26,7 @@ lazyLoad(); | @@ -26,6 +26,7 @@ lazyLoad(); | ||
26 | 26 | ||
27 | if (window.getUid() !== orderInfo('uid')) { | 27 | if (window.getUid() !== orderInfo('uid')) { |
28 | order.init(); | 28 | order.init(); |
29 | + window.location.reload(); | ||
29 | } | 30 | } |
30 | 31 | ||
31 | if ($couponUse.data('name') !== orderInfo('couponName')) { | 32 | if ($couponUse.data('name') !== orderInfo('couponName')) { |
@@ -33,6 +34,8 @@ if ($couponUse.data('name') !== orderInfo('couponName')) { | @@ -33,6 +34,8 @@ if ($couponUse.data('name') !== orderInfo('couponName')) { | ||
33 | orderInfo('couponName', null); | 34 | orderInfo('couponName', null); |
34 | } | 35 | } |
35 | 36 | ||
37 | +orderInfo('cartType', queryString.cartType || queryString.carttype || 'ordinary'); | ||
38 | + | ||
36 | function dispacthTapEvt(e) { | 39 | function dispacthTapEvt(e) { |
37 | var $cur = $(e.target).closest('li'); | 40 | var $cur = $(e.target).closest('li'); |
38 | 41 | ||
@@ -78,7 +81,7 @@ function orderCompute() { | @@ -78,7 +81,7 @@ function orderCompute() { | ||
78 | method: 'POST', | 81 | method: 'POST', |
79 | url: '/cart/index/orderCompute', | 82 | url: '/cart/index/orderCompute', |
80 | data: { | 83 | data: { |
81 | - cartType: queryString.cartType || queryString.carttype || 'ordinary', | 84 | + cartType: orderInfo('cartType') || 'ordinary', |
82 | deliveryId: orderInfo('deliveryId'), | 85 | deliveryId: orderInfo('deliveryId'), |
83 | paymentTypeId: orderInfo('paymentTypeId'), | 86 | paymentTypeId: orderInfo('paymentTypeId'), |
84 | couponCode: orderInfo('couponCode'), | 87 | couponCode: orderInfo('couponCode'), |
@@ -139,11 +142,12 @@ function submitOrder() { | @@ -139,11 +142,12 @@ function submitOrder() { | ||
139 | url: '/cart/index/orderSub', | 142 | url: '/cart/index/orderSub', |
140 | data: { | 143 | data: { |
141 | addressId: orderInfo('addressId'), | 144 | addressId: orderInfo('addressId'), |
142 | - cartType: queryString.cartType || queryString.carttype || 'ordinary', | 145 | + cartType: orderInfo('cartType') || 'ordinary', |
143 | deliveryId: orderInfo('deliveryId'), | 146 | deliveryId: orderInfo('deliveryId'), |
144 | deliveryTimeId: orderInfo('deliveryTimeId'), | 147 | deliveryTimeId: orderInfo('deliveryTimeId'), |
145 | invoiceText: orderInfo('invoice') ? invoiceText : null, | 148 | invoiceText: orderInfo('invoice') ? invoiceText : null, |
146 | - invoiceType: orderInfo('invoice') ? ($invoice.find('.invoice-type').val() || orderInfo('invoiceType')) : null, | 149 | + invoiceType: orderInfo('invoice') ? ($invoice.find('.invoice-type').val() || |
150 | + orderInfo('invoiceType')) : null, | ||
147 | msg: msg, | 151 | msg: msg, |
148 | paymentTypeId: orderInfo('paymentTypeId'), | 152 | paymentTypeId: orderInfo('paymentTypeId'), |
149 | paymentType: orderInfo('paymentType'), //支付方式 | 153 | paymentType: orderInfo('paymentType'), //支付方式 |
@@ -19,7 +19,8 @@ function init() { | @@ -19,7 +19,8 @@ function init() { | ||
19 | invoice: null, | 19 | invoice: null, |
20 | invoiceText: null, | 20 | invoiceText: null, |
21 | invoiceType: null, | 21 | invoiceType: null, |
22 | - msg: null | 22 | + msg: null, |
23 | + cartType: 'ordinary' | ||
23 | }; | 24 | }; |
24 | window.setCookie('order-info', JSON.stringify(info)); | 25 | window.setCookie('order-info', JSON.stringify(info)); |
25 | } | 26 | } |
@@ -161,11 +161,18 @@ | @@ -161,11 +161,18 @@ | ||
161 | color: #fff; | 161 | color: #fff; |
162 | text-align: center; | 162 | text-align: center; |
163 | font-size: 12px; | 163 | font-size: 12px; |
164 | + | ||
165 | + &:before { | ||
166 | + display: block; | ||
167 | + line-height: 1; | ||
168 | + @include transform(scale(0.833)); | ||
169 | + } | ||
164 | } | 170 | } |
165 | 171 | ||
166 | .gift-tag { | 172 | .gift-tag { |
167 | height: 25rem / $pxConvertRem; | 173 | height: 25rem / $pxConvertRem; |
168 | background: #a1ce4e; | 174 | background: #a1ce4e; |
175 | + | ||
169 | &:before { | 176 | &:before { |
170 | content: '赠品'; | 177 | content: '赠品'; |
171 | } | 178 | } |
@@ -174,6 +181,7 @@ | @@ -174,6 +181,7 @@ | ||
174 | .advance-buy-tag { | 181 | .advance-buy-tag { |
175 | height: 25rem / $pxConvertRem; | 182 | height: 25rem / $pxConvertRem; |
176 | background: #eb76aa; | 183 | background: #eb76aa; |
184 | + | ||
177 | &:before { | 185 | &:before { |
178 | content: '加价购'; | 186 | content: '加价购'; |
179 | } | 187 | } |
@@ -228,4 +236,4 @@ | @@ -228,4 +236,4 @@ | ||
228 | .appear-date { | 236 | .appear-date { |
229 | color: #f00; | 237 | color: #f00; |
230 | } | 238 | } |
231 | -} | ||
239 | +} |
@@ -123,20 +123,7 @@ class CartModel | @@ -123,20 +123,7 @@ class CartModel | ||
123 | */ | 123 | */ |
124 | public static function getCartCount($uid, $shoppingKey) | 124 | public static function getCartCount($uid, $shoppingKey) |
125 | { | 125 | { |
126 | - $result = array( | ||
127 | - 'code' => 200, | ||
128 | - 'data' => array( | ||
129 | - 'cart_goods_count' => 0 | ||
130 | - ) | ||
131 | - ); | ||
132 | - | ||
133 | - $carData = self::getCartData($uid, $shoppingKey); | ||
134 | - if (isset($carData['commonGoodsCount'])) { | ||
135 | - $result['data']['cart_goods_count'] = $carData['commonGoodsCount'] + $carData['presellGoodsCount']; | ||
136 | - } | ||
137 | - | ||
138 | - return $result; | ||
139 | - | 126 | + return CartData::cartCount($uid, $shoppingKey); |
140 | } | 127 | } |
141 | 128 | ||
142 | /** | 129 | /** |
@@ -425,9 +412,9 @@ class CartModel | @@ -425,9 +412,9 @@ class CartModel | ||
425 | 412 | ||
426 | //gift=>是否赠品,advanceBuy=>是否加价购; | 413 | //gift=>是否赠品,advanceBuy=>是否加价购; |
427 | if ($single['goods_type'] == 'gift' && !isset($single['isAdvanceBuy'])) { | 414 | if ($single['goods_type'] == 'gift' && !isset($single['isAdvanceBuy'])) { |
428 | - $oneGoods['isGift'] = true; | 415 | + $oneGoods['gift'] = true; |
429 | } elseif ($single['goods_type'] == 'price_gift') { | 416 | } elseif ($single['goods_type'] == 'price_gift') { |
430 | - $oneGoods['isAdvanceBuy'] = true; | 417 | + $oneGoods['advanceBuy'] = true; |
431 | } | 418 | } |
432 | 419 | ||
433 | $result['goods'][] = $oneGoods; | 420 | $result['goods'][] = $oneGoods; |
@@ -79,7 +79,7 @@ class IndexController extends AbstractAction | @@ -79,7 +79,7 @@ class IndexController extends AbstractAction | ||
79 | $result = array(); | 79 | $result = array(); |
80 | 80 | ||
81 | if ($this->isAjax()) { | 81 | if ($this->isAjax()) { |
82 | - $uid = $this->getUid(true); | 82 | + $uid = $this->getUid(false); |
83 | $shoppingKey = Helpers::getShoppingKeyByCookie(); | 83 | $shoppingKey = Helpers::getShoppingKeyByCookie(); |
84 | $result = CartModel::getCartCount($uid, $shoppingKey); | 84 | $result = CartModel::getCartCount($uid, $shoppingKey); |
85 | } | 85 | } |
@@ -11,19 +11,22 @@ use Plugin\Helpers; | @@ -11,19 +11,22 @@ use Plugin\Helpers; | ||
11 | class BackController extends AbstractAction | 11 | class BackController extends AbstractAction |
12 | { | 12 | { |
13 | 13 | ||
14 | + /** | ||
15 | + * 通过邮箱找回密码 | ||
16 | + */ | ||
14 | public function emailAction() | 17 | public function emailAction() |
15 | { | 18 | { |
16 | $this->setTitle('找回密码-通过邮箱'); | 19 | $this->setTitle('找回密码-通过邮箱'); |
17 | - | 20 | + |
18 | $data = array( | 21 | $data = array( |
19 | - 'backUrl' => '/signin.html', | 22 | + 'backUrl' => Helpers::url('/signin.html'), |
20 | 'headerText' => '找回密码', | 23 | 'headerText' => '找回密码', |
21 | 'isPassportPage' => true, | 24 | 'isPassportPage' => true, |
22 | 'backEmail' => true | 25 | 'backEmail' => true |
23 | ); | 26 | ); |
24 | 27 | ||
25 | // 生成HTML (emailback.html) | 28 | // 生成HTML (emailback.html) |
26 | - $this->_view->html('emailback'); | 29 | + //$this->_view->html('emailback'); |
27 | $this->_view->display('email', $data); | 30 | $this->_view->display('email', $data); |
28 | } | 31 | } |
29 | 32 | ||
@@ -33,30 +36,26 @@ class BackController extends AbstractAction | @@ -33,30 +36,26 @@ class BackController extends AbstractAction | ||
33 | public function sendemailAction() | 36 | public function sendemailAction() |
34 | { | 37 | { |
35 | $result = array('code' => 400, 'message' => '邮箱格式不正确,请重新输入', 'data' => ''); | 38 | $result = array('code' => 400, 'message' => '邮箱格式不正确,请重新输入', 'data' => ''); |
36 | - do | ||
37 | - { | 39 | + do { |
38 | /* 判断是不是AJAX请求 */ | 40 | /* 判断是不是AJAX请求 */ |
39 | - if (!$this->isAjax()) | ||
40 | - { | 41 | + if (!$this->isAjax()) { |
41 | break; | 42 | break; |
42 | } | 43 | } |
43 | 44 | ||
44 | $email = $this->post('email', ''); | 45 | $email = $this->post('email', ''); |
45 | // 判断邮箱是否有效 | 46 | // 判断邮箱是否有效 |
46 | - if(!Helpers::verifyEmail($email)) | ||
47 | - { | 47 | + if (!Helpers::verifyEmail($email)) { |
48 | break; | 48 | break; |
49 | } | 49 | } |
50 | 50 | ||
51 | // 发送邮箱验证码 | 51 | // 发送邮箱验证码 |
52 | $result = BackData::sendCodeToEmail($email); | 52 | $result = BackData::sendCodeToEmail($email); |
53 | - if($result['code'] === 200) | ||
54 | - { | ||
55 | - $result['data'] = '/passport/back/success?email='.$email; | 53 | + if ($result['code'] === 200) { |
54 | + $result['data'] = Helpers::url('/passport/back/resendemail', array( | ||
55 | + 'email' => $email, | ||
56 | + )); | ||
56 | } | 57 | } |
57 | - | ||
58 | - } | ||
59 | - while (false); | 58 | + } while (false); |
60 | 59 | ||
61 | $this->echoJson($result); | 60 | $this->echoJson($result); |
62 | } | 61 | } |
@@ -67,10 +66,8 @@ class BackController extends AbstractAction | @@ -67,10 +66,8 @@ class BackController extends AbstractAction | ||
67 | public function resendemailAction() | 66 | public function resendemailAction() |
68 | { | 67 | { |
69 | $result = array('code' => 400, 'message' => '重发邮件失败'); | 68 | $result = array('code' => 400, 'message' => '重发邮件失败'); |
70 | - do | ||
71 | - { | ||
72 | - if(!$this->isAjax()) | ||
73 | - { | 69 | + do { |
70 | + if (!$this->isAjax()) { | ||
74 | break; | 71 | break; |
75 | } | 72 | } |
76 | 73 | ||
@@ -79,17 +76,17 @@ class BackController extends AbstractAction | @@ -79,17 +76,17 @@ class BackController extends AbstractAction | ||
79 | // 发送邮箱验证码 | 76 | // 发送邮箱验证码 |
80 | $return = BackData::sendCodeToEmail($email); | 77 | $return = BackData::sendCodeToEmail($email); |
81 | 78 | ||
82 | - if(!empty($return)) | ||
83 | - { | 79 | + if (!empty($return)) { |
84 | $result = $return; | 80 | $result = $return; |
85 | } | 81 | } |
86 | - | ||
87 | - } | ||
88 | - while(false); | 82 | + } while (false); |
89 | 83 | ||
90 | $this->echoJson($result); | 84 | $this->echoJson($result); |
91 | } | 85 | } |
92 | 86 | ||
87 | + /** | ||
88 | + * 邮箱找回密码-成功 | ||
89 | + */ | ||
93 | public function successAction() | 90 | public function successAction() |
94 | { | 91 | { |
95 | $email = $this->get('email', ''); | 92 | $email = $this->get('email', ''); |
@@ -97,18 +94,20 @@ class BackController extends AbstractAction | @@ -97,18 +94,20 @@ class BackController extends AbstractAction | ||
97 | if (!Helpers::verifyEmail($email)) { | 94 | if (!Helpers::verifyEmail($email)) { |
98 | $this->error(); | 95 | $this->error(); |
99 | } | 96 | } |
100 | - | 97 | + |
101 | // 获取到邮箱域名 | 98 | // 获取到邮箱域名 |
102 | list($name, $domain) = explode('@', $email); | 99 | list($name, $domain) = explode('@', $email); |
103 | $domain_name = 'http://' . (($domain == 'gmail.com') ? 'mail.google.com' : 'mail.' . $domain); | 100 | $domain_name = 'http://' . (($domain == 'gmail.com') ? 'mail.google.com' : 'mail.' . $domain); |
104 | 101 | ||
105 | $data = array( | 102 | $data = array( |
106 | - 'backUrl' => '/emailback.html', | 103 | + 'backUrl' => Helpers::url('/emailback.html'), |
107 | 'headerText' => '找回密码', | 104 | 'headerText' => '找回密码', |
108 | 'isPassportPage' => true, | 105 | 'isPassportPage' => true, |
109 | 'backEmailSuccess' => true, | 106 | 'backEmailSuccess' => true, |
110 | 'goEmail' => $domain_name, | 107 | 'goEmail' => $domain_name, |
111 | - 'resendUrl' => '/passport/back/resendemail?email='.$email | 108 | + 'resendUrl' => Helpers::url('/passport/back/resendemail', array( |
109 | + 'email' => $email, | ||
110 | + )), | ||
112 | ); | 111 | ); |
113 | 112 | ||
114 | $this->setTitle('找回密码-通过邮箱'); | 113 | $this->setTitle('找回密码-通过邮箱'); |
@@ -122,32 +121,28 @@ class BackController extends AbstractAction | @@ -122,32 +121,28 @@ class BackController extends AbstractAction | ||
122 | */ | 121 | */ |
123 | public function passwordByEmailAction() | 122 | public function passwordByEmailAction() |
124 | { | 123 | { |
125 | - if($this->isAjax()) | ||
126 | - { | 124 | + if ($this->isAjax()) { |
127 | $pwd = $this->post('password', ''); | 125 | $pwd = $this->post('password', ''); |
128 | $code = $this->post('code', ''); | 126 | $code = $this->post('code', ''); |
129 | 127 | ||
130 | $data = BackData::modifyPasswordByEmail($pwd, $code); | 128 | $data = BackData::modifyPasswordByEmail($pwd, $code); |
131 | 129 | ||
132 | - $result = array('code'=>200, 'data' => '/signin.html'); | ||
133 | - print_r($data); | ||
134 | - if(strpos($data, 'history.back') !== false) | ||
135 | - { | 130 | + $result = array('code' => 200, 'data' => Helpers::url('/signin.html') ); |
131 | + if (strpos($data, 'history.back') !== false) { | ||
136 | $result['code'] = 400; | 132 | $result['code'] = 400; |
137 | $result['message'] = '修改失败'; | 133 | $result['message'] = '修改失败'; |
138 | } | 134 | } |
139 | 135 | ||
140 | - $this->echoJson($result);// 前端不需要判断结果 | 136 | + $this->echoJson($result); // 前端不需要判断结果 |
141 | } | 137 | } |
142 | } | 138 | } |
143 | 139 | ||
144 | - | ||
145 | public function mobileAction() | 140 | public function mobileAction() |
146 | { | 141 | { |
147 | $this->setTitle('找回密码-通过手机号'); | 142 | $this->setTitle('找回密码-通过手机号'); |
148 | - | 143 | + |
149 | $data = array( | 144 | $data = array( |
150 | - 'backUrl' => '/signin.html', | 145 | + 'backUrl' => Helpers::url('/signin.html'), |
151 | 'headerText' => '找回密码', | 146 | 'headerText' => '找回密码', |
152 | 'isPassportPage' => true, | 147 | 'isPassportPage' => true, |
153 | 'backMobile' => true, | 148 | 'backMobile' => true, |
@@ -157,7 +152,7 @@ class BackController extends AbstractAction | @@ -157,7 +152,7 @@ class BackController extends AbstractAction | ||
157 | 152 | ||
158 | // 生成HTML (phoneback.html) | 153 | // 生成HTML (phoneback.html) |
159 | // $this->_view->html('phoneback'); | 154 | // $this->_view->html('phoneback'); |
160 | - | 155 | + |
161 | $this->_view->display('mobile', $data); | 156 | $this->_view->display('mobile', $data); |
162 | } | 157 | } |
163 | 158 | ||
@@ -167,35 +162,31 @@ class BackController extends AbstractAction | @@ -167,35 +162,31 @@ class BackController extends AbstractAction | ||
167 | public function sendcodeAction() | 162 | public function sendcodeAction() |
168 | { | 163 | { |
169 | $result = array('code' => 400, 'message' => '密码只能使用数字、字母和半角标点符号,请重新输入', 'data' => ''); | 164 | $result = array('code' => 400, 'message' => '密码只能使用数字、字母和半角标点符号,请重新输入', 'data' => ''); |
170 | - do | ||
171 | - { | 165 | + do { |
172 | /* 判断是不是AJAX请求 */ | 166 | /* 判断是不是AJAX请求 */ |
173 | - if (!$this->isAjax()) | ||
174 | - { | 167 | + if (!$this->isAjax()) { |
175 | break; | 168 | break; |
176 | } | 169 | } |
177 | $phoneNum = $this->post('phoneNum', ''); | 170 | $phoneNum = $this->post('phoneNum', ''); |
178 | $areaCode = $this->post('areaCode', 86); | 171 | $areaCode = $this->post('areaCode', 86); |
179 | 172 | ||
180 | - if(!Helpers::verifyMobile($phoneNum)) | ||
181 | - { | 173 | + if (!Helpers::verifyMobile($phoneNum)) { |
182 | break; | 174 | break; |
183 | } | 175 | } |
184 | 176 | ||
185 | // 发送手机验证码 | 177 | // 发送手机验证码 |
186 | $result = BackData::sendCodeToMobile($phoneNum, $areaCode); | 178 | $result = BackData::sendCodeToMobile($phoneNum, $areaCode); |
187 | - if(empty($result)) | ||
188 | - { | 179 | + if (empty($result)) { |
189 | break; | 180 | break; |
190 | } | 181 | } |
191 | - | ||
192 | - if($result['code'] === 200) | ||
193 | - { | ||
194 | - $result['data'] = '/passport/back/mobilecode?phoneNum='.$phoneNum.'&areaCode='.$areaCode; | ||
195 | - } | ||
196 | 182 | ||
197 | - } | ||
198 | - while (false); | 183 | + if ($result['code'] === 200) { |
184 | + $result['data'] = Helpers::url('/passport/back/mobilecode', array( | ||
185 | + 'phoneNum' => $phoneNum, | ||
186 | + 'areaCode' => $areaCode, | ||
187 | + )); | ||
188 | + } | ||
189 | + } while (false); | ||
199 | 190 | ||
200 | $this->echoJson($result); | 191 | $this->echoJson($result); |
201 | } | 192 | } |
@@ -207,10 +198,10 @@ class BackController extends AbstractAction | @@ -207,10 +198,10 @@ class BackController extends AbstractAction | ||
207 | { | 198 | { |
208 | $phoneNum = $this->get('phoneNum', ''); | 199 | $phoneNum = $this->get('phoneNum', ''); |
209 | $areaCode = $this->get('areaCode', 86); | 200 | $areaCode = $this->get('areaCode', 86); |
210 | - $areaCode = '+'.$areaCode; | 201 | + $areaCode = '+' . $areaCode; |
211 | 202 | ||
212 | $data = array( | 203 | $data = array( |
213 | - 'backUrl' => '/phoneback.html', | 204 | + 'backUrl' => Helpers::url('/phoneback.html'), |
214 | 'headerText' => '找回密码', | 205 | 'headerText' => '找回密码', |
215 | 'isPassportPage' => true, | 206 | 'isPassportPage' => true, |
216 | 'backCode' => true, | 207 | 'backCode' => true, |
@@ -229,23 +220,28 @@ class BackController extends AbstractAction | @@ -229,23 +220,28 @@ class BackController extends AbstractAction | ||
229 | */ | 220 | */ |
230 | public function verifycodeAction() | 221 | public function verifycodeAction() |
231 | { | 222 | { |
232 | - if($this->isAjax()) | ||
233 | - { | 223 | + if ($this->isAjax()) { |
234 | $phoneNum = $this->post('phoneNum', ''); | 224 | $phoneNum = $this->post('phoneNum', ''); |
235 | $code = $this->post('code', ''); | 225 | $code = $this->post('code', ''); |
236 | $areaCode = $this->post('areaCode', 86); | 226 | $areaCode = $this->post('areaCode', 86); |
237 | 227 | ||
238 | // 校验手机验证码 | 228 | // 校验手机验证码 |
239 | $result = BackData::validateMobileCode($phoneNum, $code, $areaCode); | 229 | $result = BackData::validateMobileCode($phoneNum, $code, $areaCode); |
240 | - if($result['code'] === 200) | ||
241 | - { | ||
242 | - $result['data'] = '/passport/back/backcode?phoneNum='.$phoneNum.'&token='.$result['data']['token'].'&areaCode='.$areaCode; | 230 | + if ($result['code'] === 200) { |
231 | + $result['data'] = Helpers::url('/passport/back/backcode', array( | ||
232 | + 'phoneNum' => $phoneNum, | ||
233 | + 'token' => $result['data']['token'], | ||
234 | + 'areaCode' => $areaCode, | ||
235 | + )); | ||
243 | } | 236 | } |
244 | 237 | ||
245 | $this->echoJson($result); | 238 | $this->echoJson($result); |
246 | } | 239 | } |
247 | } | 240 | } |
248 | 241 | ||
242 | + /** | ||
243 | + * 找回密码 | ||
244 | + */ | ||
249 | public function backcodeAction() | 245 | public function backcodeAction() |
250 | { | 246 | { |
251 | $phoneNum = $this->get('phoneNum', ''); | 247 | $phoneNum = $this->get('phoneNum', ''); |
@@ -260,9 +256,9 @@ class BackController extends AbstractAction | @@ -260,9 +256,9 @@ class BackController extends AbstractAction | ||
260 | if ((!$token || !Helpers::verifyMobile($phoneNum)) && !$code) { | 256 | if ((!$token || !Helpers::verifyMobile($phoneNum)) && !$code) { |
261 | $this->error(); | 257 | $this->error(); |
262 | } | 258 | } |
263 | - | 259 | + |
264 | $data = array( | 260 | $data = array( |
265 | - 'backUrl' => '/signin.html', | 261 | + 'backUrl' => Helpers::url('/signin.html'), |
266 | 'headerText' => '找回密码', | 262 | 'headerText' => '找回密码', |
267 | 'isPassportPage' => true, | 263 | 'isPassportPage' => true, |
268 | 'backNewPwd' => true, | 264 | 'backNewPwd' => true, |
@@ -283,8 +279,7 @@ class BackController extends AbstractAction | @@ -283,8 +279,7 @@ class BackController extends AbstractAction | ||
283 | */ | 279 | */ |
284 | public function passwordByMobileAction() | 280 | public function passwordByMobileAction() |
285 | { | 281 | { |
286 | - if($this->isAjax()) | ||
287 | - { | 282 | + if ($this->isAjax()) { |
288 | $phoneNum = $this->post('phoneNum', ''); | 283 | $phoneNum = $this->post('phoneNum', ''); |
289 | $token = $this->post('token', ''); | 284 | $token = $this->post('token', ''); |
290 | $newpwd = $this->post('password', ''); | 285 | $newpwd = $this->post('password', ''); |
@@ -292,12 +287,12 @@ class BackController extends AbstractAction | @@ -292,12 +287,12 @@ class BackController extends AbstractAction | ||
292 | 287 | ||
293 | // 根据手机验证码修改密码 | 288 | // 根据手机验证码修改密码 |
294 | $result = BackData::modifyPasswordByMobile($phoneNum, $token, $newpwd, $areaCode); | 289 | $result = BackData::modifyPasswordByMobile($phoneNum, $token, $newpwd, $areaCode); |
295 | - if($result['code'] === 200) | ||
296 | - { | ||
297 | - $result['data'] = '/'; | 290 | + if ($result['code'] === 200) { |
291 | + $result['data'] = Helpers::url('/signin.html'); | ||
298 | } | 292 | } |
299 | 293 | ||
300 | $this->echoJson($result); | 294 | $this->echoJson($result); |
301 | } | 295 | } |
302 | } | 296 | } |
303 | -} | ||
297 | + | ||
298 | +} |
@@ -17,8 +17,7 @@ class BindController extends AbstractAction | @@ -17,8 +17,7 @@ class BindController extends AbstractAction | ||
17 | public function indexAction() | 17 | public function indexAction() |
18 | { | 18 | { |
19 | $refer = $this->get('refer'); | 19 | $refer = $this->get('refer'); |
20 | - if (!empty($refer)) | ||
21 | - { | 20 | + if (!empty($refer)) { |
22 | $this->setCookie('refer', $refer); | 21 | $this->setCookie('refer', $refer); |
23 | } | 22 | } |
24 | 23 | ||
@@ -50,6 +49,7 @@ class BindController extends AbstractAction | @@ -50,6 +49,7 @@ class BindController extends AbstractAction | ||
50 | public function codeAction() | 49 | public function codeAction() |
51 | { | 50 | { |
52 | $this->setTitle('验证手机'); | 51 | $this->setTitle('验证手机'); |
52 | + | ||
53 | $openId = $this->get('openId'); | 53 | $openId = $this->get('openId'); |
54 | $sourceType = $this->get('sourceType'); | 54 | $sourceType = $this->get('sourceType'); |
55 | $nickname = $this->get('nickname'); | 55 | $nickname = $this->get('nickname'); |
@@ -101,16 +101,16 @@ class BindController extends AbstractAction | @@ -101,16 +101,16 @@ class BindController extends AbstractAction | ||
101 | $this->_view->display('password', $data); | 101 | $this->_view->display('password', $data); |
102 | } | 102 | } |
103 | 103 | ||
104 | - //绑定前手机号校验 | 104 | + /** |
105 | + * 绑定前手机号校验 | ||
106 | + */ | ||
105 | public function bindCheckAction() | 107 | public function bindCheckAction() |
106 | { | 108 | { |
107 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 109 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
108 | 110 | ||
109 | - do | ||
110 | - { | 111 | + do { |
111 | /* 判断是不是AJAX请求 */ | 112 | /* 判断是不是AJAX请求 */ |
112 | - if (!$this->isAjax()) | ||
113 | - { | 113 | + if (!$this->isAjax()) { |
114 | break; | 114 | break; |
115 | } | 115 | } |
116 | 116 | ||
@@ -121,73 +121,73 @@ class BindController extends AbstractAction | @@ -121,73 +121,73 @@ class BindController extends AbstractAction | ||
121 | $nickname = $this->post('nickname'); | 121 | $nickname = $this->post('nickname'); |
122 | 122 | ||
123 | 123 | ||
124 | - if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType) | ||
125 | - { | 124 | + if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType) { |
126 | break; | 125 | break; |
127 | } | 126 | } |
128 | 127 | ||
129 | $res = BindData::bindCheck($phoneNum, $openId, $sourceType); | 128 | $res = BindData::bindCheck($phoneNum, $openId, $sourceType); |
130 | - if (!isset($res['code'])) | ||
131 | - { | 129 | + if (!isset($res['code'])) { |
132 | break; | 130 | break; |
133 | } | 131 | } |
134 | - if ($res['code'] == 200) | ||
135 | - { | ||
136 | - $next = Helpers::url('/passport/bind/code', array('isReg' => $res['data']['is_register'], 'openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname, 'areaCode' => $areaCode, 'phoneNum' => $phoneNum)); | 132 | + |
133 | + if ($res['code'] == 200) { | ||
134 | + $next = Helpers::url('/passport/bind/code', array( | ||
135 | + 'isReg' => $res['data']['is_register'], | ||
136 | + 'openId' => $openId, | ||
137 | + 'sourceType' => $sourceType, | ||
138 | + 'areaCode' => $areaCode, | ||
139 | + 'phoneNum' => $phoneNum, | ||
140 | + 'nickname' => $nickname, | ||
141 | + )); | ||
137 | $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register'], 'next' => $next)); | 142 | $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register'], 'next' => $next)); |
138 | - } | ||
139 | - else | ||
140 | - { | 143 | + } |
144 | + else { | ||
141 | $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data']) ? $res['data'] : ''); | 145 | $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data']) ? $res['data'] : ''); |
142 | } | 146 | } |
143 | - } | ||
144 | - while (false); | 147 | + } while (false); |
145 | 148 | ||
146 | $this->echoJson($data); | 149 | $this->echoJson($data); |
147 | } | 150 | } |
148 | 151 | ||
149 | - //发送验证码 | 152 | + /** |
153 | + * 发送验证码 | ||
154 | + */ | ||
150 | public function sendBindMsgAction() | 155 | public function sendBindMsgAction() |
151 | { | 156 | { |
152 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 157 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
153 | 158 | ||
154 | - do | ||
155 | - { | 159 | + do { |
156 | /* 判断是不是AJAX请求 */ | 160 | /* 判断是不是AJAX请求 */ |
157 | - if (!$this->isAjax()) | ||
158 | - { | 161 | + if (!$this->isAjax()) { |
159 | break; | 162 | break; |
160 | } | 163 | } |
161 | 164 | ||
162 | $phoneNum = $this->post('phoneNum'); | 165 | $phoneNum = $this->post('phoneNum'); |
163 | $areaCode = $this->post('areaCode'); | 166 | $areaCode = $this->post('areaCode'); |
164 | 167 | ||
165 | - if (!is_numeric($phoneNum) || !$areaCode) | ||
166 | - { | 168 | + if (!is_numeric($phoneNum) || !$areaCode) { |
167 | break; | 169 | break; |
168 | } | 170 | } |
169 | 171 | ||
170 | $data = BindData::sendBindMsg($areaCode, $phoneNum); | 172 | $data = BindData::sendBindMsg($areaCode, $phoneNum); |
171 | - if (!isset($data['code'])) | ||
172 | - { | 173 | + if (!isset($data['code'])) { |
173 | break; | 174 | break; |
174 | } | 175 | } |
175 | - } | ||
176 | - while (false); | 176 | + } while (false); |
177 | 177 | ||
178 | $this->echoJson($data); | 178 | $this->echoJson($data); |
179 | } | 179 | } |
180 | 180 | ||
181 | - //校验短信验证码 | 181 | + /** |
182 | + * 校验短信验证码 | ||
183 | + */ | ||
182 | public function checkBindMsgAction() | 184 | public function checkBindMsgAction() |
183 | { | 185 | { |
184 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 186 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
185 | 187 | ||
186 | - do | ||
187 | - { | 188 | + do { |
188 | /* 判断是不是AJAX请求 */ | 189 | /* 判断是不是AJAX请求 */ |
189 | - if (!$this->isAjax()) | ||
190 | - { | 190 | + if (!$this->isAjax()) { |
191 | break; | 191 | break; |
192 | } | 192 | } |
193 | 193 | ||
@@ -195,32 +195,29 @@ class BindController extends AbstractAction | @@ -195,32 +195,29 @@ class BindController extends AbstractAction | ||
195 | $code = $this->post('code'); | 195 | $code = $this->post('code'); |
196 | $areaCode = $this->post('areaCode'); | 196 | $areaCode = $this->post('areaCode'); |
197 | 197 | ||
198 | - if (!is_numeric($phoneNum) || !$code || !$areaCode) | ||
199 | - { | 198 | + if (!is_numeric($phoneNum) || !$code || !$areaCode) { |
200 | break; | 199 | break; |
201 | } | 200 | } |
202 | 201 | ||
203 | $data = BindData::checkBindCode($areaCode, $phoneNum, $code); | 202 | $data = BindData::checkBindCode($areaCode, $phoneNum, $code); |
204 | - if (!isset($data['code'])) | ||
205 | - { | 203 | + if (!isset($data['code'])) { |
206 | break; | 204 | break; |
207 | } | 205 | } |
208 | - } | ||
209 | - while (false); | 206 | + } while (false); |
210 | 207 | ||
211 | $this->echoJson($data); | 208 | $this->echoJson($data); |
212 | } | 209 | } |
213 | 210 | ||
214 | - //绑定手机号 | 211 | + /** |
212 | + * 绑定手机号 | ||
213 | + */ | ||
215 | public function bindMobileAction() | 214 | public function bindMobileAction() |
216 | { | 215 | { |
217 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 216 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
218 | 217 | ||
219 | - do | ||
220 | - { | 218 | + do { |
221 | /* 判断是不是AJAX请求 */ | 219 | /* 判断是不是AJAX请求 */ |
222 | - if (!$this->isAjax()) | ||
223 | - { | 220 | + if (!$this->isAjax()) { |
224 | break; | 221 | break; |
225 | } | 222 | } |
226 | 223 | ||
@@ -231,88 +228,78 @@ class BindController extends AbstractAction | @@ -231,88 +228,78 @@ class BindController extends AbstractAction | ||
231 | $nickname = $this->post('nickname'); | 228 | $nickname = $this->post('nickname'); |
232 | $password = $this->post('password'); | 229 | $password = $this->post('password'); |
233 | 230 | ||
234 | - if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode) | ||
235 | - { | 231 | + if (!is_numeric($phoneNum) || !$openId || !$sourceType || !$areaCode) { |
236 | break; | 232 | break; |
237 | } | 233 | } |
238 | 234 | ||
239 | $res = BindData::bindMobile($openId, $nickname, $sourceType, $phoneNum, $areaCode, $password); | 235 | $res = BindData::bindMobile($openId, $nickname, $sourceType, $phoneNum, $areaCode, $password); |
240 | - if (!isset($res['code'])) | ||
241 | - { | 236 | + if (!isset($res['code'])) { |
242 | break; | 237 | break; |
243 | } | 238 | } |
244 | 239 | ||
245 | //绑定成功,跳转页面 | 240 | //绑定成功,跳转页面 |
246 | $refer = $this->getCookie('refer'); | 241 | $refer = $this->getCookie('refer'); |
247 | - if (empty($refer)) | ||
248 | - { | 242 | + if (empty($refer)) { |
249 | $refer = SITE_MAIN . '/?go=1'; | 243 | $refer = SITE_MAIN . '/?go=1'; |
250 | - } | ||
251 | - else | ||
252 | - { | 244 | + } |
245 | + else { | ||
253 | $refer = rawurldecode($refer); | 246 | $refer = rawurldecode($refer); |
254 | } | 247 | } |
255 | 248 | ||
256 | - if (isset($res['code']) && $res['code'] == 200 && !empty($res['data']['uid'])) | ||
257 | - { | 249 | + if (isset($res['code']) && $res['code'] == 200 && !empty($res['data']['uid'])) { |
258 | $token = Helpers::makeToken($res['data']['uid']); | 250 | $token = Helpers::makeToken($res['data']['uid']); |
259 | $this->setCookie('_TOKEN', $token); | 251 | $this->setCookie('_TOKEN', $token); |
260 | $this->setSession('_TOKEN', $token); | 252 | $this->setSession('_TOKEN', $token); |
261 | $refer = Helpers::syncUserSession($res['data']['uid'], $refer); | 253 | $refer = Helpers::syncUserSession($res['data']['uid'], $refer); |
262 | $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer)); | 254 | $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer)); |
263 | - } | ||
264 | - else | ||
265 | - { | 255 | + } |
256 | + else { | ||
266 | $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer)); | 257 | $data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('refer' => $refer)); |
267 | } | 258 | } |
268 | - } | ||
269 | - while (false); | 259 | + } while (false); |
270 | 260 | ||
271 | $this->echoJson($data); | 261 | $this->echoJson($data); |
272 | } | 262 | } |
273 | 263 | ||
274 | - //换绑check | 264 | + /** |
265 | + * 换绑check | ||
266 | + */ | ||
275 | public function changeCheckAction() | 267 | public function changeCheckAction() |
276 | { | 268 | { |
277 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 269 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
278 | 270 | ||
279 | - do | ||
280 | - { | 271 | + do { |
281 | /* 判断是不是AJAX请求 */ | 272 | /* 判断是不是AJAX请求 */ |
282 | - if (!$this->isAjax()) | ||
283 | - { | 273 | + if (!$this->isAjax()) { |
284 | break; | 274 | break; |
285 | } | 275 | } |
286 | 276 | ||
287 | $phoneNum = $this->post('phoneNum'); | 277 | $phoneNum = $this->post('phoneNum'); |
288 | $areaCode = $this->post('areaCode'); | 278 | $areaCode = $this->post('areaCode'); |
289 | 279 | ||
290 | - if (!is_numeric($phoneNum) || !$areaCode) | ||
291 | - { | 280 | + if (!is_numeric($phoneNum) || !$areaCode) { |
292 | break; | 281 | break; |
293 | } | 282 | } |
294 | 283 | ||
295 | $data = BindData::changeCheck($phoneNum, $areaCode); | 284 | $data = BindData::changeCheck($phoneNum, $areaCode); |
296 | - if (!isset($data['code'])) | ||
297 | - { | 285 | + if (!isset($data['code'])) { |
298 | break; | 286 | break; |
299 | } | 287 | } |
300 | - } | ||
301 | - while (false); | 288 | + } while (false); |
302 | 289 | ||
303 | $this->echoJson($data); | 290 | $this->echoJson($data); |
304 | } | 291 | } |
305 | 292 | ||
306 | - //换绑mobile | 293 | + /** |
294 | + * 换绑mobile | ||
295 | + */ | ||
307 | public function changeMobileAction() | 296 | public function changeMobileAction() |
308 | { | 297 | { |
309 | $data = array('code' => 400, 'message' => '', 'data' => ''); | 298 | $data = array('code' => 400, 'message' => '', 'data' => ''); |
310 | 299 | ||
311 | - do | ||
312 | - { | 300 | + do { |
313 | /* 判断是不是AJAX请求 */ | 301 | /* 判断是不是AJAX请求 */ |
314 | - if (!$this->isAjax()) | ||
315 | - { | 302 | + if (!$this->isAjax()) { |
316 | break; | 303 | break; |
317 | } | 304 | } |
318 | $uid = $this->getUid(true); | 305 | $uid = $this->getUid(true); |
@@ -320,18 +307,15 @@ class BindController extends AbstractAction | @@ -320,18 +307,15 @@ class BindController extends AbstractAction | ||
320 | $areaCode = $this->post('areaCode'); | 307 | $areaCode = $this->post('areaCode'); |
321 | $code = $this->post('code'); | 308 | $code = $this->post('code'); |
322 | 309 | ||
323 | - if (!is_numeric($phoneNum) || !$areaCode || !$code || !$uid) | ||
324 | - { | 310 | + if (!is_numeric($phoneNum) || !$areaCode || !$code || !$uid) { |
325 | break; | 311 | break; |
326 | } | 312 | } |
327 | 313 | ||
328 | $data = BindData::changeMobile($uid, $phoneNum, $areaCode, $code); | 314 | $data = BindData::changeMobile($uid, $phoneNum, $areaCode, $code); |
329 | - if (!isset($data['code'])) | ||
330 | - { | 315 | + if (!isset($data['code'])) { |
331 | break; | 316 | break; |
332 | } | 317 | } |
333 | - } | ||
334 | - while (false); | 318 | + } while (false); |
335 | 319 | ||
336 | $this->echoJson($data); | 320 | $this->echoJson($data); |
337 | } | 321 | } |
@@ -61,6 +61,7 @@ class LoginController extends AbstractAction | @@ -61,6 +61,7 @@ class LoginController extends AbstractAction | ||
61 | $data['isPassportPage'] = true; // 模板中模块标识 | 61 | $data['isPassportPage'] = true; // 模板中模块标识 |
62 | $data['areaCode'] = '+86'; // 默认区号 | 62 | $data['areaCode'] = '+86'; // 默认区号 |
63 | $data['countrys'] = RegData::getAreasData(); // 地区信息列表 | 63 | $data['countrys'] = RegData::getAreasData(); // 地区信息列表 |
64 | + | ||
64 | // 渲染模板 | 65 | // 渲染模板 |
65 | $this->_view->display('international', $data); | 66 | $this->_view->display('international', $data); |
66 | } | 67 | } |
@@ -146,6 +147,8 @@ class LoginController extends AbstractAction | @@ -146,6 +147,8 @@ class LoginController extends AbstractAction | ||
146 | */ | 147 | */ |
147 | public function alipayAction() | 148 | public function alipayAction() |
148 | { | 149 | { |
150 | + $this->setSession('_TOKEN', ''); | ||
151 | + | ||
149 | Factory::create('alipay')->getAuthorizeUrl(); | 152 | Factory::create('alipay')->getAuthorizeUrl(); |
150 | 153 | ||
151 | exit(); | 154 | exit(); |
@@ -156,6 +159,8 @@ class LoginController extends AbstractAction | @@ -156,6 +159,8 @@ class LoginController extends AbstractAction | ||
156 | */ | 159 | */ |
157 | public function qqAction() | 160 | public function qqAction() |
158 | { | 161 | { |
162 | + $this->setSession('_TOKEN', ''); | ||
163 | + | ||
159 | Factory::create('qqconnect')->getAuthorizeUrl(); | 164 | Factory::create('qqconnect')->getAuthorizeUrl(); |
160 | 165 | ||
161 | exit(); | 166 | exit(); |
@@ -166,6 +171,8 @@ class LoginController extends AbstractAction | @@ -166,6 +171,8 @@ class LoginController extends AbstractAction | ||
166 | */ | 171 | */ |
167 | public function sinaAction() | 172 | public function sinaAction() |
168 | { | 173 | { |
174 | + $this->setSession('_TOKEN', ''); | ||
175 | + | ||
169 | $this->go(Factory::create('sinaweibo')->getAuthorizeUrl()); | 176 | $this->go(Factory::create('sinaweibo')->getAuthorizeUrl()); |
170 | } | 177 | } |
171 | 178 |
@@ -81,7 +81,8 @@ class RegController extends AbstractAction | @@ -81,7 +81,8 @@ class RegController extends AbstractAction | ||
81 | $area = $this->get('areaCode', '86'); | 81 | $area = $this->get('areaCode', '86'); |
82 | 82 | ||
83 | // 判断是否允许访问, 不允许则跳转到错误页面 | 83 | // 判断是否允许访问, 不允许则跳转到错误页面 |
84 | - if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area) || !Helpers::verifyToken($mobile, $token)) { | 84 | + if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area) |
85 | + || !Helpers::verifyToken($mobile, $token)) { | ||
85 | $this->error(); | 86 | $this->error(); |
86 | } | 87 | } |
87 | 88 |
-
Please register or login to post a comment