Commit 17bbcf2d authored by zhz's avatar zhz

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

parents 38f91132 ce4c1b75
......@@ -3,6 +3,7 @@ namespace OSS;
use OSS\OssClient;
use OSS\Core\OssException;
use Our\SecretKeys;
/**
......@@ -17,13 +18,11 @@ class Common
const accessKeySecret = \Our\SecretKeys::ossAccessKey;
const bucket = \Our\SecretKeys::ossBucket;
/**
* Get an OSSClient instance according to config.
*
* @return OssClient An OssClient instance
*/
public static function getOssClient()
{
const endpointPre=SecretKeys::ossEndpointPre;
const buketPre=SecretKeys::ossBucket;
public static function getOssClientOnline(){
try {
$ossClient = new OssClient(self::accessKeyId, self::accessKeySecret, self::endpoint, false);
} catch (OssException $e) {
......@@ -33,10 +32,40 @@ class Common
}
return $ossClient;
}
public static function getOssClientPre(){
try {
$ossClient = new OssClient(self::accessKeyId, self::accessKeySecret, self::endpointPre, false);
} catch (OssException $e) {
printf(__FUNCTION__ . "creating OssClient instance: FAILED\n");
printf($e->getMessage() . "\n");
return null;
}
return $ossClient;
}
/**
* Get an OSSClient instance according to config.
*
* @return OssClient An OssClient instance
*/
public static function getOssClient()
{
if(APP_ENV=='product' || APP_ENV=='productone'){
return self::getOssClientOnline();
}else{
return self::getOssClientPre();
}
}
public static function getBucketName()
{
return self::bucket;
if(APP_ENV=='product' || APP_ENV=='productone'){
return self::bucket;
}else{
return self::buketPre;
}
}
/**
......
......@@ -523,6 +523,7 @@ class OrderConfirmUtil {
$order['add_time'] = TIMESTAMP;
$order['payment_type'] = $storeCarts['payway'];
$order['order_amount'] = $storeCarts['orderAmount'];
$order['origin_amount'] = $storeCarts['orderAmount'];
if($order['payment_type'] == 1 &&$storeCarts['orderAmount']>0){
$needPayFlag = \Our\ApiConst::one;
$order['order_state'] = \Our\ApiConst::orderStateWaitPay ;
......
......@@ -197,7 +197,8 @@ class ApiConst
//是否退款成功
const refundSuccess = 1;
const refundFail = 0;
//order refundState all
const refundStateAll=2;
const isNotSuccessRefund=0;
const refundCompleted=3;
......@@ -310,6 +311,7 @@ class ApiConst
const commonClassStyle = 1;
const signClassStyle = 2;
const isEffective=0;
const defaultAddressCount = 3;
......
......@@ -365,7 +365,10 @@ class Common
},$str);
return $str;
}
public static function getTodayBeginTimpSpan(){
$totayTimeSpan=strtotime(date('Y-m-d'));
return $totayTimeSpan;
}
/**
* 驼峰数组转下划线数组
* @param array $data
......
......@@ -25,6 +25,11 @@ class SecretKeys {
const ossBucket = 'qmoss-01';//存储空间名称
const ossDomain = 'http://qmoss-01.oss-cn-hangzhou.aliyuncs.com';//访问oss使用域名
//pre环境使用的oss
const ossEndpointPre = 'http://oss-cn-shanghai.aliyuncs.com';//地域节点
const ossBucketPre = 'qmoss-shanghai';//存储空间名称
const ossDomainPre = 'http://qmoss-shanghai.oss-cn-shanghai.aliyuncs.com';//访问oss使用域名
//短信验证码相关
const aliYunSmsAppId = 'LTAICEp88gU0DNMe';
......
......@@ -1378,6 +1378,9 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
if(!$oldTemp){
$storeOnlineGoodsClassDao->insert($goodsClass);
}
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getList'),array(),array($goodsClass['store_id']));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getStoreOnlineGoodsClassesByGcId'),array(),array($goodsClass['store_id']));
return true;
}
......@@ -1398,7 +1401,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
$tempOne = $goodsCommonDao->getOne($where,'goods_commonid');
if(!$tempOne){
$storeOnlineGoodsClassDao->del($goodsClass);
$result = $storeOnlineGoodsClassDao->del($goodsClass);
if($result){
$storeOnlineGoodsClassDao = \DAO\GoodsClass\StoreOnlineGoodsClassModel::getInstance();
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getList'),array(),array($goodsClass['store_id']));
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreOnlineGoodsClassRedisModel::getInstance(),array(&$storeOnlineGoodsClassDao, 'getStoreOnlineGoodsClassesByGcId'),array(),array($goodsClass['store_id']));
}
}
}
}
......
......@@ -445,7 +445,7 @@ class MessageServiceModel extends \Business\AbstractModel
}
}
public function addMessageCenterToDb()
public function addMessageCenterToDb($pushPushCenter=true)
{
$conf = \Yaf\Registry::get('config')->get('redis.database.params');
$this->baseRedis = new \Redis();
......@@ -454,7 +454,9 @@ class MessageServiceModel extends \Business\AbstractModel
$this->baseRedis->auth($conf['password']);
}
while ($center = $this->baseRedis->lPop('message_center')) {
$this->baseRedis->rPush('push_center', $center);
if($pushPushCenter){
$this->baseRedis->rPush('push_center', $center);
}
$addData = unserialize($center);
$addData['message'] = unserialize($addData['message']);
$this->addMessage($addData['fromId'], $addData['fromUserId'], $addData['fromUserName'], $addData['fromType'], $addData['message'], $addData['toId'], $addData['toUserId'], $addData['toUserName'], $addData['toType'], $addData['id']);
......
......@@ -638,7 +638,7 @@ class OrderServiceModel extends \Business\AbstractModel
echo " 退款操作操作成功:".$orderId;
return true;
}else{
echo $refundReturnDao->errorMessage;
echo $refundReturnDao->errorMessage."orderId:".$orderId;
}
......
......@@ -36,7 +36,7 @@ class RefundServiceModel extends \Business\AbstractModel
//获得退款详情字段
private $refundReturnField = 'refund_id as refundId,order_id as orderId,order_sn as orderSn,refund_sn as refundSn,store_id as storeId,store_name as storeName,seller_state as sellerState,goods_id as goodsId,order_goods_id as orderGoodsId,goods_name as goodsName,goods_num as goodsNum,refund_amount as refundAmount,goods_image as goodsImage,refund_type as refundType,refund_state as refundState,return_type as returnType,add_time as addTime,seller_time as sellerTime,admin_time as adminTime,reason_info as reasonInfo,pic_info as picInfo,buyer_message as buyerMessage,seller_message as sellerMessage,admin_message adminMessage,express_id as expressId,invoice_no as invoiceNo,ship_time as shipTime,delay_time as delayTime,receive_time as receiveTime,shipping_over as shippingOver,shipping_sign as shippingSign,shipping_html as shippingHtml,is_suc_refund as isSucRefund,refund_shipping_type as refundShippingType,address_id as addressId,diliveryman_id as diliverymanId,is_platform_in as isPlatformIn,platform_in_reason as platformInReason,platform_state as platformState,seller_state as sellerState,return_type as returnType,refund_shipping_type as refundShippingType,buyer_refund_amount as buyerRefundAmount,reason_id as reasonId,receive_message as receiveMessage,goods_state as goodsState';
private $storeRefundReturnField = 'refund_id as refundId,order_id as orderId,order_sn as orderSn,refund_sn as refundSn,store_id as storeId,store_name as storeName,seller_state as sellerState,goods_id as goodsId,order_goods_id as orderGoodsId,goods_name as goodsName,goods_num as goodsNum,refund_amount as refundAmount,buyer_refund_amount as buyerRefundAmount,goods_image as goodsImage,refund_type as refundType,refund_state as refundState,return_type as returnType,add_time as addTime,seller_time as sellerTime,admin_time as adminTime,reason_id as reasonId,reason_info as reasonInfo,pic_info as picInfo,buyer_message as buyerMessage,seller_message as sellerMessage,admin_message adminMessage,express_id as expressId,invoice_no as invoiceNo,ship_time as shipTime,delay_time as delayTime,receive_time as receiveTime,receive_message as receiveMessage,shipping_over as shippingOver,shipping_sign as shippingSign,shipping_html as shippingHtml,is_suc_refund as isSucRefund,refund_shipping_type as refundShippingType,address_id as addressId,diliveryman_id as diliverymanId,is_platform_in as isPlatformIn,platform_in_reason as platformInReason,platform_state as platformState,return_type as returnType,refund_shipping_type as refundShippingType,goods_state as goodsState';
private $storeRefundReturnField = 'refund_id as refundId,order_id as orderId,order_sn as orderSn,refund_sn as refundSn,store_id as storeId,store_name as storeName,seller_state as sellerState,goods_id as goodsId,order_goods_id as orderGoodsId,goods_name as goodsName,goods_num as goodsNum,refund_amount as refundAmount,buyer_refund_amount as buyerRefundAmount,goods_image as goodsImage,refund_type as refundType,refund_state as refundState,return_type as returnType,add_time as addTime,seller_time as sellerTime,admin_time as adminTime,reason_id as reasonId,reason_info as reasonInfo,pic_info as picInfo,buyer_message as buyerMessage,seller_message as sellerMessage,admin_message adminMessage,express_id as expressId,invoice_no as invoiceNo,ship_time as shipTime,delay_time as delayTime,receive_time as receiveTime,receive_message as receiveMessage,shipping_over as shippingOver,shipping_sign as shippingSign,shipping_html as shippingHtml,is_suc_refund as isSucRefund,refund_shipping_type as refundShippingType,address_id as addressId,diliveryman_id as diliverymanId,is_platform_in as isPlatformIn,platform_in_reason as platformInReason,platform_state as platformState,return_type as returnType,refund_shipping_type as refundShippingType,goods_state as goodsState,buyer_name as buyerName';
private $order;
......@@ -450,7 +450,7 @@ class RefundServiceModel extends \Business\AbstractModel
$refund_array['refund_amount'] = $refundAmount;
$refundReturnDao->db->doTransaction();
if($seller_state!=2){ //拒绝退款
$result= $orderGoodsDao->update(array('rec_id'=>$refund['order_goods_id']), array('is_refund'=>0, 'refund_state_name'=>'卖家拒绝退', 'gmt_update'=>TIMESTAMP));
$result= $orderGoodsDao->update(array('rec_id'=>$refund['order_goods_id']), array('is_refund'=>0, 'refund_state_name'=>'卖家拒绝退', 'gmt_update'=>TIMESTAMP));
if(!$result){
$refundReturnDao->db->doRollback();
......@@ -721,6 +721,8 @@ class RefundServiceModel extends \Business\AbstractModel
$diliveryWhere['order_type']=ApiConst::orderTypeRefund;
$orderWhere['order_id']=array('in',$orderIds);
$orders = \Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$orderDao, 'getList'), array($orderWhere, $orderDao->getOrderDetailField(), ApiConst::zero, $pageSize), \Our\ApiConst::oneDaySecond, array($storeId));
$orderConvert=$orderDao->convertOrder($orders['list'],'orderId');
$qmDeliveryManLogWhere['order_id']=array('in',$refundIds);
$qmDeliveryManLogWhere['order_type']= ApiConst::orderTypeRefund;
$qmDeliveryManLogs=\Our\RedisHelper::cachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$qmDeliveryManLogDao, 'getList'), array($qmDeliveryManLogWhere, $qmDeliveryManLogDao->fieldDetail,ApiConst::zero,$pageSize), \Our\ApiConst::oneDaySecond, array($storeId));
......@@ -742,6 +744,7 @@ class RefundServiceModel extends \Business\AbstractModel
$value['deliveryTimeEnd'] = $value['deliveryTime'] + ApiConst::arriveTimeRadius;
$value['goodsImage'] = ImageUtil::getGoodsImgUrl($value['goodsImage'], ApiConst::goodsSmallSize);
$value['goodsAttr']=$goodsDao->getFormatGoodsAttr($value['goodsSpec']);
$value['finnshedTime']=$orders[$value['orderId']]['finnshedTime'];
$extent=$orderDao->getClienOrderCommon($orders[$value['orderId']]);
$value=array_merge($value,$extent);
$goodGroup=unserialize($value['goodsGroup']);
......@@ -780,6 +783,7 @@ class RefundServiceModel extends \Business\AbstractModel
}else{
$value['markRefundButton']=ApiConst::zero;;
}
$value['addTime']=$orderConvert[$value['orderId']]['addTime'];
unset($value['goodsSpec']);
// unset($value['picInfo']);
}
......
......@@ -61,6 +61,7 @@ class DeliveryServiceModel extends \Business\AbstractModel
$orderRes= $refundReturnDao->update($returnWhere,$orderData);
}else{
$orderData['order_state']=ApiConst::orderStateWaitRecieve;
$orderData['send_time']=TIMESTAMP;
$orderRes = $orderDao->updateByOrderId($orderData, $data['orderId']);
}
......
......@@ -45,7 +45,7 @@ class OrderModel extends \DAO\AbstractModel
public function getOrderDetailField()
{
return 'order_id as orderId,coupon_id as couponId,refund_amount as refundAmount,order_sn as orderSn,pay_sn as paySn,store_name as storeName,add_time as addTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment,payment_time as paymentTime,finnshed_time as finnshedTime,need_shipping_fee as needShippingFee,payment_code as paymentCode,buyer_id as buyerId,buyer_name as buyerName,refund_condition as refundCondition,delay_time as delayTime,gmt_update as gmtUpdate,diliveryman_id as diliverymanId,shipping_arrival_time as shippingArrivalTime,delivery_time as deliveryTime,order_note as orderNote';
return 'order_id as orderId,coupon_id as couponId,refund_amount as refundAmount,order_sn as orderSn,pay_sn as paySn,store_name as storeName,add_time as addTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment,payment_time as paymentTime,finnshed_time as finnshedTime,need_shipping_fee as needShippingFee,payment_code as paymentCode,buyer_id as buyerId,buyer_name as buyerName,refund_condition as refundCondition,delay_time as delayTime,gmt_update as gmtUpdate,diliveryman_id as diliverymanId,shipping_arrival_time as shippingArrivalTime,delivery_time as deliveryTime,order_note as orderNote,send_time as sendTime';
}
public function getOrderShippingField()
......@@ -419,10 +419,11 @@ class OrderModel extends \DAO\AbstractModel
return [];
}
}
public function getMemberStoreStaticsByCreateTime($gmtCreate,$pageIndex,$pageSize){
$this->setDb($this->dbName);
$where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1} and order_state={2}',$gmtCreate,TIMESTAMP,ApiConst::orderStateWaitRecieve);
$res=$this->lists($where,array('gmt_update'=>'asc'),$this->sumField,$pageIndex,$pageSize);
$where =\Our\Common::format(' gmt_update>={0} and gmt_update<{1}',$gmtCreate,TIMESTAMP);
$res=$this->lists($where,array('gmt_update'=>'asc'),$this->getOrderDetailField(),$pageIndex,$pageSize);
return $res['list']?$res:false;
}
public function getSumAmountCountByMemberAndStoreId($storeIds,$memberIds)
......@@ -438,6 +439,62 @@ class OrderModel extends \DAO\AbstractModel
$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;
}
public function getSumAmountCountByMemberIdAndStoreId($storeId,$memberId=false)
{
$this->setDb($this->dbName);
$where['store_id']=$storeId;
if($memberId){
$where['buyer_id']=$memberId;
}
$where['order_state']=array('notin',ArrayConst::orderCloseAndCancel);
if(is_array($where)){
$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)) AS orderTotal")->fetchOne();
return $res?$res:array();
}
public function getOrderCountByStoreId($storeId,$today=false){
$this->setDb($this->dbName);
$where['store_id']=$storeId;
$where['order_state']=array('notin',ArrayConst::orderCloseAndCancel);
$where['refund_state']=array('neq',ApiConst::refundStateAll);
if($today){
$todayTimeSpan=Common::getTodayBeginTimpSpan();
$where['gmt_update']=array('egt', $todayTimeSpan);
$where['gmt_update']=array('elt', TIMESTAMP);
}
if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where);
}
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(count(*)) AS orderCount")->fetchOne();
return $res?$res:array();
}
public function deleteGetOrderOrderTotalOnlineByStoreIdCache($storeId){
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this, 'getOrderOrderTotalOnlineByStoreId'), array(), array($storeId));
}
public function getOrderOrderTotalOnlineByStoreId($storeId,$today=false){
$this->setDb($this->dbName);
$where['store_id']=$storeId;
$where['order_state']=array('notin',ArrayConst::orderCloseAndCancel);
$where['refund_state']=array('neq',ApiConst::refundStateAll);
$where['payment_type']=array('in',ArrayConst::payTypeOnlines);
if($today){
$todayBegin=Common::getTodayBeginTimpSpan();
$where['gmt_update']=array('egt',$todayBegin);
$where['gmt_update']=array('elt',TIMESTAMP);
}
if(is_array($where)){
$where= $this->db->getSqlWhereByArray($where);
}
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(order_amount-refund_amount) as orderTotalOnline")->fetchOne();
return $res?$res:array();
}
//待收货获取订单状态信息
public function getOrderStatusExtent($order)
......
......@@ -246,22 +246,42 @@ class OrderGoodsModel extends \DAO\AbstractModel {
}
public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
$this->setDb($this->dbName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
$whereOrder['store_id']=array('in',$storeIds);
$whereOrder['buyer_id']=array('in',$memberIds);
$whereOrder['order_state']=array('in',ArrayConst::orderCloseAndCancel);
$orderIds=$orderDao->getFieldByWhere($whereOrder,'order_id');
$where['store_id']=array('in',$storeIds);
$where['buyer_id']=array('in',$memberIds);
$where['is_refund']=array('neq',ApiConst::refundSuccess);
if($orderIds){
$where['order_id']=array('notin',$orderIds);
}
$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;
}
public function getOrderGoodsCountBuyStoreIdAndMemberId($storeId,$memberId=false){
$this->setDb($this->dbName);
if($memberId){
$selectSql=Common::format("select {0} from {1} where store_id={2} and buyer_id={3} and is_refund<>{4} and order_id in (select order_id from han_order where store_id={2} and buyer_id={3} and order_state not in({5}) ) ",$this->sumGoodsNum,$this->_tableName,$storeId,$memberId,ApiConst::refundSuccess,"0,-1");
}else{
$selectSql=Common::format("select {0} from {1} where store_id={2} and is_refund<>{4} and order_id in (select order_id from han_order where store_id={2} and order_state not in({5}) ) ",$this->sumGoodsNum,$this->_tableName,$storeId,$memberId,ApiConst::refundSuccess,"0,-1");
}
$res=$this->db->from($this->_tableName)->query($selectSql);
return $res->one?$res->one:array();
}
// public function getMemberStoreOrderGoodsCount($storeIds,$memberIds){
// $this->setDb($this->dbName);
// $orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
// $whereOrder['store_id']=array('in',$storeIds);
// $whereOrder['buyer_id']=array('in',$memberIds);
// $whereOrder['order_state']=array('in',ArrayConst::orderCloseAndCancel);
// $orderIds=$orderDao->getFieldByWhere($whereOrder,'order_id');
// $where['store_id']=array('in',$storeIds);
// $where['buyer_id']=array('in',$memberIds);
// $where['is_refund']=array('neq',ApiConst::refundSuccess);
// if($orderIds){
// $where['order_id']=array('notin',$orderIds);
// }
// $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;
//
// }
public function getMemberStoreOrderGoodsCountBak($storeIds,$memberIds){
$this->setDb($this->dbName);
$orderDao=\DAO\Order\OrderModel::getInstance(DbNameConst::salveDBConnectName);
......
......@@ -68,6 +68,20 @@ class RefundReturnModel extends \DAO\AbstractModel
}
// 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 : [];
//
// }
public function getRefundSuccessMoneyByStoreIdAndMemberId($storeId, $buyerId)
{
$this->setDb($this->dbName);
......@@ -78,7 +92,7 @@ class RefundReturnModel extends \DAO\AbstractModel
$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();
$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 : [];
}
......@@ -662,7 +676,7 @@ class RefundReturnModel extends \DAO\AbstractModel
public function getMemberStoreStaticsByGmtUpdate($gmtUpdate, $pageIndex, $pageSize)
{
$this->setDb($this->dbName);
$where = \Our\Common::format(' gmt_update>={0} and gmt_update<{1} and refund_state={2}', $gmtUpdate, TIMESTAMP, ApiConst::refundStateComplete);
$where = \Our\Common::format(' gmt_update>={0} and gmt_update<{1} and is_suc_refund={2}', $gmtUpdate, TIMESTAMP, ApiConst::refundSuccess);
$res = $this->lists($where, array('gmt_update' => 'asc'), $this->sumField, $pageIndex, $pageSize);
return $res['list'] ? $res : false;
}
......@@ -698,7 +712,18 @@ class RefundReturnModel extends \DAO\AbstractModel
return self::$_instance;
}
public function getSumRefundAmountByMemberIdAndStoreId($storeId,$memberId=false)
{
$this->setDb($this->dbName);
$where['store_id']=$storeId;
$where['buyer_id']=$memberId;
$where['is_suc_refund']=ApiConst::refundSuccess;
if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where);
}
$res=$this->db->from($this->_tableName)->where($where)->select(" buyer_id as buyerId,store_id as storeId,(SUM(refund_amount)) AS refundAmount")->fetchOne();
return $res?$res:array();
}
/**
* @param $storeId
* @param $orderState
......
......@@ -295,6 +295,18 @@ class StoreModel extends \DAO\AbstractModel
}
}
public function deleteStoreTotalCount($storeId){
$favoritesStoreDao = \DAO\FavoritesStoreModel::getInstance();
$orderDao=\DAO\Order\OrderModel::getInstance();
$storeStatisticsDao=\DAO\StoreStatisticsModel::getInstance();
$favoritesStoreDao->deleteGetFavoritesCountByStoreId($storeId);
$memberFavoritesStoreStoreMemberStatisticsDao = \DAO\Store\MemberFavoritesStoreStoreMemberStatisticsModel::getInstance();
$memberFavoritesStoreStoreMemberStatisticsDao->deleteGetGoodsCountOrderTotalByStoreIdCache($storeId);
$orderDao->deleteGetOrderOrderTotalOnlineByStoreIdCache($storeId);
$storeStatisticsDao->deleteGetByStoreIdCache($storeId);
}
public function getStoresByCityCode($cityCode, $field = 'store_id,store_longitude,store_latitude,max_sign_rang,max_sales_rang,store_sales_scope')
{
$storeClassCondition = " store_citycode = '" . $cityCode . "' ";
......
......@@ -40,9 +40,10 @@ class StoreMemberStatisticsModel extends \DAO\AbstractModel {
* @return array
*/
public function find($where) {
$this->setDb();
$this->setDb($this->dbName);
$field='*';
$data=$this->db->select($field)->from($this->_tableName)->where($where)->fetchOne();
echo $this->db->getLastSql();exit;
return $data;
}
public function getField(){
......@@ -55,18 +56,15 @@ class StoreMemberStatisticsModel extends \DAO\AbstractModel {
* @return mixed
*/
public function update($data,$where){
$this->setDb();
$this->setDb(DbNameConst::masterDBConnectName);
return $this->db->update($this->_tableName)->where($where)->rows($data)->execute();
}
/**
* 插入数据
* @param $data
* @return mixed
*/
public function insert($data){
$this->setDb(DbNameConst::masterDBConnectName);
return $this->db->insert($this->_tableName)->rows($data)->execute();
}
/**
* 排序,1:关注时间降序,2:关注时间升序,3:购买力降序,4:购买力升序,默认1
* @param $data
......@@ -169,6 +167,19 @@ class StoreMemberStatisticsModel extends \DAO\AbstractModel {
return $result;
}
//插入数据大量
public function addOrUpdate($data)
{
$this->setDb(DbNameConst::masterDBConnectName);
$error = 0;
$baseSql = "insert into {$this->_tableName}({$this->insertField}) values";
$addSql = \Our\Common::format("({0},{1},{2},{3},{4}) ", $data['storeId'], $data['buyerId'],$data['orderGoodsCount'], $data['orderTotal'],TIMESTAMP);
$extentSql=" ON DUPLICATE KEY UPDATE order_goods_count=values(order_goods_count),order_total=values(order_total),add_time=".TIMESTAMP;
$excuteSql=$baseSql.$addSql.$extentSql;
$one = $this->db->insert($this->_tableName)->query($excuteSql);
return $one;
}
//插入数据大量
public function addAll($datas,$field="orderGoodsCount")
{
......
......@@ -43,6 +43,15 @@ class StoreStatisticsModel extends \DAO\AbstractModel {
return $data;
}
public function deleteGetByStoreIdCache($storeId){
\Our\RedisHelper::delCachedFunction(\Redis\Db6\StoreRedisModel::getInstance(), array(&$this, 'getByStoreId'), array(), array($storeId));
}
public function getByStoreId($storeId){
$where['store_id']=$storeId;
$res=$this->find($where);
return $res?$res:array();
}
/**
* 更新数据
* @param $data
......@@ -141,7 +150,19 @@ class StoreStatisticsModel extends \DAO\AbstractModel {
* @var \DAO\UserModel
*/
private static $_instance = null;
//插入数据大量
public $insertFields="store_id,order_count,order_total,order_total_online,fav_count,goods_count,add_time";
public function addOrUpdate($data)
{
$this->setDb(DbNameConst::masterDBConnectName);
$baseSql = "insert into {$this->_tableName}({$this->insertFields}) values";
$addSql = \Our\Common::format("({0},{1},{2},{3},{4},{5},{6}) ", $data['storeId'],$data['orderCount'], $data['orderTotal'],$data['orderTotalOnline'], $data['favCount'], $data['goodsCount'],TIMESTAMP);
$extentSql=" ON DUPLICATE KEY UPDATE order_count=values(order_count),order_total=values(order_total),order_total_online=values(order_total_online),fav_count=values(fav_count),goods_count=values(goods_count),add_time=".TIMESTAMP;
$excuteSql=$baseSql.$addSql.$extentSql;
$one = $this->db->insert($this->_tableName)->query($excuteSql);
return $one;
}
/**
* 获取类实例
*
......@@ -166,6 +187,7 @@ class StoreStatisticsModel extends \DAO\AbstractModel {
'order_total as orderTotal',
'fav_count as favCount',
'goods_count as goodsCount',
'order_total_online as orderTotalOnline',
);
}
......
......@@ -38,7 +38,7 @@ config.url.resourcesHost = "http://api.shenbd.com"
config.url.userHost = ""
config.url.ossHost = "https://img.shenbd.com"
//config.url.ossHost = "https://qmoss-01.oss-cn-hangzhou.aliyuncs.com"
;config.url.ossHost = "https://qmoss-01.oss-cn-hangzhou.aliyuncs.com"
;推送域名
config.url.pushHost="127.0.0.1:9503";
......@@ -55,7 +55,7 @@ config.url.convert=/usr/local/bin/wkhtmltoimage
config.url.resourcesHost = "http://apitest.shenbd.com"
; 用户中心host
config.url.userHost = ""
config.url.ossHost = "http://testadmin.shenbd.com/data/upload"
config.url.ossHost = "https://imgpre.shenbd.com"
; oss 域名
;config.url.ossHost = "https://qmoss-01.oss-cn-hangzhou.aliyuncs.com"
......
......@@ -48,7 +48,7 @@ class cliOrderClose extends basecli
$redis->auth($conf['password']);
}
$clientPush=\JPush\ClientPush::getInstance();
$clientPush->pushTest(array());exit;
$clientPush->pushTest(array());
$memberCenterServiceDao=\Business\User\MemberCenterServiceModel::getInstance();
//$messageService=\DAO\MessageHistoryModel::getInstance();
while($pushData=$redis->rPop('push_center')){
......
......@@ -72,13 +72,13 @@ class cliShopkeeperIndex extends basecli
try {
$shopkeeperService->insertStoreMemberStatics();
//退货退款订单自动关闭
// $shopkeeperService->reduceStoreMemberStatics();
//$shopkeeperService->storeStatictisTask();
$shopkeeperService->updateLastId();
$shopkeeperService->reduceStoreMemberStatics();
// $shopkeeperService->storeStatictisTask();
// $shopkeeperService->updateLastId();
} catch (Exception $ex) {
throw new Exception($ex->getCode() . '|' . $ex->getMessage());
}
echo '店铺统计数据插入成功' .date('Y-m-d H:i:s',TIMESTAMP). "\r\n";
echo 'store static insert success' .date('Y-m-d H:i:s',TIMESTAMP). "\r\n";
}
}
......
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