作者 lyh

gx

@@ -260,20 +260,19 @@ class LoginController extends BaseController @@ -260,20 +260,19 @@ class LoginController extends BaseController
260 260
261 261
262 public function ceshi(){ 262 public function ceshi(){
263 - $templateModel = new TemplateModule(); 263 + $templateModel = new Template();
264 $list = $templateModel->list(); 264 $list = $templateModel->list();
265 foreach ($list as $k => $v){ 265 foreach ($list as $k => $v){
266 - // 使用正则表达式和 preg_match_all 函数来匹配多个 img 标签的 src 值  
267 preg_match_all('/\"https:\/\/admin.item.globalso.site\/a\/image\/(.*?)\"/', $v['html'], $matches); 266 preg_match_all('/\"https:\/\/admin.item.globalso.site\/a\/image\/(.*?)\"/', $v['html'], $matches);
268 if (!empty($matches[1])) { 267 if (!empty($matches[1])) {
269 $srcValues = $matches[1]; 268 $srcValues = $matches[1];
270 $imageModel = new Image(); 269 $imageModel = new Image();
271 $html = $v['html']; 270 $html = $v['html'];
272 foreach ($srcValues as $srcValue) { 271 foreach ($srcValues as $srcValue) {
273 - $image_info = $imageModel->read(['hash'=>$srcValue]);  
274 - if($image_info !== false){  
275 - $path = basename($image_info['path']);  
276 - $html = $this->re($html,'/a/image/'.$srcValue,$path); 272 + $image_info = $imageModel->read(['hash' => $srcValue]);
  273 + if ($image_info !== false) {
  274 + $path = $image_info['path'];
  275 + $html = $this->re($html, $srcValue, $path);
277 } 276 }
278 } 277 }
279 $templateModel->edit(['html'=>$html],['id'=>$v['id']]); 278 $templateModel->edit(['html'=>$html],['id'=>$v['id']]);
@@ -290,4 +289,30 @@ class LoginController extends BaseController @@ -290,4 +289,30 @@ class LoginController extends BaseController
290 ); 289 );
291 return $html; 290 return $html;
292 } 291 }
  292 +
  293 + public function updateHtml(){
  294 + $html = $this->re($v['html'],'https://develop.globalso.com/a/image/','https://ecdn6.globalso.com/public/template/');
  295 + $html = $this->re($v['html'],'https://develop.globalso.com/b/image/','https://ecdn6.globalso.com/public/template/');
  296 + }
  297 +
  298 + public function updateCe(){
  299 + $templateModel = new TemplateModule();
  300 + $list = [];
  301 + foreach ($list as $k => $v){
  302 + preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches);
  303 + if (!empty($matches[1])) {
  304 + $srcValues = $matches[1];
  305 + $imageModel = new Image();
  306 + $html = $v['html'];
  307 + foreach ($srcValues as $srcValue) {
  308 + $image_info = $imageModel->read(['hash' => $srcValue]);
  309 + if ($image_info !== false) {
  310 + $path = basename($image_info['path']);
  311 + $html = $this->re($html, $srcValue, $path);
  312 + }
  313 + }
  314 + }
  315 + $templateModel->edit(['html'=>$html],['id'=>$v['id']]);
  316 + }
  317 + }
293 } 318 }