Ken 1 周之前
父节点
当前提交
35d36c3898
共有 1 个文件被更改,包括 6 次插入11 次删除
  1. 6 11
      app/Services/BaseService.php

+ 6 - 11
app/Services/BaseService.php

@@ -197,25 +197,20 @@ class BaseService
      */
     public static function bettingGroupNotice($text, $keyboard = [], $image = '', $isTop = false): void
     {
-
         $bettingGroup = Config::where('field', 'betting_group')->first()->val;
         $array = explode("\n", $text);
         foreach ($array as &$line) $line .= "\n";
         $texts = [];
+
+        $len = 4096;
+        if (!empty($image)) $len = 1024;
         foreach ($array as $item) {
             if (count($texts) == 0) {
                 $texts[] = $item;
-            } else if (strlen($texts[count($texts) - 1] . $item) <= 4096) {
-                if (!empty($image) && count($texts) == 1) {
-                    if (strlen($texts[0] . $item) <= 1024) {
-                        $texts[0] .= $item;
-                    } else {
-                        $texts[] = $item;
-                    }
-                } else {
-                    $texts[count($texts) - 1] .= $item;
-                }
+            } else if (strlen($texts[count($texts) - 1] . $item) <= $len) {
+                $texts[count($texts) - 1] .= $item;
             } else {
+                $len = 4096;
                 $texts[] = $item;
             }
         }