lvhao преди 1 ден
родител
ревизия
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 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;
+        }
+
+   }
 }
 }