Authored by Rock Zhang

修复用户等级,用户个人信息接口处理的问题

@@ -19,7 +19,7 @@ class GradeData @@ -19,7 +19,7 @@ class GradeData
19 * @param string $uid 用户id 19 * @param string $uid 用户id
20 * @return array 接口返回的会员等级数据 20 * @return array 接口返回的会员等级数据
21 */ 21 */
22 - public function getGradeData($gender, $channel, $uid) { 22 + public static function getGradeData($gender, $channel, $uid) {
23 $urlList = array(); 23 $urlList = array();
24 //获取会员等级数据 24 //获取会员等级数据
25 $param = Yohobuy::param(); 25 $param = Yohobuy::param();
@@ -403,19 +403,19 @@ class HomeController extends AbstractAction @@ -403,19 +403,19 @@ class HomeController extends AbstractAction
403 * 意见反馈 403 * 意见反馈
404 */ 404 */
405 public function suggestAction() { 405 public function suggestAction() {
  406 + // 设置网站标题
  407 + $this->setTitle('意见反馈');
  408 + $this->setNavHeader('意见反馈', true, SITE_MAIN);
  409 +
406 $udid = $this->getUdid(); 410 $udid = $this->getUdid();
407 $page = $this->get('page', 1); 411 $page = $this->get('page', 1);
408 $limit = $this->get('limit', 30); 412 $limit = $this->get('limit', 30);
409 413
410 $suggest = \Index\UserModel::getSuggestData($udid, $page, $limit); 414 $suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);
411 415
412 - //print_r($suggest); 416 + print_r($suggest);
413 $this->_view->display('suggest', array( 417 $this->_view->display('suggest', array(
414 'suggestPage' => true, //加载js 418 'suggestPage' => true, //加载js
415 - 'pageHeader' => array(  
416 - 'navBack' => true,  
417 - 'navTitle' => '意见反馈'  
418 - ),  
419 'pageFooter' => true, 419 'pageFooter' => true,
420 'suggest' => true, 420 'suggest' => true,
421 'suggestContent' => array( 421 'suggestContent' => array(
@@ -15,7 +15,7 @@ class GradeModel @@ -15,7 +15,7 @@ class GradeModel
15 * 获取个人中心-会员等级数据 15 * 获取个人中心-会员等级数据
16 */ 16 */
17 17
18 - public function getGrade($gender, $channel, $uid) { 18 + public static function getGrade($gender, $channel, $uid) {
19 $result = array(); 19 $result = array();
20 20
21 if (USE_CACHE) { 21 if (USE_CACHE) {
@@ -27,40 +27,42 @@ class GradeModel @@ -27,40 +27,42 @@ class GradeModel
27 } 27 }
28 //调用接口获取数据 28 //调用接口获取数据
29 $data = GradeData::getGradeData($gender, $channel, $uid); 29 $data = GradeData::getGradeData($gender, $channel, $uid);
30 - switch (intval($data['grade']['current_vip_level'])) {  
31 - case 0://普通会员  
32 - $result['vipGrade']['vip0'] = true;  
33 - break;  
34 - case 1://银卡会员  
35 - $result['vipGrade']['vip1'] = true;  
36 - break;  
37 - case 2://金卡会员  
38 - $result['vipGrade']['vip2'] = true;  
39 - break;  
40 - case 3://白金会员  
41 - $result['vipGrade']['vip3'] = true;  
42 - break;  
43 - }  
44 -  
45 - //今年总消费  
46 - $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];  
47 - //升级下一等级会员的进度;  
48 - $result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));  
49 - //距离升级所需消费金额  
50 -  
51 - if ($data['grade']['current_vip_level'] != 3) {  
52 - $result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];  
53 - }  
54 - //消费总计  
55 - $result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];  
56 - //username 调用获取用户基本信息数据,获得username;  
57 - //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);  
58 - $result['vipGrade']['name'] = $data['userProfile']['username'];  
59 - //跳转url(会员特权详情)  
60 - $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);  
61 - //当前vip等级享受的特权  
62 - $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];  
63 30
  31 + if (!empty($data['grade'])) {
  32 + switch (intval($data['grade']['current_vip_level'])) {
  33 + case 0://普通会员
  34 + $result['vipGrade']['vip0'] = true;
  35 + break;
  36 + case 1://银卡会员
  37 + $result['vipGrade']['vip1'] = true;
  38 + break;
  39 + case 2://金卡会员
  40 + $result['vipGrade']['vip2'] = true;
  41 + break;
  42 + case 3://白金会员
  43 + $result['vipGrade']['vip3'] = true;
  44 + break;
  45 + }
  46 +
  47 + //今年总消费
  48 + $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
  49 + //升级下一等级会员的进度;
  50 + $result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
  51 + //距离升级所需消费金额
  52 +
  53 + if ($data['grade']['current_vip_level'] != 3) {
  54 + $result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];
  55 + }
  56 + //消费总计
  57 + $result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];
  58 + //username 调用获取用户基本信息数据,获得username;
  59 + //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
  60 + $result['vipGrade']['name'] = $data['userProfile']['username'];
  61 + //跳转url(会员特权详情)
  62 + $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);
  63 + //当前vip等级享受的特权
  64 + $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
  65 + }
64 66
65 if (USE_CACHE) { 67 if (USE_CACHE) {
66 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. 68 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
@@ -33,6 +33,7 @@ class UserModel @@ -33,6 +33,7 @@ class UserModel
33 // 处理个人详情数据 33 // 处理个人详情数据
34 if (isset($userData['data']) && !empty($userData['data'])) { 34 if (isset($userData['data']) && !empty($userData['data'])) {
35 $result = $userData['data']; 35 $result = $userData['data'];
  36 + $result['gender'] = $result['gender'] == 1 ? '男' : '女';
36 $result['head_ico'] = Images::getImageUrl($result['head_ico'], 128, 128); 37 $result['head_ico'] = Images::getImageUrl($result['head_ico'], 128, 128);
37 } 38 }
38 39
@@ -349,7 +350,20 @@ class UserModel @@ -349,7 +350,20 @@ class UserModel
349 350
350 // 处理意见反馈数据 351 // 处理意见反馈数据
351 if (isset($suggest['data']) && !empty($suggest['data'])) { 352 if (isset($suggest['data']) && !empty($suggest['data'])) {
352 - $result = $suggest['data']; 353 + $one = array();
  354 + foreach ($suggest['data']['list'] as $val) {
  355 + $one = array();
  356 + $one['hasImage'] = $val['has_image'];
  357 + $one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240);
  358 + $one['title'] = $val['filter_content'];
  359 + $one['content'] = $val['reply_content'];
  360 + $one['good'] = $val['is_reliable'];
  361 + $one['bad'] = !$val['is_reliable'];
  362 + $one['goodNum'] = $val['reliable'];
  363 + $one['badNum'] = $val['unreliable'];
  364 +
  365 + $result[] = $one;
  366 + }
353 } 367 }
354 368
355 return $result; 369 return $result;