shish %!s(int64=3) %!d(string=hai) anos
pai
achega
67aa532220

+ 2 - 4
app-ghs/controllers/ClearController.php

@@ -22,10 +22,8 @@ class ClearController extends BaseController
         CustomClass::valid($custom, $this->shopId);
         $info = ClearClass::getByCondition(['customId' => $customId, 'status' => 1], true);
         if (isset($info->deadline) && $info->deadline < date("Y-m-d H:i:s")) {
-            if ($info->status == 1) {
-                $info->status = 3;
-                $info->save();
-            }
+            $info->status = 3;
+            $info->save();
             util::success(['info' => []]);
         }
         util::success(['info' => $info]);

+ 11 - 5
app-ghs/controllers/RefundController.php

@@ -127,14 +127,20 @@ class RefundController extends BaseController
                 util::fail("订单完成了才能发起退款");
             }
             $customId = $order->customId ?? 0;
-            $clearList = PurchaseClearClass::getAllByCondition(['customId' => $customId, 'status' => 1], null, '*');
+            $clearList = PurchaseClearClass::getAllByCondition(['customId' => $customId, 'status' => 1], null, '*', null, true);
             $orderIds = [];
             if (!empty($clearList)) {
                 foreach ($clearList as $clear) {
-                    $saleStr = $clear['saleIds'] ?? '';
-                    if (!empty($saleStr)) {
-                        $current = explode(',', $saleStr);
-                        $orderIds = array_merge($orderIds, $current);
+                    $saleStr = $clear->saleIds ?? '';
+                    $deadline = $clear->deadline ?? '';
+                    if ($deadline < date("Y-m-d H:i:s")) {
+                        $clear->status = 3;
+                        $clear->save();
+                    }else{
+                        if (!empty($saleStr)) {
+                            $current = explode(',', $saleStr);
+                            $orderIds = array_merge($orderIds, $current);
+                        }
                     }
                 }
                 if (!empty($orderIds) && in_array($id, $orderIds)) {