Commit 9a3c2507 authored by liuyuzhen's avatar liuyuzhen

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

parents 3f321f14 47a6b62c
...@@ -101,7 +101,7 @@ class Common ...@@ -101,7 +101,7 @@ class Common
return $url; return $url;
} }
function is_https() { public static function is_https() {
if ( !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') { if ( !empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') {
return true; return true;
} elseif ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) { } elseif ( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https' ) {
......
...@@ -169,7 +169,7 @@ class EvaluationServiceModel extends \Business\AbstractModel { ...@@ -169,7 +169,7 @@ class EvaluationServiceModel extends \Business\AbstractModel {
//删除缓存 //删除缓存
\Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(),array(&$orderInstance, 'find'),array(),array($order['order_id'])); \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(),array(&$orderInstance, 'find'),array(),array($order['order_id']));
//\DAO\MemberModel::getInstance()->_changeNum(\Our\NameConst::waitEvaluate,$memberId,-1); //\DAO\MemberModel::getInstance()->_changeNum(\Our\NameConst::waitEvaluate,$memberId,-1);
$orderInstance->deleteOrderCache($memberId, $order['order_id']); $orderInstance->deleteOrderCache($memberId, $order['order_id'],$order['store_id']);
} }
/** /**
......
...@@ -23,6 +23,9 @@ class GroupSaleServiceModel extends \Business\AbstractModel { ...@@ -23,6 +23,9 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
public function getGroupGoods($param){ public function getGroupGoods($param){
$groupId = intval($param['groupId']); $groupId = intval($param['groupId']);
$groupList = $this->getPBundlingListByBlIds(array($groupId)); $groupList = $this->getPBundlingListByBlIds(array($groupId));
if(!$groupList){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyPBundlingdForOrder);
}
$data = $groupList[0]; $data = $groupList[0];
if($data['goodsCountFlag'] === false){ if($data['goodsCountFlag'] === false){
$data['state'] = 0; $data['state'] = 0;
......
...@@ -274,7 +274,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -274,7 +274,7 @@ class OrderServiceModel extends \Business\AbstractModel
$res=$orderDao->updateStatusByOrderId($orderId, ApiConst::orderStateCancel); $res=$orderDao->updateStatusByOrderId($orderId, ApiConst::orderStateCancel);
if($res){ if($res){
if ($memberId) { if ($memberId) {
$orderDao->deleteOrderCache($memberId, $orderId); $orderDao->deleteOrderCache($memberId, $orderId,$order['store_id']);
// $memberDao->fromOrderStateToOrderState($memberId,$order['order_state'],ApiConst::orderStateCancel); // $memberDao->fromOrderStateToOrderState($memberId,$order['order_state'],ApiConst::orderStateCancel);
} }
} }
...@@ -296,7 +296,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -296,7 +296,7 @@ class OrderServiceModel extends \Business\AbstractModel
if ($isAllowConfirm) { if ($isAllowConfirm) {
$res = $orderDao->updateStatusByOrderId($orderId, ApiConst::orderStateComplete, TRUE); $res = $orderDao->updateStatusByOrderId($orderId, ApiConst::orderStateComplete, TRUE);
if ($res) { if ($res) {
$orderDao->deleteOrderCache($memberId, $orderId); $orderDao->deleteOrderCache($memberId, $orderId,$order['store_id']);
\Our\RedisHelper::memberTotalFromStateToState($memberId,$order['order_state'],ApiConst::orderStateComplete); \Our\RedisHelper::memberTotalFromStateToState($memberId,$order['order_state'],ApiConst::orderStateComplete);
return true; return true;
} else { } else {
...@@ -395,7 +395,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -395,7 +395,7 @@ class OrderServiceModel extends \Business\AbstractModel
$orders = $orderDao->getOrdersByOrderState(ApiConst::orderStateWaitConfirm, 'add_time', ApiConst::orderStateWaitConfirmBeyond, $this->orderMessageField); $orders = $orderDao->getOrdersByOrderState(ApiConst::orderStateWaitConfirm, 'add_time', ApiConst::orderStateWaitConfirmBeyond, $this->orderMessageField);
if (!empty($orders)) { if (!empty($orders)) {
foreach ($orders as $order) { foreach ($orders as $order) {
$orderDao->deleteOrderCache($order['buyerId'], $order['orderId']); $orderDao->deleteOrderCache($order['buyerId'], $order['orderId'],$order['storeId']);
\Our\RedisHelper::memberTotalFromStateToState($order['buyerId'],$order['orderState'],ApiConst::orderStateClose); \Our\RedisHelper::memberTotalFromStateToState($order['buyerId'],$order['orderState'],ApiConst::orderStateClose);
} }
$res = $orderDao->updateOrdersByorderState(ApiConst::orderStateWaitConfirm, ApiConst::orderStateClose, 'add_time', ApiConst::orderStateWaitConfirmBeyond, $this->orderMessageField); $res = $orderDao->updateOrdersByorderState(ApiConst::orderStateWaitConfirm, ApiConst::orderStateClose, 'add_time', ApiConst::orderStateWaitConfirmBeyond, $this->orderMessageField);
...@@ -425,13 +425,13 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -425,13 +425,13 @@ class OrderServiceModel extends \Business\AbstractModel
if ($order['shippingType'] == ApiConst::bySeller) { if ($order['shippingType'] == ApiConst::bySeller) {
if (isset($qmDeliverymanLogsOrderIds[$order['orderId']])) { if (isset($qmDeliverymanLogsOrderIds[$order['orderId']])) {
array_push($sellerOrderIds, $order['orderId']); array_push($sellerOrderIds, $order['orderId']);
$orderDao->deleteOrderCache($order['buyerId'], $order['orderId']); $orderDao->deleteOrderCache($order['buyerId'], $order['orderId'],$order['storeId']);
} }
} else { } else {
$limitTime = TIMESTAMP - ApiConst::orderWaitRecieveThreeDays; $limitTime = TIMESTAMP - ApiConst::orderWaitRecieveThreeDays;
if ($order['acceptTime'] < $limitTime) { if ($order['acceptTime'] < $limitTime) {
array_push($expressOrderIds, $order['orderId']); array_push($expressOrderIds, $order['orderId']);
$orderDao->deleteOrderCache($order['buyerId'], $order['orderId']); $orderDao->deleteOrderCache($order['buyerId'], $order['orderId'],$order['storeId']);
} }
} }
\Our\RedisHelper::memberTotalFromStateToState($order['buyerId'],$order['orderState'],ApiConst::orderStateComplete); \Our\RedisHelper::memberTotalFromStateToState($order['buyerId'],$order['orderState'],ApiConst::orderStateComplete);
...@@ -642,7 +642,7 @@ class OrderServiceModel extends \Business\AbstractModel ...@@ -642,7 +642,7 @@ class OrderServiceModel extends \Business\AbstractModel
$push=Push::getInstance(); $push=Push::getInstance();
$push->reacheRemind($order['buyerId'],$order['orderId'],$order['orderSn']); $push->reacheRemind($order['buyerId'],$order['orderId'],$order['orderSn']);
} }
$orderDao->deleteOrderCache($memberid, $qmDeliveryManLog['orderId']); $orderDao->deleteOrderCache($memberid, $qmDeliveryManLog['orderId'],$order['storeId']);
$qmDeliverymanLogDao->deleteOrderCache($deliverymanId, $id); $qmDeliverymanLogDao->deleteOrderCache($deliverymanId, $id);
return $updateResult; return $updateResult;
} else { } else {
......
...@@ -46,27 +46,31 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -46,27 +46,31 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
//获得统计数据 //获得统计数据
public function getStatistics($memberId) public function getStatistics($memberId)
{ {
$storeId = $this->_getStoreByMemberId($memberId); $memberDao=\DAO\MemberModel::getInstance();
$storeStatisticsDayDao = \DAO\Store\StoreStatisticsDayModel::getInstance(); $storeId=$memberDao->getInfo($memberId,'store_id');
$storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance(); //$storeId = $this->_getStoreByMemberId($memberId);
// $storeStatisticsDayDao = \DAO\Store\StoreStatisticsDayModel::getInstance();
// $storeStatisticsDao = \DAO\StoreStatisticsModel::getInstance();
$orderDao=\DAO\Order\OrderModel::getInstance();
$favoritesStoreDao=\DAO\FavoritesStoreModel::getInstance();
$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));
//获取店铺数据统计 //获取店铺数据统计
$storeStats = $storeStatisticsDao->find($condition); //$storeStats = $storeStatisticsDao->find($condition);
//获取店铺今日销售额和订单量 //获取店铺今日销售额和订单量
$today = date('Y-m-d', TIMESTAMP); $storeStats = $orderDao->getShopKeeperCountByStoreIdCache($storeId);
$storeTodayStats = $storeStatisticsDayDao->getByStoreIdAndGmtCreate($storeId, $today); $storeFavariteCount=$favoritesStoreDao->getFavoritesCountByStoreIdCache($storeId);
$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'] = isset($storeStats['goodsCount']) ? $storeStats['goodsCount'] : ApiConst::zero; $data['goodsCount'] = ApiConst::zero;
$data['orderCount'] = isset($storeStats['orderCount']) ? $storeStats['orderCount'] : ApiConst::zero; $data['orderCount'] =$storeStats['orderCount'];
$data['orderTotal'] = isset($storeStats['orderTotal']) ? $storeStats['orderTotal'] : ApiConst::zero; $data['orderTotal'] = $storeStats['orderTotal'];
$data['favCount'] = isset($storeStats['favCount']) ? $storeStats['favCount'] : ApiConst::zero; $data['favCount'] = $storeFavariteCount['favCount'];
$data['todayOrderCount'] = isset($storeTodayStats['orderCount']) ? $storeTodayStats['orderCount'] : ApiConst::zero; $data['todayOrderCount'] = $storeStats['todayOrderCount'];
$data['todayOrderTotal'] = isset($storeTodayStats['orderTotal']) ? $storeTodayStats['orderTotal'] : ApiConst::zero; $data['todayOrderTotal'] = $storeStats['todayOrderTotal'];
$data['tadayFavCount'] = isset($storeTodayStats['favCount']) ? $storeTodayStats['favCount'] : ApiConst::zero; $data['tadayFavCount'] = $storeFavariteCount['todayFavCount'];
return $data; return $data;
} }
...@@ -233,7 +237,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -233,7 +237,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
} else { } else {
$update_data['order_state'] = ApiConst::orderStateWaitSend; $update_data['order_state'] = ApiConst::orderStateWaitSend;
$result = $orderDao->update($where, $update_data); $result = $orderDao->update($where, $update_data);
$orderDao->deleteOrderCache($order['buyer_id'], $orderId); $orderDao->deleteOrderCache($order['buyer_id'], $orderId,$order['store_id']);
\Our\RedisHelper::memberTotalFromStateToState($order['buyer_id'], $order['order_state'], ApiConst::orderStateWaitSend); \Our\RedisHelper::memberTotalFromStateToState($order['buyer_id'], $order['order_state'], ApiConst::orderStateWaitSend);
return $result; return $result;
} }
...@@ -475,6 +479,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -475,6 +479,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
public function insertStoreMemberStatics() public function insertStoreMemberStatics()
{ {
$orderGoodDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName); $orderGoodDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$orderDao=\DAO\Order\OrderModel::getInstance();
$storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName); $storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName);
$gmtCreate = file_get_contents($this->baseDir . PathConst::orderGoodsCreateTime); $gmtCreate = file_get_contents($this->baseDir . PathConst::orderGoodsCreateTime);
$gmtCreate = $gmtCreate ? $gmtCreate : ApiConst::zero; $gmtCreate = $gmtCreate ? $gmtCreate : ApiConst::zero;
...@@ -485,6 +490,13 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -485,6 +490,13 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$addDatas = array(); $addDatas = array();
$storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize); $storeMemberStatisticData = $orderGoodDao->getMemberStoreStaticsByCreateTime($beginTime, $this->taskIndex, $this->taskSize);
$storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false; $storeMemberStatisticData = isset($storeMemberStatisticData['list']) ? $storeMemberStatisticData['list'] : false;
$orderIds=array_column($storeMemberStatisticData,'orderId');
array_unique($orderIds);
if(!empty($orderIds)){
$orders=$orderDao->getByOrderId($orderIds,'order_amount as orderAmount,order_id as orderId','orderId');
}else{
$orders=[];
}
if ($storeMemberStatisticData) { if ($storeMemberStatisticData) {
$this->taskIndex++; $this->taskIndex++;
foreach ($storeMemberStatisticData as $value) { foreach ($storeMemberStatisticData as $value) {
...@@ -496,9 +508,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel ...@@ -496,9 +508,10 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderGoodsCount'] = $value['goodsNum']; $addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderGoodsCount'] = $value['goodsNum'];
} }
if (isset($addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'])) { if (isset($addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'])) {
$addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'] += $value['goodsPrice']; // $addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'] += $value['goodsPrice'];
$addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'] +=$orders[$value['orderId']]['orderAmount'];
} else { } else {
$addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'] = $value['goodsPrice']; $addDatas[$value['buyerId'] . '-' . $value['storeId']]['orderTotal'] = $orders[$value['orderId']]['orderAmount'];
} }
} }
} }
......
...@@ -113,7 +113,7 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -113,7 +113,7 @@ class StoreServiceModel extends \Business\AbstractModel{
$defaultDeliveryTime = (empty($formula['default_time'])?$formula[2]['time']:$formula['default_time']); $defaultDeliveryTime = (empty($formula['default_time'])?$formula[2]['time']:$formula['default_time']);
} }
if(!$defaultDeliveryTime){ if(!$defaultDeliveryTime){
$in_store_service_flag = 0; //$in_store_service_flag = 0;
$defaultDeliveryTime = 0; $defaultDeliveryTime = 0;
} }
}else{ }else{
...@@ -734,86 +734,7 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -734,86 +734,7 @@ class StoreServiceModel extends \Business\AbstractModel{
} }
return false; return false;
} }
// /**
// * 获取组合销售对应商品列表
// * @param $param
// * @return array
// * @throws \Exception
// * @throws \Our\Exception
// */
// public function getGroupSaleGoodsList($param){
// $storeId = (int)$param['storeId'];
// if(!$storeId){
// \Error\ErrorModel::throwException(\Error\CodeConfigModel::emptyStoreId);
// }
// $pageSize = (int)$param['pageSize'];
// $pageIndex = (int)$param['pageIndex'];
// if($pageSize === 0){
// \Error\ErrorModel::throwException(\Error\CodeConfigModel::commonError);
// }
// $limit = array($pageIndex*$pageSize,$pageSize);
// $where = array('store_id'=>$storeId);
// //$field = 'bl_id,bl_name,bl_title,store_id,bl_discount_price,bl_sum_price,bl_quota_starttime,bl_quota_endtime,bl_image';
// $field = 'bl_id AS blId,bl_name AS name,bl_title,store_id,store_name,bl_state,bl_quota_starttime,bl_image,bl_storage,bl_discount_price AS discountPrice,bl_sum_price AS sumPrice,bl_quota_endtime AS endTime,image';
// $pbundlingInstance = \DAO\PBundlingModel::getInstance();
//
// $list = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingRedisModel::getInstance(),array(&$pbundlingInstance, 'getList'),array($field,array('store_id'=>$storeId),$limit),\Our\ApiConst::oneDaySecond,array($storeId));
// $group = [];
// if($list){
// $totalCount = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingRedisModel::getInstance(),array(&$pbundlingInstance, 'getCount'),array(array('store_id'=>$storeId)),\Our\ApiConst::oneDaySecond,array($storeId));
// $groupList = \Business\Goods\GroupSaleServiceModel::getInstance()->getGoods($list);
// foreach ($groupList as $k=>$v){
// $v['groupId'] = $v['blId'];
// $v['image'] = \Our\ImageUtil::getGoodsImgUrl($v['image']);
// unset($v['bl_title']);
// unset($v['store_id']);
// unset($v['store_name']);
// unset($v['bl_state']);
// unset($v['bl_quota_starttime']);
// unset($v['bl_image']);
// unset($v['bl_storage']);
// unset($v['blId']);
// unset($v['goodsCountFlag']);
// unset($v['endTime']);
// $goods = [];
// if($v['goodsList']){
// foreach ($v['goodsList'] as $v2){
// unset($v2['goods_id']);
// unset($v2['goodsStorage']);
// $goods[] = $v2;
// }
// }
// unset($v['goodsList']);
// $group[$k] = $v;
// $group[$k]['goods'] = $goods;
// }
// }else{
// $totalCount = 0;
// }
//
//// var_dump($group);exit;
//// $groupSaleGoods = [];
//// $blIds = [];
//// foreach ($list as $k=>$v){
//// $groupSaleGoods[$v['bl_id']] = array('groupId'=>$v['bl_id'],'name'=>$v['bl_name'],'image'=>\DAO\PBundlingModel::getInstance()->getImgPath($v['bl_image']),'price'=>$v['bl_discount_price'],'sumPrice'=>$v['bl_sum_price']);
//// $blIds[]=$v['bl_id'];
//// }
//// if($blIds){
//// $bundingGoodsDAO = \DAO\PBundlingGoodsModel::getInstance();
//// $goods = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingGoodsRedisModel::getInstance(),array(&$bundingGoodsDAO, 'getList'),array('bl_id,goods_commonid AS goodsCommonId,goods_name AS goodsName,goods_image AS goodsImage,bl_count_price AS goodsPrice,bl_goods_price AS discountPrice,num','bl_id in('.implode(',',$blIds).')'),\Our\ApiConst::oneDaySecond,array($storeId));
//// foreach ($goods as $v){
//// $v['goodsImage'] = \Our\ImageUtil::getGoodsImgUrl($v['goodsImage']);
//// $bl_id = $v['bl_id'];
//// $v['goodsAttr'] = [];
//// unset($v['bl_id']);
//// $groupSaleGoods[$bl_id]['goods'][] = $v;
////
//// }
//// }
//// $groupSaleGoods && $groupSaleGoods = array_values($groupSaleGoods);
// return array('totalCount'=>$totalCount,'groupGoods'=>$group);
// }
/** /**
* 获取热销专区的商品 * 获取热销专区的商品
......
...@@ -105,7 +105,7 @@ class FootprintServiceModel extends \Business\AbstractModel ...@@ -105,7 +105,7 @@ class FootprintServiceModel extends \Business\AbstractModel
$field = 'bl_id AS blId,bl_name AS name,bl_title,store_id,store_name,bl_state,bl_quota_starttime,bl_image,bl_storage,bl_discount_price AS discountPrice,bl_sum_price AS sumPrice,bl_quota_endtime AS endTime,image,is_transport,transport_id'; $field = 'bl_id AS blId,bl_name AS name,bl_title,store_id,store_name,bl_state,bl_quota_starttime,bl_image,bl_storage,bl_discount_price AS discountPrice,bl_sum_price AS sumPrice,bl_quota_endtime AS endTime,image,is_transport,transport_id';
$pbundlingInstance = \DAO\PBundlingModel::getInstance(); $pbundlingInstance = \DAO\PBundlingModel::getInstance();
$where2 = ' bl_id in ('.implode(',',$groupIds).')'; $where2 = ' bl_id in ('.implode(',',$groupIds).')';
$groupList = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingRedisModel::getInstance(), array(&$pbundlingInstance, 'getList'), array($field,$where2), \Our\ApiConst::oneDaySecond); $groupList = \Our\RedisHelper::cachedFunction(\Redis\Db4\PBundlingRedisModel::getInstance(), array(&$pbundlingInstance, 'getList'), array($field,$where2), \Our\ApiConst::oneMinute);
if($groupList) { if($groupList) {
$dates = array_column($browseList,'browsedate','group_id'); $dates = array_column($browseList,'browsedate','group_id');
foreach ($groupList as $group) { foreach ($groupList as $group) {
...@@ -122,10 +122,10 @@ class FootprintServiceModel extends \Business\AbstractModel ...@@ -122,10 +122,10 @@ class FootprintServiceModel extends \Business\AbstractModel
} }
} }
foreach ($browseList as $browse) { foreach ($browseList as $browse) {
if($browse['goods_commonid']) { if($browse['goods_commonid'] && $goodsCommons[$browse['goods_commonid']]) {
$footPrints[] = $goodsCommons[$browse['goods_commonid']]; $footPrints[] = $goodsCommons[$browse['goods_commonid']];
} }
if($browse['group_id']) { if($browse['group_id'] && $groups[$browse['group_id']]) {
$footPrints[] = $groups[$browse['group_id']]; $footPrints[] = $groups[$browse['group_id']];
} }
} }
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
namespace DAO; namespace DAO;
use OSS\Common;
use Our\ApiConst;
class FavoritesStoreModel extends \DAO\AbstractModel { class FavoritesStoreModel extends \DAO\AbstractModel {
...@@ -58,6 +61,25 @@ class FavoritesStoreModel extends \DAO\AbstractModel { ...@@ -58,6 +61,25 @@ class FavoritesStoreModel extends \DAO\AbstractModel {
$this->setDb($this->dbName); $this->setDb($this->dbName);
return $this->db->from($this->_tableName)->where($where)->fetchNum(); return $this->db->from($this->_tableName)->where($where)->fetchNum();
} }
public function getFavoritesCountByStoreId($storeId){
$where=\Our\Common::format(" store_id={0}",$storeId);
$total['favCount']=$this->getFavoritesStoreCount($where);
$todayBegin=strtotime(date('Y-m-d',TIMESTAMP));
$todayEnd=TIMESTAMP;
$where.=\Our\Common::format( " and fav_time between {0} and {1}",$todayBegin,$todayEnd);
$total['todayFavCount']=$this->getFavoritesStoreCount($where);
return $total?$total:array();
}
//删除订单列表缓存
public function deleteGetFavoritesCountByStoreId($storeId)
{
return \Our\RedisHelper::delCachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getFavoritesCountByStoreId'), array(), array($storeId));
}
public function getFavoritesCountByStoreIdCache($storeId){
return \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getFavoritesCountByStoreId'), array($storeId), \Our\ApiConst::oneDaySecond,array($storeId));
}
public function insertOrUpdate($data){ public function insertOrUpdate($data){
$this->setDb(\Our\DbNameConst::masterDBConnectName); $this->setDb(\Our\DbNameConst::masterDBConnectName);
$baseSql = "insert into {$this->_tableName}(member_id,store_id,fav_type,fav_time) values({0},{1},1,{2}) ON DUPLICATE KEY UPDATE fav_type=1,fav_time=VALUES (fav_time)"; $baseSql = "insert into {$this->_tableName}(member_id,store_id,fav_type,fav_time) values({0},{1},1,{2}) ON DUPLICATE KEY UPDATE fav_type=1,fav_time=VALUES (fav_time)";
......
...@@ -33,7 +33,11 @@ class GoodsAttributeModel extends \DAO\AbstractModel { ...@@ -33,7 +33,11 @@ class GoodsAttributeModel extends \DAO\AbstractModel {
$productData = []; $productData = [];
if(is_array($data) && !empty($data)){ if(is_array($data) && !empty($data)){
foreach ($data as $v){ foreach ($data as $v){
$productData[] = array('attrName'=>$v['attribute'],'attrValue'=>unserialize($v['attribute_value'])); $attrValue = unserialize($v['attribute_value']);
if(!is_array($attrValue)) {
$attrValue = array($attrValue);
}
$productData[] = array('attrName'=>$v['attribute'],'attrValue'=>$attrValue);
} }
} }
return $productData; return $productData;
......
This diff is collapsed.
...@@ -17,7 +17,7 @@ class OrderGoodsModel extends \DAO\AbstractModel { ...@@ -17,7 +17,7 @@ class OrderGoodsModel extends \DAO\AbstractModel {
* @var string * @var string
*/ */
protected $_tableName = 'han_order_goods'; protected $_tableName = 'han_order_goods';
public $sumField="rec_id,store_id as storeId,buyer_id as buyerId,goods_num as goodsNum,goods_price as goodsPrice,gmt_create as gmtCreate"; public $sumField="rec_id,store_id as storeId,buyer_id as buyerId,goods_num as goodsNum,goods_price as goodsPrice,gmt_create as gmtCreate,order_id as orderId";
public $groupField=array('buyer_id','store_id'); public $groupField=array('buyer_id','store_id');
public $orderGoodsField = "order_id as orderId,rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_price as goodsPrice,goods_num as goodsNum,goods_image as goodsImage,goods_pay_price as goodsPayPrice,sale_act_id as saleActId,sale_id as saleId,comment_state as commentState,is_refund as isRefund,goods_spec as goodsSpec,refund_state_name as refundStateName,refund_id as refundId"; public $orderGoodsField = "order_id as orderId,rec_id as recId,goods_id as goodsId,goods_name as goodsName,goods_price as goodsPrice,goods_num as goodsNum,goods_image as goodsImage,goods_pay_price as goodsPayPrice,sale_act_id as saleActId,sale_id as saleId,comment_state as commentState,is_refund as isRefund,goods_spec as goodsSpec,refund_state_name as refundStateName,refund_id as refundId";
......
...@@ -38,7 +38,7 @@ class PBundlingModel extends \DAO\AbstractModel { ...@@ -38,7 +38,7 @@ class PBundlingModel extends \DAO\AbstractModel {
if(is_array($where)){ if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where); $where = $this->db->getSqlWhereByArray($where);
} }
return $this->db->select($field)->from($this->_tableName)->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1')->limit($limit[0],$limit[1])->fetchAll(); return $this->db->select($field)->from($this->_tableName)->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1')->where('is_del=0')->limit($limit[0],$limit[1])->fetchAll();
} }
public function getImgPath($image){ public function getImgPath($image){
if($image){ if($image){
...@@ -48,11 +48,11 @@ class PBundlingModel extends \DAO\AbstractModel { ...@@ -48,11 +48,11 @@ class PBundlingModel extends \DAO\AbstractModel {
public function getDetail($where,$field,$limit=false){ public function getDetail($where,$field,$limit=false){
$this->setDb($this->dbName); $this->setDb($this->dbName);
return $this->db->select($field)->from($this->_tableName)->join('han_p_bundling_goods',"han_p_bundling_goods.bl_id = han_p_bundling.bl_id",'inner')->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1')->limit($limit[0],$limit[1])->fetchAll(); return $this->db->select($field)->from($this->_tableName)->join('han_p_bundling_goods',"han_p_bundling_goods.bl_id = han_p_bundling.bl_id",'inner')->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1')->where('is_del=0')->limit($limit[0],$limit[1])->fetchAll();
} }
public function getCount($where){ public function getCount($where){
$this->setDb($this->dbName); $this->setDb($this->dbName);
return $this->db->from($this->_tableName)->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1')->fetchNum(); return $this->db->from($this->_tableName)->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1')->where('is_del=0')->fetchNum();
} }
......
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