作者 lyh

gx

... ... @@ -18,9 +18,11 @@ use App\Helper\Socket;
use App\Helper\Translate;
use App\Helper\Wechat;
use App\Http\Logic\Bside\User\UserLoginLogic;
use App\Models\File\Image;
use App\Models\Project\Project;
use App\Models\Service\Service;
use App\Models\Sms\SmsLog;
use App\Models\Template\Template;
use App\Models\User\User as UserModel;
use App\Utils\EncryptUtils;
use \Illuminate\Support\Facades\Cache;
... ... @@ -257,8 +259,30 @@ class LoginController extends BaseController
public function ceshi(){
$url = "https://develop.globalso.com/upload/m/file/2023-08/64e86d1942c4c67754.psd";
$urlParts = parse_url($url);
str_replace('/upload', '', $urlParts['path']);
$templateModel = new Template();
$lists = $templateModel->list();
foreach ($lists as $k => $v){
// 使用正则表达式和 preg_match_all 函数来匹配多个 img 标签的 src 值
preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches);
if (!empty($matches[1])) {
$srcValues = $matches[1];
var_dump($srcValues);
die();
$imageModel = new Image();
foreach ($srcValues as $srcValue) {
$hash = basename($srcValue);
$image_info = $imageModel->read(['hash'=>$hash]);
if($image_info !== false){
$path = basename($image_info['path']);
$data['html'] = str_replace(
$hash,
$path,
$v['html']
);
$templateModel->edit(['html'=>$data['html']],['id'=>$v['id']]);
}
}
}
}
}
}
... ...