Commit c5e24876 authored by zhz's avatar zhz

image

parent fa9b3284
......@@ -99,4 +99,8 @@ class ImageConst{
const goodsDetailImgSize = 750;
const goodsCollectionImgSize = 336;
const footPrintGoodsImgSize = 216;
const circleStoreLabel = 124;
const commentCircleStoreLabel = 48;
const storeQualificationImg = 188;
const storeCollectionImg = 112;
}
......@@ -61,7 +61,8 @@ class CommentServiceModel extends \Business\AbstractModel {
$groupId = $comment['goods_id'];
}
$attr = \DAO\GoodsModel::getInstance()->getFormatGoodsAttr($comment['goods_spec']);
list($storeInfo,$storeLabel) = \DAO\StoreModel::getInstance()->get($comment['store_id']);
$storeInfo = \DAO\StoreModel::getInstance()->get($comment['store_id'],false);
$storeLabel = \DAO\StoreModel::getInstance()->getStoreLabelSrc($storeInfo['store_label'],\Our\ImageConst::commentCircleStoreLabel);
$goodsDao = \DAO\GoodsModel::getInstance();
$goods = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsRedisModel::getInstance(),array(&$goodsDao, 'find'),array(array('goods_id'=>$comment['goods_id']),'*'),\Our\ApiConst::oneHour,array($comment['goods_id']));
return array('content'=>$comment['content'],'addTime'=>$comment['addtime'],'goodsName'=>$comment['goods_name'],'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($comment['goods_image'],\Our\ImageConst::CommentDetailGoodsImgSize),'goodsAttr'=>$attr,'goodsPrice'=>(int)$comment['goods_pay_price'],'storeLabel'=>$storeLabel,'storeName'=>$storeInfo['store_name'],'storeId'=>$comment['store_id'],'goodsCommonId'=>$goodsCommonId,'groupId'=>$groupId);
......
......@@ -154,7 +154,7 @@ class StoreServiceModel extends \Business\AbstractModel{
$storeDetailImg = unserialize($storeInfo['store_detail_image']);
if($storeDetailImg && is_array($storeDetailImg)){
foreach ($storeDetailImg as $v){
$detailImg[] = \DAO\StoreModel::getInstance()->getStoreLabelSrc($v);
$detailImg[] = \DAO\StoreModel::getInstance()->getStoreLabelSrc($v, \Our\ImageConst::storeQualificationImg);
}
}
}
......
......@@ -125,7 +125,7 @@ class MemberCenterServiceModel extends \Business\AbstractModel
if(is_array($list) && !empty($list)){
foreach ($list as $v){
$v['evaluation_score'] ? $grade = number_format(($v['evaluation_score']/3/$v['evaluation_number']),1,'.',''):$grade = '5.0';
$stores[] = array('favid'=>$v['favid'],'storeId'=>$v['store_id'],'storeLabel'=>\DAO\StoreModel::getInstance()->getStoreLabelSrc($v['store_label']),'storeName'=>$v['store_name'],'grade'=>$grade,'collectCount'=>$favoritesInstance->getFavoritesStoreCountByStoreId($v['store_id']));
$stores[] = array('favid'=>$v['favid'],'storeId'=>$v['store_id'],'storeLabel'=>\DAO\StoreModel::getInstance()->getStoreLabelSrc($v['store_label'],\Our\ImageConst::storeCollectionImg),'storeName'=>$v['store_name'],'grade'=>$grade,'collectCount'=>$favoritesInstance->getFavoritesStoreCountByStoreId($v['store_id']));
}
}
return array('stores'=>$stores,'totalCount'=>$totalCount);
......
......@@ -86,7 +86,7 @@ class SalespersonServiceModel extends \Business\AbstractModel
if($goodsList[$v['goodsId']]) {
$goods['goodsId'] = $v['goodsId'];
$goods['goodsCommonId'] = $goodsList[$v['goodsId']]['goods_commonid'];
$goods['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($goodsList[$v['goodsId']]['goods_image'],\Our\ApiConst::SaleGoodsImgSize);
$goods['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($goodsList[$v['goodsId']]['goods_image'],\Our\ImageConst::SaleGoodsImgSize);
$goods['goodsName'] = $goodsList[$v['goodsId']]['goods_name'];
$goods['goodsCount'] = (int)$v['goodsCount'];
$hashData[$v['sale_act_id']][$v['sale_act_id'].'_'.$memberId.'_'.$v['goodsId']] = serialize($goods);
......@@ -116,7 +116,7 @@ class SalespersonServiceModel extends \Business\AbstractModel
if(!in_array($id,$existIds)){
if($goodsList[$id]) {
$data = [
'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($goodsList[$id]['goods_image'],\Our\ApiConst::SaleGoodsImgSize),
'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($goodsList[$id]['goods_image'],\Our\ImageConst::SaleGoodsImgSize),
'goodsName'=>$goodsList[$id]['goods_name'],
'goodsCount'=>0,
'goodsId'=>$id,
......
......@@ -77,18 +77,21 @@ class StoreModel extends \DAO\AbstractModel
}
/**
* 店铺头像
* 店铺头像/资质图片
*
* @param $storeLabel
* @return string
*/
public function getStoreLabelSrc($storeLabel)
public function getStoreLabelSrc($storeLabel, $width = \Our\ImageConst::circleStoreLabel, $height = 0)
{
$width = $width * \Our\ImageConst::sizeScale;
$height ? $height = $height * \Our\ImageConst::sizeScale : $height = $width;
if ($storeLabel) {
$storeLabel = \Our\Common::getStaticFile($storeLabel, \Our\ImageConst::storeLabel, 'ossHost');
} else {
$storeLabel = \Our\Common::getStaticFile(ImageConst::defaultStoreLabelName, ImageConst::defaultPath);
}
$storeLabel .= "?x-oss-process=image/resize,m_fill,h_{$height},w_{$width}";
return $storeLabel;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment