Authored by hf

code review by hf: do modify home page download link and do add newyear game coupon huodong

@@ -138,4 +138,20 @@ class DetailData @@ -138,4 +138,20 @@ class DetailData
138 return Yohobuy::post(Yohobuy::API_URL, $param); 138 return Yohobuy::post(Yohobuy::API_URL, $param);
139 } 139 }
140 140
  141 + /**
  142 + * 商品信息
  143 + *
  144 + * @param int $productSkn 商品SKN号
  145 + * @return array
  146 + */
  147 + public static function product($productSkn)
  148 + {
  149 + $param = Yohobuy::param();
  150 + $param['method'] = 'app.product.intro';
  151 + $param['product_skn'] = $productSkn;
  152 + $param['client_secret'] = Sign::getSign($param);
  153 +
  154 + return Yohobuy::get(Yohobuy::API_URL, $param);
  155 + }
  156 +
141 } 157 }
@@ -9,6 +9,7 @@ namespace Plugin; @@ -9,6 +9,7 @@ namespace Plugin;
9 use Hood\Core\Security\AuthCode; 9 use Hood\Core\Security\AuthCode;
10 use Api\Yohobuy; 10 use Api\Yohobuy;
11 use LibModels\Wap\Home\OrderData; 11 use LibModels\Wap\Home\OrderData;
  12 +use LibModels\Wap\Product\SearchData;
12 13
13 class UnionTrans 14 class UnionTrans
14 { 15 {
@@ -343,7 +344,7 @@ class UnionTrans @@ -343,7 +344,7 @@ class UnionTrans
343 344
344 foreach ($orderDetail['order_goods'] as $val) { 345 foreach ($orderDetail['order_goods'] as $val) {
345 $goodsName .= str_replace(array("&", "<", ">", "'", '"', " ", "|"), array("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "%20", "%20"), $val['product_name']) . '|'; 346 $goodsName .= str_replace(array("&", "<", ">", "'", '"', " ", "|"), array("&amp;", "&lt;", "&gt;", "&quot;", "&apos;", "%20", "%20"), $val['product_name']) . '|';
346 - $goodsIds .= $val['product_sku'] . '|'; 347 + $goodsIds .= self::getGoodsId($val['product_skn'], $val['color_name'], $val['product_sku']) . '|';
347 $goodsPrice .= $val['goods_price'] . '|'; 348 $goodsPrice .= $val['goods_price'] . '|';
348 $goodsTotalPrice .= $val['goods_amount'] . '|'; 349 $goodsTotalPrice .= $val['goods_amount'] . '|';
349 $goodsNum .= $val['buy_number'] . '|'; 350 $goodsNum .= $val['buy_number'] . '|';
@@ -424,5 +425,36 @@ class UnionTrans @@ -424,5 +425,36 @@ class UnionTrans
424 // pass back as string. or simple xml object if you want! 425 // pass back as string. or simple xml object if you want!
425 return $xml->asXML(); 426 return $xml->asXML();
426 } 427 }
  428 +
  429 + /**
  430 + * 获取商品ID
  431 + *
  432 + * @param int $skn 商品SKN
  433 + * @param string $color 颜色名称
  434 + * @param int $sku 商品尺码唯一标识
  435 + * @return int
  436 + */
  437 + public static function getGoodsId($skn, $color, $sku)
  438 + {
  439 + $goodsId = $sku;
  440 +
  441 + $productData = SearchData::searchElasticByCondition(array('query' => $skn) );
  442 + if (!empty($productData['data']['product_list'])) {
  443 + foreach ($productData['data']['product_list'] as $value) {
  444 + if (empty($value['goods_list'])) {
  445 + continue;
  446 + }
  447 + foreach ($value['goods_list'] as $goods) {
  448 + if ($goods['color_name'] === $color) {
  449 + $goodsId = $goods['goods_id'];
  450 + break;
  451 + }
  452 + }
  453 + }
  454 + }
  455 + $productData = array();
  456 +
  457 + return $goodsId;
  458 + }
427 459
428 } 460 }
@@ -28,8 +28,8 @@ @@ -28,8 +28,8 @@
28 <div class="coupon-top"> 28 <div class="coupon-top">
29 <img src="{{imgUrl}}/cuxiao/img/newyear/160105/top-bg.png" alt=""> 29 <img src="{{imgUrl}}/cuxiao/img/newyear/160105/top-bg.png" alt="">
30 <a class="go-check" href="{{myCouponUrl}}"></a> 30 <a class="go-check" href="{{myCouponUrl}}"></a>
31 - <a class="app-btn app1" href="http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445"></a>  
32 - <a class="app-btn app2" href="http://www.yohoshow.com/about/index/yohobuyqr"></a> 31 + <a class="app-btn app1" href="{{appUrl_1}}"></a>
  32 + <a class="app-btn app2" href="{{appUrl_2}}"></a>
33 </div> 33 </div>
34 <div class="coupon-bottom"> 34 <div class="coupon-bottom">
35 <div class="coupon-banner"> 35 <div class="coupon-banner">
@@ -63,6 +63,8 @@ class NewyearController extends HuodongAction @@ -63,6 +63,8 @@ class NewyearController extends HuodongAction
63 'bannerUrl_3' => 'http://m.yohobuy.com/kids?openby:yohobuy={"action":"go.home","params":{"channel":"3"}}', 63 'bannerUrl_3' => 'http://m.yohobuy.com/kids?openby:yohobuy={"action":"go.home","params":{"channel":"3"}}',
64 'bannerUrl_4' => 'http://m.yohobuy.com/lifestyle?openby:yohobuy={"action":"go.home","params":{"channel":"4"}}', 64 'bannerUrl_4' => 'http://m.yohobuy.com/lifestyle?openby:yohobuy={"action":"go.home","params":{"channel":"4"}}',
65 'playAgain' => 'http://feature.yoho.cn/2016lishifeng/index.html', 65 'playAgain' => 'http://feature.yoho.cn/2016lishifeng/index.html',
  66 + 'appUrl_1' => 'http://www.yohoshow.com/about/index/yohobuyqr',
  67 + 'appUrl_2' => 'http://www.yohoshow.com/about/index/yohoboysqr',
66 )); 68 ));
67 } 69 }
68 70