Authored by uedxwg

Merge branch 'feature/yoho-coin-new' of http://git.dev.yoho.cn/web/yohobuy into …

…feature/yoho-coin-new
... ... @@ -194,9 +194,10 @@ class UserData
* @param int $uid 用户ID
* @param int $page 第几页,默认1
* @param int $limit 限制读取的数目,默认10
* @param string $type 请求类型 get,post
* @return array YOHO币接口返回的数据
*/
public static function yohoCoinData($uid, $page = 1, $limit = 10)
public static function yohoCoinData($uid, $page = 1, $limit = 10,$type = 'get')
{
$param = Yohobuy::param();
$param['method'] = 'app.yohocoin.lists';
... ... @@ -205,7 +206,7 @@ class UserData
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
return Yohobuy::$type(Yohobuy::API_URL, $param);
}
/**
... ...
... ... @@ -827,73 +827,13 @@ class HomeController extends AbstractAction
{
$this->setTitle('YOHO币');
$this->setNavHeader('YOHO币', true, false);
$uid = $this->getUid();
$currency = array(
array(
'title' => '购买商品 Nike XXXXXX 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike XXXXXX 运动鞋运动鞋运动鞋运动鞋运动鞋运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike XXXXXX 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike XXXXXX 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike XXXXXX 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike XXXXXX 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike XXXXXX 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike XXXXXX 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike XXXXXX 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike XXXXXX 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
),
array(
'title' => '购买商品 Nike XXXXXX 运动鞋',
'time' => '2015.11.23 12:45:33',
'count' => '+943'
)
);
$page = $this->get('page', 1);
$size = $this->get('size', 10);
//$data = UserModel::getYohoCoinLists($this->_uid,$page,$size);
$data = UserModel::getYohoCoinLists(3965746,$page,$size);
$this->_view->display('currency-detail', array(
'currency' => $currency,
'currency' => $data['list'],
'money' => $data['money'],
'pageFooter' => true,
'money' => 100,
'currencyDetailPage' => true
... ...
... ... @@ -354,6 +354,35 @@ class UserModel
}
/**
* 处理YOHO币变化履历数据
*
* @param int $uid 用户ID
* @param int $page 当前页
* @param int $limit 一页记录数
* @return array|mixed 处理之后的YOHO币数据
*/
public static function getYohoCoinLists($uid, $page, $limit)
{
$result = array();
// 调用接口获取YOHO币
$yohoCoin = UserData::yohoCoinData($uid, $page, $limit, 'post');
// 处理YOHO币数据
$coinList = $yohoCoin['data']['coinlist'];
$data['money'] = $yohoCoin['data']['total'];
foreach($coinList as $key => $val){
$result[$key]['title'] = $val['message'];
$result[$key]['time'] = $val['date'];
if($val['num'] > 0){
$val['num'] = '+'.$val['num'];
}
$result[$key]['count'] = $val['num'];
}
$data['list'] = $result;
return $data;
}
/**
* 处理优惠券数据
*
* @param int $uid 用户ID
... ...