GradeData.php 1.63 KB
<?php

namespace LibModels\Wap\Home;

use Api\Yohobuy;
use Api\Sign;

/*
 * 个人中心-会员等级接口操作类
 */

class GradeData
{

	/**
	 * 获取会员等级数据
	 * @param  string  $yh_channel   频道数据,1->男,2->女,3->潮童,4->创意生活,5->其他
	 * @param  string  $uid          用户id
	 * @return array                 接口返回的会员等级数据
	 */
	public static function getGradeData($channel, $uid) {
		$urlList = array();
		//获取会员等级数据
		$param = Yohobuy::param();
		$param['yh_channel'] = $channel;
		$param['uid'] = $uid;
		$param['method'] = 'app.Passport.vip';
		$param['client_secret'] = Sign::getSign($param);
		$urlList['grade'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);

		//获取用户基本信息数据(用来得到username)
		$param = Yohobuy::param();
		$param['uid'] = $uid;
		$param['method'] = 'app.passport.profile';
		$param['client_secret'] = Sign::getSign($param);
		$urlList['userProfile'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);

		return Yohobuy::getMulti($urlList);
	}

	/**
	 * 获取会员特权详情数据
	 * @param  string  $yh_channel   频道数据,1->男,2->女,3->潮童,4->创意生活,5->其他
	 * @param  string  $uid          用户id
	 * @return array                 接口返回的会员特权详情数据
	 */
	public static function getPreferentialData($channel, $uid) {

		$param = Yohobuy::param();
		$param['yh_channel'] = $channel;
		$param['uid'] = $uid;
		$param['method'] = 'app.passport.getPrivilege';
		$param['client_secret'] = Sign::getSign($param);
		return Yohobuy::get(Yohobuy::API_URL, $param);
	}

}