Commit 305d122d authored by wwccw0591's avatar wwccw0591

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

parents db83c8af 5b917573
...@@ -350,14 +350,24 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -350,14 +350,24 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
//商品图片表 //商品图片表
$goodsImagesInstance = \DAO\GoodsImagesModel::getInstance(); $goodsImagesInstance = \DAO\GoodsImagesModel::getInstance();
$image = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsImagesRedisModel::getInstance(),array(&$goodsImagesInstance, 'getListByCommonId'),array($goodsCommonId,'attr_name,attr_value,goods_image'),\Our\ApiConst::oneDaySecond,array($goodsCommonId)); $image = \Our\RedisHelper::cachedFunction(\Redis\Db4\GoodsImagesRedisModel::getInstance(),array(&$goodsImagesInstance, 'getListByCommonId'),array($goodsCommonId,'attr_name,attr_value,goods_image'),\Our\ApiConst::oneDaySecond,array($goodsCommonId));
$attrImage = [];
$images = []; $images = [];
$haveImg = false;
$goodsImageGroup = unserialize($commonInfo['goods_image_group']);
if($goodsImageGroup) {
$haveImg = true;
foreach ($goodsImageGroup as $v) {
$images[] = \Our\ImageUtil::getGoodsImgUrl($v,\Our\ImageConst::goodsDetailImgSize);
}
}
$attrImage = [];
if($image && is_array($image)){ if($image && is_array($image)){
$i = 0; $i = 0;
foreach ($image as $k=>$v){ foreach ($image as $k=>$v){
$image[$k]['goods_image'] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::SpecSelectGoodsImgSize); $image[$k]['goods_image'] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::SpecSelectGoodsImgSize);
$attrImage[$v['attr_name']][$v['attr_value']][] = $image[$k]['goods_image']; $attrImage[$v['attr_name']][$v['attr_value']][] = $image[$k]['goods_image'];
if($i < 5 ){ if($i < 5 && !$haveImg){
$images[] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::goodsDetailImgSize); $images[] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::goodsDetailImgSize);
} }
$i += 1; $i += 1;
...@@ -1141,7 +1151,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1141,7 +1151,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
*/ */
public function checkExistOnlineGoodsClass($goodsClass){ public function checkExistOnlineGoodsClass($goodsClass){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance(); $storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
$oldTemp = $storeOnlineGoodsClassDao->find($goodsClass); $oldTemp = $storeOnlineGoodsClassDao->findByWhere($goodsClass);
if(!$oldTemp){ if(!$oldTemp){
$storeOnlineGoodsClassDao->insert($goodsClass); $storeOnlineGoodsClassDao->insert($goodsClass);
} }
...@@ -1175,10 +1185,10 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1175,10 +1185,10 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$topSaleList = array(); $topSaleList = array();
for($i=0;$i<2000;$i++){ for($i=0;$i<2000;$i++){
$storeId = $storeTopSaleGoodsModel->getChangedSaleStoreId(); $storeId = $storeTopSaleGoodsModel->getChangedSaleStoreId();
if(!$storeId){ if($storeId!==false){
break; break;
} }
if(!($storeIds&&in_array($storeId,$storeIds))){ if($storeIds&&!($storeIds&&in_array($storeId,$storeIds))){
$topSaleList=$storeTopSaleGoodsModel->getStoreTopSaleGoodsListByStoreId($storeId); $topSaleList=$storeTopSaleGoodsModel->getStoreTopSaleGoodsListByStoreId($storeId);
$storeTopSaleList = $this->getNewStoreTopSaleGoodsList($topSaleList,$storeId); $storeTopSaleList = $this->getNewStoreTopSaleGoodsList($topSaleList,$storeId);
$topSaleList = $topSaleList?array_merge($topSaleList,$storeTopSaleList):$storeTopSaleList; $topSaleList = $topSaleList?array_merge($topSaleList,$storeTopSaleList):$storeTopSaleList;
......
...@@ -454,6 +454,9 @@ class AddressServiceModel extends \Business\AbstractModel { ...@@ -454,6 +454,9 @@ class AddressServiceModel extends \Business\AbstractModel {
if(!($address['address']&&$address['name'])){ if(!($address['address']&&$address['name'])){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyAddressAndName); \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyAddressAndName);
} }
if(!($address['tag_type']>=\Our\ApiConst::zero&&$address['tag_type']<=3)){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::wrongAddressTagType);
}
if($province){ if($province){
$province = mb_substr($province,0,2); $province = mb_substr($province,0,2);
$provinceList = $areaList[\Our\ApiConst::zero]; $provinceList = $areaList[\Our\ApiConst::zero];
......
...@@ -84,6 +84,7 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{ ...@@ -84,6 +84,7 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{
* @return mixed * @return mixed
*/ */
public function getStoreTopSaleGoodsListByStoreId($storeId){ public function getStoreTopSaleGoodsListByStoreId($storeId){
$this->setDb();
$sql = \Our\Common::format('SELECT a.store_id,a.sale_num,a.goods_commonid,IFNULL((evaluation_score/evaluation_number),{0}) as goods_score,a.group_id as rank,a.goods_name,a.goods_image $sql = \Our\Common::format('SELECT a.store_id,a.sale_num,a.goods_commonid,IFNULL((evaluation_score/evaluation_number),{0}) as goods_score,a.group_id as rank,a.goods_name,a.goods_image
FROM FROM
( (
...@@ -101,6 +102,7 @@ WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\Api ...@@ -101,6 +102,7 @@ WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\Api
* @return mixed * @return mixed
*/ */
public function getSourceGoodsList(){ public function getSourceGoodsList(){
$this->setDb();
$sql = 'SELECT a.store_id,a.goods_commonid,IFNULL(a.evaluation_score/a.evaluation_number,'.\Our\ApiConst::defaultGoodsScore.') as goods_score,a.group_id as rank,a.goods_name,a.goods_image $sql = 'SELECT a.store_id,a.goods_commonid,IFNULL(a.evaluation_score/a.evaluation_number,'.\Our\ApiConst::defaultGoodsScore.') as goods_score,a.group_id as rank,a.goods_name,a.goods_image
FROM FROM
( (
......
...@@ -36,6 +36,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{ ...@@ -36,6 +36,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
public function insert($data){ public function insert($data){
$this->setDb(\Our\DbNameConst::masterDBConnectName); $this->setDb(\Our\DbNameConst::masterDBConnectName);
$data['gmt_create'] = TIMESTAMP; $data['gmt_create'] = TIMESTAMP;
$data['gmt_update'] = TIMESTAMP;
$result = $this->db->insert($this->_tableName)->rows($data)->execute(); $result = $this->db->insert($this->_tableName)->rows($data)->execute();
if($result){ if($result){
$storeId = $data['store_id']; $storeId = $data['store_id'];
...@@ -47,9 +48,11 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{ ...@@ -47,9 +48,11 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
public function del($where){ public function del($where){
$this->setDb(\Our\DbNameConst::masterDBConnectName); $this->setDb(\Our\DbNameConst::masterDBConnectName);
$temp = $this->findByWhere($where);
$result = $this->db->delete($this->_tableName)->where($where)->execute(); $result = $this->db->delete($this->_tableName)->where($where)->execute();
if($result){
$storeId = $where['store_id'];
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$this, 'getList'),array(),array($storeId));
}
return $result; return $result;
} }
......
...@@ -354,6 +354,7 @@ const notAllowDelete=300114; ...@@ -354,6 +354,7 @@ const notAllowDelete=300114;
const emptyCityId = 140019; const emptyCityId = 140019;
const emptyDistrictId = 140020; const emptyDistrictId = 140020;
const emptyAddressAndName = 140021; const emptyAddressAndName = 140021;
const wrongAddressTagType = 140022;
//消息,推送等 //消息,推送等
const removeMessage=150001; const removeMessage=150001;
...@@ -580,6 +581,7 @@ const notAllowDelete=300114; ...@@ -580,6 +581,7 @@ const notAllowDelete=300114;
self::emptyCityId => '找不到对应城市', self::emptyCityId => '找不到对应城市',
self::emptyDistrictId => '找不到对应区', self::emptyDistrictId => '找不到对应区',
self::emptyAddressAndName => '地址和具体街道不能为空', self::emptyAddressAndName => '地址和具体街道不能为空',
self::wrongAddressTagType => '地址标签传输错误',
self::emptyLatLng => '经纬度不能为空', self::emptyLatLng => '经纬度不能为空',
self::emptyCityCode => '高德地图城市编码不能为空', self::emptyCityCode => '高德地图城市编码不能为空',
......
...@@ -96,7 +96,12 @@ class AbstractModel extends \Redis\AbstractModel { ...@@ -96,7 +96,12 @@ class AbstractModel extends \Redis\AbstractModel {
return $this->lpush($this->calcKey($h),$value); return $this->lpush($this->calcKey($h),$value);
} }
public function tableLPop($h){ public function tableLPop($h){
return $this->lpop($this->calcKey($h)); if($res=$this->lpop($this->calcKey($h))){
return $res;
}else{
return false;
}
} }
public function tableSRandMember($h,$count = null){ public function tableSRandMember($h,$count = null){
return $this->sRandMember($this->calcKey($h),$count); return $this->sRandMember($this->calcKey($h),$count);
......
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