Showing
5 changed files
with
177 additions
and
27 deletions
@@ -23,11 +23,11 @@ class Yohobuy | @@ -23,11 +23,11 @@ class Yohobuy | ||
23 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 23 | // const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
24 | 24 | ||
25 | //java API | 25 | //java API |
26 | - const API_URL = 'http://apih5.yoho.cn/'; | ||
27 | - const API_URL2 = 'http://apih5.yoho.cn/'; | ||
28 | - const SERVICE_URL = 'http://serviceh5.yoho.cn/'; | ||
29 | - const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
30 | - const API_OLD = 'http://api2.open.yohobuy.com/'; | 26 | +// const API_URL = 'http://apih5.yoho.cn/'; |
27 | +// const API_URL2 = 'http://apih5.yoho.cn/'; | ||
28 | +// const SERVICE_URL = 'http://serviceh5.yoho.cn/'; | ||
29 | +// const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
30 | +// const API_OLD = 'http://api2.open.yohobuy.com/'; | ||
31 | 31 | ||
32 | // const API_URL = 'http://api.yoho.cn/'; | 32 | // const API_URL = 'http://api.yoho.cn/'; |
33 | // const API_URL2 = 'http://api.yoho.cn/'; | 33 | // const API_URL2 = 'http://api.yoho.cn/'; |
@@ -44,10 +44,13 @@ class Yohobuy | @@ -44,10 +44,13 @@ class Yohobuy | ||
44 | 44 | ||
45 | /* 测试环境 java API*/ | 45 | /* 测试环境 java API*/ |
46 | // const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://devapi.yoho.cn:58078/'; | 46 | // const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://devapi.yoho.cn:58078/'; |
47 | -// const DEV_API_URL = 'http://devapi.yoho.cn:58078/'; | ||
48 | -// const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; // 'http://devservice.yoho.cn:58077/'; | ||
49 | -// const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
50 | -// const API_OLD = 'http://test2.open.yohobuy.com/'; | 47 | + const API_URL = 'http://devapi.yoho.cn:58078/'; |
48 | + const DEV_API_URL = 'http://devapi.yoho.cn:58078/'; | ||
49 | + const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; // 'http://devservice.yoho.cn:58077/'; | ||
50 | + const DEV_SERVICE_URL = 'http://devservice.yoho.cn:58077/'; | ||
51 | + const PRD_SERVICE_URL = 'http://serviceh5.yoho.cn/'; | ||
52 | + const YOHOBUY_URL = 'http://www.yohobuy.com/'; | ||
53 | + const API_OLD = 'http://test2.open.yohobuy.com/'; | ||
51 | 54 | ||
52 | /* 测试环境 php API*/ | 55 | /* 测试环境 php API*/ |
53 | // const API_URL = 'http://test2.open.yohobuy.com/'; | 56 | // const API_URL = 'http://test2.open.yohobuy.com/'; |
@@ -71,6 +74,7 @@ class Yohobuy | @@ -71,6 +74,7 @@ class Yohobuy | ||
71 | 'iphone' => 'a85bb0674e08986c6b115d5e3a4884fa', | 74 | 'iphone' => 'a85bb0674e08986c6b115d5e3a4884fa', |
72 | 'ipad' => 'ad9fcda2e679cf9229e37feae2cdcf80', | 75 | 'ipad' => 'ad9fcda2e679cf9229e37feae2cdcf80', |
73 | 'web' => '0ed29744ed318fd28d2c07985d3ba633', | 76 | 'web' => '0ed29744ed318fd28d2c07985d3ba633', |
77 | + 'h5' => 'fd4ad5fcfa0de589ef238c0e7331b585', | ||
74 | ); | 78 | ); |
75 | 79 | ||
76 | /** | 80 | /** |
@@ -5,6 +5,7 @@ namespace LibModels\Wap\Guang; | @@ -5,6 +5,7 @@ namespace LibModels\Wap\Guang; | ||
5 | use Api\Yohobuy; | 5 | use Api\Yohobuy; |
6 | use Configs\CacheConfig; | 6 | use Configs\CacheConfig; |
7 | use Plugin\Cache; | 7 | use Plugin\Cache; |
8 | +use Api\Sign; | ||
8 | 9 | ||
9 | /** | 10 | /** |
10 | * 逛资讯详情相关的数据模型 | 11 | * 逛资讯详情相关的数据模型 |
@@ -45,7 +46,17 @@ class DetailData | @@ -45,7 +46,17 @@ class DetailData | ||
45 | // 先尝试获取一级缓存(master), 有数据则直接返回. | 46 | // 先尝试获取一级缓存(master), 有数据则直接返回. |
46 | $cached = Cache::get($key, 'master'); | 47 | $cached = Cache::get($key, 'master'); |
47 | if (!empty($cached)) { | 48 | if (!empty($cached)) { |
48 | - $article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id, $clientType), false, 1000); | 49 | +// $article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id, $clientType), false, 1000); |
50 | + | ||
51 | + // 获取资讯 | ||
52 | + $param = Yohobuy::param(); | ||
53 | + $param['article_id'] = $id; | ||
54 | + $param['client_type'] = $clientType; | ||
55 | + $param['private_key'] = Yohobuy::$privateKeyList['h5']; | ||
56 | + $param['client_secret'] = Sign::getSign($param); | ||
57 | + $result = Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE . 'getArticle', $param); | ||
58 | + $article = $result['data']; | ||
59 | + | ||
49 | if (isset($article['pageViews'])) { | 60 | if (isset($article['pageViews'])) { |
50 | $cached['getArticle']['pageViews'] = $article['pageViews']; | 61 | $cached['getArticle']['pageViews'] = $article['pageViews']; |
51 | } | 62 | } |
@@ -54,7 +65,20 @@ class DetailData | @@ -54,7 +65,20 @@ class DetailData | ||
54 | } | 65 | } |
55 | 66 | ||
56 | // 获取资讯 | 67 | // 获取资讯 |
57 | - $article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id, $clientType), false, 1500); | 68 | +// $article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id, $clientType), false, 1500); |
69 | +// ksort($article); | ||
70 | +// file_put_contents('../../../../../../Desktop/app/o/getArticle.txt', var_export($article, true)); | ||
71 | + | ||
72 | + // 获取资讯 | ||
73 | + $param = Yohobuy::param(); | ||
74 | + $param['article_id'] = $id; | ||
75 | + $param['client_type'] = $clientType; | ||
76 | + $param['private_key'] = Yohobuy::$privateKeyList['h5']; | ||
77 | + $param['client_secret'] = Sign::getSign($param); | ||
78 | + $result = Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE . 'getArticle', $param); | ||
79 | + $article = $result['data']; | ||
80 | +// file_put_contents('../../../../../../Desktop/app/n/getArticle3.txt', var_export($article, true)); | ||
81 | + | ||
58 | if (!isset($article['author_id'])) { | 82 | if (!isset($article['author_id'])) { |
59 | // 再尝试获取二级缓存(slave), 有数据则直接返回. | 83 | // 再尝试获取二级缓存(slave), 有数据则直接返回. |
60 | $cached = Cache::get($key, 'slave'); | 84 | $cached = Cache::get($key, 'slave'); |
@@ -65,31 +89,89 @@ class DetailData | @@ -65,31 +89,89 @@ class DetailData | ||
65 | } | 89 | } |
66 | $result['getArticle'] = $article; | 90 | $result['getArticle'] = $article; |
67 | 91 | ||
92 | + | ||
93 | + // 获取作者信息 | ||
94 | + $param = Yohobuy::param(); | ||
95 | + $param['author_id'] = $article['author_id']; | ||
96 | + $param['client_secret'] = Sign::getSign($param); | ||
97 | + $urlList['getAuthor'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_PACKAGE_AUTHOR . 'getAuthor', $param); | ||
98 | + | ||
99 | + // 获取资讯内容 | ||
100 | + $param = Yohobuy::param(); | ||
101 | + $param['article_id'] = $id; | ||
102 | + $param['client_type'] = $clientType; | ||
103 | + $param['private_key'] = Yohobuy::$privateKeyList['h5']; | ||
104 | + $param['client_secret'] = Sign::getSign($param); | ||
105 | + $urlList['getArticleContent'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE . 'getArticleContent', $param); | ||
106 | + | ||
107 | + // 获取资讯相关的品牌 | ||
108 | + $param = Yohobuy::param(); | ||
109 | + $param['article_id'] = $id; | ||
110 | + $param['client_type'] = $clientType; | ||
111 | + $param['private_key'] = Yohobuy::$privateKeyList['h5']; | ||
112 | + $param['client_secret'] = Sign::getSign($param); | ||
113 | + $urlList['getBrand'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE . 'getBrand', $param); | ||
114 | + | ||
115 | + // 获取资讯相关的其它资讯 | ||
116 | + if (isset($article['tag'])) { | ||
117 | + $param = Yohobuy::param(); | ||
118 | + $param['article_id'] = $id; | ||
119 | + $param['client_type'] = $clientType; | ||
120 | + $param['tags'] = $article['tag']; | ||
121 | + $param['offset'] = 0; | ||
122 | + $param['limit'] = 3; | ||
123 | + $param['private_key'] = Yohobuy::$privateKeyList['h5']; | ||
124 | + $param['client_secret'] = Sign::getSign($param); | ||
125 | + $urlList['getOtherArticle'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE . 'getOtherArticle', $param); | ||
126 | + } | ||
127 | + | ||
128 | + $multiResult = Yohobuy::getMulti($urlList, array()); | ||
129 | + $result['getAuthor'] = $multiResult['getAuthor']; | ||
130 | + $result['getArticleContent'] = $multiResult['getArticleContent']; | ||
131 | + $result['getBrand'] = $multiResult['getBrand']; | ||
132 | + $result['getOtherArticle'] = $multiResult['getOtherArticle']; | ||
133 | +// var_dump($urlList); | ||
134 | +// file_put_contents('../../../../../../Desktop/app/n/getAuthor.txt', var_export($result['getAuthor'], true)); | ||
135 | +// file_put_contents('../../../../../../Desktop/app/n/getArticleContent.txt', var_export($result['getArticleContent'], true)); | ||
136 | +// file_put_contents('../../../../../../Desktop/app/n/getBrand.txt', var_export($result['getBrand'], true)); | ||
137 | +// file_put_contents('../../../../../../Desktop/app/n/getOtherArticle.txt', var_export($result['getOtherArticle'], true)); | ||
138 | + | ||
139 | + /* | ||
68 | // 获取作者信息 | 140 | // 获取作者信息 |
69 | Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_AUTHOR, 'getAuthor', array($article['author_id'], $clientType), function ($retval) use (&$result) { | 141 | Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_AUTHOR, 'getAuthor', array($article['author_id'], $clientType), function ($retval) use (&$result) { |
70 | $result['getAuthor'] = empty($retval) ? array() : $retval; | 142 | $result['getAuthor'] = empty($retval) ? array() : $retval; |
143 | + ksort($retval); | ||
144 | + file_put_contents('../../../../../../Desktop/app/o/getAuthor.txt', var_export($retval, true)); | ||
71 | }); | 145 | }); |
72 | 146 | ||
73 | // 获取资讯内容 | 147 | // 获取资讯内容 |
74 | Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticleContent', array($id, $clientType), function ($retval) use (&$result) { | 148 | Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticleContent', array($id, $clientType), function ($retval) use (&$result) { |
75 | $result['getArticleContent'] = empty($retval) ? array() : $retval; | 149 | $result['getArticleContent'] = empty($retval) ? array() : $retval; |
150 | + ksort($retval); | ||
151 | + file_put_contents('../../../../../../Desktop/app/o/getArticleContent.txt', var_export($retval, true)); | ||
76 | }); | 152 | }); |
77 | 153 | ||
78 | // 获取资讯相关的品牌 | 154 | // 获取资讯相关的品牌 |
79 | Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getBrand', array($id, $clientType), function ($retval) use (&$result) { | 155 | Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getBrand', array($id, $clientType), function ($retval) use (&$result) { |
80 | $result['getBrand'] = empty($retval) ? array() : $retval; | 156 | $result['getBrand'] = empty($retval) ? array() : $retval; |
157 | + ksort($retval); | ||
158 | + file_put_contents('../../../../../../Desktop/app/o/getBrand.txt', var_export($retval, true)); | ||
81 | }); | 159 | }); |
82 | 160 | ||
83 | // 获取资讯相关的其它资讯 | 161 | // 获取资讯相关的其它资讯 |
84 | if (isset($article['tag'])) { | 162 | if (isset($article['tag'])) { |
85 | Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getOtherArticle', array($article['tag'], $id, 0, 3, $clientType), function ($retval) use (&$result) { | 163 | Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getOtherArticle', array($article['tag'], $id, 0, 3, $clientType), function ($retval) use (&$result) { |
86 | $result['getOtherArticle'] = empty($retval) ? array() : $retval; | 164 | $result['getOtherArticle'] = empty($retval) ? array() : $retval; |
165 | + ksort($retval); | ||
166 | + file_put_contents('../../../../../../Desktop/app/o/getOtherArticle.txt', var_export($retval, true)); | ||
87 | }); | 167 | }); |
88 | } | 168 | } |
89 | 169 | ||
90 | // 调用发起请求 | 170 | // 调用发起请求 |
91 | Yohobuy::yarConcurrentLoop(); | 171 | Yohobuy::yarConcurrentLoop(); |
92 | 172 | ||
173 | + */ | ||
174 | + | ||
93 | if (USE_CACHE) { | 175 | if (USE_CACHE) { |
94 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 176 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
95 | if (empty($result)) { | 177 | if (empty($result)) { |
@@ -181,7 +263,15 @@ class DetailData | @@ -181,7 +263,15 @@ class DetailData | ||
181 | */ | 263 | */ |
182 | public static function intro($id) | 264 | public static function intro($id) |
183 | { | 265 | { |
184 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticleContent', array($id, 'h5')); | 266 | + $param = Yohobuy::param(); |
267 | + $param['article_id'] = $id; | ||
268 | + $param['client_type'] = 'h5'; | ||
269 | + $param['private_key'] = Yohobuy::$privateKeyList['h5']; | ||
270 | + $param['client_secret'] = Sign::getSign($param); | ||
271 | + $result = Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE . 'getArticleContent', $param); | ||
272 | + return $result['data']; | ||
273 | + | ||
274 | +// return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticleContent', array($id, 'h5')); | ||
185 | } | 275 | } |
186 | 276 | ||
187 | } | 277 | } |
@@ -118,7 +118,13 @@ class ListData | @@ -118,7 +118,13 @@ class ListData | ||
118 | $result = array(); | 118 | $result = array(); |
119 | 119 | ||
120 | if (is_numeric($id)) { | 120 | if (is_numeric($id)) { |
121 | - $result = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_AUTHOR, 'getAuthor', array($id), 3600); // 缓存1小时 | 121 | +// $result = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_AUTHOR, 'getAuthor', array($id), 3600); // 缓存1小时 |
122 | + | ||
123 | + $param = Yohobuy::param(); | ||
124 | + $param['author_id'] = $id; | ||
125 | + $param['client_secret'] = Sign::getSign($param); | ||
126 | + $article = Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_AUTHOR . 'getAuthor', $param, 3600); | ||
127 | + $result = $article['data']; | ||
122 | } | 128 | } |
123 | 129 | ||
124 | return $result; | 130 | return $result; |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | namespace LibModels\Wap\Guang; | 3 | namespace LibModels\Wap\Guang; |
4 | 4 | ||
5 | use Api\Yohobuy; | 5 | use Api\Yohobuy; |
6 | +use Api\Sign; | ||
6 | 7 | ||
7 | /** | 8 | /** |
8 | * 逛操作相关的数据模型 | 9 | * 逛操作相关的数据模型 |
@@ -26,11 +27,17 @@ class OptData | @@ -26,11 +27,17 @@ class OptData | ||
26 | */ | 27 | */ |
27 | public static function favoriteBrand($uid, $id, $opt = 'ok') | 28 | public static function favoriteBrand($uid, $id, $opt = 'ok') |
28 | { | 29 | { |
29 | - if ($opt == 'ok') { | ||
30 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id)); | ||
31 | - } else { | ||
32 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id)); | ||
33 | - } | 30 | + $param = Yohobuy::param(); |
31 | + $param['uid'] = $uid; | ||
32 | + $param['id'] = $id; | ||
33 | + $param['client_secret'] = Sign::getSign($param); | ||
34 | + return Yohobuy::get(Yohobuy::SERVICE_URL.'guang/service/v2/favorite/toggleBrand', $param); | ||
35 | + | ||
36 | +// if ($opt == 'ok') { | ||
37 | +// return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id)); | ||
38 | +// } else { | ||
39 | +// return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id)); | ||
40 | +// } | ||
34 | } | 41 | } |
35 | 42 | ||
36 | /** | 43 | /** |
@@ -43,10 +50,19 @@ class OptData | @@ -43,10 +50,19 @@ class OptData | ||
43 | */ | 50 | */ |
44 | public static function favoriteProduct($uid, $skn, $opt = 'ok') | 51 | public static function favoriteProduct($uid, $skn, $opt = 'ok') |
45 | { | 52 | { |
53 | + $param = Yohobuy::param(); | ||
54 | + $param['uid'] = $uid; | ||
55 | + $param['productSkn'] = $skn; | ||
56 | + $param['client_secret'] = Sign::getSign($param); | ||
57 | + | ||
46 | if ($opt === 'cancel') { | 58 | if ($opt === 'cancel') { |
47 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'addUidProductFav', array($uid, $skn)); | 59 | +// return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'addUidProductFav', array($uid, $skn)); |
60 | + | ||
61 | + return Yohobuy::get(Yohobuy::SERVICE_URL.'shops/service/v1/favorite/addUidProductFav', $param); | ||
48 | } else { | 62 | } else { |
49 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'delUidProductFav', array($uid, $skn)); | 63 | +// return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'delUidProductFav', array($uid, $skn)); |
64 | + | ||
65 | + return Yohobuy::get(Yohobuy::SERVICE_URL.'shops/service/v1/favorite/delUidProductFav', $param); | ||
50 | } | 66 | } |
51 | } | 67 | } |
52 | 68 |
@@ -23,6 +23,7 @@ class PlusstarData | @@ -23,6 +23,7 @@ class PlusstarData | ||
23 | 23 | ||
24 | const URI_BRANDLIST = 'guang/api/v3/plustar/getlist'; | 24 | const URI_BRANDLIST = 'guang/api/v3/plustar/getlist'; |
25 | const URI_BRANDINFO_PLUSSTAR = 'guang/service/v3/plustar/'; // 'guang/service/v3/plustar/' | 25 | const URI_BRANDINFO_PLUSSTAR = 'guang/service/v3/plustar/'; // 'guang/service/v3/plustar/' |
26 | + const URI_BRANDINFO_PLUSSTAR_NEW = 'guang/api/v1/plustar/'; | ||
26 | const URI_BRANDINFO_FAVORITE = 'shops/service/v1/favorite/'; | 27 | const URI_BRANDINFO_FAVORITE = 'shops/service/v1/favorite/'; |
27 | const URI_BRANDINFO_ARTICLE = 'guang/service/v1/article/'; | 28 | const URI_BRANDINFO_ARTICLE = 'guang/service/v1/article/'; |
28 | 29 | ||
@@ -139,17 +140,35 @@ class PlusstarData | @@ -139,17 +140,35 @@ class PlusstarData | ||
139 | if (!empty($cached)) { | 140 | if (!empty($cached)) { |
140 | // 判断用户是否已收藏 | 141 | // 判断用户是否已收藏 |
141 | if ($isUidOk) { | 142 | if ($isUidOk) { |
142 | - $getUidBrandFav = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $cached['getBrandInfo']['data']['brand_id']), false, 1000); | 143 | +// $getUidBrandFav = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $cached['getBrandInfo']['data']['brand_id']), false, 1000); |
144 | + | ||
145 | + $param = Yohobuy::param(); | ||
146 | + $param['uid'] = $uid; | ||
147 | + $param['brandId'] = $cached['getBrandInfo']['data']['brand_id']; | ||
148 | + $param['client_secret'] = Sign::getSign($param); | ||
149 | + $getUidBrandFav = Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE . 'getUidBrandFav', $param); | ||
150 | +// file_put_contents('../../../../../../Desktop/app/n/getUidBrandFav.txt', var_export($getUidBrandFav, true)); | ||
151 | + | ||
143 | if (isset($getUidBrandFav['code']) && $getUidBrandFav['code'] == 200) { | 152 | if (isset($getUidBrandFav['code']) && $getUidBrandFav['code'] == 200) { |
144 | $cached['getUidBrandFav'] = true; | 153 | $cached['getUidBrandFav'] = true; |
145 | } | 154 | } |
155 | + | ||
146 | } | 156 | } |
147 | return $cached; | 157 | return $cached; |
148 | } | 158 | } |
149 | } | 159 | } |
150 | 160 | ||
151 | // 品牌详情信息 | 161 | // 品牌详情信息 |
152 | - $brandInfo = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR, 'getBrandInfo', array(array('id' => $id)), 3600); // 缓存1小时 | 162 | +// $brandInfo = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR, 'getBrandInfo', array(array('id' => $id)), 3600); // 缓存1小时 |
163 | +// file_put_contents('../../../../../../Desktop/app/o/getbrandinfo.txt', var_export($brandInfo, true)); | ||
164 | + | ||
165 | + // 品牌详情信息 | ||
166 | + $param = Yohobuy::param(); | ||
167 | + $param['id'] = $id; | ||
168 | + $param['client_secret'] = Sign::getSign($param); | ||
169 | + $brandInfo = Yohobuy::get(Yohobuy::DEV_SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR_NEW . 'getbrandinfo', $param, 3600); | ||
170 | +// file_put_contents('../../../../../../Desktop/app/n/getbrandinfo.txt', var_export($brandInfo, true)); | ||
171 | + | ||
153 | if (!isset($brandInfo['data']['brand_id'])) { | 172 | if (!isset($brandInfo['data']['brand_id'])) { |
154 | // 再尝试获取二级缓存(master), 有数据则直接返回. | 173 | // 再尝试获取二级缓存(master), 有数据则直接返回. |
155 | $cached = Cache::get($key, 'slave'); | 174 | $cached = Cache::get($key, 'slave'); |
@@ -161,6 +180,20 @@ class PlusstarData | @@ -161,6 +180,20 @@ class PlusstarData | ||
161 | $result['getBrandInfo'] = $brandInfo; | 180 | $result['getBrandInfo'] = $brandInfo; |
162 | } | 181 | } |
163 | 182 | ||
183 | + // 相关资讯列表 (3篇) | ||
184 | + $result['getArticleByBrand'] = array(); | ||
185 | + $param = Yohobuy::param(); | ||
186 | + $param['brand_id'] = $brandInfo['data']['brand_id']; | ||
187 | + $param['udid'] = $udid; | ||
188 | + $param['limit'] = 3; | ||
189 | + $param['client_type'] = $clientType; | ||
190 | + $param['private_key'] = Yohobuy::$privateKeyList['h5']; | ||
191 | + $param['client_secret'] = Sign::getSign($param); | ||
192 | + | ||
193 | + $article = Yohobuy::get(Yohobuy::SERVICE_URL.self::URI_BRANDINFO_ARTICLE.'getArticleByBrand', $param); | ||
194 | + $result['getArticleByBrand'] = empty($article['data']) ? array() : $article['data']; | ||
195 | +// file_put_contents('../../../../../../Desktop/app/n/getArticleByBrand.txt', var_export($result['getArticleByBrand'], true)); | ||
196 | + | ||
164 | // // 是否收藏店铺 | 197 | // // 是否收藏店铺 |
165 | // if ($isUidOk) { | 198 | // if ($isUidOk) { |
166 | // Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $brandInfo['data']['brand_id']), function($retval) use(&$result) { | 199 | // Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $brandInfo['data']['brand_id']), function($retval) use(&$result) { |
@@ -168,10 +201,11 @@ class PlusstarData | @@ -168,10 +201,11 @@ class PlusstarData | ||
168 | // }); | 201 | // }); |
169 | // } | 202 | // } |
170 | // 相关资讯列表 (3篇) | 203 | // 相关资讯列表 (3篇) |
171 | - $result['getArticleByBrand'] = array(); | ||
172 | - Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_ARTICLE, 'getArticleByBrand', array($brandInfo['data']['brand_id'], 3, $udid), function($retval) use(&$result) { | ||
173 | - $result['getArticleByBrand'] = empty($retval) ? array() : $retval; | ||
174 | - }); | 204 | +// $result['getArticleByBrand'] = array(); |
205 | +// Yohobuy::yarConcurrentCall(Yohobuy::PRD_SERVICE_URL . self::URI_BRANDINFO_ARTICLE, 'getArticleByBrand', array($brandInfo['data']['brand_id'], 3, $udid), function($retval) use(&$result) { | ||
206 | +// $result['getArticleByBrand'] = empty($retval) ? array() : $retval; | ||
207 | +// file_put_contents('../../../../../../Desktop/app/o/getArticleByBrand.txt', var_export($retval, true)); | ||
208 | +// }); | ||
175 | 209 | ||
176 | // 新品到着列表 (6篇) | 210 | // 新品到着列表 (6篇) |
177 | $result['getNewProduct'] = array(); | 211 | $result['getNewProduct'] = array(); |
@@ -229,7 +263,7 @@ class PlusstarData | @@ -229,7 +263,7 @@ class PlusstarData | ||
229 | } while (false); | 263 | } while (false); |
230 | 264 | ||
231 | // 调用发起请求 | 265 | // 调用发起请求 |
232 | - Yohobuy::yarConcurrentLoop(); | 266 | +// Yohobuy::yarConcurrentLoop(); |
233 | 267 | ||
234 | if (USE_CACHE) { | 268 | if (USE_CACHE) { |
235 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 269 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
-
Please register or login to post a comment