|
@@ -23,6 +23,7 @@ use App\Models\Project\Project; |
|
@@ -23,6 +23,7 @@ use App\Models\Project\Project; |
|
23
|
use App\Models\Service\Service;
|
23
|
use App\Models\Service\Service;
|
|
24
|
use App\Models\Sms\SmsLog;
|
24
|
use App\Models\Sms\SmsLog;
|
|
25
|
use App\Models\Template\Template;
|
25
|
use App\Models\Template\Template;
|
|
|
|
26
|
+use App\Models\Template\TemplateModule;
|
|
26
|
use App\Models\User\User as UserModel;
|
27
|
use App\Models\User\User as UserModel;
|
|
27
|
use App\Utils\EncryptUtils;
|
28
|
use App\Utils\EncryptUtils;
|
|
28
|
use \Illuminate\Support\Facades\Cache;
|
29
|
use \Illuminate\Support\Facades\Cache;
|
|
@@ -260,26 +261,58 @@ class LoginController extends BaseController |
|
@@ -260,26 +261,58 @@ class LoginController extends BaseController |
|
260
|
|
261
|
|
|
261
|
public function ceshi(){
|
262
|
public function ceshi(){
|
|
262
|
$templateModel = new Template();
|
263
|
$templateModel = new Template();
|
|
263
|
- $lists = $templateModel->list();
|
|
|
|
264
|
- foreach ($lists as $k => $v){
|
|
|
|
265
|
- // 使用正则表达式和 preg_match_all 函数来匹配多个 img 标签的 src 值
|
|
|
|
266
|
- preg_match_all('/\"https:\/\/admin.item.globalso.site\/a\/image\/(.*?)\"/', $v['html'], $matches);
|
264
|
+ $list = $templateModel->list();
|
|
|
|
265
|
+ foreach ($list as $k => $v){
|
|
|
|
266
|
+ preg_match_all('/\(https:\/\/admin.item.globalso.site\/a\/image\/(.*?)\)/', $v['html'], $matches);
|
|
267
|
if (!empty($matches[1])) {
|
267
|
if (!empty($matches[1])) {
|
|
268
|
$srcValues = $matches[1];
|
268
|
$srcValues = $matches[1];
|
|
269
|
$imageModel = new Image();
|
269
|
$imageModel = new Image();
|
|
|
|
270
|
+ $html = $v['html'];
|
|
270
|
foreach ($srcValues as $srcValue) {
|
271
|
foreach ($srcValues as $srcValue) {
|
|
271
|
- $image_info = $imageModel->read(['hash'=>$srcValue]);
|
|
|
|
272
|
- if($image_info !== false){
|
272
|
+ $image_info = $imageModel->read(['hash' => $srcValue]);
|
|
|
|
273
|
+ if ($image_info !== false) {
|
|
273
|
$path = $image_info['path'];
|
274
|
$path = $image_info['path'];
|
|
274
|
- $v['html'] = str_replace(
|
|
|
|
275
|
- '/a/image/'.$srcValue,
|
|
|
|
276
|
- $path,
|
|
|
|
277
|
- $v['html']
|
|
|
|
278
|
- );
|
|
|
|
279
|
- $templateModel->edit(['html'=>$v['html']],['id'=>$v['id']]);
|
275
|
+ $html = $this->re($html, '/a/image/'.$srcValue, $path);
|
|
280
|
}
|
276
|
}
|
|
281
|
}
|
277
|
}
|
|
|
|
278
|
+ $templateModel->edit(['html'=>$html],['id'=>$v['id']]);
|
|
282
|
}
|
279
|
}
|
|
283
|
}
|
280
|
}
|
|
|
|
281
|
+ return 1;
|
|
|
|
282
|
+ }
|
|
|
|
283
|
+
|
|
|
|
284
|
+ public function re(&$html,$srcValue,$path){
|
|
|
|
285
|
+ $html = str_replace(
|
|
|
|
286
|
+ $srcValue,
|
|
|
|
287
|
+ $path,
|
|
|
|
288
|
+ $html
|
|
|
|
289
|
+ );
|
|
|
|
290
|
+ return $html;
|
|
|
|
291
|
+ }
|
|
|
|
292
|
+
|
|
|
|
293
|
+ public function updateHtml(){
|
|
|
|
294
|
+ $html = $this->re($v['html'],'https://develop.globalso.com/a/image/','https://ecdn6.globalso.com/public/template/');
|
|
|
|
295
|
+ $html = $this->re($v['html'],'https://develop.globalso.com/b/image/','https://ecdn6.globalso.com/public/template/');
|
|
|
|
296
|
+ }
|
|
|
|
297
|
+
|
|
|
|
298
|
+ public function updateCe(){
|
|
|
|
299
|
+ $templateModel = new TemplateModule();
|
|
|
|
300
|
+ $list = [];
|
|
|
|
301
|
+ foreach ($list as $k => $v){
|
|
|
|
302
|
+ preg_match_all('/\"https:\/\/develop.globalso.com\/a\/image\/(.*?)\"/', $v['html'], $matches);
|
|
|
|
303
|
+ if (!empty($matches[1])) {
|
|
|
|
304
|
+ $srcValues = $matches[1];
|
|
|
|
305
|
+ $imageModel = new Image();
|
|
|
|
306
|
+ $html = $v['html'];
|
|
|
|
307
|
+ foreach ($srcValues as $srcValue) {
|
|
|
|
308
|
+ $image_info = $imageModel->read(['hash' => $srcValue]);
|
|
|
|
309
|
+ if ($image_info !== false) {
|
|
|
|
310
|
+ $path = basename($image_info['path']);
|
|
|
|
311
|
+ $html = $this->re($html, $srcValue, $path);
|
|
|
|
312
|
+ }
|
|
|
|
313
|
+ }
|
|
|
|
314
|
+ }
|
|
|
|
315
|
+ $templateModel->edit(['html'=>$html],['id'=>$v['id']]);
|
|
|
|
316
|
+ }
|
|
284
|
}
|
317
|
}
|
|
285
|
} |
318
|
} |