Commit f63dfcae authored by liuyuzhen's avatar liuyuzhen

购物车商品规格图片处理

parent 6ece0365
...@@ -111,4 +111,8 @@ class ImageConst{ ...@@ -111,4 +111,8 @@ class ImageConst{
const groupGoodsImg = 160; //组合详情页的搭配商品 const groupGoodsImg = 160; //组合详情页的搭配商品
const storeGroupImg = 186; //店铺促销 const storeGroupImg = 186; //店铺促销
const storeGroupGoodsImg = 130; const storeGroupGoodsImg = 130;
const cartBlImage = 184;
const cartBlDetailImage = 148;
} }
...@@ -449,7 +449,6 @@ class CartServiceModel extends \Business\AbstractModel{ ...@@ -449,7 +449,6 @@ class CartServiceModel extends \Business\AbstractModel{
$field = 'MAX(gmt_update) AS gmtupdate,store_id'; $field = 'MAX(gmt_update) AS gmtupdate,store_id';
$group = 'store_id'; $group = 'store_id';
$storeIds = $cartDao->getCartStoreIdsByMemberId($where,$memberId,$field,$group,$order); $storeIds = $cartDao->getCartStoreIdsByMemberId($where,$memberId,$field,$group,$order);
\Our\Log::getInstance()->write(json_encode($storeIds));
//$cartStores = $cartDao->lists($where,$order,$field,$data['pageIndex'],$data['pageSize'],$group); //$cartStores = $cartDao->lists($where,$order,$field,$data['pageIndex'],$data['pageSize'],$group);
$storeIdList = array_column($storeIds,'store_id'); $storeIdList = array_column($storeIds,'store_id');
$totalCount = count($storeIdList); $totalCount = count($storeIdList);
......
...@@ -114,6 +114,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -114,6 +114,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
//$pBundlingList = $this->getGroupListForCart($blIds); //$pBundlingList = $this->getGroupListForCart($blIds);
//var_dump($pBundlingList); //var_dump($pBundlingList);
$pBundlingList = $this->getPBundlingListByBlIds($blIds,\Our\DbNameConst::salveDBConnectName,true); $pBundlingList = $this->getPBundlingListByBlIds($blIds,\Our\DbNameConst::salveDBConnectName,true);
$pBundlingList = $this->getResizeGroupSaleGoodsList($pBundlingList);
} }
$goodsCommonIds = $cartListData['goodsCommonIds']; $goodsCommonIds = $cartListData['goodsCommonIds'];
$goodsIds = $cartListData['goodsIds']; $goodsIds = $cartListData['goodsIds'];
...@@ -138,7 +139,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -138,7 +139,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
$tempObj['goodsName'] = $tempCart['goods_name']; $tempObj['goodsName'] = $tempCart['goods_name'];
$tempObj['goodsPrice'] = $tempCart['goods_price']; $tempObj['goodsPrice'] = $tempCart['goods_price'];
$tempObj['goodsNum'] = $tempCart['goods_num']; $tempObj['goodsNum'] = $tempCart['goods_num'];
$tempObj['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($tempCart['goods_image']); $tempObj['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($tempCart['goods_image'],\Our\ImageConst::cartBlImage);
$tempObj['type'] = $tempCart['type']; $tempObj['type'] = $tempCart['type'];
if ($tempCart['type'] == \Our\ApiConst::addBundingToCart) { if ($tempCart['type'] == \Our\ApiConst::addBundingToCart) {
$pBundling = isset($pBundlingList[$tempCart['goods_id']])?$pBundlingList[$tempCart['goods_id']]:array(); $pBundling = isset($pBundlingList[$tempCart['goods_id']])?$pBundlingList[$tempCart['goods_id']]:array();
...@@ -164,13 +165,15 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -164,13 +165,15 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
if($tempPrice){ if($tempPrice){
$tempObj['goodsPrice'] = $tempPrice; $tempObj['goodsPrice'] = $tempPrice;
} }
$tempObj['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($pBundling['image']);
$tempObj['goodsList'] = \Our\Common::convertUnderline($pBundling['goodsList']); $tempObj['goodsList'] = \Our\Common::convertUnderline($pBundling['goodsList']);
$tempObj['goodsOriginalPrice'] = $pBundling['sumPrice']; $tempObj['goodsOriginalPrice'] = $pBundling['sumPrice'];
} else if ($tempCart['type'] == \Our\ApiConst::addGoodsToCart) { } else if ($tempCart['type'] == \Our\ApiConst::addGoodsToCart) {
$goodsStorage = isset($goodsCommonStorages[$tempCart['goods_commonid']][$tempCart['goods_id']])?$goodsCommonStorages[$tempCart['goods_commonid']][$tempCart['goods_id']]:array();//$goodsDao->getOnlineStorageGoods($tempCart['goods_id']); $goodsStorage = isset($goodsCommonStorages[$tempCart['goods_commonid']][$tempCart['goods_id']])?$goodsCommonStorages[$tempCart['goods_commonid']][$tempCart['goods_id']]:array();//$goodsDao->getOnlineStorageGoods($tempCart['goods_id']);
if($goodsStorage){ if($goodsStorage){
if(isset($goodsStorage['goods_image'])&&$goodsStorage['goods_image']){ if(isset($goodsStorage['goods_image'])&&$goodsStorage['goods_image']){
$tempObj['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($goodsStorage['goods_image']); $tempObj['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($goodsStorage['goods_image'],\Our\ImageConst::cartBlImage);
} }
if ($goodsStorage['onlineFlag'] == \Our\ApiConst::one) { if ($goodsStorage['onlineFlag'] == \Our\ApiConst::one) {
if($goodsStorage['goodsStorage']>\Our\ApiConst::zero){ if($goodsStorage['goodsStorage']>\Our\ApiConst::zero){
...@@ -353,6 +356,24 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -353,6 +356,24 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
return $return; return $return;
} }
public function getResizeGroupSaleGoodsList($pbundingList, $blImageWidth = \Our\ImageConst::cartBlImage,$blDetailImageWidth = \Our\ImageConst::cartBlDetailImage){
$groupList = array();
foreach ($pbundingList as $k=>$v){
$v['image'] = ImageUtil::getGoodsImgUrl($v['image'],$blImageWidth);
if($v['goodsList']){
$goods = array();
foreach ($v['goodsList'] as $v2){
$v2['goodsImage'] = ImageUtil::getGoodsImgWithUrl($v2['goodsImage'],$blDetailImageWidth);
$goods[] = $v2;
}
$v['goodsList'] = $goods;
}
$groupList[] = $v;
}
return $groupList;
}
/** /**
* 获取组合销售与商品列表 * 获取组合销售与商品列表
* @param $param * @param $param
......
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