Commit d4c433fa authored by wwccw0591's avatar wwccw0591

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

parents 4d03d548 0d297654
......@@ -36,7 +36,6 @@ class CartController extends \Our\Controller_AbstractApi{
$data['pageIndex'] = $pageIndex;
$data['pageSize'] = $pageSize;
$storeCartList = $cartService->getCart($data,$this->memberId);
$pBundlingService = \Business\Goods\GroupSaleServiceModel::getInstance();
$sess=\Yaf\Session::getInstance();
$currentAddress = $sess->get('currentAddress');
......
......@@ -41,5 +41,6 @@ class CouponController extends \Our\Controller_AbstractIndex{
$couponList = $couponService->getGoodsCoupons($data,$memberId);
$this->success($couponList);
}
}
......@@ -23,21 +23,21 @@ class HomeController extends \Our\Controller_AbstractIndex{
}
$returnData['currentAddress'] = $currentAddress;
$currentAddress = $this->sess->get('currentAddress');
$data = $this->req[\Our\NameConst::data];
$requestAddress = \Business\User\AddressServiceModel::getInstance()->getRequestAddress($data,$currentAddress);
//获取首页推荐分类
$resultClasses = $this->getPlatformGoodsClassAction(true);
$resultClasses = $this->getPlatformGoodsClassAction($requestAddress);
if($resultClasses){
$returnData['recommendClasses'] = $resultClasses;
}
//获取当前位置对应附近店铺
$nearbyStores = $this->getNearbyStoresAction(true);
$nearbyStores = $this->getNearbyStoresAction($requestAddress);
$returnData['nearbyStores'] = $nearbyStores;
//获取附近店铺对应的商品
$recommendGoods = $this->getIndexHotSalesGoodsAction(true);
$recommendGoods = $this->getIndexHotSalesGoodsAction($requestAddress);
$returnData['recommendGoods'] = $recommendGoods;
......@@ -46,6 +46,8 @@ class HomeController extends \Our\Controller_AbstractIndex{
$this->success($returnData);
}
/**
* 设置当前地址
* @param bool $flag
......@@ -67,11 +69,14 @@ class HomeController extends \Our\Controller_AbstractIndex{
* @param bool $flag
* @return array
*/
public function getIndexHotSalesGoodsAction($flag = false){
public function getIndexHotSalesGoodsAction($address = false){
$currentAddress = $this->sess->get('currentAddress');
if($address){
$currentAddress = $address ;
}
$goodsCommonService = \Business\Goods\GoodsCommonServiceModel::getInstance();
$recommendGoods = $goodsCommonService->getIndexHotSalesGoods($currentAddress);
if($flag){
if($address){
return $recommendGoods;
}
$this->success($recommendGoods);
......@@ -82,11 +87,14 @@ class HomeController extends \Our\Controller_AbstractIndex{
* @param bool $flag
* @return array
*/
public function getNearbyStoresAction($flag = false){
public function getNearbyStoresAction($address = false){
$currentAddress = $this->sess->get('currentAddress');
if($address){
$currentAddress = $address ;
}
$storesService = \Business\Store\StoreServiceModel::getInstance();
$nearbyStores = $storesService->getNearbyStores($currentAddress);
if($flag){
if($address){
return $nearbyStores;
}
$this->success($nearbyStores);
......@@ -98,11 +106,14 @@ class HomeController extends \Our\Controller_AbstractIndex{
* @param bool $flag
* @return array
*/
public function getPlatformGoodsClassAction($flag = false){
public function getPlatformGoodsClassAction($address = false){
$currentAddress = $this->sess->get('currentAddress');
if($address){
$currentAddress = $address ;
}
$goodsClassService = \Business\Goods\GoodsClassServiceModel::getInstance();
$resultClasses = $goodsClassService->getHomeIndexGoodsClasses($currentAddress);
if($flag){
if($address){
return $resultClasses;
}
$this->success($resultClasses);
......
......@@ -136,7 +136,9 @@ class UserController extends \Our\Controller_AbstractIndex {
$member = $this->memberService->loginWithThirdPlatformInfo($where);
if($member){
$userToken=$this->memberService->findMbUserTokenByMemberId($member['member_id']);
$this->memberService->clearKey($userToken['token']);
if(!empty($userToken['token'])){
$this->updateOldLoginKey($userToken['token']);
}
$this->memberService->clearKey($this->key);
$this->key=Common::bulidToken('', '', '', \Our\ApiConst::wechatDeviceType);
session_id($this->key);
......
......@@ -376,22 +376,6 @@ class CouponServiceModel extends \Business\AbstractModel{
return $couponList;
}
/**
* 删除店铺优惠券缓存
* @param $storeId 店铺ID
* @param bool $couponId 指定优惠券ID
* @throws \Our\Exception
*/
public function deleteCouponCache($storeId,$couponId=false){
$couponDao = \DAO\Coupon\CouponModel::getInstance();
$memberCouponDao = \DAO\Coupon\MemberCouponModel::getInstance();
if($couponId){
\Our\RedisHelper::delCachedFunction(\Redis\Db13\MemberCouponRedisModel::getInstance(), array(&$memberCouponDao, 'getList'),array(),array($couponId));
}
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponDao, 'getStorePromotionCouponList'),array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStoreCouponsById'),array(),array($storeId));
}
public function sortCouponList($couponList){
foreach($couponList as $key => $coupon){
$isGet[$key] = $coupon['isGet'];
......
......@@ -24,7 +24,7 @@ class EvaluationServiceModel extends \Business\AbstractModel {
if($order['diliveryman_id']) {
//获取配送员评价标签
$evalLabelDAO = \DAO\DeliveryEvalLabelModel::getInstance();
$data = \Our\RedisHelper::cachedFunction(\Redis\Db5\DeliveryEvalLabelRedisModel::getInstance(),array(&$evalLabelDAO, 'getLabelList'),array(array('store_id'=>$order['store_id'],'is_show'=>1),'label_id,label_name'),\Our\ApiConst::oneDaySecond);
$data = \Our\RedisHelper::cachedFunction(\Redis\Db5\DeliveryEvalLabelRedisModel::getInstance(),array(&$evalLabelDAO, 'getLabelList'),array(array('store_id'=>$order['store_id'],'is_show'=>1),'label_id,label_name'),\Our\ApiConst::oneDaySecond,array($order['store_id']));
if($data && is_array($data)){
foreach ($data as $k=>$v){
$serviceEvaluations[] = array('labelId'=>$v['label_id'],'label'=>$v['label_name']);
......
......@@ -312,7 +312,7 @@ class OrderServiceModel extends \Business\AbstractModel
if($resultRefund){
$where['order_id']=$order['orderId'];
//$orderGoodsUpdateData['refund_state_name']='退款成功';
$orderGoodsUpdateData['is_refund']=1;
$orderGoodsUpdateData['is_refund']=ApiConst::refundSuccess;
$orderGoodsDao->update($where,$orderGoodsUpdateData);
}
}
......@@ -718,18 +718,19 @@ class OrderServiceModel extends \Business\AbstractModel
*/
public function getQmDeliveryLogList($memberId, $type = ApiConst::orderTypeBuy, $pageIndex = ApiConst::pageIndex, $pageSize = ApiConst::pageSize)
{
$QmDeliveryLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::salveDBConnectName);
$qmDeliveryLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::salveDBConnectName);
$qmDeliveryMan=\DAO\Order\DiliverymanModel::getInstance(DbNameConst::salveDBConnectName);
$orderDao = \DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$orderGoodsDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$orderCommonDao = \DAO\Order\OrderCommonModel::getInstance(DbNameConst::salveDBConnectName);
$memberDao = \DAO\MemberModel::getInstance(DbNameConst::salveDBConnectName);
$qmMans=$qmDeliveryMan->getListByMemberId($memberId);
$diliverymanIds=array_column($qmMans,'id');
$diliverymanId = $memberDao->getInfo($memberId, 'diliveryman_id');
if (empty($diliverymanId)) {
if (empty($diliverymanIds)) {
ErrorModel::throwException(CodeConfigModel::commonError);
}
$qmDeliveryLogList = $QmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanId, $type, $pageIndex, $pageSize);
$qmDeliveryLogList = $qmDeliveryLogDao->getListByDeliverymanIdAndTypeCache($diliverymanIds, $type, $pageIndex, $pageSize,$memberId);
$orderIds = array_column($qmDeliveryLogList['list'], 'orderId');
// echo json_encode($orderIds);exit;
// $where['delete_state'] = ApiConst::undeleteOrder;
......@@ -860,7 +861,7 @@ class OrderServiceModel extends \Business\AbstractModel
{
$memberDao = \DAO\MemberModel::getInstance(DbNameConst::masterDBConnectName);
$qmDeliverymanLogDao = \DAO\Order\QmDeliverymanLogModel::getInstance(DbNameConst::masterDBConnectName);
$deliverymanId = $memberDao->getInfo($memberid, 'diliveryman_id');
//$deliverymanId = $memberDao->getInfo($memberid, 'diliveryman_id');
$qmDeliveryManLog = $qmDeliverymanLogDao->findById($id);
if ($qmDeliveryManLog['deliveryState'] == ApiConst::deliveryStateWait && $qmDeliveryManLog['id'] == $id) {
$updateResult = $qmDeliverymanLogDao->updateStatusById($id);
......@@ -871,7 +872,7 @@ class OrderServiceModel extends \Business\AbstractModel
$push->reacheRemind($order['buyerId'], $order['orderId'], $order['orderSn']);
}
$orderDao->deleteOrderCache($memberid, $qmDeliveryManLog['orderId'], $order['storeId'],true);
$qmDeliverymanLogDao->deleteOrderCache($deliverymanId, $id);
$qmDeliverymanLogDao->deleteOrderCache($memberid, $id);
return $updateResult;
} else {
return false;
......
......@@ -54,7 +54,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$orderDao=\DAO\Order\OrderModel::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));
$goodsCount=\Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderGoodsDao, 'getOrderGoodsCountByStoreId'), array($storeId), ApiConst::one, array($storeId));
$condition['store_id'] = $storeId;
//获取店铺信息
$store = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this->storeDao, 'getInfo'), array($condition), ApiConst::tenDaySecond, array($storeId));
......@@ -484,6 +484,7 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$orderGoodDao = \DAO\Order\OrderGoodsModel::getInstance(DbNameConst::salveDBConnectName);
$orderDao=\DAO\Order\OrderModel::getInstance();
$storeMemberStatisticDao = \DAO\StoreMemberStatisticsModel::getInstance(DbNameConst::masterDBConnectName);
$reufndReturnDao=\DAO\Order\RefundReturnModel::getInstance(DbNameConst::masterDBConnectName);
$gmtCreate = file_get_contents($this->baseDir . PathConst::orderGoodsCreateTime);
$gmtCreate = $gmtCreate ? $gmtCreate : ApiConst::zero;
$beginTime = $gmtCreate;
......@@ -501,7 +502,16 @@ class ShopkeeperServiceModel extends \Business\AbstractModel
$memberIds=array_unique($memberId);
$goodsNumCount=$orderGoodDao->getMemberStoreOrderGoodsCount($storeIds,$memberIds);
$ordersCount=$orderDao->getSumAmountCountByMemberAndStoreId($storeIds,$memberIds);
$refundLists=$reufndReturnDao->getRefundSuccessMoneyByStoreIdAndMemberId($storeIds,$memberIds);
if(!empty($ordersCount) && !empty($refundLists)){
foreach($ordersCount as &$order){
foreach($refundLists as $refund){
if($order['buyerId']==$refund['buyerId'] and $order['storeId']==$refund['storeId']){
$order['orderTotal']=$order['orderTotal']-$refund['refundTotal'];
}
}
}
}
if(!empty($goodsNumCount)){
$storeMemberStatisticDao->addAll($goodsNumCount,'orderGoodsCount');
}
......
......@@ -398,7 +398,6 @@ class StoreServiceModel extends \Business\AbstractModel{
if(!$nearbyStoreIds){
return array('totalCount'=>0);
}
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
$storeDao = \DAO\StoreModel::getInstance();
......@@ -483,7 +482,6 @@ class StoreServiceModel extends \Business\AbstractModel{
$position['lng'] = $where['lng'];
$position['cityCode'] = $where['cityCode'];
$readisSuffix = crc32(serialize(ksort($position)));
$storeRedis = \Redis\Db6\StoreRedisModel::getInstance();
$nearbyStoreKey = \Our\NameConst::nearbyStoreKeyPrefix . $readisSuffix;
......
......@@ -16,6 +16,25 @@ class AddressServiceModel extends \Business\AbstractModel {
{
}
public function getRequestAddress($data,$returnAddress){
$returnData = array();
if($returnAddress['returnAddressId'] > \Our\ApiConst::zero){
$returnData['lat'] = $returnAddress['addresses'][0]['lat'];
$returnData['lng'] = $returnAddress['addresses'][0]['lng'];
$returnData['cityCode'] = $returnAddress['addresses'][0]['cityCode'];
}else {
if($data['cityCode']&&$data['lng']&&$data['lat']){
$returnData = $data;
}else{
$returnData = \Our\ArrayConst::defaultAddress;
unset($returnData['address']);
unset($returnData['default']);
}
}
return $returnData;
}
public function writeToFile(){
$addressDao = \DAO\AreaModel::getInstance();
......
......@@ -512,5 +512,22 @@ class CouponModel extends \DAO\AbstractModel {
}
/**
* 删除店铺优惠券缓存
* @param $storeId 店铺ID
* @param bool $couponId 指定优惠券ID
* @throws \Our\Exception
*/
public function deleteCouponCache($storeId,$couponId=false){
$couponService = \Business\Coupon\CouponServiceModel::getInstance();
$memberCouponDao = \DAO\Coupon\MemberCouponModel::getInstance();
if($couponId){
\Our\RedisHelper::delCachedFunction(\Redis\Db13\MemberCouponRedisModel::getInstance(), array(&$memberCouponDao, 'getList'),array(),array($couponId));
}
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$this, 'getStorePromotionCouponList'),array(),array($storeId));
\Our\RedisHelper::delCachedFunction(\Redis\Db13\CouponRedisModel::getInstance(), array(&$couponService, 'getStoreCouponsById'),array(),array($storeId));
return true;
}
}
......@@ -93,7 +93,7 @@ FROM han_goods_common t1 where t1.goods_state={1} and t1.goods_verify={2} and t1
) a
left join han_goods_score_statistics b
on a.goods_commonid = b.goods_commonid
WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\ApiConst::onlineGoodsState,\Our\ApiConst::onlineGoodsVerify,$storeId,\Our\ApiConst::onlineGoodsState);
WHERE a.group_id<=3 AND a.sale_num>0 ',\Our\ApiConst::defaultGoodsScore,\Our\ApiConst::onlineGoodsState,\Our\ApiConst::onlineGoodsVerify,$storeId,\Our\ApiConst::onlineGoodsDel);
$list = $this->db->query($sql)->rows;
return $list;
}
......
......@@ -18,7 +18,7 @@ use Our\OrderConst;
class DiliverymanModel extends \DAO\AbstractModel
{
public $detailField='id as id,true_name as trueName,mobile as mobile,scores as scores,store_id as storeId,add_time as addTime,update_time as updateTime,member_id as memberId,bind_status as bindStatus,is_del as isDel';
/**
* 表名
*
......@@ -64,7 +64,16 @@ class DiliverymanModel extends \DAO\AbstractModel
$data = $this->db->from($this->_tableName)->where($where)->fetchOne();
return $data;
}
//任务脚本方法
public function getListByMemberId($memberId)
{
$this->setDb($this->dbName);
$where['member_id']=$memberId;
$where['is_del']=ApiConst::zero;
$where = $this->db->getSqlWhereByArray($where);
$list = $this->db->select($this->detailField)->from($this->_tableName)->where($where)->fetchAll();
return $list;
}
public function findById($id)
{
$this->setDb($this->dbName);
......
......@@ -29,7 +29,7 @@ class OrderModel extends \DAO\AbstractModel
*/
protected $_tableName = 'han_order';
private $countField = '(sum(order_amount)-sum(refund_amount)) as orderTotal,count(*) as orderCount';
private $countField = '(sum(order_amount)) as orderTotal,count(*) as orderCount';
/**
* 主键
*
......@@ -83,13 +83,18 @@ class OrderModel extends \DAO\AbstractModel
public function getShopKeeperCountByStoreId($storeId)
{
$refundReturnDao=\DAO\Order\RefundReturnModel::getInstance(DbNameConst::salveDBConnectName);
$begin = strtotime(date("Y-m-d"), time());
$end = TIMESTAMP;
$notInState=ApiConst::orderStateCancel.','.ApiConst::orderStateClose;
$where = Common::format(" store_id={0} and order_state not in ({1})", $storeId,$notInState);
$orderTotal = $this->getOrderCounts($where, $this->countField);
$where .= Common::format(" and add_time between {0} and {1}", $begin, $end);
$refundAmount=$refundReturnDao->getRefundSuccessMoneyByStoreId($storeId);
$orderTotal['orderTotal']=$orderTotal['orderTotal']-$refundAmount;
$where .= Common::format(" and gmt_update between {0} and {1}", $begin, $end);
$todayTotal = $this->getOrderCounts($where, $this->countField);
$todayRefund=$refundReturnDao->getRefundSuccessMoneyByStoreId($storeId,$begin,$end);
$todayTotal['orderTotal']=$todayTotal['orderTotal']-$todayRefund;
$total['todayOrderTotal'] = isset($todayTotal['orderTotal']) ? $todayTotal['orderTotal'] : ApiConst::zero;
$total['todayOrderCount'] = isset($todayTotal['orderCount']) ? $todayTotal['orderCount'] : ApiConst::zero;
$total['orderTotal'] = isset($orderTotal['orderTotal']) ? (int)$orderTotal['orderTotal'] : ApiConst::zero;
......@@ -227,6 +232,7 @@ class OrderModel extends \DAO\AbstractModel
public function insert($data)
{
$this->setDb(\Our\DbNameConst::masterDBConnectName);
$data['gmt_update']=TIMESTAMP;
$result = $this->db->insert($this->_tableName)->rows($data)->execute();
return $result;
}
......@@ -390,11 +396,7 @@ class OrderModel extends \DAO\AbstractModel
$memberIds=implode(',',$memberIds);
}
$where=Common::format(" store_id in({0}) and buyer_id in({1}) and order_state not in({2})",$storeIds,$memberIds,'-1,0');
// $where['store_id']=array('in',$storeIds);
// $where['buyer_id']=array('in',$memberIds);
// $where['order_state']=array('notin','-1,0');
// $where=$this->db->getSqlWhereByArray($where);
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(order_amount)-SUM(refund_amount)) AS orderTotal")->group('buyer_id')->group('store_id')->fetchAll();
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(order_amount)) AS orderTotal")->group('buyer_id')->group('store_id')->fetchAll();
return $res;
}
......
......@@ -66,8 +66,12 @@ class OrderGoodsModel extends \DAO\AbstractModel {
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;
$where['is_refund']=array('neq',ApiConst::refundSuccess);
if(is_array($where)){
$where=$this->db->getSqlWhereByArray($where);
}
$goodsCount = $this->db->select($this->orderGoodsGoodsNumCountField)->from($this->_tableName)->where($where)->fetchValue();
return (int)$goodsCount;
}
/**
* 获取单条数据
......@@ -231,15 +235,9 @@ class OrderGoodsModel extends \DAO\AbstractModel {
}
public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
$this->setDb($this->dbName);
// if(is_array($storeIds)){
// $storeIds=implode(',',$storeIds);
// }
// if(is_array($memberIds)){
// $memberIds=implode($memberIds);
// }
$where['store_id']=array('in',$storeIds);
$where['buyer_id']=array('in',$memberIds);
$where['is_refund']=array('neq',ApiConst::one);
$where['is_refund']=array('neq',ApiConst::refundSuccess);
$where=$this->db->getSqlWhereByArray($where);
$res=$this->db->from($this->_tableName)->select($this->sumGoodsNum)->where($where)->group("buyer_id")->group("store_id")->fetchAll();
return $res;
......
......@@ -88,19 +88,24 @@ class QmDeliverymanLogModel extends \DAO\AbstractModel
public function getListByDeliverymanIdAndType($diliveryId, $type, $pageIndex, $pageSize, $order = array('get_time' => 'desc'))
{
$this->setDb($this->dbName);
$where['diliveryman_id'] = $diliveryId;
$where['diliveryman_id'] =array('in',$diliveryId);
if ($type == ApiConst::orderTypeBuy) {
$where['order_type'] = ApiConst::orderTypeBuy;
$where['delivery_state'] = ApiConst::deliveryStateWait;
}
if ($type == ApiConst::orderTypeRefund) {
$where=Common::format(" diliveryman_id={0} and order_type={1} and (delivery_state={2} or delivery_state={3})",$diliveryId,ApiConst::orderTypeRefund,ApiConst::deliveryStateWait,ApiConst::deliveryStateWaitTen);
// $where['order_type'] = ApiConst::orderTypeRefund;
// $where['delivery_state'] = ApiConst::deliveryStateWait;
// $where=Common::format(" diliveryman_id in ({0}) and order_type={1} and (delivery_state={2} or delivery_state={3})",$diliveryId,ApiConst::orderTypeRefund,ApiConst::deliveryStateWait,ApiConst::deliveryStateWaitTen);
$where['order_type'] = ApiConst::orderTypeRefund;
$where['delivery_state'] = ApiConst::deliveryStateWait;
}
if ($type == ApiConst::deliveryStateWait) {
$where['delivery_state'] = ApiConst::deliveryStateComplete;
}
if(is_array($where)){
$where=$this->db->getSqlWhereByArray($where);
}
if($type==ApiConst::deliveryStateComplete){
$order = array('finish_time' => 'desc');
}
......@@ -108,9 +113,9 @@ class QmDeliverymanLogModel extends \DAO\AbstractModel
return $list;
}
public function getListByDeliverymanIdAndTypeCache($diliveryId, $type, $pageIndex, $pageSize, $order = array('get_time' => 'desc'))
public function getListByDeliverymanIdAndTypeCache($diliveryId, $type, $pageIndex, $pageSize, $order = array('get_time' => 'desc'),$memberId)
{
return \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getListByDeliverymanIdAndType'), array($diliveryId, $type, $pageIndex, $pageSize, $order), ApiConst::oneDaySecond, array($diliveryId));
return \Our\RedisHelper::cachedFunction(\Redis\Db5\OrderRedisModel::getInstance(), array(&$this, 'getListByDeliverymanIdAndType'), array($diliveryId, $type, $pageIndex, $pageSize, $order), ApiConst::oneDaySecond, array($memberId));
}
/**
......
......@@ -26,6 +26,7 @@ class RefundReturnModel extends \DAO\AbstractModel {
public $refundDetailField='is_platform_in as isPlatformIn,seller_state as sellerState,platform_state as platformState,refund_id as refundId,order_id as orderId,store_id as storeId,order_goods_id as orderGoodsId';
public $refundReturnField="seller_state,refund_state,is_platform_in,platform_state";
private $sumField="order_id as orderId,buyer_id as buyerId,store_id as storeId,goods_num as goodsNum,refund_amount as refundAmount,is_suc_refund as isSucRefund,gmt_update as gmtUpdate";
private $sumRefundAmount=" sum(refund_amount) as sumRefundAmont";
/**
* 主键
*
......@@ -47,6 +48,31 @@ class RefundReturnModel extends \DAO\AbstractModel {
return $list;
}
public function getRefundSuccessMoneyByStoreId($storeId,$beginTime=false,$endTime=false){
$this->setDb($this->dbName);
if($beginTime){
$where=\Our\Common::format(" store_id={0} and is_suc_refund={1} and gmt_update between {2} and {3}",$storeId,ApiConst::refundSuccess,$beginTime,$endTime);
}else{
$where=\Our\Common::format(" store_id={0} and is_suc_refund={1}",$storeId,ApiConst::refundSuccess);
}
$res=$this->db->from($this->_tableName)->select($this->sumRefundAmount)->where($where)->fetchValue();
return !empty($res)?$res:ApiConst::zero;
}
public function getRefundSuccessMoneyByStoreIdAndMemberId($storeId,$buyerId){
$this->setDb($this->dbName);
if(is_array($storeId)){
$storeId=implode(',',$storeId);
}
if(is_array($buyerId)){
$buyerId=implode(',',$buyerId);
}
$where=\Our\Common::format(" store_id in({0}) and buyer_id in({1}) and is_suc_refund={2}",$storeId,$buyerId,ApiConst::refundSuccess);
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(refund_amount)) AS refundTotal")->group('buyer_id')->group('store_id')->fetchAll();
return !empty($res)?$res:[];
}
/**
* 更新数据
* @param $data
......
......@@ -33,12 +33,28 @@ class PBundlingModel extends \DAO\AbstractModel {
// $where = array();
// $groupList=$this->db->select($field)->from($this->_tableName)->where($where)->order('gmt_create','DESC')->fetchOne();
// }
public function getList($field,$where,$limit = array(0,0)){
/**
* @param $field
* @param $where
* @param array $limit
* @param int $isDel 是否包含已删除数据(0:不包含,1包含)
* @return mixed
*/
public function getList($field,$where,$limit = [],$isDel = \Our\ApiConst::zero){
$this->setDb($this->dbName);
if(is_array($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')->where('is_del=0')->limit($limit[0],$limit[1])->fetchAll();
$this->db->select($field)->from($this->_tableName)->where($where)->where("bl_quota_starttime <= ".time())->where('bl_quota_endtime >= '.time())->where('bl_state=1');
if($isDel==\Our\ApiConst::zero){
$this->db->where('is_del=0');
}
if($limit){
$this->db->limit($limit[0],$limit[1]);
}
$result = $this->db->fetchAll();
return $result;
}
public function getImgPath($image){
if($image){
......
......@@ -33,7 +33,6 @@ class QmStoreClassModel extends \DAO\AbstractModel{
}else{
$result = $this->db->select($field)->from($this->_tableName)->where($where)->fetchAll();
}
return $result;
}
......
......@@ -10,7 +10,7 @@ class DeliveryEvalLabelRedisModel extends \Redis\Db5\AbstractModel {
*
* @var string
*/
protected $_tableName = 'OrderRedis.php';
protected $_tableName = 'han_delivery_eval_label';
/**
......
......@@ -219,7 +219,7 @@ push.open=1
[ccwdevelop : common]
; 数据库配置
resources.database.params.driver = "pdo_mysql"
resources.database.params.hostname = "192.168.1.201"
resources.database.params.hostname = "127.0.0.1"
resources.database.params.port = 3306
resources.database.params.database = "qmcs"
resources.database.params.username = "root"
......@@ -229,7 +229,7 @@ resources.database.params.driver_options.1002 = "SET NAMES utf8"
; 从库配置
resources.database.slave.params.driver = "pdo_mysql"
resources.database.slave.params.hostname = "192.168.1.201"
resources.database.slave.params.hostname = "127.0.0.1"
resources.database.slave.params.port = 3306
resources.database.slave.params.database = "qmcs"
resources.database.slave.params.username = "root"
......
......@@ -72,7 +72,7 @@ class cliShopkeeperIndex extends basecli
try {
$shopkeeperService->insertStoreMemberStatics();
$shopkeeperService->reduceStoreMemberStatics();
$shopkeeperService->storeStatictisTask();
//$shopkeeperService->storeStatictisTask();
$shopkeeperService->updateLastId();
} catch (Exception $ex) {
throw new Exception($ex->getCode() . '|' . $ex->getMessage());
......
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