From 265f4e6b00dfed3d8320ad950cfac6fc9935e2c4 Mon Sep 17 00:00:00 2001
From: hf <fei.hong@yoho.cn>
Date: Fri, 19 Feb 2016 20:33:37 +0800
Subject: [PATCH] code review by fei.hong : do format yuanxiao huodong codes

---
 library/LibModels/Wap/Cuxiao/ActivityData.php                                     |   2 +-
 template/www.yohobuy.com/actions/product/detail/index.phtml                       | 534 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 yohobuy/huodong.m.yohobuy.com/application/modules/Cuxiao/controllers/Yuanxiao.php |  26 ++++++++++++--------------
 yohobuy/www.yohobuy.com/application/models/Product/Detail.php                     | 734 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 yohobuy/www.yohobuy.com/application/modules/Product/controllers/Detail.php        | 237 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 1518 insertions(+), 15 deletions(-)
 create mode 100644 template/www.yohobuy.com/actions/product/detail/index.phtml
 create mode 100644 yohobuy/www.yohobuy.com/application/models/Product/Detail.php
 create mode 100644 yohobuy/www.yohobuy.com/application/modules/Product/controllers/Detail.php

diff --git a/library/LibModels/Wap/Cuxiao/ActivityData.php b/library/LibModels/Wap/Cuxiao/ActivityData.php
index c61cb07..a7b5e41 100644
--- a/library/LibModels/Wap/Cuxiao/ActivityData.php
+++ b/library/LibModels/Wap/Cuxiao/ActivityData.php
@@ -122,7 +122,7 @@ class ActivityData
     {
         //调用接口发送站内信
         return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_SEND_MESSAGE, 'setSingleMessage', array(
-                $uid, $title, $content, $type, $verify_key, $send_uid, $call_back
+            $uid, $title, $content, $type, $verify_key, $send_uid, $call_back
         ));
     }
 
