modify to fixes bugs to plustar
Showing
3 changed files
with
13 additions
and
6 deletions
@@ -26,7 +26,11 @@ class OptData | @@ -26,7 +26,11 @@ class OptData | ||
26 | */ | 26 | */ |
27 | public static function favoriteBrand($uid, $id, $opt = 'ok') | 27 | public static function favoriteBrand($uid, $id, $opt = 'ok') |
28 | { | 28 | { |
29 | + if ($opt == 'ok') { | ||
29 | return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id)); | 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 | } | 34 | } |
31 | 35 | ||
32 | /** | 36 | /** |
@@ -135,8 +135,8 @@ class PlusstarData | @@ -135,8 +135,8 @@ class PlusstarData | ||
135 | // 是否收藏店铺 | 135 | // 是否收藏店铺 |
136 | $isUidOk = $uid && is_numeric($uid); | 136 | $isUidOk = $uid && is_numeric($uid); |
137 | if ($isUidOk) { | 137 | if ($isUidOk) { |
138 | - Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $id), function($retval) use(&$result) { | ||
139 | - $result['getUidBrandFav'] = empty($retval['data']) ? false : $retval['data']; | 138 | + Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $brandInfo['data']['brand_id']), function($retval) use(&$result) { |
139 | + $result['getUidBrandFav'] = (isset($retval['message']) && $retval['message'] == 'favorite') ? true : false; | ||
140 | }); | 140 | }); |
141 | } | 141 | } |
142 | 142 |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | use LibModels\Wap\Guang\OptData; | 4 | use LibModels\Wap\Guang\OptData; |
5 | +use LibModels\Wap\Product\BrandData; | ||
5 | use Plugin\Helpers; | 6 | use Plugin\Helpers; |
6 | 7 | ||
7 | /** | 8 | /** |
@@ -120,13 +121,15 @@ class OptController extends AbstractAction | @@ -120,13 +121,15 @@ class OptController extends AbstractAction | ||
120 | break; | 121 | break; |
121 | } | 122 | } |
122 | 123 | ||
123 | - /* 执行点赞或取消操作 */ | 124 | + /* 取消收藏 */ |
124 | $opt = $this->post('opt', 'ok'); | 125 | $opt = $this->post('opt', 'ok'); |
125 | - $status = OptData::favoriteBrand($uid, $id, $opt); | ||
126 | - if (!$status) { | 126 | + if ($opt !== 'ok') { |
127 | + $result = BrandData::favoriteCancel($id, $uid); | ||
127 | break; | 128 | break; |
128 | } | 129 | } |
129 | - $result = array('code' => 200, 'message' => '收藏成功', 'data' => ''); | 130 | + |
131 | + /* 收藏 */ | ||
132 | + $result = BrandData::favorite($id, $uid); | ||
130 | 133 | ||
131 | } while (false); | 134 | } while (false); |
132 | 135 |
-
Please register or login to post a comment