正在显示
1 个修改的文件
包含
27 行增加
和
3 行删除
| @@ -18,9 +18,11 @@ use App\Helper\Socket; | @@ -18,9 +18,11 @@ use App\Helper\Socket; | ||
| 18 | use App\Helper\Translate; | 18 | use App\Helper\Translate; |
| 19 | use App\Helper\Wechat; | 19 | use App\Helper\Wechat; |
| 20 | use App\Http\Logic\Bside\User\UserLoginLogic; | 20 | use App\Http\Logic\Bside\User\UserLoginLogic; |
| 21 | +use App\Models\File\Image; | ||
| 21 | use App\Models\Project\Project; | 22 | use App\Models\Project\Project; |
| 22 | use App\Models\Service\Service; | 23 | use App\Models\Service\Service; |
| 23 | use App\Models\Sms\SmsLog; | 24 | use App\Models\Sms\SmsLog; |
| 25 | +use App\Models\Template\Template; | ||
| 24 | use App\Models\User\User as UserModel; | 26 | use App\Models\User\User as UserModel; |
| 25 | use App\Utils\EncryptUtils; | 27 | use App\Utils\EncryptUtils; |
| 26 | use \Illuminate\Support\Facades\Cache; | 28 | use \Illuminate\Support\Facades\Cache; |
| @@ -257,8 +259,30 @@ class LoginController extends BaseController | @@ -257,8 +259,30 @@ class LoginController extends BaseController | ||
| 257 | 259 | ||
| 258 | 260 | ||
| 259 | public function ceshi(){ | 261 | public function ceshi(){ |
| 260 | - $url = "https://develop.globalso.com/upload/m/file/2023-08/64e86d1942c4c67754.psd"; | ||
| 261 | - $urlParts = parse_url($url); | ||
| 262 | - str_replace('/upload', '', $urlParts['path']); | 262 | + $templateModel = new Template(); |
| 263 | + $lists = $templateModel->list(); | ||
| 264 | + foreach ($lists as $k => $v){ | ||
| 265 | + // 使用正则表达式和 preg_match_all 函数来匹配多个 img 标签的 src 值 | ||
| 266 | + preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches); | ||
| 267 | + if (!empty($matches[1])) { | ||
| 268 | + $srcValues = $matches[1]; | ||
| 269 | + var_dump($srcValues); | ||
| 270 | + die(); | ||
| 271 | + $imageModel = new Image(); | ||
| 272 | + foreach ($srcValues as $srcValue) { | ||
| 273 | + $hash = basename($srcValue); | ||
| 274 | + $image_info = $imageModel->read(['hash'=>$hash]); | ||
| 275 | + if($image_info !== false){ | ||
| 276 | + $path = basename($image_info['path']); | ||
| 277 | + $data['html'] = str_replace( | ||
| 278 | + $hash, | ||
| 279 | + $path, | ||
| 280 | + $v['html'] | ||
| 281 | + ); | ||
| 282 | + $templateModel->edit(['html'=>$data['html']],['id'=>$v['id']]); | ||
| 283 | + } | ||
| 284 | + } | ||
| 285 | + } | ||
| 286 | + } | ||
| 263 | } | 287 | } |
| 264 | } | 288 | } |
-
请 注册 或 登录 后发表评论