@@ -23,56 +24,65 @@ class RefundReturnModel extends \DAO\AbstractModel {
* @var string
*/
protected$_tableName='han_refund_return';
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';
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";
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';
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";
$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);
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);
$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:[];
$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
...
...
@@ -84,175 +94,215 @@ class RefundReturnModel extends \DAO\AbstractModel {