Authored by Rock Zhang

添加未登录用户点击咨询赞或者有用时的跳转登陆页数据

@@ -586,9 +586,10 @@ class DetailModel @@ -586,9 +586,10 @@ class DetailModel
586 * 586 *
587 * @param int $uid 用户ID 587 * @param int $uid 用户ID
588 * @param int $id 咨询ID 588 * @param int $id 咨询ID
  589 + * @param int $productId 商品ID
589 * @return array 590 * @return array
590 */ 591 */
591 - public static function upvoteConsult($uid, $id) 592 + public static function upvoteConsult($uid, $id, $productId)
592 { 593 {
593 $result = array('code' => 400, 'message' => '出错啦~'); 594 $result = array('code' => 400, 'message' => '出错啦~');
594 595
@@ -598,6 +599,7 @@ class DetailModel @@ -598,6 +599,7 @@ class DetailModel
598 if (empty($uid)) { 599 if (empty($uid)) {
599 $result['code'] = 401; 600 $result['code'] = 401;
600 $result['message'] = '用户id为空'; 601 $result['message'] = '用户id为空';
  602 + $result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consultform', array('product_id' => $productId))));
601 break; 603 break;
602 } 604 }
603 605
@@ -616,9 +618,10 @@ class DetailModel @@ -616,9 +618,10 @@ class DetailModel
616 * 618 *
617 * @param int $uid 用户ID 619 * @param int $uid 用户ID
618 * @param int $id 咨询ID 620 * @param int $id 咨询ID
  621 + * @param int $productId 商品ID
619 * @return array 622 * @return array
620 */ 623 */
621 - public static function usefulConsult($uid, $id) 624 + public static function usefulConsult($uid, $id, $productId)
622 { 625 {
623 $result = array('code' => 400, 'message' => '出错啦~'); 626 $result = array('code' => 400, 'message' => '出错啦~');
624 627
@@ -628,6 +631,7 @@ class DetailModel @@ -628,6 +631,7 @@ class DetailModel
628 if (empty($uid)) { 631 if (empty($uid)) {
629 $result['code'] = 401; 632 $result['code'] = 401;
630 $result['message'] = '用户id为空'; 633 $result['message'] = '用户id为空';
  634 + $result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consultform', array('product_id' => $productId))));
631 break; 635 break;
632 } 636 }
633 637
@@ -171,9 +171,10 @@ class DetailController extends AbstractAction @@ -171,9 +171,10 @@ class DetailController extends AbstractAction
171 $result = array(); 171 $result = array();
172 172
173 if ($this->isAjax()) { 173 if ($this->isAjax()) {
  174 + $productId = $this->get('product_id', 0);
174 $uid = $this->getUid(); 175 $uid = $this->getUid();
175 - $id = $this->get('id');  
176 - $result = \Product\DetailModel::upvoteConsult($uid, $id); 176 + $id = $this->post('id');
  177 + $result = \Product\DetailModel::upvoteConsult($uid, $id, $productId);
177 } 178 }
178 179
179 $this->echoJson($result); 180 $this->echoJson($result);
@@ -187,9 +188,10 @@ class DetailController extends AbstractAction @@ -187,9 +188,10 @@ class DetailController extends AbstractAction
187 $result = array(); 188 $result = array();
188 189
189 if ($this->isAjax()) { 190 if ($this->isAjax()) {
  191 + $productId = $this->get('product_id', 0);
190 $uid = $this->getUid(); 192 $uid = $this->getUid();
191 - $id = $this->get('id');  
192 - $result = \Product\DetailModel::upvoteConsult($uid, $id); 193 + $id = $this->post('id');
  194 + $result = \Product\DetailModel::upvoteConsult($uid, $id, $productId);
193 } 195 }
194 196
195 $this->echoJson($result); 197 $this->echoJson($result);