Authored by yangyang

修改了GradeData.php:username数据修复;

... ... @@ -45,16 +45,17 @@ class GradeData
}
/**
* 获取用户基本信息数据??获取不到
* 获取用户基本信息数据
*/
// public function getUserProfileData($gender, $uid, $channel) {
// $param = Yohobuy::param();
// $param['gender'] = $gender;
// $param['uid'] = $uid;
// $param['yh_channel'] = $channel;
// $param['method'] = 'app.passport.profile';
// $param['client_secret'] = Sign::getSign($param);
// var_dump(Yohobuy::post(Yohobuy::API_URL,$param));
// }
public function getUserProfileData($gender, $uid, $channel) {
$param = Yohobuy::param();
$param['gender'] = $gender;
$param['uid'] = $uid;
$param['yh_channel'] = $channel;
$param['method'] = 'app.passport.profile';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get("http://api.open.yohobuy.com/",$param);
}
}
... ...
... ... @@ -239,7 +239,7 @@ class HomeController extends AbstractAction
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$uid = $this -> getUid();
$uid = '10267443';//临时测试用
$uid = '7566245';//临时测试用
$data = GradeModel::getGrade($gender,$channel,$uid);
$this -> _view -> display('vip-grade',$data);
}
... ...
... ... @@ -27,6 +27,7 @@ class GradeModel
}
//调用接口获取数据
$data = GradeData::getGradeData($channel, $uid);
if (isset($data['code']) && $data['code'] === 200 && isset($data['data'])) {
switch (intval($data['data']['current_vip_level'])) {
case 0://普通会员
... ... @@ -42,19 +43,25 @@ class GradeModel
$result['vipGrade']['vip3'] = true;
break;
}
//今年总消费
$result['vipGrade']['costOfThisYear'] = $data['data']['current_year_cost'];
//升级下一等级会员的进度;
$result['vipGrade']['percent'] = 100*(round(round($data['data']['current_total_cost'], 2) / round($data['data']['next_need_cost'], 2), 2));
$result['vipGrade']['percent'] = 100*(round($data['data']['current_total_cost'] / $data['data']['next_need_cost'], 2));
//距离升级所需消费金额
if ($data['data']['current_vip_level'] != 3) {
$result['vipGrade']['costGap'] = $data['data']['upgrade_need_cost'];
}
//消费总计
$result['vipGrade']['sumCost'] = $data['data']['current_total_cost'];
//username 接口问题取不到,暂时写uid
$result['vipGrade']['name'] = $uid;
//username 调用获取用户基本信息数据,获得username;
$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
$result['vipGrade']['name'] = $userProfile['data']['username'];
//跳转url(会员特权详情)
$result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential',null);
//当前vip等级享受的特权
$result['vipGrade']['privilege'] = $data['data']['enjoy_preferential'];
}
if (USE_CACHE) {
... ...