正在显示
1 个修改的文件
包含
24 行增加
和
24 行删除
| @@ -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(); | 133 | + $image_info = $imageModel->read(['hash'=>$hash]); |
| 134 | + if($image_info !== false){ | ||
| 135 | + $data['html'] = str_replace( | ||
| 136 | + $hash, | ||
| 137 | + basename($image_info['path']), | ||
| 138 | + $v['html'] | ||
| 139 | + ); | ||
| 140 | + $data['head_html'] = str_replace( | ||
| 141 | + $hash, | ||
| 142 | + basename($image_info['path']), | ||
| 143 | + $v['head_html'] | ||
| 144 | + ); | ||
| 145 | + $data['main_html'] = str_replace( | ||
| 146 | + $hash, | ||
| 147 | + basename($image_info['path']), | ||
| 148 | + $v['main_html'] | ||
| 149 | + ); | ||
| 150 | + $data['footer_html'] = str_replace( | ||
| 151 | + $hash, | ||
| 152 | + basename($image_info['path']), | ||
| 153 | + $v['footer_html'] | ||
| 154 | + ); | ||
| 155 | + } | ||
| 134 | } | 156 | } |
| 135 | - } else { | ||
| 136 | - echo "未找到 img 标签的 src 值"; | ||
| 137 | } | 157 | } |
| 138 | - $data['html'] = str_replace( | ||
| 139 | - 'https://develop.globalso.com/a/image/', | ||
| 140 | - 'https://ecdn6.globalso.com/public/template/', | ||
| 141 | - $v['html'] | ||
| 142 | - ); | ||
| 143 | - $data['head_html'] = str_replace( | ||
| 144 | - 'https://develop.globalso.com/a/image/', | ||
| 145 | - 'https://ecdn6.globalso.com/public/template/', | ||
| 146 | - $v['head_html'] | ||
| 147 | - ); | ||
| 148 | - $data['main_html'] = str_replace( | ||
| 149 | - 'https://develop.globalso.com/a/image/', | ||
| 150 | - 'https://ecdn6.globalso.com/public/template/', | ||
| 151 | - $v['main_html'] | ||
| 152 | - ); | ||
| 153 | - $data['footer_html'] = str_replace( | ||
| 154 | - 'https://develop.globalso.com/a/image/', | ||
| 155 | - 'https://ecdn6.globalso.com/public/template/', | ||
| 156 | - $v['footer_html'] | ||
| 157 | - ); | ||
| 158 | $templateModel->edit($data,['id'=>$v['id']]); | 158 | $templateModel->edit($data,['id'=>$v['id']]); |
| 159 | } | 159 | } |
| 160 | return 1; | 160 | return 1; |
-
请 注册 或 登录 后发表评论