do add guang search api docs
Showing
7 changed files
with
165 additions
and
106 deletions
docs/清首页缓存.txt
0 → 100644
1 | + | ||
2 | +guang.m.yohobuy.com/guang/index/clear?type=boys | ||
3 | +guang.m.yohobuy.com/guang/index/clear?type=girls | ||
4 | +guang.m.yohobuy.com/guang/index/clear?type=kids | ||
5 | +guang.m.yohobuy.com/guang/index/clear?type=lifestyle | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | +http://new.yohobuy.com/cache/clear?key=Default_Kids_index&token=yoho9646abcdef | ||
10 | + | ||
11 | +http://new.yohobuy.com/cache/clear?key=Default_Lifestyle_index&token=yoho9646abcdef | ||
12 | + | ||
13 | +http://new.yohobuy.com/cache/clear?key=Default_Woman_index&token=yoho9646abcdef | ||
14 | + | ||
15 | +##http://new.yohobuy.com/cache/clear?key=Default_Default_index&token=yoho9646abcdef | ||
16 | + | ||
17 | + | ||
18 | +其中token就按照上述中去填写,key代表具体要清的缓存的键 | ||
19 | + | ||
20 | +具体key的对应关系如下: | ||
21 | +key 说明 | ||
22 | +Default_Kids_index 潮童页面缓存 | ||
23 | +Default_Lifestyle_index 创意生活页面缓存 | ||
24 | +Default_Woman_index 女生页面缓存 | ||
25 | +Default_Default_index 男生 |
docs/网站搜索接口说明.docx
0 → 100644
No preview for this file type
docs/逛接口说明.xls
0 → 100644
No preview for this file type
@@ -261,6 +261,7 @@ class AbstractAction extends Controller_Abstract | @@ -261,6 +261,7 @@ class AbstractAction extends Controller_Abstract | ||
261 | * 获取Session | 261 | * 获取Session |
262 | * | 262 | * |
263 | * @param string $name 名称 | 263 | * @param string $name 名称 |
264 | + * @return mixed | ||
264 | */ | 265 | */ |
265 | public function getSession($name) | 266 | public function getSession($name) |
266 | { | 267 | { |
@@ -270,18 +271,25 @@ class AbstractAction extends Controller_Abstract | @@ -270,18 +271,25 @@ class AbstractAction extends Controller_Abstract | ||
270 | /** | 271 | /** |
271 | * 获取当前登录的用户ID | 272 | * 获取当前登录的用户ID |
272 | * | 273 | * |
274 | + * @param bool $useSession 是否使用Session会话 | ||
273 | * @return int | 275 | * @return int |
274 | - * @todo | ||
275 | */ | 276 | */ |
276 | - protected function getUid() | 277 | + protected function getUid($useSession = false) |
277 | { | 278 | { |
278 | if (!$this->_uid) { | 279 | if (!$this->_uid) { |
279 | - $cookie = $this->getCookie('_UID'); | ||
280 | - if (!empty($cookie)) { | ||
281 | - $cookieList = explode('::', $cookie); | ||
282 | - if (isset($cookieList[1]) && is_numeric($cookieList[1])) { | ||
283 | - $this->_uid = $cookieList[1]; | ||
284 | - $this->_uname = $cookieList[0]; | 280 | + // 从SESSION获取 |
281 | + if ($useSession) { | ||
282 | + $this->_uid = $this->getSession('_UID'); | ||
283 | + } | ||
284 | + // 从COOKIE获取 | ||
285 | + else { | ||
286 | + $cookie = $this->getCookie('_UID'); | ||
287 | + if (!empty($cookie)) { | ||
288 | + $cookieList = explode('::', $cookie); | ||
289 | + if (isset($cookieList[1]) && is_numeric($cookieList[1])) { | ||
290 | + $this->_uid = $cookieList[1]; | ||
291 | + $this->_uname = $cookieList[0]; | ||
292 | + } | ||
285 | } | 293 | } |
286 | } | 294 | } |
287 | } | 295 | } |
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | -use home\GradeModel; | ||
5 | -use home\OrderModel; | ||
6 | use Plugin\Helpers; | 4 | use Plugin\Helpers; |
7 | use LibModels\Wap\Home\OrderData; | 5 | use LibModels\Wap\Home\OrderData; |
8 | 6 | ||
@@ -13,18 +11,33 @@ use LibModels\Wap\Home\OrderData; | @@ -13,18 +11,33 @@ use LibModels\Wap\Home\OrderData; | ||
13 | * @package | 11 | * @package |
14 | * @copyright yoho.inc | 12 | * @copyright yoho.inc |
15 | * @version 1.0 (2015-10-28 16:28:32) | 13 | * @version 1.0 (2015-10-28 16:28:32) |
16 | - * @author fei.hong <fei.hong@yoho.cn> | ||
17 | */ | 14 | */ |
18 | class HomeController extends AbstractAction | 15 | class HomeController extends AbstractAction |
19 | { | 16 | { |
20 | - | 17 | + protected $_uid; |
18 | + | ||
19 | +// /** | ||
20 | +// * 初始化 | ||
21 | +// */ | ||
22 | +// public function init() | ||
23 | +// { | ||
24 | +// // 检查用户是否登录, 未登录则跳转到登录页 | ||
25 | +// $uid = $this->getUid(true); | ||
26 | +// if (!$uid) { | ||
27 | +// $this->go(Helpers::url('/signin.html')); | ||
28 | +// } | ||
29 | +// | ||
30 | +// parent::init(); | ||
31 | +// } | ||
32 | + | ||
21 | /** | 33 | /** |
22 | * 个人中心入口 | 34 | * 个人中心入口 |
23 | */ | 35 | */ |
24 | - public function indexAction() { | 36 | + public function indexAction() |
37 | + { | ||
25 | // 设置网站标题 | 38 | // 设置网站标题 |
26 | $this->setTitle('个人中心'); | 39 | $this->setTitle('个人中心'); |
27 | - $this->setNavHeader('个人中心', true, SITE_MAIN); | 40 | + $this->setNavHeader('个人中心'); |
28 | 41 | ||
29 | // $uid = $this->getUid(); | 42 | // $uid = $this->getUid(); |
30 | $uid = 8826435; | 43 | $uid = 8826435; |
@@ -45,7 +58,8 @@ class HomeController extends AbstractAction | @@ -45,7 +58,8 @@ class HomeController extends AbstractAction | ||
45 | /** | 58 | /** |
46 | * 用户收藏的商品 | 59 | * 用户收藏的商品 |
47 | */ | 60 | */ |
48 | - public function favoriteAction() { | 61 | + public function favoriteAction() |
62 | + { | ||
49 | $uid = $this->getUid(); | 63 | $uid = $this->getUid(); |
50 | 64 | ||
51 | $favProducts = \Index\UserModel::getFavProductData($uid); | 65 | $favProducts = \Index\UserModel::getFavProductData($uid); |
@@ -160,7 +174,8 @@ class HomeController extends AbstractAction | @@ -160,7 +174,8 @@ class HomeController extends AbstractAction | ||
160 | /** | 174 | /** |
161 | * 用户收藏的品牌 | 175 | * 用户收藏的品牌 |
162 | */ | 176 | */ |
163 | - public function favoritebrandAction() { | 177 | + public function favoritebrandAction() |
178 | + { | ||
164 | $uid = $this->getUid(); | 179 | $uid = $this->getUid(); |
165 | $gender = Helpers::getGenderByCookie(); | 180 | $gender = Helpers::getGenderByCookie(); |
166 | 181 | ||
@@ -170,11 +185,12 @@ class HomeController extends AbstractAction | @@ -170,11 +185,12 @@ class HomeController extends AbstractAction | ||
170 | } | 185 | } |
171 | 186 | ||
172 | /** | 187 | /** |
173 | - * 个人信息 | 188 | + * 我的个人信息 |
174 | */ | 189 | */ |
175 | - public function personalDetailsAction() { | 190 | + public function mydetailsAction() |
191 | + { | ||
176 | $this->setTitle('个人信息'); | 192 | $this->setTitle('个人信息'); |
177 | - $this->setNavHeader('个人信息', true, SITE_MAIN); | 193 | + $this->setNavHeader('个人信息'); |
178 | 194 | ||
179 | // $uid = $this->getUid(); | 195 | // $uid = $this->getUid(); |
180 | $uid = 967016; | 196 | $uid = 967016; |
@@ -186,9 +202,10 @@ class HomeController extends AbstractAction | @@ -186,9 +202,10 @@ class HomeController extends AbstractAction | ||
186 | /** | 202 | /** |
187 | * YOHO币 | 203 | * YOHO币 |
188 | */ | 204 | */ |
189 | - public function currencyAction() { | 205 | + public function currencyAction() |
206 | + { | ||
190 | $this->setTitle('YOHO币'); | 207 | $this->setTitle('YOHO币'); |
191 | - $this->setNavHeader('优惠券', true, SITE_MAIN); | 208 | + $this->setNavHeader('优惠券'); |
192 | 209 | ||
193 | $uid = 967016; | 210 | $uid = 967016; |
194 | $currency = \Index\UserModel::getYohoCoinData($uid); | 211 | $currency = \Index\UserModel::getYohoCoinData($uid); |
@@ -200,10 +217,11 @@ class HomeController extends AbstractAction | @@ -200,10 +217,11 @@ class HomeController extends AbstractAction | ||
200 | /** | 217 | /** |
201 | * 优惠券 | 218 | * 优惠券 |
202 | */ | 219 | */ |
203 | - public function couponsAction() { | 220 | + public function couponsAction() |
221 | + { | ||
204 | 222 | ||
205 | $this->setTitle('优惠券'); | 223 | $this->setTitle('优惠券'); |
206 | - $this->setNavHeader('优惠券', true, SITE_MAIN); | 224 | + $this->setNavHeader('优惠券'); |
207 | // $uid = $this->getUid(); | 225 | // $uid = $this->getUid(); |
208 | $uid = 8826435; | 226 | $uid = 8826435; |
209 | $status = $this->get('status', 0); | 227 | $status = $this->get('status', 0); |
@@ -219,7 +237,8 @@ class HomeController extends AbstractAction | @@ -219,7 +237,8 @@ class HomeController extends AbstractAction | ||
219 | /** | 237 | /** |
220 | * 我的消息 | 238 | * 我的消息 |
221 | */ | 239 | */ |
222 | - public function messageAction() { | 240 | + public function messageAction() |
241 | + { | ||
223 | // $uid = $this->getUid(); | 242 | // $uid = $this->getUid(); |
224 | $page = $this->get('page', 0); | 243 | $page = $this->get('page', 0); |
225 | $size = $this->get('size', 10); | 244 | $size = $this->get('size', 10); |
@@ -233,10 +252,11 @@ class HomeController extends AbstractAction | @@ -233,10 +252,11 @@ class HomeController extends AbstractAction | ||
233 | /** | 252 | /** |
234 | * 地址管理 | 253 | * 地址管理 |
235 | */ | 254 | */ |
236 | - public function addressAction() { | 255 | + public function addressAction() |
256 | + { | ||
237 | // 设置网站标题 | 257 | // 设置网站标题 |
238 | $this->setTitle('地址管理'); | 258 | $this->setTitle('地址管理'); |
239 | - $this->setNavHeader('地址管理', true, SITE_MAIN); | 259 | + $this->setNavHeader('地址管理'); |
240 | 260 | ||
241 | // $uid = $this->getUid(); | 261 | // $uid = $this->getUid(); |
242 | $uid = 967016; | 262 | $uid = 967016; |
@@ -257,7 +277,8 @@ class HomeController extends AbstractAction | @@ -257,7 +277,8 @@ class HomeController extends AbstractAction | ||
257 | /** | 277 | /** |
258 | * 修改地址或者添加新地址 | 278 | * 修改地址或者添加新地址 |
259 | */ | 279 | */ |
260 | - public function saveAddressAction() { | 280 | + public function saveAddressAction() |
281 | + { | ||
261 | $result = array(); | 282 | $result = array(); |
262 | 283 | ||
263 | if ($this->isAjax()) { | 284 | if ($this->isAjax()) { |
@@ -284,7 +305,8 @@ class HomeController extends AbstractAction | @@ -284,7 +305,8 @@ class HomeController extends AbstractAction | ||
284 | /** | 305 | /** |
285 | * 设置默认地址 | 306 | * 设置默认地址 |
286 | */ | 307 | */ |
287 | - public function defaultAddressAction() { | 308 | + public function defaultAddressAction() |
309 | + { | ||
288 | $result = array(); | 310 | $result = array(); |
289 | 311 | ||
290 | if ($this->isAjax()) { | 312 | if ($this->isAjax()) { |
@@ -303,12 +325,13 @@ class HomeController extends AbstractAction | @@ -303,12 +325,13 @@ class HomeController extends AbstractAction | ||
303 | } | 325 | } |
304 | 326 | ||
305 | //在线客服 | 327 | //在线客服 |
306 | - public function onlineServiceAction() { | 328 | + public function onlineServiceAction() |
329 | + { | ||
307 | // 设置网站标题 | 330 | // 设置网站标题 |
308 | $this->setTitle('在线客服'); | 331 | $this->setTitle('在线客服'); |
309 | - $this->setNavHeader('在线客服', true, SITE_MAIN); | 332 | + $this->setNavHeader('在线客服'); |
310 | 333 | ||
311 | - $service = home\OnlineModel::getOnlineServiceInfo(); | 334 | + $service = \Home\OnlineModel::getOnlineServiceInfo(); |
312 | 335 | ||
313 | $this->_view->display('online_service', array( | 336 | $this->_view->display('online_service', array( |
314 | 'onlineServicePage' => true, | 337 | 'onlineServicePage' => true, |
@@ -318,12 +341,13 @@ class HomeController extends AbstractAction | @@ -318,12 +341,13 @@ class HomeController extends AbstractAction | ||
318 | } | 341 | } |
319 | 342 | ||
320 | //在线客服-具体详情 | 343 | //在线客服-具体详情 |
321 | - public function onlineServiceDetailAction() { | 344 | + public function onlineServiceDetailAction() |
345 | + { | ||
322 | $service = array(); | 346 | $service = array(); |
323 | $cateId = $this->get('cateId', 0); | 347 | $cateId = $this->get('cateId', 0); |
324 | $cateName = $this->get('cateName', ''); | 348 | $cateName = $this->get('cateName', ''); |
325 | if ($cateId > 0) { | 349 | if ($cateId > 0) { |
326 | - $service = home\OnlineModel::getOnlineServiceDetail($cateId); | 350 | + $service = \Home\OnlineModel::getOnlineServiceDetail($cateId); |
327 | } | 351 | } |
328 | $this->setTitle('在线客服'); | 352 | $this->setTitle('在线客服'); |
329 | $this->setNavHeader($cateName, true, ''); | 353 | $this->setNavHeader($cateName, true, ''); |
@@ -333,17 +357,19 @@ class HomeController extends AbstractAction | @@ -333,17 +357,19 @@ class HomeController extends AbstractAction | ||
333 | /** | 357 | /** |
334 | * 我的逛 | 358 | * 我的逛 |
335 | */ | 359 | */ |
336 | - public function myGuangAction() { | 360 | + public function myGuangAction() |
361 | + { | ||
337 | echo 'My Guang'; | 362 | echo 'My Guang'; |
338 | } | 363 | } |
339 | 364 | ||
340 | /** | 365 | /** |
341 | * 意见反馈 | 366 | * 意见反馈 |
342 | */ | 367 | */ |
343 | - public function suggestAction() { | 368 | + public function suggestAction() |
369 | + { | ||
344 | // 设置网站标题 | 370 | // 设置网站标题 |
345 | $this->setTitle('意见反馈'); | 371 | $this->setTitle('意见反馈'); |
346 | - $this->setNavHeader('意见反馈', true, SITE_MAIN); | 372 | + $this->setNavHeader('意见反馈'); |
347 | 373 | ||
348 | $udid = $this->getUdid(); | 374 | $udid = $this->getUdid(); |
349 | $page = $this->get('page', 1); | 375 | $page = $this->get('page', 1); |
@@ -382,7 +408,8 @@ class HomeController extends AbstractAction | @@ -382,7 +408,8 @@ class HomeController extends AbstractAction | ||
382 | /** | 408 | /** |
383 | * 意见反馈-提交表单 | 409 | * 意见反馈-提交表单 |
384 | */ | 410 | */ |
385 | - public function suggest_subAction() { | 411 | + public function suggest_subAction() |
412 | + { | ||
386 | $udid = $this->getUdid(); | 413 | $udid = $this->getUdid(); |
387 | $page = $this->get('page', 1); | 414 | $page = $this->get('page', 1); |
388 | $limit = $this->get('limit', 30); | 415 | $limit = $this->get('limit', 30); |
@@ -405,7 +432,8 @@ class HomeController extends AbstractAction | @@ -405,7 +432,8 @@ class HomeController extends AbstractAction | ||
405 | /** | 432 | /** |
406 | * 异步保存意见反馈数据 | 433 | * 异步保存意见反馈数据 |
407 | */ | 434 | */ |
408 | - public function savesuggestAction() { | 435 | + public function savesuggestAction() |
436 | + { | ||
409 | if ($this->isAjax()) { | 437 | if ($this->isAjax()) { |
410 | $uid = $this->getUid(); | 438 | $uid = $this->getUid(); |
411 | $content = $this->post('content', ''); | 439 | $content = $this->post('content', ''); |
@@ -419,7 +447,8 @@ class HomeController extends AbstractAction | @@ -419,7 +447,8 @@ class HomeController extends AbstractAction | ||
419 | /** | 447 | /** |
420 | * 会员等级展示页 | 448 | * 会员等级展示页 |
421 | */ | 449 | */ |
422 | - public function gradeAction() { | 450 | + public function gradeAction() |
451 | + { | ||
423 | //设置网站seo信息 | 452 | //设置网站seo信息 |
424 | $this->setTitle('会员等级'); | 453 | $this->setTitle('会员等级'); |
425 | //显示网站导航头部信息 | 454 | //显示网站导航头部信息 |
@@ -438,7 +467,8 @@ class HomeController extends AbstractAction | @@ -438,7 +467,8 @@ class HomeController extends AbstractAction | ||
438 | * 会员特权查看页 | 467 | * 会员特权查看页 |
439 | */ | 468 | */ |
440 | 469 | ||
441 | - public function preferentialAction() { | 470 | + public function preferentialAction() |
471 | + { | ||
442 | //设置网站seo信息 | 472 | //设置网站seo信息 |
443 | $this->setTitle('会员等级'); | 473 | $this->setTitle('会员等级'); |
444 | //显示网站导航头部信息 | 474 | //显示网站导航头部信息 |
@@ -446,7 +476,7 @@ class HomeController extends AbstractAction | @@ -446,7 +476,7 @@ class HomeController extends AbstractAction | ||
446 | 476 | ||
447 | $channel = Helpers::getChannelByCookie(); | 477 | $channel = Helpers::getChannelByCookie(); |
448 | $uid = $this->getUid(); | 478 | $uid = $this->getUid(); |
449 | - $data = GradeModel::getPreferential($channel, $uid); | 479 | + $data = \Home\GradeModel::getPreferential($channel, $uid); |
450 | $data['pageFooter'] = true; | 480 | $data['pageFooter'] = true; |
451 | $this->_view->display('privilege', $data); | 481 | $this->_view->display('privilege', $data); |
452 | } | 482 | } |
@@ -455,7 +485,8 @@ class HomeController extends AbstractAction | @@ -455,7 +485,8 @@ class HomeController extends AbstractAction | ||
455 | * 我的订单页面 | 485 | * 我的订单页面 |
456 | */ | 486 | */ |
457 | 487 | ||
458 | - public function orderAction() { | 488 | + public function orderAction() |
489 | + { | ||
459 | //获得type值 | 490 | //获得type值 |
460 | $type = $this->get('type', 1); | 491 | $type = $this->get('type', 1); |
461 | $this->setTitle('我的订单'); | 492 | $this->setTitle('我的订单'); |
@@ -475,7 +506,8 @@ class HomeController extends AbstractAction | @@ -475,7 +506,8 @@ class HomeController extends AbstractAction | ||
475 | } | 506 | } |
476 | 507 | ||
477 | //ajax请求订单页面 | 508 | //ajax请求订单页面 |
478 | - public function getOrderAction() { | 509 | + public function getOrderAction() |
510 | + { | ||
479 | //判断是不是ajax请求 | 511 | //判断是不是ajax请求 |
480 | if (!$this->isAjax()) { | 512 | if (!$this->isAjax()) { |
481 | $this->error(); | 513 | $this->error(); |
@@ -505,7 +537,8 @@ class HomeController extends AbstractAction | @@ -505,7 +537,8 @@ class HomeController extends AbstractAction | ||
505 | * 我的订单-取消订单 | 537 | * 我的订单-取消订单 |
506 | */ | 538 | */ |
507 | 539 | ||
508 | - public function cancelOrderAction() { | 540 | + public function cancelOrderAction() |
541 | + { | ||
509 | 542 | ||
510 | //判断是不是ajax请求 | 543 | //判断是不是ajax请求 |
511 | if (!$this->isAjax()) { | 544 | if (!$this->isAjax()) { |
@@ -528,7 +561,8 @@ class HomeController extends AbstractAction | @@ -528,7 +561,8 @@ class HomeController extends AbstractAction | ||
528 | * 我的订单-删除订单 | 561 | * 我的订单-删除订单 |
529 | */ | 562 | */ |
530 | 563 | ||
531 | - public function deleteOrderAction() { | 564 | + public function deleteOrderAction() |
565 | + { | ||
532 | //判断是不是ajax请求 | 566 | //判断是不是ajax请求 |
533 | if (!$this->isAjax()) { | 567 | if (!$this->isAjax()) { |
534 | $this->error(); | 568 | $this->error(); |
@@ -549,7 +583,8 @@ class HomeController extends AbstractAction | @@ -549,7 +583,8 @@ class HomeController extends AbstractAction | ||
549 | /** | 583 | /** |
550 | * 订单详情页 | 584 | * 订单详情页 |
551 | */ | 585 | */ |
552 | - public function orderDetailAction() { | 586 | + public function orderDetailAction() |
587 | + { | ||
553 | $data = array( | 588 | $data = array( |
554 | 'name' => '毛毛莉Lydia', | 589 | 'name' => '毛毛莉Lydia', |
555 | 'phoneNum' => '18600001133', | 590 | 'phoneNum' => '18600001133', |
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | -namespace home; | 3 | +namespace Home; |
4 | 4 | ||
5 | use LibModels\Wap\Home\GradeData; | 5 | use LibModels\Wap\Home\GradeData; |
6 | -use Action\AbstractAction; | ||
7 | use Plugin\Helpers; | 6 | use Plugin\Helpers; |
8 | 7 | ||
9 | /** | 8 | /** |
@@ -15,7 +14,8 @@ class GradeModel | @@ -15,7 +14,8 @@ class GradeModel | ||
15 | * 获取个人中心-会员等级数据 | 14 | * 获取个人中心-会员等级数据 |
16 | */ | 15 | */ |
17 | 16 | ||
18 | - public static function getGrade($gender, $channel, $uid) { | 17 | + public static function getGrade($gender, $channel, $uid) |
18 | + { | ||
19 | $result = array(); | 19 | $result = array(); |
20 | 20 | ||
21 | if (USE_CACHE) { | 21 | if (USE_CACHE) { |
@@ -28,41 +28,41 @@ class GradeModel | @@ -28,41 +28,41 @@ class GradeModel | ||
28 | //调用接口获取数据 | 28 | //调用接口获取数据 |
29 | $data = GradeData::getGradeData($gender, $channel, $uid); | 29 | $data = GradeData::getGradeData($gender, $channel, $uid); |
30 | 30 | ||
31 | - if (!empty($data['grade'])) { | ||
32 | - switch (intval($data['grade']['current_vip_level'])) { | ||
33 | - case 0://普通会员 | ||
34 | - $result['vipGrade']['vip0'] = true; | ||
35 | - break; | ||
36 | - case 1://银卡会员 | ||
37 | - $result['vipGrade']['vip1'] = true; | ||
38 | - break; | ||
39 | - case 2://金卡会员 | ||
40 | - $result['vipGrade']['vip2'] = true; | ||
41 | - break; | ||
42 | - case 3://白金会员 | ||
43 | - $result['vipGrade']['vip3'] = true; | ||
44 | - break; | ||
45 | - } | ||
46 | - | ||
47 | - //今年总消费 | ||
48 | - $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost']; | ||
49 | - //升级下一等级会员的进度; | ||
50 | - $result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2)); | ||
51 | - //距离升级所需消费金额 | ||
52 | - | ||
53 | - if ($data['grade']['current_vip_level'] != 3) { | ||
54 | - $result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost']; | ||
55 | - } | ||
56 | - //消费总计 | ||
57 | - $result['vipGrade']['sumCost'] = $data['grade']['current_total_cost']; | ||
58 | - //username 调用获取用户基本信息数据,获得username; | ||
59 | - //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel); | ||
60 | - $result['vipGrade']['name'] = $data['userProfile']['username']; | ||
61 | - //跳转url(会员特权详情) | ||
62 | - $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null); | ||
63 | - //当前vip等级享受的特权 | ||
64 | - $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential']; | ||
65 | - } | 31 | + if (!empty($data['grade'])) { |
32 | + switch (intval($data['grade']['current_vip_level'])) { | ||
33 | + case 0://普通会员 | ||
34 | + $result['vipGrade']['vip0'] = true; | ||
35 | + break; | ||
36 | + case 1://银卡会员 | ||
37 | + $result['vipGrade']['vip1'] = true; | ||
38 | + break; | ||
39 | + case 2://金卡会员 | ||
40 | + $result['vipGrade']['vip2'] = true; | ||
41 | + break; | ||
42 | + case 3://白金会员 | ||
43 | + $result['vipGrade']['vip3'] = true; | ||
44 | + break; | ||
45 | + } | ||
46 | + | ||
47 | + //今年总消费 | ||
48 | + $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost']; | ||
49 | + //升级下一等级会员的进度; | ||
50 | + $result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2)); | ||
51 | + //距离升级所需消费金额 | ||
52 | + | ||
53 | + if ($data['grade']['current_vip_level'] != 3) { | ||
54 | + $result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost']; | ||
55 | + } | ||
56 | + //消费总计 | ||
57 | + $result['vipGrade']['sumCost'] = $data['grade']['current_total_cost']; | ||
58 | + //username 调用获取用户基本信息数据,获得username; | ||
59 | + //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel); | ||
60 | + $result['vipGrade']['name'] = $data['userProfile']['username']; | ||
61 | + //跳转url(会员特权详情) | ||
62 | + $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null); | ||
63 | + //当前vip等级享受的特权 | ||
64 | + $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential']; | ||
65 | + } | ||
66 | 66 | ||
67 | if (USE_CACHE) { | 67 | if (USE_CACHE) { |
68 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 68 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
@@ -82,7 +82,8 @@ class GradeModel | @@ -82,7 +82,8 @@ class GradeModel | ||
82 | * 获取个人中心-会员特权详情页 | 82 | * 获取个人中心-会员特权详情页 |
83 | */ | 83 | */ |
84 | 84 | ||
85 | - public function getPreferential($channel, $uid) { | 85 | + public function getPreferential($channel, $uid) |
86 | + { | ||
86 | $result = array(); | 87 | $result = array(); |
87 | 88 | ||
88 | if (USE_CACHE) { | 89 | if (USE_CACHE) { |
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | -namespace home; | 3 | +namespace Home; |
4 | 4 | ||
5 | use LibModels\Wap\Home\OnlineData; | 5 | use LibModels\Wap\Home\OnlineData; |
6 | -use Action\AbstractAction; | ||
7 | use Plugin\Helpers; | 6 | use Plugin\Helpers; |
8 | 7 | ||
9 | /** | 8 | /** |
@@ -20,13 +19,10 @@ class OnlineModel | @@ -20,13 +19,10 @@ class OnlineModel | ||
20 | $cateInfo = $res['data']; | 19 | $cateInfo = $res['data']; |
21 | $question = array(); | 20 | $question = array(); |
22 | $tab = array(); | 21 | $tab = array(); |
23 | - if ($cateInfo) | ||
24 | - { | ||
25 | - foreach ($cateInfo as $key => $value) | ||
26 | - { | 22 | + if ($cateInfo) { |
23 | + foreach ($cateInfo as $key => $value) { | ||
27 | //强制截成3个tab | 24 | //强制截成3个tab |
28 | - if ($key > 2) | ||
29 | - { | 25 | + if ($key > 2) { |
30 | break; | 26 | break; |
31 | } | 27 | } |
32 | $tab[$key]['tabid'] = 'tab' . $value['id']; | 28 | $tab[$key]['tabid'] = 'tab' . $value['id']; |
@@ -37,12 +33,10 @@ class OnlineModel | @@ -37,12 +33,10 @@ class OnlineModel | ||
37 | $question[$key]['current'] = (!$key) ? TRUE : FALSE; | 33 | $question[$key]['current'] = (!$key) ? TRUE : FALSE; |
38 | $sub = $value['sub']; | 34 | $sub = $value['sub']; |
39 | $qTmp = array(); | 35 | $qTmp = array(); |
40 | - if ($sub) | ||
41 | - { | ||
42 | - foreach ($sub as $sk => $sv) | ||
43 | - { | 36 | + if ($sub) { |
37 | + foreach ($sub as $sk => $sv) { | ||
44 | $qTmp[$sk]['title'] = $sv['category_name']; | 38 | $qTmp[$sk]['title'] = $sv['category_name']; |
45 | - $qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'].'&cateName='.$sv['category_name']; | 39 | + $qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'] . '&cateName=' . $sv['category_name']; |
46 | } | 40 | } |
47 | } | 41 | } |
48 | $question[$key]['list'] = $qTmp; | 42 | $question[$key]['list'] = $qTmp; |
@@ -64,19 +58,15 @@ class OnlineModel | @@ -64,19 +58,15 @@ class OnlineModel | ||
64 | public static function getOnlineServiceDetail($cateId, $clinetType = 'iphone') | 58 | public static function getOnlineServiceDetail($cateId, $clinetType = 'iphone') |
65 | { | 59 | { |
66 | $result = array(); | 60 | $result = array(); |
67 | - if (!$cateId) | ||
68 | - { | 61 | + if (!$cateId) { |
69 | return $result; | 62 | return $result; |
70 | } | 63 | } |
71 | $res = OnlineData::getOnlineServiceDetail($cateId, $clinetType); | 64 | $res = OnlineData::getOnlineServiceDetail($cateId, $clinetType); |
72 | $questionInfo = $res['data']; | 65 | $questionInfo = $res['data']; |
73 | - if ($questionInfo) | ||
74 | - { | 66 | + if ($questionInfo) { |
75 | $list = array(); | 67 | $list = array(); |
76 | - if ($questionInfo) | ||
77 | - { | ||
78 | - foreach ($questionInfo as $qk => $qv) | ||
79 | - { | 68 | + if ($questionInfo) { |
69 | + foreach ($questionInfo as $qk => $qv) { | ||
80 | $list[$qk]['q'] = $qv['title']; | 70 | $list[$qk]['q'] = $qv['title']; |
81 | $list[$qk]['a'] = $qv['content']; | 71 | $list[$qk]['a'] = $qv['content']; |
82 | } | 72 | } |
-
Please register or login to post a comment