Commit 5b917573 authored by zhz's avatar zhz

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

parents d99769bb 72dbd34d
...@@ -1120,14 +1120,27 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1120,14 +1120,27 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
*/ */
public function storeOnlineGoodsClass(){ public function storeOnlineGoodsClass(){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance(); $storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
$plusFlag = false;
$minusFlag = false;
for($i=0;$i<2000;$i++){ for($i=0;$i<2000;$i++){
$goodsClassStr = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::plus); $goodsClassStr = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::plus);
$goodsClass = unserialize($goodsClassStr); if($goodsClassStr&&$plusFlag==false){
$this->checkExistOnlineGoodsClass($goodsClass); $goodsClass = unserialize($goodsClassStr);
$this->checkExistOnlineGoodsClass($goodsClass);
}else{
$plusFlag=true;
}
$goodsClassStrMinus = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::minus); $goodsClassStrMinus = $storeOnlineGoodsClassDao->getChangedGoodsClass(\Our\ApiConst::minus);
$goodsClassMinus = unserialize($goodsClassStrMinus); if($goodsClassStrMinus&&$minusFlag==false){
$this->checkRemoveOnlineGoodsClass($goodsClassMinus); $goodsClassMinus = unserialize($goodsClassStrMinus);
$this->checkRemoveOnlineGoodsClass($goodsClassMinus);
}else{
$minusFlag = true;
}
if($plusFlag&&$minusFlag){
break;
}
} }
} }
...@@ -1138,7 +1151,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1138,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);
} }
...@@ -1172,10 +1185,10 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -1172,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;
......
...@@ -53,6 +53,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -53,6 +53,8 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
// $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance(); // $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance();
$orderDao=\DAO\Order\OrderModel::getInstance(); $orderDao=\DAO\Order\OrderModel::getInstance();
$favoritesStoreDao=\DAO\FavoritesStoreModel::getInstance(); $favoritesStoreDao=\DAO\FavoritesStoreModel::getInstance();
$orderGoodsDao=\DAO\Order\OrderGoodsModel::getInstance();
$goodsCount=\Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsCountByStoreId'), array($storeId), ApiConst::tenDaySecond, array($storeId));
$condition['store_id'] = $storeId; $condition['store_id'] = $storeId;
//获取店铺信息 //获取店铺信息
$store = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this->storeDao, 'getInfo'), array($condition), ApiConst::tenDaySecond, array($storeId)); $store = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this->storeDao, 'getInfo'), array($condition), ApiConst::tenDaySecond, array($storeId));
...@@ -64,7 +66,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -64,7 +66,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$data['storeId'] = $store['store_id']; $data['storeId'] = $store['store_id'];
$data['storeName'] = $store['store_name']; $data['storeName'] = $store['store_name'];
$data['storeLabel'] = $store['store_label']; $data['storeLabel'] = $store['store_label'];
$data['goodsCount'] = ApiConst::zero; $data['goodsCount'] = $goodsCount;
$data['orderCount'] =$storeStats['orderCount']; $data['orderCount'] =$storeStats['orderCount'];
$data['orderTotal'] = $storeStats['orderTotal']; $data['orderTotal'] = $storeStats['orderTotal'];
$data['favCount'] = $storeFavariteCount['favCount']; $data['favCount'] = $storeFavariteCount['favCount'];
......
...@@ -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;
} }
......
...@@ -800,7 +800,10 @@ class OrderModel extends \DAO\AbstractModel ...@@ -800,7 +800,10 @@ class OrderModel extends \DAO\AbstractModel
if ($deleteGetFavoritesCountByStoreId) { if ($deleteGetFavoritesCountByStoreId) {
$favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance(); $favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance();
$favoritesStoreDao->deleteGetFavoritesCountByStoreId($stroeId); $favoritesStoreDao->deleteGetFavoritesCountByStoreId($stroeId);
} }
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::masterDBConnectName);
$orderGoodsDao->deleteOrderGoodsCache($memberId, $orderId,$stroeId);
} }
if(!empty($diliverymanId)){ if(!empty($diliverymanId)){
......
...@@ -28,6 +28,7 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -28,6 +28,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
*/ */
protected $_primaryKey = 'rec_id'; protected $_primaryKey = 'rec_id';
public $orderGoodsGoodsNumCountField=" sum(goods_num) as goodsNum";
public function init(){ public function init(){
...@@ -57,10 +58,16 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -57,10 +58,16 @@ class OrderGoodsModel extends \DAO\AbstractModel {
} }
public function getOrderGoods($where,$field,$db=DbNameConst::salveDBConnectName){ public function getOrderGoods($where,$field,$db=DbNameConst::salveDBConnectName){
$this->setDb($db); $this->setDb($this->dbName);
$list = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll(); $list = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll();
return $list; return $list;
} }
public function getOrderGoodsCountByStoreId($storeId){
$this->setDb($this->dbName);
$where['store_id']=$storeId;
$goodsCount = $this->db->select($this->orderGoodsGoodsNumCountField)->from($this->_tableName)->where($where)->fetchNum();
return $goodsCount;
}
/** /**
* 获取单条数据 * 获取单条数据
* @param $where * @param $where
...@@ -100,13 +107,16 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -100,13 +107,16 @@ class OrderGoodsModel extends \DAO\AbstractModel {
return $this->getOrderGoods($where,$field); return $this->getOrderGoods($where,$field);
} }
public function deleteOrderGoodsCache($memberId,$orderIds){ public function deleteOrderGoodsCache($memberId,$orderIds,$storeId=false){
if($memberId){ if($memberId){
return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsByOrderIds'), array($memberId)); return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsByOrderIds'), array($memberId));
} }
if($orderIds){ if($orderIds){
return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsByOrderIds'), array($orderIds)); return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsByOrderIds'), array($orderIds));
} }
if(!empty($storeId)){
return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getOrderGoodsCountByStoreId'), array($storeId));
}
} }
public function getIsRefundMoney($orderGoodses,$promotionsId){ public function getIsRefundMoney($orderGoodses,$promotionsId){
$isRefundMoney=ApiConst::zero; $isRefundMoney=ApiConst::zero;
......
...@@ -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);
......
...@@ -56,6 +56,7 @@ class cliStoreOnlineGoodsClass extends basecli ...@@ -56,6 +56,7 @@ class cliStoreOnlineGoodsClass extends basecli
} }
// Step: 02 检查是否已有相同CLI在运行中 // Step: 02 检查是否已有相同CLI在运行中
$lockDir=$this->_getBaseFileName('storeOnlineGoodsClass'); $lockDir=$this->_getBaseFileName('storeOnlineGoodsClass');
echo $lockDir;
if(!$this->mkdirs($lockDir)){ if(!$this->mkdirs($lockDir)){
echo '****create dir fail ****'; echo '****create dir fail ****';
exit; exit;
...@@ -82,7 +83,7 @@ class cliStoreOnlineGoodsClass extends basecli ...@@ -82,7 +83,7 @@ class cliStoreOnlineGoodsClass extends basecli
} }
} }
$oCli = new cliShopkeeperIndex(TRUE); $oCli = new cliStoreOnlineGoodsClass(TRUE);
EXIT; EXIT;
?> ?>
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