Authored by Rock Zhang

修复保存意见反馈接口的bug

@@ -329,11 +329,12 @@ class UserData @@ -329,11 +329,12 @@ class UserData
329 * @param int $suggest_type 意见类型 329 * @param int $suggest_type 意见类型
330 * @return array 意见反馈接口返回的数据 330 * @return array 意见反馈接口返回的数据
331 */ 331 */
332 - public static function savesuggestData($uid, $content, $suggest_type, $limit = 30) 332 + public static function savesuggestData($uid, $content, $suggest_type)
333 { 333 {
334 $param = Yohobuy::param(); 334 $param = Yohobuy::param();
335 $param['uid'] = $uid; 335 $param['uid'] = $uid;
336 $param['content'] = $content; 336 $param['content'] = $content;
  337 + $param['suggest_type'] = $suggest_type;
337 $param['client_secret'] = Sign::getSign($param); 338 $param['client_secret'] = Sign::getSign($param);
338 339
339 return Yohobuy::get(Yohobuy::SERVICE_URL . 'suggest/api/v1/suggest/saveSuggest', $param); 340 return Yohobuy::get(Yohobuy::SERVICE_URL . 'suggest/api/v1/suggest/saveSuggest', $param);
@@ -416,7 +416,7 @@ class HomeController extends AbstractAction @@ -416,7 +416,7 @@ class HomeController extends AbstractAction
416 { 416 {
417 $uid = $this->getUid(); 417 $uid = $this->getUid();
418 $content = $this->post('content', ''); 418 $content = $this->post('content', '');
419 - $suggest_type = $this->get('suggest_type', 2); 419 + $suggest_type = $this->post('suggest_type', 2);
420 $result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type); 420 $result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type);
421 421
422 $this->echoJson($result); 422 $this->echoJson($result);
@@ -472,8 +472,17 @@ class UserModel @@ -472,8 +472,17 @@ class UserModel
472 */ 472 */
473 public static function saveSuggestData($uid, $content, $suggest_type) 473 public static function saveSuggestData($uid, $content, $suggest_type)
474 { 474 {
  475 + $result = array('code' => 400, 'message' => '保存出错');
  476 +
475 // 调用接口保存意见反馈数据 477 // 调用接口保存意见反馈数据
476 - return UserData::savesuggestData($uid, $content, $suggest_type); 478 + $save = UserData::savesuggestData($uid, $content, $suggest_type);
  479 +
  480 + if (isset($save['code']) && $save['code'] == 200) {
  481 + $result['code'] = 200;
  482 + $result['message'] = '谢谢您的反馈';
  483 + }
  484 +
  485 + return $result;
477 } 486 }
478 487
479 /** 488 /**