Authored by 周少峰

hide part in app

@@ -12,17 +12,20 @@ class ShopProcess @@ -12,17 +12,20 @@ class ShopProcess
12 { 12 {
13 private static $shopData = array(); 13 private static $shopData = array();
14 private static $shopId = 0; 14 private static $shopId = 0;
  15 + private static $appVersion = 0;
15 16
16 /** 17 /**
17 * 组织店铺页面数据 18 * 组织店铺页面数据
18 * @param array $data 接口返回的店铺页所需数据 19 * @param array $data 接口返回的店铺页所需数据
19 * @param int $shopId 店铺id 20 * @param int $shopId 店铺id
  21 + * @param int $appVersion app版本
20 * @author sefon 2016-4-26 21:56:32 22 * @author sefon 2016-4-26 21:56:32
21 * @return array 23 * @return array
22 */ 24 */
23 - public static function formShopData($data, $shopId) 25 + public static function formShopData($data, $shopId, $appVersion)
24 { 26 {
25 self::$shopId = $shopId; 27 self::$shopId = $shopId;
  28 + self::$appVersion = $appVersion;
26 foreach ($data as $key => $val) { 29 foreach ($data as $key => $val) {
27 if (empty($val) || !is_callable("self::$key")) { 30 if (empty($val) || !is_callable("self::$key")) {
28 continue; 31 continue;
@@ -407,10 +407,11 @@ class ListModel @@ -407,10 +407,11 @@ class ListModel
407 * 新店铺首页 407 * 新店铺首页
408 * @param int $shopId 店铺id 408 * @param int $shopId 店铺id
409 * @param int $uid 用户id 409 * @param int $uid 用户id
  410 + * @param string $appVersion app版本
410 * @author sefon 2016-4-26 21:09:35 411 * @author sefon 2016-4-26 21:09:35
411 * @return array 412 * @return array
412 */ 413 */
413 - public static function shopData($shopId, $uid) 414 + public static function shopData($shopId, $uid, $appVersion = '')
414 { 415 {
415 $data = array(); 416 $data = array();
416 //店铺信息 417 //店铺信息
@@ -420,7 +421,7 @@ class ListModel @@ -420,7 +421,7 @@ class ListModel
420 //店铺装修资源数据 421 //店铺装修资源数据
421 $data['decorator'] = ListData::getShopDecorator($shopId); 422 $data['decorator'] = ListData::getShopDecorator($shopId);
422 //组织楼层数据 423 //组织楼层数据
423 - $result = ShopProcess::formShopData($data, $shopId); 424 + $result = ShopProcess::formShopData($data, $shopId, $appVersion);
424 return $result; 425 return $result;
425 } 426 }
426 427
@@ -462,9 +462,9 @@ class IndexController extends AbstractAction @@ -462,9 +462,9 @@ class IndexController extends AbstractAction
462 */ 462 */
463 private function shop($shopId) 463 private function shop($shopId)
464 { 464 {
465 - $uid = $this->getUid(true);  
466 - $data = ListModel::shopData($shopId, $uid);  
467 $appVersion = $this->get('app_version'); 465 $appVersion = $this->get('app_version');
  466 + $uid = $this->getUid(true);
  467 + $data = ListModel::shopData($shopId, $uid, $appVersion);
468 if (empty($appVersion)) { 468 if (empty($appVersion)) {
469 $this->setNavHeader('', true, SITE_MAIN); 469 $this->setNavHeader('', true, SITE_MAIN);
470 } else { 470 } else {
@@ -485,6 +485,7 @@ class IndexController extends AbstractAction @@ -485,6 +485,7 @@ class IndexController extends AbstractAction
485 { 485 {
486 $data = array(); 486 $data = array();
487 $shopId = $this->post('shop_id', 0); 487 $shopId = $this->post('shop_id', 0);
  488 + $appVersion = $this->get('app_version', 0);
488 $uid = $this->getUid(); 489 $uid = $this->getUid();
489 do { 490 do {
490 if (!$this->isAjax()) { 491 if (!$this->isAjax()) {
@@ -493,7 +494,14 @@ class IndexController extends AbstractAction @@ -493,7 +494,14 @@ class IndexController extends AbstractAction
493 if (empty($uid)) { 494 if (empty($uid)) {
494 $data['code'] = 401; 495 $data['code'] = 401;
495 //TODO app登陆地址 496 //TODO app登陆地址
496 - $data['url'] = Helpers::url('/signin.html'); 497 + $refer = urlencode($_SERVER['HTTP_REFERER']);
  498 + $toUrl = Helpers::url('/signin.html')."?refer=".$refer;
  499 + if (!empty($appVersion)){
  500 + echo 'eee';
  501 + $toUrl .= 'yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"'.$refer.'","param":{}},"requesturl":{"param":{},"url":""},"priority":"Y"}}';
  502 + }
  503 + $data['url'] = $toUrl;
  504 +// print_r($data); exit;
497 break; 505 break;
498 } 506 }
499 if (!empty($shopId) && !empty($uid)) { 507 if (!empty($shopId) && !empty($uid)) {
@@ -509,7 +517,6 @@ class IndexController extends AbstractAction @@ -509,7 +517,6 @@ class IndexController extends AbstractAction
509 */ 517 */
510 public function cancelShopFavAction() 518 public function cancelShopFavAction()
511 { 519 {
512 -  
513 $data = array(); 520 $data = array();
514 $shopId = $this->post('shop_id', 0); 521 $shopId = $this->post('shop_id', 0);
515 $uid = $this->getUid(); 522 $uid = $this->getUid();