Authored by Rock Zhang

修复未登录状态点赞或者点击有用,跳转登录之后的回调地址

Code Review By Rock Zhang
... ... @@ -607,9 +607,10 @@ class DetailModel
* @param int $uid 用户ID
* @param int $id 咨询ID
* @param int $productId 商品ID
* @param int $total 购买咨询总数
* @return array
*/
public static function upvoteConsult($uid, $id, $productId)
public static function upvoteConsult($uid, $id, $productId, $total)
{
$result = array('code' => 400, 'message' => '出错啦~');
... ... @@ -619,7 +620,7 @@ class DetailModel
if (empty($uid)) {
$result['code'] = 401;
$result['message'] = '用户id为空';
$result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consultform', array('product_id' => $productId))));
$result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total))));
break;
}
... ... @@ -639,9 +640,10 @@ class DetailModel
* @param int $uid 用户ID
* @param int $id 咨询ID
* @param int $productId 商品ID
* @param int $total 购买咨询总数
* @return array
*/
public static function usefulConsult($uid, $id, $productId)
public static function usefulConsult($uid, $id, $productId, $total)
{
$result = array('code' => 400, 'message' => '出错啦~');
... ... @@ -651,7 +653,7 @@ class DetailModel
if (empty($uid)) {
$result['code'] = 401;
$result['message'] = '用户id为空';
$result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consultform', array('product_id' => $productId))));
$result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total))));
break;
}
... ...
... ... @@ -176,10 +176,11 @@ class DetailController extends AbstractAction
$result = array();
if ($this->isAjax()) {
$productId = $this->get('product_id', 0);
$productId = $this->get('productId', 0);
$total = $this->get('total', 0);
$uid = $this->getUid();
$id = $this->post('id');
$result = \Product\DetailModel::upvoteConsult($uid, $id, $productId);
$result = \Product\DetailModel::upvoteConsult($uid, $id, $productId, $total);
}
$this->echoJson($result);
... ... @@ -193,10 +194,11 @@ class DetailController extends AbstractAction
$result = array();
if ($this->isAjax()) {
$productId = $this->get('product_id', 0);
$productId = $this->get('productId', 0);
$total = $this->get('total', 0);
$uid = $this->getUid();
$id = $this->post('id');
$result = \Product\DetailModel::usefulConsult($uid, $id, $productId);
$result = \Product\DetailModel::usefulConsult($uid, $id, $productId, $total);
}
$this->echoJson($result);
... ...