作者 lyh

gx

@@ -267,5 +267,49 @@ class LoginController extends BaseController @@ -267,5 +267,49 @@ class LoginController extends BaseController
267 return $data; 267 return $data;
268 } 268 }
269 269
  270 + public function ceshi(){
  271 + $templateModel = new TemplateModule();
  272 + $list = $templateModel->list();
  273 + foreach ($list as $k => $v){
  274 + $html = $this->updateHtml();
  275 + $templateModel->edit(['html'=>$html],['id'=>$v['id']]);
  276 + }
  277 + return 1;
  278 + }
  279 +
  280 + public function re(&$html,$srcValue,$path){
  281 + $html = str_replace(
  282 + $srcValue,
  283 + $path,
  284 + $html
  285 + );
  286 + return $html;
  287 + }
  288 +
  289 + public function updateHtml(){
  290 + $html = $this->re($v['html'],'admin.item.globalso.site','ecdn6.globalso.com/');
  291 +// $html = $this->re($v['html'],'https://develop.globalso.com/b/image/','https://ecdn6.globalso.com/public/template/');
  292 + }
  293 +
  294 + public function updateCe(){
  295 + $templateModel = new TemplateModule();
  296 + $list = [];
  297 + foreach ($list as $k => $v){
  298 + preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches);
  299 + if (!empty($matches[1])) {
  300 + $srcValues = $matches[1];
  301 + $imageModel = new Image();
  302 + $html = $v['html'];
  303 + foreach ($srcValues as $srcValue) {
  304 + $image_info = $imageModel->read(['hash' => $srcValue]);
  305 + if ($image_info !== false) {
  306 + $path = basename($image_info['path']);
  307 + $html = $this->re($html, $srcValue, $path);
  308 + }
  309 + }
  310 + }
  311 + $templateModel->edit(['html'=>$html],['id'=>$v['id']]);
  312 + }
  313 + }
270 314
271 } 315 }
@@ -114,19 +114,4 @@ class ATemplateModuleLogic extends BaseLogic @@ -114,19 +114,4 @@ class ATemplateModuleLogic extends BaseLogic
114 return $this->success(); 114 return $this->success();
115 } 115 }
116 116
117 - /**  
118 - * @remark :如果是图片名称返回图片hash值  
119 - * @name :imageName  
120 - * @author :lyh  
121 - * @method :post  
122 - * @time :2023/8/31 11:49  
123 - */  
124 - public function imageName($string){  
125 - $imageModel = new Image();  
126 - if (strpos($string, '.') !== false) {  
127 - $info = $imageModel->read(['path'=>['like','%'.$string.'%']]);  
128 - $string = $info['hash'];  
129 - }  
130 - return $string;  
131 - }  
132 } 117 }