cqpCow 2 年 前
コミット
38b1744e56
1 ファイル変更14 行追加5 行削除
  1. 14 5
      app/Service/HeaderWord/HeaderWordHookService.php

+ 14 - 5
app/Service/HeaderWord/HeaderWordHookService.php

@@ -136,14 +136,23 @@ class HeaderWordHookService extends Service
         foreach ($data['data'] as $key => $value){
             if (strpos($value['position'], ',') !== false) {
                 $tmp = explode(',',$value['position']);
-                $str = '';
+                $str_col = $str_ros =  '';
                 foreach ($tmp as $v){
                     $tmp_v = explode(':',$v);
-                    if($tmp_v[0] != $tmp_v[1]) continue;
-                    $str .= $tmp_v[0] . ':';
+                    if($tmp_v[0] != $tmp_v[1]) {
+                        // 截取头部
+                        $head = explode(':', $tmp[0])[0];
+                        // 截取尾部
+                        $tail = explode(':', end($tmp))[1];
+                        $str_ros = $head . ":" . $tail;
+                        continue;
+                    }else{
+                        $str_col .= $tmp_v[0] . ':';
+                    }
                 }
-                $str = rtrim($str,':');
-                if($str) $data['data'][$key]['position'] = $str;
+                $str_col = rtrim($str_col,':');
+                if($str_col) $data['data'][$key]['position'] = $str_col;
+                if($str_ros) $data['data'][$key]['position'] = $str_ros;
             }
         }