作者 lyh

gx

@@ -123,31 +123,15 @@ class LoginController extends BaseController @@ -123,31 +123,15 @@ class LoginController extends BaseController
123 $templateModel = new Template(); 123 $templateModel = new Template();
124 $list = $templateModel->list(); 124 $list = $templateModel->list();
125 foreach ($list as $k => $v){ 125 foreach ($list as $k => $v){
126 - // 使用正则表达式和 preg_match_all 函数来匹配多个 img 标签的 src 值  
127 - preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches);  
128 - if (!empty($matches[1])) {  
129 - $srcValues = $matches[1];  
130 - $imageModel = new Image();  
131 - $html = $v['html'];  
132 - foreach ($srcValues as $srcValue) {  
133 - $image_info = $imageModel->read(['hash'=>$srcValue]);  
134 - if($image_info !== false){  
135 - $path = basename($image_info['path']);  
136 - $html = $this->re($html,$srcValue,$path);  
137 - }  
138 - }  
139 - $templateModel->edit(['html'=>$html],['id'=>$v['id']]);  
140 - } 126 + $html = str_replace(
  127 + "https://develop.globalso.com/a/image/",
  128 + "https://ecdn6.globalso.com/public/template/",
  129 + $v['html']
  130 + );
  131 + $templateModel->edit(['html'=>$html],['id'=>$v['id']]);
  132 +
141 } 133 }
142 return 1; 134 return 1;
143 } 135 }
144 136
145 - public function re(&$html,$srcValue,$path){  
146 - $html = str_replace(  
147 - $srcValue,  
148 - $path,  
149 - $html  
150 - );  
151 - return $html;  
152 - }  
153 } 137 }