shish 2 лет назад
Родитель
Сommit
d6af2c6633
1 измененных файлов с 36 добавлено и 0 удалено
  1. 36 0
      app-ghs/controllers/TestController.php

+ 36 - 0
app-ghs/controllers/TestController.php

@@ -18,6 +18,7 @@ use bizHd\purchase\classes\PurchaseClearClass;
 use bizHd\wx\classes\WxOpenClass;
 use bizGhs\express\services\MiniExpressService;
 use common\components\arrayUtil;
+use common\components\dateUtil;
 use common\components\dict;
 use common\components\lakala\Lakala;
 use common\components\miniUtil;
@@ -38,6 +39,41 @@ class TestController extends BaseController
 
     public function actionIn()
     {
+        $searchTime = 'custom';
+        $startTime = '2024-05-04';
+        $endTime = '2024-05-04';
+        $mainId = 23390;
+        $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
+        $start = $period['startTime'];
+        $end = $period['endTime'];
+        $where['time'] = ['between', [$start, $end]];
+
+        $currentStartDate = date('Y-m-d', strtotime($start));
+        $currentEndDate = date('Y-m-d', strtotime($end));
+        $currentStartTime = $currentStartDate . ' 00:00:00';
+        $currentEndTime = $currentEndDate . ' 23:59:59';
+
+        $totalAmount = 0;
+
+        $where = ['mainId' => $mainId, 'status' => ['in', [OrderClass::ORDER_STATUS_UN_SEND, OrderClass::ORDER_STATUS_SENDING, OrderClass::ORDER_STATUS_COMPLETE]]];
+        $where['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
+        $ghsOrderList = OrderClass::getAllByCondition($where, null, '*');
+        if (!empty($ghsOrderList)) {
+            foreach ($ghsOrderList as $ghsKey => $ghsOrder) {
+                $book = $ghsOrder['book'] ?? 0;
+                $status = $ghsOrder['status'] ?? 0;
+                $actPrice = $ghsOrder['actPrice'] ?? 0;
+                if ($book == 1 && $status == 2) {
+                    //预订单待发货的不算收入
+                    continue;
+                }
+                if ($status == 0 || $status == 5) {
+                    continue;
+                }
+                $totalAmount = bcadd($totalAmount, $actPrice);
+            }
+        }
+        echo $totalAmount;die;
     }
 
     public function actionIp()