shish 1 mesiac pred
rodič
commit
290dc07ce4
1 zmenil súbory, kde vykonal 10 pridanie a 0 odobranie
  1. 10 0
      biz-ghs/order/classes/ShMethodClass.php

+ 10 - 0
biz-ghs/order/classes/ShMethodClass.php

@@ -162,6 +162,16 @@ class ShMethodClass extends BaseClass
             $result[] = $config;
         }
 
+        // 按 sort 升序返回,供 hd/ghs GetAllConfig 等接口展示自定义排序
+        usort($result, function ($a, $b) {
+            $sortCompare = (int)($a['sort'] ?? 0) <=> (int)($b['sort'] ?? 0);
+            if ($sortCompare !== 0) {
+                return $sortCompare;
+            }
+            // sort 相同时按 style 稳定排序,避免顺序抖动
+            return (int)($a['style'] ?? 0) <=> (int)($b['style'] ?? 0);
+        });
+
         return $result;
     }