modify guang plusstar add check user is favorite
Showing
1 changed file
with
8 additions
and
1 deletions
@@ -129,12 +129,20 @@ class PlusstarData | @@ -129,12 +129,20 @@ class PlusstarData | ||
129 | 129 | ||
130 | // 客户端类型 | 130 | // 客户端类型 |
131 | $clientType = $isApp ? 'iphone' : 'h5'; | 131 | $clientType = $isApp ? 'iphone' : 'h5'; |
132 | + $isUidOk = $uid && is_numeric($uid); | ||
132 | $key = CacheConfig::KEY_ACTION_GUANG_PLUSTAR_DATA . strval($id) . $clientType; | 133 | $key = CacheConfig::KEY_ACTION_GUANG_PLUSTAR_DATA . strval($id) . $clientType; |
133 | 134 | ||
134 | if (USE_CACHE) { | 135 | if (USE_CACHE) { |
135 | // 先尝试获取二级缓存(slave), 有数据则直接返回. | 136 | // 先尝试获取二级缓存(slave), 有数据则直接返回. |
136 | $cached = Cache::get($key, 'master'); | 137 | $cached = Cache::get($key, 'master'); |
137 | if (!empty($cached)) { | 138 | if (!empty($cached)) { |
139 | + // 判断用户是否已收藏 | ||
140 | + if ($isUidOk) { | ||
141 | + $getUidBrandFav = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $cached['getBrandInfo']['brand_id']), false, 1000); | ||
142 | + if (isset($getUidBrandFav['code']) && $getUidBrandFav['code'] == 200) { | ||
143 | + $cached['getUidBrandFav'] = true; | ||
144 | + } | ||
145 | + } | ||
138 | return $cached; | 146 | return $cached; |
139 | } | 147 | } |
140 | } | 148 | } |
@@ -148,7 +156,6 @@ class PlusstarData | @@ -148,7 +156,6 @@ class PlusstarData | ||
148 | } | 156 | } |
149 | 157 | ||
150 | // // 是否收藏店铺 | 158 | // // 是否收藏店铺 |
151 | -// $isUidOk = $uid && is_numeric($uid); | ||
152 | // if ($isUidOk) { | 159 | // if ($isUidOk) { |
153 | // Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $brandInfo['data']['brand_id']), function($retval) use(&$result) { | 160 | // Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $brandInfo['data']['brand_id']), function($retval) use(&$result) { |
154 | // $result['getUidBrandFav'] = (isset($retval['message']) && $retval['message'] == 'favorite') ? true : false; | 161 | // $result['getUidBrandFav'] = (isset($retval['message']) && $retval['message'] == 'favorite') ? true : false; |
-
Please register or login to post a comment