diff --git a/template/www.yohobuy.com/actions/product/detail/index.phtml b/template/www.yohobuy.com/actions/product/detail/index.phtml
new file mode 100644
index 0000000..53738f4
--- /dev/null
+++ b/template/www.yohobuy.com/actions/product/detail/index.phtml
@@ -0,0 +1,534 @@
+{{> layout/header}}
+<div class="product-detail-page yoho-page">
+    {{# detail}}
+        {{# banner}}
+            <div class="brand-banner" style="background:{{bgColor}}{{#if bgImg}} url({{bgImg}}){{/if}}">
+                <div class="center-content clearfix">
+                    <a class="pull-left" href="{{homeUrl}}">
+                        <img src="{{logo}}">
+                    </a>
+
+                    <div class="opt pull-right">
+                        <a class="home" href="{{homeUrl}}">
+                            <span class="iconfont">&#xe617;</span>
+                        </a>
+                        <span id="brand-favour" class="brand-fav">
+                            <i class="iconfont{{#if coled}} coled{{/if}}">&#xe616;</i>
+                        </span>
+                    </div>
+                </div>
+            </div>
+        {{/ banner}}
+
+        <div class="center-content">
+            {{> layout/path-nav}}
+            
+            {{# goodInfo}}
+                <div class="main clearfix" data-skn="{{skn}}">
+                    <div class="pull-left imgs clearfix">
+                        <div class="pull-left img">
+                            <div class="tags clearfix">
+                                {{# tags}}
+                                    {{# isNew}}
+                                        <span class="good-tag new-tag">NEW</span>
+                                    {{/ isNew}}
+                                    {{# isReNew}}
+                                        <span class="good-tag renew-tag">再到着</span>
+                                    {{/ isReNew}}
+                                    {{# isSale}}
+                                        <span class="good-tag sale-tag">SALE</span>
+                                    {{/ isSale}}
+                                    {{# isNewFestival}}
+                                        <span class="good-tag new-festival-tag">新品节</span>
+                                    {{/ isNewFestival}}
+                                    {{# isLimit}}
+                                        <span class="good-tag limit-tag">限量商品</span>
+                                    {{/ isLimit}}
+                                    {{# isYearEndPromotion}}
+                                        <span class="good-tag yep-tag">年终大促</span>
+                                    {{/ isYearEndPromotion}}
+                                    {{# isYearMidPromotion}}
+                                        <span class="good-tag ymp-tag">年中热促</span>
+                                    {{/ isYearMidPromotion}}
+                                    {{# isFew}}
+                                        <p class="good-tag few-tag">即将售罄</p>
+                                    {{/ isFew}}
+                                {{/ tags}}
+                            </div>
+                            <img id="img-show" class="img-show" src="{{img}}">
+                        </div>
+                        <div id="thumbs" class="pull-right thumbs">
+                            {{# colors}}
+                                <div class="thumb-wrap{{#unless focus}} hide{{/unless}}">
+                                    {{#if focus}}
+                                        {{# thumbs}}
+                                            <a href="{{url}}">
+                                                <img class="thumb" src="{{img}}" data-shower="{{shower}}">
+                                            </a>
+                                        {{/ thumbs}}
+                                    {{^}}
+                                        {{# thumbs}}
+                                            <a href="{{url}}">
+                                                <img class="thumb lazy" data-original="{{img}}" data-shower="{{shower}}">
+                                            </a>
+                                        {{/ thumbs}}
+                                    {{/if}}
+                                </div>
+                            {{/ colors}}
+                        </div>
+                    </div>
+                    <div class="pull-right infos">
+                        <p class="name">
+                            {{name}}
+                        </p>
+                        <a class="brand-name" href="{{brandUrl}}">{{brandName}}</a>
+                        <p class="market-price {{#if salePrice}}with-sale{{/unless}}">
+                            <span class="title">市场价:</span>
+                            <span class="price">¥{{marketPrice}}</span>
+                        </p>
+                        {{#if salePrice}}
+                            <p class="sale-price">
+                                <span class="title">促销价:</span>
+                                <span class="price">¥{{salePrice}}</span>
+                            </p>
+                        {{/if}}
+
+                        {{#if activity}}
+                            <ul class="activity">
+                                {{#each activity}}
+                                    <li>
+                                        {{#if activityImg}}
+                                            <a class="img-link" href="{{url}}">
+                                                <img src="{{activityImg}}">
+                                            </a>
+                                        {{^}}
+                                            <span class="ac-type">{{type}}</span>
+                                            <span class="ac-des">【{{des}}】</span>
+                                        {{/if}}
+                                    </li>
+                                {{/each}}
+                            </ul>
+                        {{/if}}
+
+                        <div class="trade-content">
+                            <div id="type-chose" class="type-chose">
+                                <div class="chose-color row clearfix">
+                                    <span class="title pull-left">选颜色:</span>
+                                    <ul class="colors pull-left clearfix">
+                                        {{#each colors}}
+                                            <li class="{{#if focus}}focus{{/if}} {{#if disable}}disable{{/if}} pull-left" title="{{title}}">
+                                                <img src="{{src}}">
+                                            </li>
+                                        {{/each}}
+                                    </ul>
+                                </div>
+
+                                <div class="chose-size row clearfix">
+                                    <span class="title pull-left">选尺码:</span>
+
+                                    <div id="sizes" class="size-wrapper pull-left clearfix">
+                                        {{#each colors}}
+                                            <ul class="size {{#unless focus}}hide{{/unless}} clearfix">
+                                                {{#each size}}
+                                                    <li {{#unless num}}class="disable"{{/unless}} data-title="{{title}}" data-sku="{{sku}}" data-num="{{num}}">{{name}}</li>
+                                                {{/each}}
+                                            </ul>
+                                        {{/each}}
+                                        <span class="size-ruler"></span>
+
+                                        <span class="size-warn warn-tip hide">
+                                            <i class="iconfont">&#xe62c;</i>
+                                            请选择尺码
+                                        </span>
+
+                                        <p class="color-size-tip hide"></p>
+                                    </div>
+                                </div>
+
+                                <div class="chose-count row clearfix">
+                                    <span class="title pull-left">选数量:</span>
+                                    <div class="num-wraper pull-left clearfix">
+                                        <span id="num" class="num pull-left">1</span>
+                                        <span class="minus-plus pull-left">
+                                            <i id="plus-num" class="plus iconfont">&#xe610;</i>
+                                            <i id="minus-num" class="minus iconfont">&#xe600;</i>
+                                        </span>
+                                        <span id="num-warn" class="num-warn warn-tip hide">
+                                            <i class="iconfont">&#xe62c;</i>
+                                            库存不足
+                                        </span>
+
+                                        {{# fashionTopGoods}}
+                                            {{#if getLimitedCode}}
+                                                <span class="lc-btn get-lc">获取限购码</span>
+                                                <div class="lc-container hide">
+                                                    <span class="lc-arrow"></span>
+                                                    <div class="lc-content">
+                                                        <div class="qr-code"></div>
+                                                        <p class="title">打开APP扫描二维码获取限购码</p>
+                                                        <p class="sub-title">商品开售后即可购买</p>
+                                                    </div>
+                                                </div>
+                                            {{/if}}
+
+                                            {{#if hadLimitedCode}}
+                                                <span class="lc-btn had-lc">已获取限购码</span>
+                                            {{/if}}
+
+                                            {{#if limitedCodeSoldOut}}
+                                                <span class="lc-btn lc-sold-out">限购码已抢光</span>
+                                            {{/if}}
+                                        {{/ fashionTopGoods}}
+                                    </div>
+                                </div>
+
+                                <p class="row">
+                                    {{# fashionTopGoods}}
+                                        {{#if buyNow}}
+                                            <span id="buy-now" class="buy-btn item-buy{{#if dis}} dis{{/if}}">立即购买</span>
+                                        {{/if}}
+
+                                        {{#if openSoon}}
+                                            <span id="open-soon" class="buy-btn item-buy{{#if dis}} dis{{/if}}">即将开售</span>
+                                        {{/if}}
+                                    {{^}}
+                                        <span id="add-to-cart" class="buy-btn item-buy">
+                                            <i class="iconfont">&#xe628;</i>
+                                            添加到购物车
+                                        </span>
+                                    {{/ fashionTopGoods}}
+
+                                    <span id="sold-out" class="buy-btn dis hide">
+                                        <i class="iconfont">&#xe62d;</i>
+                                        已售罄
+                                    </span>
+
+                                    <span id="collect-product" class="{{#if coled}}coled {{/if}}collect-product">
+                                        <i class="iconfont">&#xe616;</i>
+                                        {{#if coled}}
+                                            <em>已收藏</em>
+                                        {{^}}
+                                            <em>收藏商品</em>
+                                        {{/if}}
+                                    </span>
+                                </p>
+
+                                <p class="share-row">
+                                    <span class="title pull-left">分享商品:</span>
+                                    <span class="share-wrapper pull-left clearfix">
+                                        <i class="weibo" data-type="weibo" title="分享到新浪微博"></i>
+                                        <i class="weixin" data-type="weixin" title="分享到微信朋友圈"></i>
+                                        <i class="qweibo" data-type="qweibo" title="分享到腾讯微博"></i>
+                                        <i class="qzone" data-type="qzone" title="分享到QQ空间"></i>
+                                        <i class="qq" data-type="qq" title="分享到QQ好友"></i>
+                                        <i class="renren" data-type="renren" title="分享到人人"></i>
+                                        <i class="douban" data-type="douban" class="分享到豆瓣"></i>
+                                    </span>
+                                </p>
+                            </div>
+
+                            <div id="balance" class="balance">
+                                <p class="success-tip">商品已成功添加到购物车!</p>
+                                <p class="cart-total">购物车一共有<span id="cart-num">0</span>件商品</p>
+                                <p class="balance-btns">
+                                    <a class="go-cart buy-btn" href="{{goCartUrl}}">
+                                        去购物车结算
+                                        <i class="iconfont">&#xe601;</i>
+                                    </a>
+
+                                    <span id="keep-shopping" class="keep-shopping">
+                                        继续购物
+                                    </span>
+                                </p>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            {{/ goodInfo}}
+
+            <div class="other-infos">
+                <div class="description-material info-block">
+                    <p class="block-title">
+                        <span class="title cur">商品信息 DESCRIPTION</span>
+                        <span class="sep">|</span>
+                        <span class="title">材质洗涤 MATERIALS</span>
+                    </p>
+                    <div class="description-content">
+                        {{# description}}
+                            <ul class="basic clearfix">
+                                {{# basic}}
+                                    <li>
+                                        {{key}}: {{value}}
+                                    </li>
+                                {{/ basic}}
+                            </ul>
+                            {{#if comfort}}
+                                <ul class="comfort clearfix">
+                                    {{# comfort}}
+                                        <li class="pull-left">
+                                            <span class="comfort-title">{{name}}:</span>
+                                            <span class="min-des">{{minDes}}</span>
+                                            {{# blocks}}
+                                                <span class="comfort-block {{#if cur}}cur{{/if}}"></span>
+                                            {{/ blocks}}
+                                            <span class="max-des">{{maxDes}}</span>
+                                        </li>
+                                    {{/ comfort}}
+                                </ul>
+                            {{/if}}
+                        {{/ description}}
+                    </div>
+                    <div class="material-content">
+                        {{# material}}
+                            {{#if detail}}
+                                <ul class="material-detail clearfix">
+                                    {{# detail}}
+                                        <li>
+                                            <img src="{{img}}">
+                                            <p class="name">{{name}}<br>{{enName}}</p>
+                                            <p class="text">{{text}}</p>
+                                        </li>
+                                    {{/ detail}}
+                                </ul>
+                            {{/if}}
+
+                            {{#if wash}}
+                                <ul class="wash">
+                                    {{# wash}}
+                                        <li>
+                                            <img class="wash-icon" src="{{img}}">
+                                            <p class="wash-name">{{name}}</p>
+                                        </li>
+                                    {{/ wash}}
+                                </ul>
+                            {{/if}}
+                        {{/ material}}
+                    </div>
+                </div>
+                <div class="size-info info-block">
+                    <p class="block-title">
+                        <span class="title cur">尺码信息 SIZE INFO</span>
+                    </p>
+                    {{# size}}
+                        <table class="size-table">
+                            <thead>
+                                <tr>
+                                    {{# thead}}
+                                        <th width="{{width}}">{{name}}</th>
+                                    {{/ thead}}
+                                </tr>
+                            </thead>
+                            <tbody>
+                                {{# tbody}}
+                                    <tr>
+                                        {{#each .}}
+                                            <td>{{.}}</td>
+                                        {{/each}}
+                                    </tr>
+                                {{/ tbody}}
+                            </tbody>
+                        </table>
+                        <p class="size-tip">
+                            ※ 以上尺寸为实物人工测量,因测量方式不同会有1-2CM误差,相关数据仅作参考,以收到实物为准。  单位:CM
+                        </p>
+                        <p class="size-tip">
+                            ※ 参考尺码因衣服版型、剪裁不同会有误差,仅供参考
+                        </p>
+                        {{#if sizeImg}}
+                            <img class="size-img" src="{{sizeImg}}">
+                        {{/if}}
+                    {{/ size}}
+                </div>
+
+                {{#if reference}}
+                    <div class="reference info-block">
+                        <p class="block-title">
+                            <span class="title cur">模特试穿 REFERENCE</span>
+                        </p>
+                        {{# reference}}
+                            <table class="reference-table">
+                                <thead>
+                                    <tr>
+                                        {{# thead}}
+                                            <th width="{{width}}">{{name}}</th>
+                                        {{/ thead}}
+                                    </tr>
+                                </thead>
+                                <tbody>
+                                    {{# tbody}}
+                                        <tr>
+                                            {{#each .}}
+                                                <td>
+                                                    {{#if @first}}
+                                                        <img class="avatar" src="{{.}}">
+                                                    {{^}}
+                                                        {{.}}
+                                                    {{/if}}
+                                                </td>
+                                            {{/each}}
+                                        </tr>
+                                    {{/ tbody}}
+                                </tbody>
+                            </table>
+                        {{/ reference}}
+                        <p class="size-tip">
+                            ※ 模特试穿中身高单位:CM,体重单位:KG,三围单位:CM
+                        </p>
+                    </div>
+                {{/if}}
+
+                <div class="details info-block">
+                    <p class="block-title">
+                        <span class="title cur">商品详情 DETAILS</span>
+                    </p>
+                    <div class="details-html">
+                        {{{details}}}
+                    </div>
+                </div>
+
+                {{# consultComment}}
+                    <div class="consult-comment info-block">
+                        <p class="block-title">
+                            <span class="title">顾客咨询({{consultNum}})</span>
+                            <span class="sep">|</span>
+                            <span class="title cur">购买评价({{commentNum}})</span>
+                        </p>
+                        <div class="comments cc-content">
+                            <h2>购买评价({{commentNum}})</h2>
+                            <ul id="comments-ul">
+                                {{# comments}}
+                                    <li>
+                                        <div class="user-info clearfix">
+                                            <img class="user-avatar pull-left" src="{{avatar}}">
+                                            <p>
+                                                <span class="name">{{userName}}  </span>
+                                                购买了{{color}}/{{size}}
+                                                <br>
+                                                <span class="date">{{date}}</span>
+                                            </p>
+                                        </div>
+                                        <p class="comment">{{comment}}</p>
+                                    </li>
+                                {{/ comments}}
+                            </ul>
+                            {{#if hasMoreComments}}
+                                <p class="more-wrap">
+                                    <span class="load-more-comments load-more">
+                                        加载更多
+                                        <i class="iconfont">&#xe61d;</i>
+                                    </span>
+                                </p>
+                            {{/if}}
+                            <p class="btn-wrap">
+                                <a class="btn" href="{{commentUrl}}" target="_blank">
+                                    <i class="iconfont">&#xe62a;</i>
+                                    我要评论
+                                </a>
+                            </p>
+                        </div>
+
+                        <div class="consults cc-content">
+                            <h2>顾客咨询({{consultNum}})</h2>
+                            <ul id="consults-ul">
+                                {{# consults}}
+                                    <li>
+                                        <div class="user-info clearfix">
+                                            <img class="user-avatar" src="{{avatar}}">
+                                            <p>
+                                                <span class="question">{{question}}</span>
+                                                <br>
+                                                <span class="date">{{date}}</span>
+                                            </p>
+                                        </div>
+                                        <p class="consult">{{answer}}</p>
+                                    </li>
+                                {{/ consults}}
+                            </ul>
+                            {{#if hasMoreConsults}}
+                                <p class="more-wrap">
+                                    <span class="load-more-consults load-more">
+                                        加载更多
+                                        <i class="iconfont">&#xe61d;</i>
+                                    </span>
+                                </p>
+                            {{/if}}
+                            <p class="btn-wrap">
+                                <span id="consults-btn" class="btn">
+                                    <i class="iconfont">&#xe62a;</i>
+                                    我要咨询
+                                </span>
+                            </p>
+                            <div class="new-consult hide">
+                                <textarea class="my-consult"></textarea>
+                                <span class="consult-warn warn-tip hide">
+                                    <i class="iconfont">&#xe62c;</i>
+                                    请输入咨询内容
+                                </span>
+                                <div class="captcha-row">
+                                    <input class="captcha" type="text">
+                                    <img class="captcha-img" src="http://www.yohobuy.com/passport/images?g=consult">
+                                    <span class="captcha-warn warn-tip hide">
+                                        <i class="iconfont">&#xe62c;</i>
+                                        <em>请输入验证码</em>
+                                    </span>
+                                </div>
+                                <span id="submit-consult" class="btn submit-consult">提交咨询</span>
+                            </div>
+
+                            <div class="consult-success hide">
+                                <p>
+                                    <span class="iconfont">&#xe61a;</span>
+                                    咨询成功,请等待客服回复
+                                </p>
+                            </div>
+                        </div>
+                    </div>
+                {{/ consultComment}}
+
+                <div class="after-service">
+                    <p id="after-service-switch" class="after-service-switch">
+                        <span class="iconfont">&#xe62b;</span>
+                        售后服务
+                        <span class="iconfont triangle">&#xe604;</span>
+                    </p>
+                    <div class="after-service-content info-block">
+                        <div class="block-title">
+                            <span class="title cur">售后服务 AFTER SERVICE</span>
+                        </div>
+                        <div class="img-1"></div>
+                        <div class="img-2"></div>
+                        <div class="text">
+                            <h4>退换货承诺</h4>
+                            <p>自您签收商品7日内可以退货,15日内可以换货,在商品不影响二次销售的情况下,YOHO!有货将为您办理退换货服务,请在网站提交"退换货"申请。需要说明的是:非质量问题的退换货,来回运费由您承担。</p>
+                            <h4>退换货方式</h4>
+                            <p>
+                                针对国内大中型城市,YOHO!有货开通了<span class="orange">"上门换货"</span>服务,上门服务区域及费用请联系客服中心;若您所在的区域不在上门换货范围内,请您选择普通快递将商品、内包装、赠品及发货单等一并寄回。质量问题的退换货,目前不支持运费到付款业务,请您先垫付运费寄回。如需退换货,请致电客服电话:400-889-9646。
+                            </p>
+                            <h4>退换货邮寄地址</h4>
+                            <p>
+                                南京市江宁区江宁经济技术开发区苏源大道87号YOHO!有货物流中心东一楼 收件人:YOHO!有货 邮编:211106
+                                <br>
+                                YOHO!有货客服热线:400-889-9646  客服邮箱:<a href="mailto:service@yoho.cn">service@yoho.cn</a>
+                                <br>
+                                有疑问请联系我们,我们将为您提供最优质的产品和服务。
+                            </p>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="service"></div>
+                {{#if latestWalk}}
+                    <div class="info-block latest-walk">
+                        <input id="latest-walk-count" type="hidden" value="{{latestWalk}}">
+                        <p class="block-title">
+                            <span class="title cur">最近浏览 RECENT REVIEW</span>
+                        </p>
+                        <div id="latest-walk-goods" class="goods clearfix"></div>
+                        {{> product/latest-walk-tpl}}
+                    </div>
+                {{/if}}
+            </div>
+        </div>
+    {{/ detail}}
+</div>
+{{> layout/footer}}
\ No newline at end of file
diff --git a/yohobuy/huodong.m.yohobuy.com/application/modules/Cuxiao/controllers/Yuanxiao.php b/yohobuy/huodong.m.yohobuy.com/application/modules/Cuxiao/controllers/Yuanxiao.php
index f846b81..24bd9b8 100644
--- a/yohobuy/huodong.m.yohobuy.com/application/modules/Cuxiao/controllers/Yuanxiao.php
+++ b/yohobuy/huodong.m.yohobuy.com/application/modules/Cuxiao/controllers/Yuanxiao.php
@@ -9,6 +9,7 @@ use Plugin\Helpers;
  */
 class YuanxiaoController extends HuodongAction
 {
+
     // const STATIC_FILE = 'http://localhost:2222/assets/1.0.8';
     const STATIC_FILE = 'http://cdn.yoho.cn/huodong/2016yuanxiao/1.0.8';
     const ENCRYPT_KEY = 'iamgtskkwhoareyou';
@@ -124,7 +125,8 @@ class YuanxiaoController extends HuodongAction
 
         $result = $this->getCookie('yuanxiaochouqian', null);
         if (empty($result)) { // 未取到信息就重新测试
-            $this->go(Helpers::url('/cuxiao/yuanxiao/info'));       }
+            $this->go(Helpers::url('/cuxiao/yuanxiao/info'));
+        }
 
         // cookie中存的结果
         $result = json_decode($result, true);
@@ -175,7 +177,6 @@ class YuanxiaoController extends HuodongAction
         ));
     }
 
-
     /**
      * 根据结果类型获取抽签结果标题
      * @param $type
@@ -191,12 +192,10 @@ class YuanxiaoController extends HuodongAction
             'M2' => '把妹不花钱!买鞋不排队!',
             'M3' => '穿着跑鞋到达人生巅峰!',
             'M4' => '帅气多金颜值高!',
-            'F1' => '拥有拆不完的快递和礼物!
-',
+            'F1' => '拥有拆不完的快递和礼物!',
             'F2' => '被男神强势壁咚!',
             'F3' => '腿细胸大屁股翘!',
-            'F4' => '任何style都轻松驾驭!
-'
+            'F4' => '任何style都轻松驾驭!'
         );
 
         return $data[$type];
@@ -240,16 +239,15 @@ class YuanxiaoController extends HuodongAction
     private function encrypt($data)
     {
         $data = strval($data);
-        $key	=	md5(self::ENCRYPT_KEY);
-        $x		=	0;
-        $len	=	strlen($data);
-        $l		=	strlen($key);
+        $key = md5(self::ENCRYPT_KEY);
+        $x = 0;
+        $len = strlen($data);
+        $l = strlen($key);
         $char = '';
         $str = '';
 
         for ($i = 0; $i < $len; $i++) {
-            if ($x == $l)
-            {
+            if ($x == $l) {
                 $x = 0;
             }
             $char .= $key{$x};
@@ -280,8 +278,7 @@ class YuanxiaoController extends HuodongAction
         $str = '';
 
         for ($i = 0; $i < $len; $i++) {
-            if ($x == $l)
-            {
+            if ($x == $l) {
                 $x = 0;
             }
             $char .= substr($key, $x, 1);
@@ -298,4 +295,5 @@ class YuanxiaoController extends HuodongAction
 
         return $str;
     }
+
 }
diff --git a/yohobuy/www.yohobuy.com/application/models/Product/Detail.php b/yohobuy/www.yohobuy.com/application/models/Product/Detail.php
new file mode 100644
index 0000000..6eff165
--- /dev/null
+++ b/yohobuy/www.yohobuy.com/application/models/Product/Detail.php
@@ -0,0 +1,734 @@
+<?php
+
+namespace Product;
+
+use LibModels\Web\Product\DetailData;
+use Plugin\Helpers;
+
+/**
+ * 商品详情页模板相关的数据模型
+ *
+ * @name DetailModel
+ * @package Product
+ * @copyright yoho.inc
+ * @version 1.0 (2015-11-19 10:49:36)
+ * @author fei.hong <fei.hong@yoho.cn>
+ */
+class DetailModel
+{
+
+    /**
+     * 商品基本信息
+     *
+     * @param int $productId 商品ID SKN 和 ID 只需要传一个
+     * @param int $goodsId 某个颜色的商品
+     * @param int $uid 当前登录用户ID, 未登录为0
+     * @param int $productSkn SKN 和 ID 只需要传一个
+     * @return array
+     */
+    public static function getBaseInfo($productId, $goodsId, $uid, $vipLevel, $productSkn = null)
+    {
+        $result = array();
+
+        $baseInfo = array();
+        // 通过ID获取
+        if (is_numeric($productId) && is_numeric($goodsId)) {
+            $baseInfo = DetailData::baseInfo($productId, $uid);
+        }
+        // 通过SKN获取
+        elseif (is_numeric($productSkn)) {
+            $baseInfo = DetailData::baseInfo(null, $uid, $productSkn);
+        }
+        // 商品名称
+        if (empty($baseInfo['productName'])) {
+            return $result;
+        }
+        
+        // 面包屑导航
+        $result['pathNav'] = array(
+            array(
+                'href' => '/boys',
+                'name' => 'BOYS首页'
+            ),
+            array(
+                'href' => '/boys?sort=1',
+                'name' => '服配'
+            ),
+            array(
+                'href' => '/boys?sort=1&msort=232',
+                'name' => '手表'
+            ),
+            array(
+                'name' => $baseInfo['productName'],
+            )
+        );
+                            
+        // 商品促销短语
+        if (!empty($baseInfo['salesPhrase'])) {
+            $result['goodsSubtitle'] = $baseInfo['salesPhrase'];
+        }
+
+        // 商品标签
+        if (!empty($baseInfo['productTagBoList'])) {
+            foreach ($baseInfo['productTagBoList'] as $value) {
+                switch ($value['tagLabel']) {
+                    case 'is_soon_sold_out': // 即将售磬
+                        $result['tags']['is_soon_sold_out'] = true;
+                        break;
+                    case 'is_new': // 新品NEW
+                        $result['tags']['is_new'] = true;
+                        break;
+                    case 'is_discount': // SALE
+                        $result['tags']['is_discount'] = true;
+                        break;
+                    case 'is_limited': // 限量
+                        $result['tags']['is_limited'] = true;
+                        break;
+                    case 'is_yohood': // YOHOOD
+                        $result['tags']['is_yohood'] = true;
+                        break;
+                    case 'is_advance': // 再到着
+                        $result['tags']['is_advance'] = true;
+                        break;
+                }
+            }
+        }
+
+        // 商品价格
+        if (isset($baseInfo['productPriceBo'])) {
+            $result['goodsPrice'] = array();
+            $result['goodsPrice']['currentPrice'] = $baseInfo['productPriceBo']['formatSalesPrice'];
+            if ($baseInfo['productPriceBo']['formatMarketPrice'] !== $baseInfo['productPriceBo']['formatSalesPrice']) {
+                $result['goodsPrice']['previousPrice'] = $baseInfo['productPriceBo']['formatMarketPrice'];
+            }
+        }
+        // VIP商品价格
+        if (isset($baseInfo['productPriceBo']['vipPrices'])) {
+            $build = array();
+            foreach ($baseInfo['productPriceBo']['vipPrices'] as $value) {
+                $build['level'] = $value['vipLevel'];
+                $build['text'] = $value['vipPrice'];
+                $build['currentLevel'] = ($value['vipLevel'] == $vipLevel) ? true : false;
+                $result['vipLevel']['list'][] = $build;
+            }
+        }
+
+        // 上市期
+        if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
+            $result['periodOfMarket'] = $baseInfo['expectArrivalTime'] . '月';
+        }
+
+        // 促销信息
+        if (isset($baseInfo['promotionBoList'])) {
+            $build = array();
+            foreach ($baseInfo['promotionBoList'] as $value) {
+                $build['text'] = '【' . $value['promotionType'] . '】' . $value['promotionTitle'];
+                $result['goodsDiscount']['list'][] = $build;
+            }
+        }
+
+        // 没有商品ID, 则取一次
+        if (empty($productId)) {
+            $productId = isset($baseInfo['id']) ? $baseInfo['id'] : 0;
+        }
+
+        $result['feedbacks'] = array();
+
+        // 商品咨询
+        $result['feedbacks']['consultsNum'] = 0;
+        if (!empty($baseInfo['consultBoWrapper'])) {
+            $result['feedbacks']['consultsNum'] = $baseInfo['consultBoWrapper']['consultTotal'];
+            $result['feedbacks']['consults'] = array();
+            $build = array();
+            foreach ($baseInfo['consultBoWrapper']['consultBoList'] as $value) {
+                $build['question'] = $value['ask'];
+                $build['time'] = $value['askTime'];
+                $build['answer'] = $value['answer'];
+                $result['feedbacks']['consults'][] = $build;
+            }
+            $result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $result['feedbacks']['consultsNum']));
+        }
+        // 暂无咨询
+        else {
+            $result['feedbacks']['consultsUrl'] = Helpers::url('/product/detail/consultform', array('product_id' => $productId));
+        }
+
+        // 商品评价
+        $result['feedbacks']['commentsNum'] = 0;
+        if (!empty($baseInfo['commentBoWrapper'])) {
+            $result['feedbacks']['commentsNum'] = $baseInfo['commentBoWrapper']['commentTotal'];
+            $result['feedbacks']['comments'] = array();
+            $build = array();
+            foreach ($baseInfo['commentBoWrapper']['commentBoList'] as $value) {
+                $build['userName'] = $value['nickName'];
+                $build['desc'] = $value['colorName'] . '/' . $value['sizeName'];
+                $build['content'] = isset($value['content']) ? $value['content'] : '';
+                $build['time'] = $value['createTime'];
+                $result['feedbacks']['comments'][] = $build;
+            }
+            $result['feedbacks']['commentsUrl'] = Helpers::url('/product/detail/comments', array('product_id' => $productId, 'total' => $result['feedbacks']['commentsNum']));
+        }
+
+        // 品牌信息
+        if (!empty($baseInfo['brand'])) {
+            $result['enterStore'] = array(
+                'img' => Helpers::getImageUrl($baseInfo['brand']['brandIco'], 47, 47),
+                'storeName' => $baseInfo['brand']['brandName'],
+                'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain'])
+            );
+            // 为你优选的链接
+            $result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']), '');
+        }
+
+        // 商品信息
+        if (!empty($baseInfo['goodsList'])) {
+            $colorGroup = array();
+            $sizeGroup = array();
+            $goodsGroup = array();
+            $sizeName = '';
+            $colorList = array();
+            $sizeList = array();
+            $allSizeList = array(); // 所有尺码列表
+            $thumbImageList = array();
+            $colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔
+            $colorStorageNum = 0;
+            $totalStorageNum = 0; // 总库存数
+            foreach ($baseInfo['goodsList'] as $value) {
+                // 如果status为0,即skc下架时就跳过该商品
+                if ($value['status'] === 0) {
+                    continue;
+                }
+
+                $colorStorageNum = 0;
+
+                // 商品分组
+                if (isset($value['goodsImagesList'])) {
+                    foreach ($value['goodsImagesList'] as $goods) {
+                        $goodsGroup[] = array(
+                            'goodsId' => $goods['goodsId'],
+                            'img' => $goods['imageUrl'],
+                        );
+                    }
+                }
+
+                // 商品的尺码列表
+                $colorStorageGroup[ $value['productSkc'] ] = array();
+                if (isset($value['goodsSizeBoList'])) {
+                    $sizeName = '';
+                    foreach ($value['goodsSizeBoList'] as $size) {
+                        $sizeList[ $value['productSkc'] ][] = array(
+                            'id' => $size['id'],
+                            'skuId' => $size['goodsSizeSkuId'],
+                            'goodsId' => $size['goodsId'],
+                            'colorId' => $value['colorId'],
+                            'name' => $size['sizeName'],
+                            'sizeNum' => $size['goodsSizeStorageNum'],
+                        );
+                        $sizeName = $size['sizeName'];
+                        
+                        // 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
+                        $allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage']) 
+                                                          ? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id']) 
+                                                          : $allSizeList[$sizeName];
+                        $colorStorageNum += intval($size['goodsSizeStorageNum']);
+                        $colorStorageGroup[ $value['productSkc'] ][$sizeName] = intval($size['goodsSizeStorageNum']);
+                    }
+
+                    // 颜色分组
+                    $colorList[] = array(
+                        'id' => $value['colorId'],
+                        'skcId' => $value['productSkc'],
+                        'name' => $value['colorName'],
+                        'goodsName' => $value['goodsName'],
+                        'colorNum' => $colorStorageNum,
+                    );
+                }
+
+                // 缩略图
+                $thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60));
+
+                // 商品库存总数
+                $totalStorageNum += $colorStorageNum;
+            }
+            
+            // 遍历所有尺码,构建颜色显示数据
+            $i = 1;
+            foreach ($allSizeList as $sizeName => $value) {
+                // 默认尺码
+                $sizeGroup[0]['size'][] = array(
+                    'name' => $sizeName, // 尺码名称
+                    'sizeNum' => empty($value['storage']) ? false : true, // 是否有库存 (false:表示没有库存,true:表示有库存)
+                    'id' => $value['id'],
+                );
+
+                // 各个颜色的尺码, 每行显示一个尺码对应的颜色
+                foreach ($colorList as $colorArr) {
+                    $colorArr['colorNum'] = isset($colorStorageGroup[ $colorArr['skcId'] ][$sizeName]) ? $colorStorageGroup[ $colorArr['skcId'] ][$sizeName] : 0;
+                    $colorGroup[$i]['color'][] = $colorArr;
+                }
+                $colorGroup[$i]['id'] = $value['id'];
+                
+                ++ $i;
+            }
+            // 遍历所有颜色, 构建尺码显示数据
+            $i = 1;
+            foreach ($colorList as $value) {
+                // 各个尺码的颜色,每行显示一个颜色的对应尺码
+                $sizeGroup[$i]['size'] = $sizeList[ $value['skcId'] ];
+                $sizeGroup[$i]['colorId'] = $value['skcId'];
+                // 默认颜色
+                $colorGroup[0]['color'][] = $value;
+                
+                ++ $i;
+            }
+
+            // 商品图: 多个
+            if (isset($goodsGroup[1])) {
+                foreach ($goodsGroup as $value) {
+                    $result['bannerTop']['list'][] = array(
+                        'img' => Helpers::getImageUrl($value['img'], 450, 600)
+                    );
+                }
+            }
+            // 商品图: 单个
+            elseif (isset($goodsGroup[0])) {
+                $result['bannerTop'] = array(
+                    'img' => Helpers::getImageUrl($goodsGroup[0]['img'], 450, 600)
+                );
+            }
+        }
+
+        // 悬浮的购物车信息
+        $result['cartInfo'] = array(
+            'cartUrl' => Helpers::url('/cart/index/index', null), // 购物车链接
+            'numInCart' => 0,
+            'goodsInstore' => $baseInfo['storage'], // 库存量
+        );
+        $soldOut = ($baseInfo['storage'] == 0) || ($baseInfo['status'] == 0 || $totalStorageNum === 0);
+        $notForSale = $baseInfo['attribute'] == 2;
+        // 显示加入购物车链接
+        if (!$soldOut && !$notForSale) {
+            ksort($colorGroup, SORT_NUMERIC);
+            
+            $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
+            $result['cartInfo']['productId'] = $productId;
+            $result['cartInfo']['thumbs'] = $thumbImageList;
+            $result['cartInfo']['name'] = isset($result['goodsName']) ? $result['goodsName'] : '';
+            $result['cartInfo']['price'] = isset($result['goodsPrice']['previousPrice']) ? $result['goodsPrice']['previousPrice'] : '';
+            $result['cartInfo']['salePrice'] = isset($result['goodsPrice']['currentPrice']) ? $result['goodsPrice']['currentPrice'] : '';
+            $result['cartInfo']['totalNum'] = $totalStorageNum;
+            $result['cartInfo']['colors'] = $colorGroup;
+            $result['cartInfo']['sizes'] = $sizeGroup;
+        }
+        // 非卖品
+        elseif ($notForSale) {
+            $result['cartInfo']['notForSale'] = true;
+        }
+        // 已售磬
+        elseif ($soldOut) {
+            $result['cartInfo']['soldOut'] = true;
+        }
+
+        // 是否收藏
+        $result['isCollect'] = false;
+        if (isset($baseInfo['isCollect']) && $baseInfo['isCollect'] === 'Y') {
+            $result['isCollect'] = true;
+        }
+
+        // 底部简介的URL链接
+        $result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html', null, '');
+        $result['id'] = $productId;
+
+        // 清空变量,释放内存
+        $baseInfo = array();
+        $goodsGroup = array();
+        $sizeGroup = array();
+        $colorGroup = array();
+        $sizeList = array();
+
+        return $result;
+    }
+
+    /**
+     * 商品尺码信息
+     *
+     * @param int $productSkn
+     * @return array
+     */
+    public static function getSizeInfo($productSkn)
+    {
+        $result = array();
+
+        if (is_numeric($productSkn)) {
+            // 调用服务
+            $sizeInfo = DetailData::sizeInfo($productSkn);
+
+            // 商品信息
+            if (isset($sizeInfo['productDescBo']['erpProductId'])) {
+                $sex = '通用';
+                switch ($sizeInfo['productDescBo']['gender']) {
+                    case 1:
+                        $sex = '男款';
+                        break;
+                    case 2:
+                        $sex = '女款';
+                        break;
+                }
+                $result['goodsDescription'] = array(
+                    'title' => '商品信息',
+                    'enTitle' => 'DESCRIPTION',
+                    'detail' => array(
+                        'list' => array(
+                            array('param' => '编号:' . $sizeInfo['productDescBo']['erpProductId']),
+                            array('param' => '颜色:' . $sizeInfo['productDescBo']['colorName']),
+                            array('param' => '性别:' . $sex),
+                        )
+                    ),
+                );
+            }
+            if (!empty($sizeInfo['productDescBo']['standardBos'])) {
+                foreach ($sizeInfo['productDescBo']['standardBos'] as $value) {
+                    $result['goodsDescription']['detail']['list'][] = array('param' => $value['standardName'] . ':' . $value['standardVal']);
+                }
+            }
+            if (isset($sizeInfo['phrase'])) {
+                $result['goodsDescription']['desc'] = $sizeInfo['phrase'];
+            }
+
+            // 尺码信息
+            if (!empty($sizeInfo['sizeInfoBo'])) {
+                $result['sizeInfo'] = array(
+                    'title' => '尺码信息',
+                    'enTitle' => 'SIZE INFO',
+                    'detail' => array('list' => array()),
+                );
+                /* 参考尺码 */
+                $boyReference = !empty($sizeInfo['productExtra']['boyReference']);
+                $girlReference = !empty($sizeInfo['productExtra']['girlReference']);
+                $gender = isset($sizeInfo['productDescBo']['gender']) ? $sizeInfo['productDescBo']['gender'] : 3;
+                $referenceName = '参考尺码';
+                if (($gender == 1 && $boyReference) || ($gender == 2 && $girlReference)) {
+                    $referenceName = '参考尺码';
+                } elseif ($gender == 3 && $boyReference) {
+                    $referenceName = '参考尺码(男)';
+                } elseif ($gender == 3 && $girlReference) {
+                    $referenceName = '参考尺码(女)';
+                }
+
+                $referenceList = array();
+                // 判断是否显示参考尺码
+                $showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) || ($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']) );
+                if ($showReference) {
+                    $referenceList[0] = array('param' => $referenceName);
+                }
+
+                if (!empty($sizeInfo['sizeInfoBo']['sizeAttributeBos'])) {
+                    $sizeNameList = array(0 => array('param' => '吊牌尺码')); // 尺码名称
+                    $sizeBoGroup = array(); // 尺码按ID分组
+                    foreach ($sizeInfo['sizeInfoBo']['sizeAttributeBos'] as $attr) {
+                        $sizeBoGroup[$attr['id']][0] = array('param' => empty($attr['attributeName']) ? ' ' : $attr['attributeName']);
+                    }
+                    $item = array();
+                    foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) {
+                        $item = array();
+                        $sizeNameList[] = array('param' => $value['sizeName']);
+                        if ($boyReference && ($gender == 1 || $gender == 3)) {
+                            $referenceList[] = array('param' => empty($value['boyReferSize']['referenceName']) ? ' ' : $value['boyReferSize']['referenceName']);
+                        } elseif ($girlReference && ($gender == 2 || $gender == 3)) {
+                            $referenceList[] = array('param' => empty($value['girlReferSize']['referenceName']) ? ' ' : $value['girlReferSize']['referenceName']);
+                        } else {
+                            $showReference = false;
+                        }
+                        foreach ($value['sortAttributes'] as $attr) {
+                            $sizeBoGroup[$attr['id']][] = array('param' => empty($attr['sizeValue']) ? ' ' : $attr['sizeValue']);
+                        }
+                    }
+
+                    // 根据模板页面的显示,按表格一列一列来显示
+                    $result['sizeInfo']['detail']['list'][0]['params'] = $sizeNameList;
+                    if ($showReference) {
+                        $result['sizeInfo']['detail']['list'][1]['params'] = $referenceList;
+                    }
+                    foreach ($sizeBoGroup as $value) {
+                        $result['sizeInfo']['detail']['list'][]['params'] = $value;
+                    }
+                } else {
+                    $result['sizeInfo']['detail']['list'][0]['params'] = array(0 => array('param' => ''));
+                }
+            }
+
+            // 测量方式
+            if (!empty($sizeInfo['sizeImage'])) {
+                $result['measurementMethod'] = array(
+                    'title' => '测量方式',
+                    'enTitle' => 'MEASUREMENT METHOD',
+                    'img' => $sizeInfo['sizeImage'],
+                );
+            }
+
+            // 模特试穿, 竖着输出排列显示
+            if (!empty($sizeInfo['modelBos'])) {
+                $result['reference'] = array(
+                    'title' => '模特试穿',
+                    'enTitle' => 'REFERENCE',
+                    'detail' => array('list' => array()),
+                );
+
+                // 控制是否显示备注
+                $showRemark = false;
+                $remarkList = array(0 => array('param' => '备注'));
+
+                $result['reference']['detail']['list'][0]['params'] = array(0 => array('param' => '')); // 头像列表
+                $result['reference']['detail']['list'][1]['params'] = array(0 => array('param' => '模特')); // 模特名字列表
+                $result['reference']['detail']['list'][2]['params'] = array(0 => array('param' => '身高')); // 身高列表
+                $result['reference']['detail']['list'][3]['params'] = array(0 => array('param' => '体重')); // 体重列表
+                $result['reference']['detail']['list'][4]['params'] = array(0 => array('param' => '三围')); // 三围列表
+                $result['reference']['detail']['list'][5]['params'] = array(0 => array('param' => '吊牌尺码')); // 吊牌尺码
+                $result['reference']['detail']['list'][6]['params'] = array(0 => array('param' => '试穿描述')); // 试穿描述
+
+                foreach ($sizeInfo['modelBos'] as $value) {
+                    $result['reference']['detail']['list'][0]['params'][] = array('param' => $value['avatar']);
+                    $result['reference']['detail']['list'][1]['params'][] = array('param' => $value['modelName']);
+                    $result['reference']['detail']['list'][2]['params'][] = array('param' => $value['height']);
+                    $result['reference']['detail']['list'][3]['params'][] = array('param' => $value['weight']);
+                    $result['reference']['detail']['list'][4]['params'][] = array('param' => $value['vitalStatistics']);
+                    $result['reference']['detail']['list'][5]['params'][] = array('param' => $value['fitModelBo']['fit_size']);
+                    $result['reference']['detail']['list'][6]['params'][] = array('param' => $value['fitModelBo']['feel']);
+                    if (!empty($value['fitModelBo']['fit_remark'])) {
+                        $showRemark = true;
+                        $remarkList[] = array('param' => $value['fitModelBo']['fit_remark']);
+                    } else {
+                        $remarkList[] = array('param' => '');
+                    }
+                }
+
+                // 显示模特备注
+                if ($showRemark) {
+                    $result['reference']['detail']['list'][7]['params'] = $remarkList;
+                }
+            }
+
+            // 商品材质
+            if (!empty($sizeInfo['productMaterialList'])) {
+                $result['materials'] = array(
+                    'title' => '商品材质',
+                    'enTitle' => 'MATERIALS',
+                    'list' => array(),
+                );
+                foreach ($sizeInfo['productMaterialList'] as $value) {
+                    $result['materials']['list'][] = array(
+                        'img' => $value['imageUrl'],
+                        'desc' => $value['remark'],
+                    );
+                }
+            }
+
+            // 洗涤提示
+            if (!empty($sizeInfo['washTipsBoList'])) {
+                $result['washTips']['list'] = array();
+                foreach ($sizeInfo['washTipsBoList'] as $value) {
+                    $result['washTips']['list'][] = $value;
+                }
+            }
+
+            // 详情配图
+            if (isset($sizeInfo['productIntroBo']['productIntro'])) {
+                $productIntro = '';
+                if (!empty($sizeInfo['productDescBo']['phrase'])) {
+                    $productIntro .= $sizeInfo['productDescBo']['phrase'] . '<br/>';
+                }
+                $productIntro .= $sizeInfo['productIntroBo']['productIntro'];
+                if ($productIntro) {
+                    $result['productDetail'] = array(
+                        'title' => '商品详情',
+                        'enTitle' => 'DETAILS',
+                        'desc' => strtr($productIntro, array(
+                            '\r\n\t' => '',
+                            '</p>' => '',
+                            '<img src=' => "<img class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=",
+                            '<img border="0" src=' => "<img border=\"0\" class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=",
+                            '.jpg' => '.jpg?imageMogr2/thumbnail/750x/quality/90',
+                        )),
+                    );
+                }
+            }
+
+            // 清空变量,释放内存
+            $sizeInfo = array();
+        }
+
+        return $result;
+    }
+
+    /**
+     * 获取评价列表
+     *
+     * @param int $productId 产品ID
+     * @param int $pageNum 页码数
+     * @param int $pageSize 每页显示个数
+     * @return array
+     */
+    public static function getComments($productId, $pageNum = 1, $pageSize = 300)
+    {
+        $result = array();
+
+        if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
+            $commentList = DetailData::commentList($productId, $pageNum, $pageSize);
+            if (!empty($commentList['data'])) {
+                $build = array();
+                foreach ($commentList['data'] as $value) {
+                    $build['userName'] = $value['nickname'];
+                    $build['desc'] = $value['color_name'] . '/' . $value['size_name'];
+                    $build['content'] = $value['content'];
+                    $build['time'] = $value['create_time'];
+                    $result[] = $build;
+                }
+            }
+        }
+
+        return $result;
+    }
+
+    /**
+     * 获取咨询列表
+     *
+     * @param int $uid 用户ID
+     * @param int $productId 产品ID
+     * @param int $pageNum 页码数
+     * @param int $pageSize 每页显示个数
+     * @return array
+     */
+    public static function getConsults($uid, $productId, $pageNum = 1, $pageSize = 300)
+    {
+        $result = array();
+
+        if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
+            $consultList = DetailData::consultList($uid, $productId, $pageNum, $pageSize);
+            if (isset($consultList['code']) && $consultList['code'] === 200) {
+                $build = array();
+                foreach ($consultList['data']['list'] as $value) {
+                    $build['question'] = $value['ask'];
+                    $build['time'] = $value['ask_time'];
+                    $build['answer'] = $value['answer'];
+                    $build['id'] = $value['id'];
+                    $build['isLike'] = $value['is_like'] === 'Y';
+                    $build['like'] = intval($value['like']);
+                    $build['isUseful'] = $value['is_useful'] === 'Y';
+                    $build['useful'] = intval($value['useful']);
+                    $result[] = $build;
+                }
+            }
+            $consultList = array();
+        }
+
+        return $result;
+    }
+
+    /**
+     * 获取常见问题列表
+     *
+     * @return array
+     */
+    public static function getCommonConsults()
+    {
+        $result = array();
+
+        $consults = DetailData::commonConsultList();
+        if (isset($consults['code']) && $consults['code'] === 200) {
+            $result['commonConsults'] = $consults['data'];
+            $consults = array();
+        }
+
+        return $result;
+    }
+
+    /**
+     * 咨询点赞
+     *
+     * @param int $uid 用户ID
+     * @param int $id 咨询ID
+     * @param int $productId 商品ID
+     * @param int $total 购买咨询总数
+     * @return array
+     */
+    public static function upvoteConsult($uid, $id, $productId, $total)
+    {
+        $result = array('code' => 400, 'message' => '出错啦~');
+
+        do {
+            if (empty($uid)) {
+                $result['code'] = 401;
+                $result['message'] = '用户id为空';
+                $result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total))));
+                break;
+            }
+            
+            // 处理数据
+            $record = DetailData::upvoteConsult($uid, $id);
+            if (!empty($record['code'])) {
+                $result['code'] = $record['code'];
+                $result['message'] = $record['message'];
+            }
+        } while (false);
+
+        return $result;
+    }
+
+    /**
+     * 咨询有用
+     *
+     * @param int $uid 用户ID
+     * @param int $id 咨询ID
+     * @param int $productId 商品ID
+     * @param int $total 购买咨询总数
+     * @return array
+     */
+    public static function usefulConsult($uid, $id, $productId, $total)
+    {
+        $result = array('code' => 400, 'message' => '出错啦~');
+
+        do {
+            if (empty($uid)) {
+                $result['code'] = 401;
+                $result['message'] = '用户id为空';
+                $result['data'] = Helpers::url('/signin.html', array('refer' => Helpers::url('/product/detail/consults', array('product_id' => $productId, 'total' => $total))));
+                break;
+            }
+            
+            // 处理数据
+            $record = DetailData::usefulConsult($uid, $id);
+            if (!empty($record['code'])) {
+                $result['code'] = $record['code'];
+                $result['message'] = $record['message'];
+            }
+        } while (false);
+
+        return $result;
+    }
+
+    /**
+     * 获取为你优选的商品
+     *
+     * @param int $productSkn 商品SKN
+     * @return array
+     */
+    public static function getPreference($productSkn, $channel, $brandId)
+    {
+        $result = array();
+
+        if (is_numeric($productSkn)) {
+            $preference = DetailData::preference($productSkn, $channel, $brandId);
+            if (!empty($preference)) {
+                foreach ($preference as $value) {
+                    $value = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
+                    if (false !== $value) {
+                        $result['recommendList'][] = $value;
+                    }
+                }
+            }
+        }
+
+        return $result;
+    }
+
+}
diff --git a/yohobuy/www.yohobuy.com/application/modules/Product/controllers/Detail.php b/yohobuy/www.yohobuy.com/application/modules/Product/controllers/Detail.php
new file mode 100644
index 0000000..7180d7a
--- /dev/null
+++ b/yohobuy/www.yohobuy.com/application/modules/Product/controllers/Detail.php
@@ -0,0 +1,237 @@
+<?php
+
+use Action\AbstractAction;
+use Plugin\Helpers;
+use LibModels\Web\Product\DetailData;
+
+/**
+ * 商品详情的控制器
+ */
+class DetailController extends AbstractAction
+{
+
+    /**
+     * 商品详情
+     *
+     * @param int productId
+     * @param int goodsId
+     */
+    public function indexAction()
+    {
+        $productId = $this->param('productId');
+        if (!is_numeric($productId)) {
+            $this->error();
+        }
+        $goodsId = $this->param('goodsId');
+        if (!is_numeric($goodsId)) {
+            $this->error();
+        }
+        $uid = $this->getUid();
+
+        $vipLevel = 0;
+        if (isset($this->_vip)) {
+            $vipLevel = Helpers::getVipLevel($this->_vip);
+        }
+
+        $data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid, $vipLevel);
+        if (array() === $data) {
+            $this->error();
+        }
+        $data['productDetailPage'] = true;
+        
+        if (isset($data['goodsName'])) {
+            $this->setTitle($data['goodsName']);
+        }
+
+        // 渲染模板
+        $this->_view->display('index', $data);
+    }
+
+    /**
+     * 商品详情 (SKN)
+     *
+     * @param int productSkn
+     */
+    public function showAction()
+    {
+        $productSkn = $this->param('productSkn');
+        if (!is_numeric($productSkn)) {
+            $this->error();
+        }
+        $uid = $this->getUid();
+
+        $vipLevel = 0;
+        if (isset($this->_vip)) {
+            $vipLevel = Helpers::getVipLevel($this->_vip);
+        }
+
+        $data = \Product\DetailModel::getBaseInfo(null, null, $uid, $vipLevel, $productSkn);
+        if (array() === $data) {
+            $this->error();
+        }
+        $data['goodsDetailPage'] = true;
+        $data['pageFooter'] = true;
+
+        if (isset($data['goodsName'])) {
+            $this->setTitle($data['goodsName']);
+        }
+        $this->setNavHeader('商品详情');
+        // 渲染模板
+        $this->_view->display('index', $data);
+    }
+
+    /**
+     * 尺码描述信息
+     */
+    public function introAction()
+    {
+        $productSkn = $this->param('productSkn');
+        if (!is_numeric($productSkn)) {
+            echo ' ';
+        }
+        $data = \Product\DetailModel::getSizeInfo($productSkn);
+        if (array() === $data) {
+            echo ' ';
+            exit();
+        }
+        $this->_view->display('intro', $data);
+    }
+
+    /**
+     * 购买评价列表
+     *
+     * @param int productId
+     * @param int total
+     */
+    public function commentsAction()
+    {
+        $productId = $this->get('product_id', 0);
+        $total = $this->get('total');
+        if (!is_numeric($total)) {
+            $total = 0;
+        }
+        if ($total) {
+            $this->setNavHeader('购买评价(' . $total . ')');
+        } else {
+            $this->setNavHeader('购买评价');
+        }
+        $this->setTitle('购买评价');
+
+        $data = array(
+            'goodsCommentsPage' => true,
+            'pageFooter' => true,
+            'comments' => array(
+                'list' => \Product\DetailModel::getComments($productId),
+            ),
+        );
+
+        // 渲染模板
+        $this->_view->display('comments', $data);
+    }
+
+    /**
+     * 购买咨询列表
+     *
+     * @param int productId
+     * @param int total
+     */
+    public function consultsAction()
+    {
+        $productId = $this->get('product_id', 0);
+        $total = $this->get('total', 0);
+        if (!is_numeric($total)) {
+            $total = 0;
+        }
+        if ($total) {
+            $this->setNavHeader('购买咨询(' . $total . ')');
+        } else {
+            $this->setNavHeader('购买咨询');
+        }
+        $this->setTitle('购买咨询');
+
+        $uid = $this->getUid();
+        $consults = \Product\DetailModel::getConsults($uid, $productId);
+        $data = array(
+            'goodsConsultsPage' => true,
+            'pageFooter' => true,
+            'consults' => array(
+                'list' => $consults
+            ),
+            'faq' => \Product\DetailModel::getCommonConsults(),
+            'showReadMore' => count($consults) > 2,
+            'link' => Helpers::url('/product/detail/consultform', array('product_id' => $productId)),
+        );
+
+        // 渲染模板
+        $this->_view->display('consults', $data);
+    }
+
+    /**
+     * 我要咨询表单
+     */
+    public function consultformAction()
+    {
+        $uid = $this->getUid();
+        if (!$uid) {
+            $this->go(Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', '/'))));
+        }
+
+        $this->setTitle('我要咨询');
+        $this->setNavHeader('我要咨询');
+
+        $productId = $this->get('product_id', 0);
+
+        // 渲染模板
+        $this->_view->display('consultform', array(
+            'consultformPage' => true,
+            'productId' => $productId,
+            'formUrl' => Helpers::url('/product/detail/consultsubmit'),
+        ));
+    }
+
+    /**
+     * 添加咨询操作
+     *
+     * @param int product_id 商品ID
+     * @param string content 咨询内容
+     * @return json
+     */
+    public function consultsubmitAction()
+    {
+        $result = array('code' => 400, 'message' => '请输入咨询内容', 'data' => '');
+
+        if ($this->isAjax()) {
+            $uid = $this->getUid();
+            $productId = $this->post('product_id', 0);
+            $content = $this->post('content');
+            $result = DetailData::addConsult($uid, $productId, $content);
+        }
+
+        $this->echoJson($result);
+    }
+
+    /**
+     * 为你优选
+     *
+     * @param int productSkn 商品SKN号
+     * @return json
+     */
+    public function preferenceAction()
+    {
+        $result = array();
+
+        if ($this->isAjax()) {
+            $productSkn = $this->get('productSkn');
+            $brandId = $this->get('brandId');
+            $channel = Helpers::getChannelByCookie();
+            $result = \Product\DetailModel::getPreference($productSkn, $channel, $brandId);
+        }
+
+        if (empty($result)) {
+            echo ' ';
+        } else {
+            $this->_view->display('preference', $result);
+        }
+    }
+
+}
--
libgit2 0.24.0