作者 lyh

gx

@@ -127,34 +127,34 @@ class LoginController extends BaseController @@ -127,34 +127,34 @@ class LoginController extends BaseController
127 preg_match_all('/<img src="([^"]+)"/', $v['html'], $matches); 127 preg_match_all('/<img src="([^"]+)"/', $v['html'], $matches);
128 if (!empty($matches[1])) { 128 if (!empty($matches[1])) {
129 $srcValues = $matches[1]; 129 $srcValues = $matches[1];
  130 + $imageModel = new Image();
130 foreach ($srcValues as $srcValue) { 131 foreach ($srcValues as $srcValue) {
131 $hash = basename($srcValue); 132 $hash = basename($srcValue);
132 - var_dump($hash);  
133 - die();  
134 - }  
135 - } else {  
136 - echo "未找到 img 标签的 src 值";  
137 - } 133 + $image_info = $imageModel->read(['hash'=>$hash]);
  134 + if($image_info !== false){
138 $data['html'] = str_replace( 135 $data['html'] = str_replace(
139 - 'https://develop.globalso.com/a/image/',  
140 - 'https://ecdn6.globalso.com/public/template/', 136 + $hash,
  137 + basename($image_info['path']),
141 $v['html'] 138 $v['html']
142 ); 139 );
143 $data['head_html'] = str_replace( 140 $data['head_html'] = str_replace(
144 - 'https://develop.globalso.com/a/image/',  
145 - 'https://ecdn6.globalso.com/public/template/', 141 + $hash,
  142 + basename($image_info['path']),
146 $v['head_html'] 143 $v['head_html']
147 ); 144 );
148 $data['main_html'] = str_replace( 145 $data['main_html'] = str_replace(
149 - 'https://develop.globalso.com/a/image/',  
150 - 'https://ecdn6.globalso.com/public/template/', 146 + $hash,
  147 + basename($image_info['path']),
151 $v['main_html'] 148 $v['main_html']
152 ); 149 );
153 $data['footer_html'] = str_replace( 150 $data['footer_html'] = str_replace(
154 - 'https://develop.globalso.com/a/image/',  
155 - 'https://ecdn6.globalso.com/public/template/', 151 + $hash,
  152 + basename($image_info['path']),
156 $v['footer_html'] 153 $v['footer_html']
157 ); 154 );
  155 + }
  156 + }
  157 + }
158 $templateModel->edit($data,['id'=>$v['id']]); 158 $templateModel->edit($data,['id'=>$v['id']]);
159 } 159 }
160 return 1; 160 return 1;