code review by fei.hong: do format guang plusstar codes
Showing
1 changed file
with
10 additions
and
13 deletions
@@ -51,26 +51,23 @@ class PlusstarModel | @@ -51,26 +51,23 @@ class PlusstarModel | ||
51 | } | 51 | } |
52 | 52 | ||
53 | $result = array(); | 53 | $result = array(); |
54 | - $brandList = PlusstarData::firstBrandList($gender, $channel); | ||
55 | - if (!empty($brandList['recom']['data']['list'][0]['data'])) { | ||
56 | - $result['ps']['star'] = self::formatData($brandList['recom']['data']['list'][0]['data'], $gender, true); | ||
57 | - //$result['ps']['sName'] = isset($brandList['recom']['data']['brand_type_name']) ? $brandList['recom']['data']['brand_type_name'] : ''; | ||
58 | - } | ||
59 | - if (!empty($brandList['all']['data']['list'][0]['data'])) { | ||
60 | - $result['ps']['plus'] = self::formatData($brandList['all']['data']['list'][0]['data'], $gender, true); | ||
61 | - //$result['ps']['pName'] = isset($brandList['all']['data']['brand_type_name']) ? $brandList['all']['data']['brand_type_name'] : ''; | ||
62 | - } | ||
63 | 54 | ||
64 | - if (USE_CACHE) { | 55 | + $brandList = PlusstarData::firstBrandList($gender, $channel); |
65 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 56 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
66 | - if (empty($result)) { | 57 | + if (empty($brandList['recom']['data']['list'][0]['data']) || empty($brandList['all']['data']['list'][0]['data'])) { |
58 | + if (USE_CACHE) { | ||
67 | $result = Cache::get($key, 'slave'); | 59 | $result = Cache::get($key, 'slave'); |
68 | } | 60 | } |
61 | + return $result; | ||
62 | + } | ||
63 | + | ||
64 | + $result['ps']['star'] = self::formatData($brandList['recom']['data']['list'][0]['data'], $gender, true); | ||
65 | + $result['ps']['plus'] = self::formatData($brandList['all']['data']['list'][0]['data'], $gender, true); | ||
66 | + | ||
69 | // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 | 67 | // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存 |
70 | - else { | 68 | + if (USE_CACHE) { |
71 | Cache::set($key, $result); | 69 | Cache::set($key, $result); |
72 | } | 70 | } |
73 | - } | ||
74 | 71 | ||
75 | return $result; | 72 | return $result; |
76 | } | 73 | } |
-
Please register or login to post a comment