Commit b93566ed authored by wwccw0591's avatar wwccw0591

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into ccw

parents b643e808 833faa2d
......@@ -86,8 +86,8 @@ class UserController extends \Our\Controller_AbstractIndex {
$data['userType'] = \Our\ApiConst::wechatUserType;
$member= $this->memberService->loginWithWechatInfo($data,$authInfo);
if($member){
$userToken=$this->memberService->findMbUserTokenByMemberId($member['member_id']);
$this->memberService->clearKey($userToken['token']);
/*$userToken=$this->memberService->findMbUserTokenByMemberId($member['member_id']);
$this->memberService->clearKey($userToken['token']);*/
$this->memberService->clearKey($this->key);
$this->key=Common::bulidToken('', '', '', \Our\ApiConst::wechatDeviceType);
session_id($this->key);
......@@ -95,7 +95,7 @@ class UserController extends \Our\Controller_AbstractIndex {
$this->sess['user_type'] = \Our\ApiConst::wechatUserType;
$this->sess[NameConst::sessionKey]=$this->key;
$member[NameConst::sessionKey]=$this->key;
$this->memberService->saveMember($member);
//$this->memberService->saveMember($member);
$this->success(array('key'=>$this->key,'memberName'=>$member['member_name'],'memberAvatar'=>$member['memberAvatarUrl']));
}
......
......@@ -90,5 +90,19 @@ class ImageConst{
4=>self::reportPath
);
const sizeScale = 1.5;
const goodsListImgSize = 334;
const CommentGoodsImgSize = 138;
const CommentDetailGoodsImgSize = 148;
const SaleGoodsImgSize = 148;
const SpecSelectGoodsImgSize = 450;//规格弹出框(含购物车)
const goodsDetailImgSize = 750;
const goodsCollectionImgSize = 336;
const footPrintGoodsImgSize = 216;
const circleStoreLabel = 124;
const commentCircleStoreLabel = 48;
const storeQualificationImg = 188;
const storeCollectionImg = 112;
const homeIndexHotGoodsImageSize =250;
}
......@@ -112,11 +112,9 @@ class ImageUtil {
* @param int $type 图片规格
* @return mixed|string 返回图片路径
*/
public static function getGoodsImgUrl($goodsImg,$type=240){
// if(!in_array($type,\Our\ArrayConst::goodsImageExt)){
// $type = 240;
// }
public static function getGoodsImgUrl($goodsImg,$width=\Our\ImageConst::goodsListImgSize, $height = 0){
$width = $width * \Our\ImageConst::sizeScale;
$height ? $height = $height * \Our\ImageConst::sizeScale : $height = $width;
if (empty($goodsImg)) {
$directory =\Our\ImageConst::defaultPath;
//$goodsImg = str_ireplace('.', '_' . $type . '.', 'default_goods_image.gif');
......@@ -128,7 +126,7 @@ class ImageUtil {
//$goodsImg .= '?x-oss-process=image/resize,m_pad,h_226,w_334';
}
$goodsImg = \Our\Common::getStaticFile($goodsImg,$directory);
$goodsImg .= '?x-oss-process=image/resize,m_fixed,h_226,w_334';
$goodsImg .= "?x-oss-process=image/resize,m_fill,h_{$height},w_{$width}";
return $goodsImg;
}
......
......@@ -24,7 +24,7 @@ class CommentServiceModel extends \Business\AbstractModel {
if(is_array($list) && !empty($list)){
$totalCount = \Our\RedisHelper::cachedFunction(\Redis\Db6\CommentToBuyerRedisModel::getInstance(),array(&$CommentToBuyerDAO, 'getCount'),array($where),\Our\ApiConst::oneHour,array($memberId));
foreach ($list as $v){
$comments[] = array('id'=>$v['id'],'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($v['goods_image']),'content'=>$v['content'],'state'=>$v['state'],'addTime'=>$v['addtime']);
$comments[] = array('id'=>$v['id'],'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::CommentGoodsImgSize),'content'=>$v['content'],'state'=>$v['state'],'addTime'=>$v['addtime']);
}
}else{
$totalCount = 0;
......@@ -61,10 +61,11 @@ 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']),'goodsAttr'=>$attr,'goodsPrice'=>(int)$comment['goods_pay_price'],'storeLabel'=>$storeLabel,'storeName'=>$storeInfo['store_name'],'storeId'=>$comment['store_id'],'goodsCommonId'=>$goodsCommonId,'groupId'=>$groupId);
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);
}
private static $_instance = null;
/**
......
......@@ -263,7 +263,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
if(is_array($list) && !empty($list)){
$totalCount = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getCount'),array(implode(' and ',$where),$attrStr),\Our\ApiConst::oneDaySecond,array($storeId));
foreach ($list as $v){
$v['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($v['goodsImage'],360);
$v['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($v['goodsImage']);
$v['goodsPrice'] = (int)$v['goodsPrice'];
unset($v['goods_price']);
$goods[] = $v;
......@@ -335,7 +335,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
public function getAttr($goodsCommonId,$memberId = null){
$goodsCommonId = (int)$goodsCommonId;
$commonInfo = $this->checkGoodsCommon($goodsCommonId);
$commonInfo['goods_image'] = \Our\ImageUtil::getGoodsImgUrl($commonInfo['goods_image']);
$commonInfo['goods_image'] = \Our\ImageUtil::getGoodsImgUrl($commonInfo['goods_image'],\Our\ImageConst::SpecSelectGoodsImgSize);
//该用户是否有参加销售活动
//$activities = $this->isJoin($commonInfo['store_id'],$memberId);
$activities = \DAO\SaleMemberModel::getInstance()->isJoinStore($commonInfo['store_id'],$memberId);
......@@ -350,10 +350,10 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
if($image && is_array($image)){
$i = 0;
foreach ($image as $k=>$v){
$image[$k]['goods_image'] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],1280);
$image[$k]['goods_image'] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::SpecSelectGoodsImgSize);
$attrImage[$v['attr_name']][$v['attr_value']][] = $image[$k]['goods_image'];
if($i < 5 ){
$images[] = $image[$k]['goods_image'];
$images[] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::goodsDetailImgSize);
}
$i += 1;
}
......@@ -975,7 +975,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$goods[] = [
'goodsCommonId'=>$v['goods_commonid'],
'goodsName'=>$v['goods_name'],
'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($v['goods_image'],360),
'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($v['goods_image']),
'goodsMarketPrice'=>$v['goods_marketprice'],
'goodsPrice'=>$v['goods_price']
];
......
......@@ -44,7 +44,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
$data['image'] = [];
if($blImg = unserialize($data['bl_image'])){
foreach ($blImg as $v){
$data['image'][] = \Our\ImageUtil::getGoodsImgUrl($v,1280);
$data['image'][] = \Our\ImageUtil::getGoodsImgUrl($v,\Our\ImageConst::goodsDetailImgSize);
}
}
$data['goods'] = [];
......
......@@ -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);
}
}
}
......@@ -762,9 +762,22 @@ class StoreServiceModel extends \Business\AbstractModel{
}
$goods = [];
if(is_array($list) && !empty($list)){
foreach ($list as $v){
foreach ($list as $k=>$v){
unset($v['goods_price']);
$v['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($v['goodsImage'],360);
switch ($k) {
case 0:
$v['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($v['goodsImage'],300, 410);
break;
case 1:
$v['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($v['goodsImage'],380, 198);
break;
case 2:
$v['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($v['goodsImage'],380, 198);
break;
default:
$v['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($v['goodsImage'],380, 198);
break;
}
$v['goodsPrice'] = (int)$v['goodsPrice'];
$goods[] = $v;
}
......
......@@ -35,6 +35,9 @@ class AddressServiceModel extends \Business\AbstractModel {
$where['address_id'] = $addressId;
$result = $addressDao->update($address,$where);
\Our\RedisHelper::delCachedFunction(\Redis\Db8\AddressRedisModel::getInstance(),array(&$addressDao, 'findByWhereWithColumns'),array(),array($addressId));
if($result!==false){
$result = true;
}
}else{
$result = $addressDao->insert($address);
$addressId = $result;
......
......@@ -78,7 +78,7 @@ class FootprintServiceModel extends \Business\AbstractModel
'goodsCommonId'=>$goodsCommon['goods_commonid'],
'groupId'=>0,
'goodsName'=>$goodsCommon['goods_name'],
'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($goodsCommon['goods_image'],360),
'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($goodsCommon['goods_image'],\Our\ImageConst::footPrintGoodsImgSize),
'goodsPrice'=>$goodsCommon['goods_price'],
'viewDate'=>$dates[$v]
];
......@@ -92,7 +92,7 @@ class FootprintServiceModel extends \Business\AbstractModel
$list = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsCommonRedisModel::getInstance(),array(&$commonDAO, 'getListWithSale'),array($where,$field,$acts,[],[],'',false),\Our\ApiConst::oneMinute);;
if($list){
foreach ($list as $goodsCommon) {
$goodsCommon['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($goodsCommon['goodsImage'],360);
$goodsCommon['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($goodsCommon['goodsImage'],\Our\ImageConst::footPrintGoodsImgSize);
$goodsCommon['viewDate'] = $dates[$goodsCommon['goodsCommonId']];
$goodsCommon['groupId'] = 0;
//$footPrints[] = $goodsCommon;
......@@ -113,7 +113,7 @@ class FootprintServiceModel extends \Business\AbstractModel
'goodsCommonId'=>0,
'groupId'=>$group['blId'],
'goodsName'=>$group['name'],
'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($group['image'],360),
'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($group['image'],\Our\ImageConst::footPrintGoodsImgSize),
'goodsPrice'=>$group['discountPrice'],
'viewDate'=>$dates[$group['blId']]
];
......
......@@ -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);
......@@ -254,7 +254,7 @@ class MemberCenterServiceModel extends \Business\AbstractModel
// }
foreach ($list as $v){
//if($stores['store_id'] && $stores['store_id']['open_flag'] == 1 && $stores['store_id']['store_state'] == 1) {
$goods[] = array('favid'=>$v['favid'],'goodsCommonId'=>$v['goods_commonid'],'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($v['goods_image']),'goodsName'=>$v['goods_name'],'goodsPrice'=>$v['goods_price'],'goodsId'=>$v['goods_id']);
$goods[] = array('favid'=>$v['favid'],'goodsCommonId'=>$v['goods_commonid'],'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\our\ApiConst::goodsCollectionImgSize),'goodsName'=>$v['goods_name'],'goodsPrice'=>$v['goods_price'],'goodsId'=>$v['goods_id']);
// }
}
if($where) {
......
......@@ -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']);
$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']),
'goodsImage'=>\Our\ImageUtil::getGoodsImgUrl($goodsList[$id]['goods_image'],\Our\ImageConst::SaleGoodsImgSize),
'goodsName'=>$goodsList[$id]['goods_name'],
'goodsCount'=>0,
'goodsId'=>$id,
......
File mode changed from 100755 to 100644
......@@ -57,7 +57,7 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{
}
if ($orderGoods) {
foreach($orderGoods as &$goods){
$goods['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($goods['goodsImage']);
$goods['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($goods['goodsImage'],\Our\ImageConst::homeIndexHotGoodsImageSize);
}
return $orderGoods;
}
......
......@@ -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;
}
/**
......
......@@ -11,10 +11,10 @@
<form action="/user/loginWithWechatInfo" method="post">
用户头像:<input name="data[avatar]" value="https://tva3.sinaimg.cn/crop.0.1.1242.1242.180/4711809ejw8f387zus4vpj20yi0ykjwd.jpg"/><br />
key:<input name="data[key]" value="a47c3f7e20cd11d9473e39b36ce512ad"/><br />
key:<input name="data[key]" value="28d391fe06706bff971e2ef95d3dcdbb"/><br />
gender:<input name="data[gender]" value="1"/><br />
encryptedData:<input name="data[encryptedData]" value="kXGXJHHrTjZtBCvDtKLWv/utlY5AUbbvA2wleUx94n6nUiF6mcz9AUgNziDVDXokRq855pwjGtzHwxdwg3Se7Z4bJWzkCJnC1Vk/CBd1kXHz77ct9rRyruCz27VYHMjKPzfqEmVl7MfVg+xyoXYZQoUgz98yTBlREmmIfW5gEfSTKKW73mrVoXJJvszBj3VdwaqSWiSa4whds6OZWNpgUWlFxdntY0q5nBEaKTcxPfpF3QxKlFmD4bw30Q2c41M+wTeD/txDVtqEUJf9U5rSuA0cZSzgHllTEoS4KxXunasT0WhXJ0+Uow6xDkvMvSe2az1qAmVHweKTr5mp7wAGYn5GlrcG6cXRgfctEGQg6k/rJUQMLmiurE5Z0ERLeyWUUKU1ZSlPfYgfJ5L1zLzygIudHTozCjUDHhXh0/DTaCq5ZdTEw9FYL34uZ2TsiPUEGz/VgsD/CTgvw32O9PYBjfESt8aBFk+cKxt7eJZueWyly4H7YhT5k9+TTqiQ4GY/v81BcErat/Gx8Cn/UoQh7g=="/><br />
iv:<input name="data[iv]" value="yopI5yZHu+2vlaOatNyjIA=="/><br />
encryptedData:<input name="data[encryptedData]" value="7vq6fElU/Ly3EXz5o/kyPWyUW8LwN5oKkyX6k3OSJ+QVLSWv0nmhpWik7MnemEr9K6ToLaRnVmgtCqg8/D0Lq+xcyr6DQGvY1ihB8UecVoc3Qrz9A9OKGK1RvIoa82Z+KCXG1cg9BYWOXyCaoXw6HmqLiBD42nyC2uwUg3ShgiX0noo1H8uu7f2MRW5ig94JGnSgbqqVI3dh8cJW9oFA1fzPrT/48NbUWJjbApPhuR4SCLkf6a2d628t7Giym296BZ9jUTalJDTKxI3jWgr1ll7G0toE9oePrkvH5c9BWgDJ+YrdjpqSTeXXpiHFPDpBQqt8d0+5t6m5kGmGSKi0zM9ze+u/t3qL5b3uBo9GPAGpUrVZeBYlxUEoxGruFwdg6H/cPMQOOlSyabsiF9VMLl+kdAW4C2SunZIHgvYZ3dhyaDHJOqcCUSuqVTZY7Yi/X8U+uVFxCRDNRAJ/L39kHP/p+eDqoaMZethMKp/bfPQGCL32RSQzFA1BEcoZ9AEZMLZCIyS6vvjNlw/LHyUVQg=="/><br />
iv:<input name="data[iv]" value="3pbYLsryffNZbzPqaNBneQ=="/><br />
nickname:<input name="data[nickname]" value="lindongming123"/><br />
<input type="submit" value="提交">
</form>
......
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