Authored by Rock Zhang

修复收藏的品牌商品default_images未定义报错的bug;修复有货币调用接口错误的bug

... ... @@ -191,7 +191,23 @@ class UserData
}
/**
* YOHO币数据
* YOHO币总数
*
* @param int $uid 用户ID
* @return array YOHO币接口返回的数据
*/
public static function yohoCoinTotal($uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.yohocoin.total';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* YOHO币列表数据
*
* @param int $uid 用户ID
* @param int $page 第几页,默认1
... ...
... ... @@ -22,7 +22,10 @@
<ul class="swiper-wrapper swiper-wrapper-{{id}}">
{{# productList}}
<li class="swiper-slide">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
<a href="{{link}}">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
</a>
<div class="brand-product">
<div class="{{# discount}}price-discount{{/ discount}}">
{{# discount}}<span>{{.}}<span>{{/ discount}}
... ...
... ... @@ -237,6 +237,7 @@ class UserModel
$product = array();
foreach ($val['new_product'] as $one) {
$product = array();
$product['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
$product['imgUrl'] = (isset($one['default_images']) && !empty($one['default_images'])) ? Images::getImageUrl($one['default_images'], 235, 314) : '';
$product['price'] = !empty($one['market_price']) ? '¥' . $one['market_price'] . '.00' : 0;
$product['discount'] = !empty($one['sales_price']) ? '¥' . $one['sales_price'] . '.00' : 0;
... ... @@ -300,7 +301,8 @@ class UserModel
} else {
$data = $records['data']['product_list'];
foreach ($data as &$val) {
$val['image'] = Helpers::getImageUrl($val['image'], 140, 140);
$val['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
$val['image'] = !empty($val['image']) ? Helpers::getImageUrl($val['image'], 140, 140) : '';
$val['sales_price'] = !empty($val['sales_price']) ? $val['sales_price'] . '.00' : 0;
$val['market_price'] = !empty($val['market_price']) ? $val['market_price'] . '.00' : 0;
}
... ... @@ -334,7 +336,7 @@ class UserModel
}
/**
* 处理YOHO币数据
* 处理YOHO币总数数据
*
* @param int $uid 用户ID
* @return array|mixed 处理之后的YOHO币数据
... ... @@ -344,7 +346,7 @@ class UserModel
$result = array();
// 调用接口获取YOHO币
$yohoCoin = UserData::yohoCoinData($uid);
$yohoCoin = UserData::yohoCoinTotal($uid);
// 处理YOHO币数据
if (isset($yohoCoin['data']) && !empty($yohoCoin['data'])) {
... ...