Authored by hf

fixes bug refs YW-982 YW-976 YW-958

@@ -100,6 +100,18 @@ class AbstractAction extends Controller_Abstract @@ -100,6 +100,18 @@ class AbstractAction extends Controller_Abstract
100 { 100 {
101 return $this->_request->getParam($key, $default); 101 return $this->_request->getParam($key, $default);
102 } 102 }
  103 +
  104 + /**
  105 + * 封装一下获取服务器的参数
  106 + *
  107 + * @param String $key
  108 + * @param mixed $default
  109 + * @return mixed
  110 + */
  111 + protected function server($key, $default = null)
  112 + {
  113 + return $this->_request->getServer($key, $default);
  114 + }
103 115
104 /** 116 /**
105 * 关闭模板自动渲染 117 * 关闭模板自动渲染
1 <?php 1 <?php
  2 +
2 namespace LibModels\Wap\Category; 3 namespace LibModels\Wap\Category;
3 4
4 use Api\Yohobuy; 5 use Api\Yohobuy;
@@ -15,26 +16,28 @@ use Api\Sign; @@ -15,26 +16,28 @@ use Api\Sign;
15 */ 16 */
16 class FocusData 17 class FocusData
17 { 18 {
18 - /**  
19 - * 获取关注数据  
20 - *  
21 - * @param integ $uid 用户ID  
22 - * @param string $gender 性别  
23 - * @param integer $limit 读取数目限制,默认为10  
24 - * @param integer $page 读取分页限制,默认为1  
25 - * @return array 关注数据  
26 - */ 19 +
  20 + /**
  21 + * 获取关注数据
  22 + *
  23 + * @param integ $uid 用户ID
  24 + * @param string $gender 性别
  25 + * @param integer $limit 读取数目限制,默认为10
  26 + * @param integer $page 读取分页限制,默认为1
  27 + * @return array 关注数据
  28 + */
27 public static function getFocusData($uid, $gender, $limit = 10, $page = 1) 29 public static function getFocusData($uid, $gender, $limit = 10, $page = 1)
28 { 30 {
29 - // 构建必传参数  
30 - $param = Yohobuy::param();  
31 - $param['uid'] = $uid;  
32 - $param['gender'] = $gender;  
33 - $param['limit'] = $limit;  
34 - $param['page'] = $page; 31 + // 构建必传参数
  32 + $param = Yohobuy::param();
  33 + $param['uid'] = $uid;
  34 + $param['gender'] = $gender;
  35 + $param['limit'] = $limit;
  36 + $param['page'] = $page;
35 37
36 $param['client_secret'] = Sign::getSign($param); 38 $param['client_secret'] = Sign::getSign($param);
37 -  
38 - return Yohobuy::get(Yohobuy::SERVICE_URL.'guang/api/v1/attention/getlist', $param); 39 +
  40 + return Yohobuy::get(Yohobuy::SERVICE_URL . 'guang/api/v1/attention/getlist', $param);
39 } 41 }
  42 +
40 } 43 }
@@ -58,7 +58,7 @@ class PlusstarData @@ -58,7 +58,7 @@ class PlusstarData
58 $build['client_secret'] = Sign::getSign($build); 58 $build['client_secret'] = Sign::getSign($build);
59 $urlList['all'] = Yohobuy::httpBuildQuery($url, $build); 59 $urlList['all'] = Yohobuy::httpBuildQuery($url, $build);
60 60
61 - return Yohobuy::getMulti($urlList); 61 + return Yohobuy::getMulti($urlList, array(), 1800); // 缓存30分钟
62 } 62 }
63 63
64 /** 64 /**
@@ -96,7 +96,7 @@ class PlusstarData @@ -96,7 +96,7 @@ class PlusstarData
96 $original['client_secret'] = Sign::getSign($original); 96 $original['client_secret'] = Sign::getSign($original);
97 $urlList['original'] = Yohobuy::httpBuildQuery($url, $original); 97 $urlList['original'] = Yohobuy::httpBuildQuery($url, $original);
98 98
99 - return Yohobuy::getMulti($urlList); 99 + return Yohobuy::getMulti($urlList, array(), 1800); // 缓存30分钟
100 } 100 }
101 101
102 /** 102 /**
@@ -33,7 +33,7 @@ class BrandData @@ -33,7 +33,7 @@ class BrandData
33 $param['type'] = 'brand'; 33 $param['type'] = 'brand';
34 $param['client_secret'] = Sign::getSign($param); 34 $param['client_secret'] = Sign::getSign($param);
35 35
36 - return Yohobuy::post(Yohobuy::API_URL, $param, true); 36 + return Yohobuy::post(Yohobuy::API_URL, $param);
37 } 37 }
38 38
39 /** 39 /**
@@ -52,7 +52,7 @@ class BrandData @@ -52,7 +52,7 @@ class BrandData
52 $param['type'] = 'brand'; 52 $param['type'] = 'brand';
53 $param['client_secret'] = Sign::getSign($param); 53 $param['client_secret'] = Sign::getSign($param);
54 54
55 - return Yohobuy::post(Yohobuy::API_URL, $param, true); 55 + return Yohobuy::post(Yohobuy::API_URL, $param);
56 } 56 }
57 57
58 } 58 }
@@ -33,7 +33,7 @@ class Helpers @@ -33,7 +33,7 @@ class Helpers
33 $url = 'http://search' . SUB_DOMAIN; 33 $url = 'http://search' . SUB_DOMAIN;
34 break; 34 break;
35 case 'index': // 默认 35 case 'index': // 默认
36 - $url = ''; 36 + $url = SITE_MAIN;
37 break; 37 break;
38 default: // 其它子域名 38 default: // 其它子域名
39 $url = 'http://' . $module . SUB_DOMAIN; 39 $url = 'http://' . $module . SUB_DOMAIN;
@@ -160,7 +160,7 @@ class HomeModel @@ -160,7 +160,7 @@ class HomeModel
160 } 160 }
161 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 161 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
162 else { 162 else {
163 - Cache::set($cache, $result); 163 + Cache::set($cache, $result);
164 } 164 }
165 } 165 }
166 166
@@ -59,7 +59,7 @@ class SideModel @@ -59,7 +59,7 @@ class SideModel
59 } 59 }
60 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 60 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
61 else { 61 else {
62 - Cache::set(CacheConfig::KEY_COMMON_SIDE_NAV, $result, 3600); // 缓存1小时 62 + Cache::set(CacheConfig::KEY_COMMON_SIDE_NAV, $result);
63 } 63 }
64 } 64 }
65 65
@@ -57,7 +57,7 @@ class ListModel @@ -57,7 +57,7 @@ class ListModel
57 } 57 }
58 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 58 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
59 else { 59 else {
60 - Cache::set($key, $result, 600); // 缓存10分钟 60 + Cache::set($key, $result, 1800); // 缓存30分钟
61 } 61 }
62 } 62 }
63 63
@@ -140,7 +140,7 @@ class ListModel @@ -140,7 +140,7 @@ class ListModel
140 } 140 }
141 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 141 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
142 else { 142 else {
143 - Cache::set($key, $result, 600); // 缓存10分钟 143 + Cache::set($key, $result, 1800); // 缓存30分钟
144 } 144 }
145 } 145 }
146 146
@@ -186,7 +186,7 @@ class ListModel @@ -186,7 +186,7 @@ class ListModel
186 } 186 }
187 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 187 // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
188 else { 188 else {
189 - Cache::set($key, $result, 10800); // 缓存3小时 189 + Cache::set($key, $result); // 缓存1小时
190 } 190 }
191 } 191 }
192 192
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 use LibModels\Wap\Product\BrandData; 4 use LibModels\Wap\Product\BrandData;
  5 +use Plugin\Helpers;
5 6
6 /** 7 /**
7 * 商品操作相关的控制器 8 * 商品操作相关的控制器
@@ -56,6 +57,11 @@ class OptController extends AbstractAction @@ -56,6 +57,11 @@ class OptController extends AbstractAction
56 } 57 }
57 while (false); 58 while (false);
58 59
  60 + if (isset($result['code']) && $result['code'] == 412) {
  61 + $referer = $this->server('HTTP_REFERER', SITE_MAIN);
  62 + $result['data'] = Helpers::url('/signin.html', array('refer' => $referer));
  63 + }
  64 +
59 $this->echoJson($result); 65 $this->echoJson($result);
60 } 66 }
61 67