Authored by Rock Zhang

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

... ... @@ -19,7 +19,7 @@ class GradeData
* @param string $uid 用户id
* @return array 接口返回的会员等级数据
*/
public function getGradeData($gender, $channel, $uid) {
public static function getGradeData($gender, $channel, $uid) {
$urlList = array();
//获取会员等级数据
$param = Yohobuy::param();
... ...
... ... @@ -403,19 +403,19 @@ class HomeController extends AbstractAction
* 意见反馈
*/
public function suggestAction() {
// 设置网站标题
$this->setTitle('意见反馈');
$this->setNavHeader('意见反馈', true, SITE_MAIN);
$udid = $this->getUdid();
$page = $this->get('page', 1);
$limit = $this->get('limit', 30);
$suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);
//print_r($suggest);
print_r($suggest);
$this->_view->display('suggest', array(
'suggestPage' => true, //加载js
'pageHeader' => array(
'navBack' => true,
'navTitle' => '意见反馈'
),
'pageFooter' => true,
'suggest' => true,
'suggestContent' => array(
... ...
... ... @@ -15,7 +15,7 @@ class GradeModel
* 获取个人中心-会员等级数据
*/
public function getGrade($gender, $channel, $uid) {
public static function getGrade($gender, $channel, $uid) {
$result = array();
if (USE_CACHE) {
... ... @@ -27,40 +27,42 @@ class GradeModel
}
//调用接口获取数据
$data = GradeData::getGradeData($gender, $channel, $uid);
switch (intval($data['grade']['current_vip_level'])) {
case 0://普通会员
$result['vipGrade']['vip0'] = true;
break;
case 1://银卡会员
$result['vipGrade']['vip1'] = true;
break;
case 2://金卡会员
$result['vipGrade']['vip2'] = true;
break;
case 3://白金会员
$result['vipGrade']['vip3'] = true;
break;
}
//今年总消费
$result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
//升级下一等级会员的进度;
$result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
//距离升级所需消费金额
if ($data['grade']['current_vip_level'] != 3) {
$result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];
}
//消费总计
$result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];
//username 调用获取用户基本信息数据,获得username;
//$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
$result['vipGrade']['name'] = $data['userProfile']['username'];
//跳转url(会员特权详情)
$result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);
//当前vip等级享受的特权
$result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
if (!empty($data['grade'])) {
switch (intval($data['grade']['current_vip_level'])) {
case 0://普通会员
$result['vipGrade']['vip0'] = true;
break;
case 1://银卡会员
$result['vipGrade']['vip1'] = true;
break;
case 2://金卡会员
$result['vipGrade']['vip2'] = true;
break;
case 3://白金会员
$result['vipGrade']['vip3'] = true;
break;
}
//今年总消费
$result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
//升级下一等级会员的进度;
$result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
//距离升级所需消费金额
if ($data['grade']['current_vip_level'] != 3) {
$result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];
}
//消费总计
$result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];
//username 调用获取用户基本信息数据,获得username;
//$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
$result['vipGrade']['name'] = $data['userProfile']['username'];
//跳转url(会员特权详情)
$result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);
//当前vip等级享受的特权
$result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
... ...
... ... @@ -33,6 +33,7 @@ class UserModel
// 处理个人详情数据
if (isset($userData['data']) && !empty($userData['data'])) {
$result = $userData['data'];
$result['gender'] = $result['gender'] == 1 ? '男' : '女';
$result['head_ico'] = Images::getImageUrl($result['head_ico'], 128, 128);
}
... ... @@ -349,7 +350,20 @@ class UserModel
// 处理意见反馈数据
if (isset($suggest['data']) && !empty($suggest['data'])) {
$result = $suggest['data'];
$one = array();
foreach ($suggest['data']['list'] as $val) {
$one = array();
$one['hasImage'] = $val['has_image'];
$one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240);
$one['title'] = $val['filter_content'];
$one['content'] = $val['reply_content'];
$one['good'] = $val['is_reliable'];
$one['bad'] = !$val['is_reliable'];
$one['goodNum'] = $val['reliable'];
$one['badNum'] = $val['unreliable'];
$result[] = $one;
}
}
return $result;
... ...