Browse Source

Merge branch 'master' into dev

shish 5 hours ago
parent
commit
0fae0cf1af

+ 25 - 1
app-ghs/controllers/RefundController.php

@@ -455,6 +455,7 @@ class RefundController extends BaseController
     /**
      * 销售售后记录列表:ghs /order/refund-list、小程序售后记录共用。
      * matchPayTime/fromAffect=1 时按原单 payTime + 售后 addTime,与跨天影响统计同口径。
+     * passSearchTime 筛真实通过日 passTime,用来和花材销量跨天扣减对齐。
      */
     public function actionList()
     {
@@ -497,6 +498,15 @@ class RefundController extends BaseController
             $period = dateUtil::formatTime($refundSearchTime, $refundStartTime, $refundEndTime);
             $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
         }
+        // 通过日只认真实 passTime,不回落到申请日,避免未通过单混进来
+        $passSearchTime = $get['passSearchTime'] ?? '';
+        $passPeriod = null;
+        if (!empty($passSearchTime)) {
+            $passStartTime = $get['passStartTime'] ?? '';
+            $passEndTime = $get['passEndTime'] ?? '';
+            $passPeriod = dateUtil::formatTime($passSearchTime, $passStartTime, $passEndTime);
+            $where['passTime'] = ['between', [$passPeriod['startTime'], $passPeriod['endTime']]];
+        }
         $customId = $get['customId'] ?? '';
         if (!empty($customId)) {
             $where['customId'] = $customId;
@@ -511,7 +521,7 @@ class RefundController extends BaseController
         }
         $export = $get['export'] ?? 0;
         if ($export == 1) {
-            if (isset($where['orderTime']) == false && isset($where['addTime']) == false) {
+            if (isset($where['orderTime']) == false && isset($where['addTime']) == false && isset($where['passTime']) == false) {
                 util::fail('请选时间');
             }
             ini_set('memory_limit', '2045M');
@@ -540,6 +550,18 @@ class RefundController extends BaseController
                     util::fail('最长可导出一个月');
                 }
             }
+
+            if (isset($where['passTime'])) {
+                $start = $where['passTime'][1][0];
+                $end = $where['passTime'][1][1];
+                $monthTime = bcmul(31, 86400);
+                $startArea = strtotime($start);
+                $endArea = strtotime($end);
+                $diff = bcsub($endArea, $startArea);
+                if ($diff > $monthTime) {
+                    util::fail('最长可导出一个月');
+                }
+            }
         }
         // 从跨天售后影响点进来:按原单 payTime + 售后 addTime,且必须挂上批发单,与统计同口径
         $matchPayTime = intval($get['matchPayTime'] ?? 0);
@@ -560,6 +582,8 @@ class RefundController extends BaseController
                     'sameDay' => $sameDay,
                     'customId' => $customId,
                     'shopAdminId' => $shopAdminId,
+                    'passStart' => $passPeriod['startTime'] ?? '',
+                    'passEnd' => $passPeriod['endTime'] ?? '',
                 ]
             );
         } else {

+ 8 - 0
biz-ghs/order/classes/NextDayRefundClass.php

@@ -1020,6 +1020,14 @@ class NextDayRefundClass
             $whereSql .= ' AND r.shopAdminId = :shopAdminId';
             $params[':shopAdminId'] = $shopAdminId;
         }
+        // 从花材销量/列表带通过日时,只认真实 passTime
+        $passStart = $extra['passStart'] ?? '';
+        $passEnd = $extra['passEnd'] ?? '';
+        if ($passStart !== '' && $passEnd !== '') {
+            $whereSql .= " AND r.passTime BETWEEN :passStart AND :passEnd AND r.passTime > '1970-01-01'";
+            $params[':passStart'] = $passStart;
+            $params[':passEnd'] = $passEnd;
+        }
 
         $fromSql = "FROM xhRefund r
             INNER JOIN xhGhsOrder o ON o.orderSn = r.relateOrderSn AND o.mainId = r.mainId

+ 4 - 1
biz-ghs/order/classes/RefundOrderClass.php

@@ -58,7 +58,10 @@ class RefundOrderClass extends BaseClass
         $shopId = $refund->shopId ?? 0;
         $refundPrice = $refund->refundPrice ?? 0;
         $shop = ShopClass::getById($shopId, true);
-
+        //我要花义乌店不打印退款小票
+        if ($shopId == 100382) {
+            return false;
+        }
         $sjId = $shop->sjId ?? 0;
         $sj = SjClass::getById($sjId, true);
         $sjName = $sj->name ?? '';