Authored by hf

modify to fixes bugs to plustar

... ... @@ -26,7 +26,11 @@ class OptData
*/
public static function favoriteBrand($uid, $id, $opt = 'ok')
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id));
if ($opt == 'ok') {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id));
} else {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id));
}
}
/**
... ...
... ... @@ -135,8 +135,8 @@ class PlusstarData
// 是否收藏店铺
$isUidOk = $uid && is_numeric($uid);
if ($isUidOk) {
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $id), function($retval) use(&$result) {
$result['getUidBrandFav'] = empty($retval['data']) ? false : $retval['data'];
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $brandInfo['data']['brand_id']), function($retval) use(&$result) {
$result['getUidBrandFav'] = (isset($retval['message']) && $retval['message'] == 'favorite') ? true : false;
});
}
... ...
... ... @@ -2,6 +2,7 @@
use Action\AbstractAction;
use LibModels\Wap\Guang\OptData;
use LibModels\Wap\Product\BrandData;
use Plugin\Helpers;
/**
... ... @@ -120,13 +121,15 @@ class OptController extends AbstractAction
break;
}
/* 执行点赞或取消操作 */
/* 取消收藏 */
$opt = $this->post('opt', 'ok');
$status = OptData::favoriteBrand($uid, $id, $opt);
if (!$status) {
if ($opt !== 'ok') {
$result = BrandData::favoriteCancel($id, $uid);
break;
}
$result = array('code' => 200, 'message' => '收藏成功', 'data' => '');
/* 收藏 */
$result = BrandData::favorite($id, $uid);
} while (false);
... ...