Authored by Rock Zhang

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

@@ -191,7 +191,23 @@ class UserData @@ -191,7 +191,23 @@ class UserData
191 } 191 }
192 192
193 /** 193 /**
194 - * YOHO币数据 194 + * YOHO币总数
  195 + *
  196 + * @param int $uid 用户ID
  197 + * @return array YOHO币接口返回的数据
  198 + */
  199 + public static function yohoCoinTotal($uid)
  200 + {
  201 + $param = Yohobuy::param();
  202 + $param['method'] = 'app.yohocoin.total';
  203 + $param['uid'] = $uid;
  204 + $param['client_secret'] = Sign::getSign($param);
  205 +
  206 + return Yohobuy::get(Yohobuy::API_URL, $param);
  207 + }
  208 +
  209 + /**
  210 + * YOHO币列表数据
195 * 211 *
196 * @param int $uid 用户ID 212 * @param int $uid 用户ID
197 * @param int $page 第几页,默认1 213 * @param int $page 第几页,默认1
@@ -22,7 +22,10 @@ @@ -22,7 +22,10 @@
22 <ul class="swiper-wrapper swiper-wrapper-{{id}}"> 22 <ul class="swiper-wrapper swiper-wrapper-{{id}}">
23 {{# productList}} 23 {{# productList}}
24 <li class="swiper-slide"> 24 <li class="swiper-slide">
25 - <img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/> 25 + <a href="{{link}}">
  26 + <img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
  27 + </a>
  28 +
26 <div class="brand-product"> 29 <div class="brand-product">
27 <div class="{{# discount}}price-discount{{/ discount}}"> 30 <div class="{{# discount}}price-discount{{/ discount}}">
28 {{# discount}}<span>{{.}}<span>{{/ discount}} 31 {{# discount}}<span>{{.}}<span>{{/ discount}}
@@ -237,6 +237,7 @@ class UserModel @@ -237,6 +237,7 @@ class UserModel
237 $product = array(); 237 $product = array();
238 foreach ($val['new_product'] as $one) { 238 foreach ($val['new_product'] as $one) {
239 $product = array(); 239 $product = array();
  240 + $product['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
240 $product['imgUrl'] = (isset($one['default_images']) && !empty($one['default_images'])) ? Images::getImageUrl($one['default_images'], 235, 314) : ''; 241 $product['imgUrl'] = (isset($one['default_images']) && !empty($one['default_images'])) ? Images::getImageUrl($one['default_images'], 235, 314) : '';
241 $product['price'] = !empty($one['market_price']) ? '¥' . $one['market_price'] . '.00' : 0; 242 $product['price'] = !empty($one['market_price']) ? '¥' . $one['market_price'] . '.00' : 0;
242 $product['discount'] = !empty($one['sales_price']) ? '¥' . $one['sales_price'] . '.00' : 0; 243 $product['discount'] = !empty($one['sales_price']) ? '¥' . $one['sales_price'] . '.00' : 0;
@@ -300,7 +301,8 @@ class UserModel @@ -300,7 +301,8 @@ class UserModel
300 } else { 301 } else {
301 $data = $records['data']['product_list']; 302 $data = $records['data']['product_list'];
302 foreach ($data as &$val) { 303 foreach ($data as &$val) {
303 - $val['image'] = Helpers::getImageUrl($val['image'], 140, 140); 304 + $val['link'] = isset($val['goodsId']) ? Helpers::url('/product/pro_' . $val['product_skn'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
  305 + $val['image'] = !empty($val['image']) ? Helpers::getImageUrl($val['image'], 140, 140) : '';
304 $val['sales_price'] = !empty($val['sales_price']) ? $val['sales_price'] . '.00' : 0; 306 $val['sales_price'] = !empty($val['sales_price']) ? $val['sales_price'] . '.00' : 0;
305 $val['market_price'] = !empty($val['market_price']) ? $val['market_price'] . '.00' : 0; 307 $val['market_price'] = !empty($val['market_price']) ? $val['market_price'] . '.00' : 0;
306 } 308 }
@@ -334,7 +336,7 @@ class UserModel @@ -334,7 +336,7 @@ class UserModel
334 } 336 }
335 337
336 /** 338 /**
337 - * 处理YOHO币数据 339 + * 处理YOHO币总数数据
338 * 340 *
339 * @param int $uid 用户ID 341 * @param int $uid 用户ID
340 * @return array|mixed 处理之后的YOHO币数据 342 * @return array|mixed 处理之后的YOHO币数据
@@ -344,7 +346,7 @@ class UserModel @@ -344,7 +346,7 @@ class UserModel
344 $result = array(); 346 $result = array();
345 347
346 // 调用接口获取YOHO币 348 // 调用接口获取YOHO币
347 - $yohoCoin = UserData::yohoCoinData($uid); 349 + $yohoCoin = UserData::yohoCoinTotal($uid);
348 350
349 // 处理YOHO币数据 351 // 处理YOHO币数据
350 if (isset($yohoCoin['data']) && !empty($yohoCoin['data'])) { 352 if (isset($yohoCoin['data']) && !empty($yohoCoin['data'])) {