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
//商品图片表
$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));
$attrImage = [];
$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)){
$i = 0;
foreach ($image as $k=>$v){
$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 ){
if($i < 5 && !$haveImg){
$images[] = \Our\ImageUtil::getGoodsImgUrl($v['goods_image'],\Our\ImageConst::goodsDetailImgSize);
}
$i += 1;
......@@ -1141,7 +1151,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
*/
public function checkExistOnlineGoodsClass($goodsClass){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
$oldTemp = $storeOnlineGoodsClassDao->find($goodsClass);
$oldTemp = $storeOnlineGoodsClassDao->findByWhere($goodsClass);
if(!$oldTemp){
$storeOnlineGoodsClassDao->insert($goodsClass);
}
......@@ -1175,10 +1185,10 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$topSaleList = array();
for($i=0;$i<2000;$i++){
$storeId = $storeTopSaleGoodsModel->getChangedSaleStoreId();
if(!$storeId){
if($storeId!==false){
break;
}
if(!($storeIds&&in_array($storeId,$storeIds))){
if($storeIds&&!($storeIds&&in_array($storeId,$storeIds))){
$topSaleList=$storeTopSaleGoodsModel->getStoreTopSaleGoodsListByStoreId($storeId);
$storeTopSaleList = $this->getNewStoreTopSaleGoodsList($topSaleList,$storeId);
$topSaleList = $topSaleList?array_merge($topSaleList,$storeTopSaleList):$storeTopSaleList;
......
......@@ -454,6 +454,9 @@ class AddressServiceModel extends \Business\AbstractModel {
if(!($address['address']&&$address['name'])){
\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){
$province = mb_substr($province,0,2);
$provinceList = $areaList[\Our\ApiConst::zero];
......
......@@ -84,6 +84,7 @@ class StoreTopSaleGoodsModel extends \DAO\AbstractModel{
* @return mixed
*/
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
FROM
(
......@@ -101,6 +102,7 @@ WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\Api
* @return mixed
*/
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
FROM
(
......
......@@ -36,6 +36,7 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
public function insert($data){
$this->setDb(\Our\DbNameConst::masterDBConnectName);
$data['gmt_create'] = TIMESTAMP;
$data['gmt_update'] = TIMESTAMP;
$result = $this->db->insert($this->_tableName)->rows($data)->execute();
if($result){
$storeId = $data['store_id'];
......@@ -47,9 +48,11 @@ class StoreOnlineGoodsClassModel extends \DAO\AbstractModel{
public function del($where){
$this->setDb(\Our\DbNameConst::masterDBConnectName);
$temp = $this->findByWhere($where);
$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;
}
......
......@@ -354,6 +354,7 @@ const notAllowDelete=300114;
const emptyCityId = 140019;
const emptyDistrictId = 140020;
const emptyAddressAndName = 140021;
const wrongAddressTagType = 140022;
//消息,推送等
const removeMessage=150001;
......@@ -580,6 +581,7 @@ const notAllowDelete=300114;
self::emptyCityId => '找不到对应城市',
self::emptyDistrictId => '找不到对应区',
self::emptyAddressAndName => '地址和具体街道不能为空',
self::wrongAddressTagType => '地址标签传输错误',
self::emptyLatLng => '经纬度不能为空',
self::emptyCityCode => '高德地图城市编码不能为空',
......
......@@ -96,7 +96,12 @@ class AbstractModel extends \Redis\AbstractModel {
return $this->lpush($this->calcKey($h),$value);
}
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){
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