lvhao 20 시간 전
부모
커밋
8516838f20
1개의 변경된 파일31개의 추가작업 그리고 0개의 파일을 삭제
  1. 31 0
      core/CoreApp/models/Model_logic_tools.php

+ 31 - 0
core/CoreApp/models/Model_logic_tools.php

@@ -96,4 +96,35 @@ class Model_logic_tools extends Lin_Model {
    function readCache($filename){
     
    }
+
+
+   function transfer_img_url($url,$host){
+        if(strpos($url,'/img/thumb?src=') !== false){
+            preg_match('/src=([^&]+)&w=/', $url, $matches);
+            $result = $matches[1] ?? '';
+            if(empty($result)){
+                return $url;
+            }
+            $result = $host.$result;
+            return $result;
+        }elseif(strpos($url,'https://1.wepolicy.cn')!== false){
+            $str = str_replace('https://1.wepolicy.cn',$host,$url);
+            return $str;
+        }elseif(strpos($url,'http://1.wepolicy.cn')!== false){
+            $str = str_replace('http://1.wepolicy.cn',$host,$url);
+            return $str;
+        }elseif(strpos($url,'http://erp.hnwmzp.cn')!== false){
+            $str = str_replace('http://erp.hnwmzp.cn',$host,$url);
+            return $url;
+        }elseif(strpos($url,'http://a.wepolicy.cn')!== false){
+            $str = str_replace('http://a.wepolicy.cn',$host,$url);
+            return $url;
+        }elseif(strpos($url,'https://erp.hnwmzp.cn')!== false){
+            $str = str_replace('http://a.wepolicy.cn',$host,$url);
+            return $url;
+        }else{
+            return $url;
+        }
+
+   }
 }