diff --git a/library/LibModels/Wap/Home/UserData.php b/library/LibModels/Wap/Home/UserData.php index fa520ea..6d17a24 100644 --- a/library/LibModels/Wap/Home/UserData.php +++ b/library/LibModels/Wap/Home/UserData.php @@ -344,14 +344,18 @@ class UserData * * @param int $uid 用户ID * @param string $content 意见内容 + * @param mixed $image 图片地址 * @param int $suggest_type 意见类型 * @return array 意见反馈接口返回的数据 */ - public static function savesuggestData($uid, $content, $suggest_type) + public static function savesuggestData($uid, $content, $image, $suggest_type) { $param = Yohobuy::param(); $param['uid'] = $uid; $param['content'] = $content; + if($image !== null) { + $param['image'] = $image; + } $param['suggest_type'] = $suggest_type; $param['client_secret'] = Sign::getSign($param); diff --git a/library/Plugin/Images.php b/library/Plugin/Images.php index 04d5a6a..2bf7fbe 100644 --- a/library/Plugin/Images.php +++ b/library/Plugin/Images.php @@ -187,7 +187,11 @@ class Images if(count($file) == 1 || !is_array($file)) { - $imgList['imgList'][] = array('imgUrl' => self::getSourceUrl(current($result['data']['imagesList']), 'suggest') . $imgExtra); + $imgRelUrl = current($result['data']['imagesList']); + $imgList['imgList'][] = array( + 'imgUrl' => self::getSourceUrl($imgRelUrl, 'suggest') . $imgExtra, + 'imgRelUrl' => $imgRelUrl + ); } else { @@ -195,6 +199,7 @@ class Images foreach ($result['data']['imagesList'] as $val) { $img = array(); $img['imgUrl'] = self::getSourceUrl($val, 'suggest') . $imgExtra; + $img['imgRelUrl'] = $val; $imgList['imgList'][] = $img; } } diff --git a/template/m.yohobuy.com/actions/product/detail/index.phtml b/template/m.yohobuy.com/actions/product/detail/index.phtml index cd643ea..a19be29 100644 --- a/template/m.yohobuy.com/actions/product/detail/index.phtml +++ b/template/m.yohobuy.com/actions/product/detail/index.phtml @@ -60,10 +60,10 @@ {{# feedbacks}} {{#if commentsNum}} {{> product/feedback-tab}} - {{else}} + {{^}} {{#if consultsNum}} {{> product/feedback-tab}} - {{else}} + {{^}} <div class="nodata"> <span>暂无商品评价和咨询</span> <a class="go-consult">我要咨询<span class="iconfont"></span></a> diff --git a/template/m.yohobuy.com/partials/product/feedback-tab.phtml b/template/m.yohobuy.com/partials/product/feedback-tab.phtml index 783e3c5..191b0f1 100644 --- a/template/m.yohobuy.com/partials/product/feedback-tab.phtml +++ b/template/m.yohobuy.com/partials/product/feedback-tab.phtml @@ -22,7 +22,7 @@ </span> {{/ comments}} </div> - {{else}} + {{^}} <div class="comment-content-main content-main no-item"> <span class="iconfont"></span>暂无评论 </div> diff --git a/yohobuy/m.yohobuy.com/application/controllers/Home.php b/yohobuy/m.yohobuy.com/application/controllers/Home.php index c949e35..ec00a88 100644 --- a/yohobuy/m.yohobuy.com/application/controllers/Home.php +++ b/yohobuy/m.yohobuy.com/application/controllers/Home.php @@ -384,7 +384,8 @@ class HomeController extends AbstractAction $uid = $this->getUid(); $content = $this->post('content', ''); $suggest_type = $this->post('suggest_type', 2); - $result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type); + $image = $this->post('image', null); + $result = \Index\UserModel::saveSuggestData($uid, $content, $image, $suggest_type); $this->echoJson($result); } diff --git a/yohobuy/m.yohobuy.com/application/models/Index/User.php b/yohobuy/m.yohobuy.com/application/models/Index/User.php index 27d3f56..a843e9a 100644 --- a/yohobuy/m.yohobuy.com/application/models/Index/User.php +++ b/yohobuy/m.yohobuy.com/application/models/Index/User.php @@ -487,15 +487,16 @@ class UserModel * * @param int $uid 用户ID * @param string $content 意见内容 + * @param mixed $image 图片地址 * @param int $suggest_type 意见类型 * @return array|mixed 保存意见反馈数据之后的返回 */ - public static function saveSuggestData($uid, $content, $suggest_type) + public static function saveSuggestData($uid, $content, $image, $suggest_type) { $result = array('code' => 400, 'message' => '保存出错'); // 调用接口保存意见反馈数据 - $save = UserData::savesuggestData($uid, $content, $suggest_type); + $save = UserData::savesuggestData($uid, $content, $image, $suggest_type); if (isset($save['code']) && $save['code'] == 200) { $result['code'] = 200; diff --git a/yohobuy/m.yohobuy.com/application/models/Product/Detail.php b/yohobuy/m.yohobuy.com/application/models/Product/Detail.php index d89ce01..36cb783 100644 --- a/yohobuy/m.yohobuy.com/application/models/Product/Detail.php +++ b/yohobuy/m.yohobuy.com/application/models/Product/Detail.php @@ -76,7 +76,7 @@ class DetailModel // 商品咨询和商品评价 $result['feedbacks'] = array(); if (!empty($baseInfo['consultBoWrapper'])) { - $result['feedbacks']['consultNum'] = $baseInfo['consultBoWrapper']['consultTotal']; + $result['feedbacks']['consultsNum'] = '0';//empty($baseInfo['consultBoWrapper']['consultTotal']) ? '0' : $baseInfo['consultBoWrapper']['consultTotal']; $result['feedbacks']['consults'] = array(); $build = array(); foreach ($baseInfo['consultBoWrapper']['consultBoList'] as $value) { @@ -87,7 +87,7 @@ class DetailModel } } if (!empty($baseInfo['commentBoWrapper'])) { - $result['feedbacks']['commentNum'] = $baseInfo['commentBoWrapper']['commentTotal']; + $result['feedbacks']['commentsNum'] = '0';//empty($baseInfo['commentBoWrapper']['commentTotal']) ? '0' : $baseInfo['commentBoWrapper']['commentTotal']; $result['feedbacks']['comments'] = array(); $build = array(); foreach ($baseInfo['commentBoWrapper']['commentBoList'] as $value) { @@ -301,7 +301,8 @@ class DetailModel 'desc' => strtr($productIntro, array( '\r\n\t' => '', '</p>' => '', - '<img src=' => '<img class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=', + '<br />' => "\r\n", + '<img src=' => "<img class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=", )), ); } @@ -312,4 +313,20 @@ class DetailModel return $result; } + /** + * 获取评价列表 + */ + public static function getComments() + { + + } + + /** + * 获取咨询列表 + */ + public static function getConsults() + { + + } + } diff --git a/yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php b/yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php index e16a83b..6fc7c85 100644 --- a/yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php +++ b/yohobuy/m.yohobuy.com/application/modules/Product/controllers/Detail.php @@ -16,381 +16,50 @@ class DetailController extends AbstractAction */ public function indexAction() { - $productId = $this->param('productId', 123); - $goodsId = $this->param('goodsId', 3241); + $productId = $this->param('productId'); + $productId = 22399; + if (!is_numeric($productId)) { + $this->error(); + } + $goodsId = $this->param('goodsId'); + $goodsId = 32443; + if (!is_numeric($goodsId)) { + $this->error(); + } $uid = $this->getUid(); + $data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid); + if (array() === $data) { + $this->error(); + } + $data['goodsDetailPage'] = true; + if (isset($data['goodsName'])) { + $this->setTitle($data['goodsName']); + } + $this->setNavHeader('商品详情'); - // $data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid); - // $data['goodsDetailPage'] = true; - - // if (isset($data['goodsName'])) { - // $this->setTitle($data['goodsName']); - // } - // $this->setNavHeader('商品详情'); - - $data = array ( - 'goodsDetailPage' => true, - 'pageHeader' => array ( - 'navBack' => 'sss ', - 'navHome' => 'sss ', - 'navTitle' => '商品详情TEST' - ), - - 'bannerTop' => array ( - 'list' => array ( - array ( - 'url' => '', - 'img' => 'http://img13.static.yhbimg.com/goodsimg/2015/10/18/03/0250c3935f86dbd2baa7d45603d19fd637.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90' - ), - array ( - 'url' => '', - 'img' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/12/03/01bf4cf4444035a1930d33a9d0f8bff4fa.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90' - ), - array ( - 'url' => '', - 'img' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/12/03/01d7ef2f624eeea15e80bb374607aea317.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90' - ) - ) - ), - 'goodsName' => 'Stussy No. 4 BOX TEE DC SPAR HIGH WC -SHOE BQT KEN BLOCK', - 'goodsSubtitle'=>'【全民拼抢购】经典印花T恤,满4件免一件!全场低至 -9.9元,拼购时代High起来。', - - 'goodsPrice' =>array( - 'currentPrice'=>'¥298.00', - 'previousPrice'=>'¥598.00' - ), - 'periodOfMarket'=>'11月', - 'goodsTitle' => '¥298.00', - 'vipLevel' => array ( - 'list' => array ( - array ( - 'img'=>'http://static.dev.yohobuy.com/img/product/silver.png', - 'text' => '¥284.00' - ), - array ( - 'img'=>'http://static.dev.yohobuy.com/img/product/golden.png', - 'text' => '¥269.00' - ), - array ( - 'img'=>'http://static.dev.yohobuy.com/img/product/platinum.png', - 'text' => '¥263.00' - ) - ) - ), - 'goodsDiscount'=>array( - 'list'=>array( - array( - 'text' =>' 【summer final sale】满¥499立享6.8折' - ), - array( - 'text' =>' 【BACK TO SCHOOL】满¥499赠送Paul - Franke帽子一个,多买多送!' - ), - array( - 'text' =>' 【BACK TO SCHOOL】满¥499赠送Paul - Franke帽子一个,多买多送!' - ) - ) - ), - 'feedbacks'=>array( - 'commentsNum'=>0, - 'consultsNum'=>1, - // 'commentName'=>'商品评价', - // 'consultName' =>'购买咨询', - 'link'=>'', - 'comments'=>array( - array( - 'userName'=>'Lynnic', - 'desc'=>'购买了白色Mate7', - 'content'=>'活动时买的,挺超值。上身效果也不错。质量 -很好,买送人的,很满意。而且物流相当给...', - 'time'=>'2014-08-12 10:24:26' - ) - ), - 'consults'=>array( - array( - 'question' =>'您好 我一米七七 140斤 穿M的行吗', - 'time'=>'2014-08-12 10:24:26', - 'answer'=>'您好,建议您参考XL的款式,由于版型和个人穿衣风格不同,需要' - ) - ) - ), - - 'enterStore'=>array( - 'img'=>'http://static.dev.yohobuy.com/img/product/store.png', - 'storeName'=>'Stussy', - 'url'=>'http://stussy.m.yohobuy.com/' - ), - - 'goodsDescription'=>array( - 'title' =>'商品描述', - 'enTitle'=>'DESCRIPTON', - - 'detail'=>array( - 'list' =>array( - array( - 'param'=>'编号:100101' - ), - array( - 'param'=>'编号:100101' - ), - array( - 'param'=>'编号:100101' - ) - ) - ), - - 'desc'=>'fafdfa' - ), - - 'sizeInfo'=>array( - 'title' => '尺码信息', - 'enTitle' =>'xSIZE INFO', - - 'detail' =>array( - 'list'=>array( - array( - 'params'=>array( - array( - 'param' =>'M' - ), - array( - 'param' =>'XL' - ), - array( - 'param' =>'XXL' - ) - ) - ), - array( - 'params'=>array( - array( - 'param' =>'43' - ), - array( - 'param' =>'46' - ), - array( - 'param' =>'XXL' - ) - ) - ), - array( - 'params'=>array( - array( - 'param' =>'102' - ), - array( - 'param' =>'107' - ), - array( - 'param' =>'XXL' - ) - ) - ), - array( - 'params'=>array( - array( - 'param' =>'11' - ), - array( - 'param' =>'22' - ), - array( - 'param' =>'XXL' - ) - ) - ), - array( - 'params'=>array( - array( - 'param' =>'bb' - ), - array( - 'param' =>'cc' - ), - array( - 'param' =>'XXL' - ) - ) - ), - array( - 'params'=>array( - array( - 'param' =>'kk' - ), - array( - 'param' =>'bb' - ), - array( - 'param' =>'XXL' - ) - ) - ) - ) - ) - ), - - 'measurementMethod'=>array( - 'title' => '测量方式', - 'enTitle' =>'MEASUREMENT METHOD', - 'img'=>'http://static.yohobuy.com/images/1.jpg' - ), - - 'reference' => array( - 'title' => '模特试穿', - 'enTitle' =>'REFERENCE', - - 'detail' =>array( - 'list'=>array( - array( - 'params'=>array( - array( - 'param' =>'M' - ), - array( - 'param' =>'http://static.dev.yohobuy.com/img/product/avatar1.png' - ), - array( - 'param' =>'http://static.dev.yohobuy.com/img/product/avatar2.png' - ) - ) - ), - array( - 'params'=>array( - array( - 'param' =>'模特' - ), - array( - 'param' =>'Oliver' - ), - array( - 'param' =>'http://static.dev.yohobuy.com/img/product/avatar2.png' - ) - ) - ), - array( - 'params'=>array( - array( - 'param' =>'102' - ), - array( - 'param' =>'107' - ), - array( - 'param' =>'XXL' - ) - ) - ), - array( - 'params'=>array( - array( - 'param' =>'11' - ), - array( - 'param' =>'22' - ), - array( - 'param' =>'XXL' - ) - ) - ), - array( - 'params'=>array( - array( - 'param' =>'bb' - ), - array( - 'param' =>'cc' - ), - array( - 'param' =>'XXL' - ) - ) - ), - array( - 'params'=>array( - array( - 'param' =>'kk' - ), - array( - 'param' =>'bb' - ), - array( - 'param' =>'XXL' - ) - ) - ) - ) - ) - ), - - 'materials' => array( - 'title' => '商品材质', - 'enTitle' =>'MATERIALS', - 'list' => array( - array( - 'img' => 'http://static.dev.yohobuy.com/img/product/material.png', - 'desc' =>'用各种洗涤剂,可手洗机洗,但不宜氯漂,宜阴干,避免曝晒,以免深色衣物褪色,在日光下晾晒时,将里面朝外。浸泡时间不能太长,避免褪色,深色与浅色衣服最好请分开洗涤,避免染色。' - ), - array( - 'img' => 'http://static.dev.yohobuy.com/img/product/material.png', - 'desc' =>'用各种洗涤剂,可手洗机洗,但不宜氯漂,宜阴干,避免曝晒,以免深色衣物褪色,在日光下晾晒时,将里面朝外。浸泡时间不能太长,避免褪色,深色与浅色衣服最好请分开洗涤,避免染色。' - ) - - ) - ), - - 'washTips' => array( - array( - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png', - 'caption'=>'不可干燥不可干洗' - ), - array( - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png', - 'caption'=>'不可干燥不可干洗' - ), - array( - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png', - 'caption'=>'不可干燥不可干洗' - ), - array( - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png', - 'caption'=>'不可干燥不可干洗' - ), - array( - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png', - 'caption'=>'不可干燥不可干洗' - ), - array( - 'img' => 'http://static.dev.yohobuy.com/img/product/washtips/washtip-1.png', - 'caption'=>'不可干燥不可干洗' - ) - ), - - 'productDetail' =>array( - 'title' => '商品详情', - 'enTitle' =>'DETAILS', - 'desc' => 'Married to the MOB是由Leah McSweeney创立的女装品牌,一向标榜不羁、大胆的女性streetwear设计。喜欢恶搞的女生们,赶紧入手吧。', - 'list' => array ( - array('img' =>'http://static.dev.yohobuy.com/img/product/product.png'), - array('img' =>'http://static.dev.yohobuy.com/img/product/product.png') - ) - ), - - 'cartInfo' =>array( - 'numInCart' => 3, - 'goodsInstore'=>0 - ) - - ); // 渲染模板 $this->_view->display('index', $data); } + + /** + * 尺码描述信息 + */ + public function introAction() + { + $productSkn = $this->param('productSkn'); + if (!is_numeric($productSkn)) { + $this->error(); + } + $data = \Product\DetailModel::getSizeInfo($productSkn); + if (array() === $data) { + echo ' '; + exit(); + } + $this->_view->display('intro', $data); + } + public function commentsAction() {