Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
24 个修改的文件
包含
401 行增加
和
101 行删除
app/Console/Commands/Test/Temp.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\Test; | ||
| 4 | + | ||
| 5 | +use App\Models\Collect\CollectTask; | ||
| 6 | +use App\Models\Com\UpdateLog; | ||
| 7 | +use App\Services\ProjectServer; | ||
| 8 | +use Illuminate\Console\Command; | ||
| 9 | +use Illuminate\Support\Facades\DB; | ||
| 10 | + | ||
| 11 | +class Temp extends Command | ||
| 12 | +{ | ||
| 13 | + /** | ||
| 14 | + * The name and signature of the console command. | ||
| 15 | + * | ||
| 16 | + * @var string | ||
| 17 | + */ | ||
| 18 | + protected $signature = 'test_temp'; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * The console command description. | ||
| 22 | + * | ||
| 23 | + * @var string | ||
| 24 | + */ | ||
| 25 | + protected $description = '临时脚本'; | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + public function handle() | ||
| 29 | + { | ||
| 30 | + $data = UpdateLog::where('sort', 0)->get(); | ||
| 31 | + | ||
| 32 | + foreach ($data as $item) { | ||
| 33 | + $project_id = $item->project_id; | ||
| 34 | + $project = ProjectServer::useProject($project_id); | ||
| 35 | + if ($project) { | ||
| 36 | + try { | ||
| 37 | + DB::connection('custom_mysql')->statement("ALTER TABLE `gl_product_category` ADD COLUMN `original_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '来源id'"); | ||
| 38 | + } catch (\Exception $e) { | ||
| 39 | + echo $project_id . '已存在'; | ||
| 40 | + continue; | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + //关闭数据库 | ||
| 44 | + DB::disconnect('custom_mysql'); | ||
| 45 | + | ||
| 46 | + echo $project_id.'成功'; | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | +} |
| @@ -98,6 +98,8 @@ class HtmlCollect extends Command | @@ -98,6 +98,8 @@ class HtmlCollect extends Command | ||
| 98 | if($html == '0'){ | 98 | if($html == '0'){ |
| 99 | $collect_info->status = CollectTask::STATUS_FAIL; | 99 | $collect_info->status = CollectTask::STATUS_FAIL; |
| 100 | $collect_info->save(); | 100 | $collect_info->save(); |
| 101 | + echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: no html' . PHP_EOL; | ||
| 102 | + sleep(2); | ||
| 101 | return true; | 103 | return true; |
| 102 | } | 104 | } |
| 103 | 105 | ||
| @@ -111,6 +113,7 @@ class HtmlCollect extends Command | @@ -111,6 +113,7 @@ class HtmlCollect extends Command | ||
| 111 | $collect_info->save(); | 113 | $collect_info->save(); |
| 112 | 114 | ||
| 113 | echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $e->getMessage() . PHP_EOL; | 115 | echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $e->getMessage() . PHP_EOL; |
| 116 | + sleep(2); | ||
| 114 | return true; | 117 | return true; |
| 115 | } | 118 | } |
| 116 | 119 | ||
| @@ -123,6 +126,7 @@ class HtmlCollect extends Command | @@ -123,6 +126,7 @@ class HtmlCollect extends Command | ||
| 123 | //关闭数据库 | 126 | //关闭数据库 |
| 124 | DB::disconnect('custom_mysql'); | 127 | DB::disconnect('custom_mysql'); |
| 125 | 128 | ||
| 129 | + sleep(2); | ||
| 126 | return true; | 130 | return true; |
| 127 | } | 131 | } |
| 128 | 132 | ||
| @@ -151,9 +155,6 @@ class HtmlCollect extends Command | @@ -151,9 +155,6 @@ class HtmlCollect extends Command | ||
| 151 | case 'blog': | 155 | case 'blog': |
| 152 | $source = RouteMap::SOURCE_BLOG; | 156 | $source = RouteMap::SOURCE_BLOG; |
| 153 | break; | 157 | break; |
| 154 | - case 'tag': | ||
| 155 | - $source = RouteMap::SOURCE_PRODUCT_KEYWORD; | ||
| 156 | - break; | ||
| 157 | default: | 158 | default: |
| 158 | $source = RouteMap::SOURCE_PRODUCT; | 159 | $source = RouteMap::SOURCE_PRODUCT; |
| 159 | break; | 160 | break; |
| @@ -105,6 +105,8 @@ class HtmlLanguageCollect extends Command | @@ -105,6 +105,8 @@ class HtmlLanguageCollect extends Command | ||
| 105 | if($html == '0'){ | 105 | if($html == '0'){ |
| 106 | $collect_info->status = CollectTask::STATUS_FAIL; | 106 | $collect_info->status = CollectTask::STATUS_FAIL; |
| 107 | $collect_info->save(); | 107 | $collect_info->save(); |
| 108 | + echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: no html' . PHP_EOL; | ||
| 109 | + sleep(2); | ||
| 108 | return true; | 110 | return true; |
| 109 | } | 111 | } |
| 110 | 112 | ||
| @@ -118,6 +120,7 @@ class HtmlLanguageCollect extends Command | @@ -118,6 +120,7 @@ class HtmlLanguageCollect extends Command | ||
| 118 | $collect_info->save(); | 120 | $collect_info->save(); |
| 119 | 121 | ||
| 120 | echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $e->getMessage() . PHP_EOL; | 122 | echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $e->getMessage() . PHP_EOL; |
| 123 | + sleep(2); | ||
| 121 | return true; | 124 | return true; |
| 122 | } | 125 | } |
| 123 | 126 | ||
| @@ -130,6 +133,7 @@ class HtmlLanguageCollect extends Command | @@ -130,6 +133,7 @@ class HtmlLanguageCollect extends Command | ||
| 130 | //关闭数据库 | 133 | //关闭数据库 |
| 131 | DB::disconnect('custom_mysql'); | 134 | DB::disconnect('custom_mysql'); |
| 132 | 135 | ||
| 136 | + sleep(2); | ||
| 133 | return true; | 137 | return true; |
| 134 | } | 138 | } |
| 135 | 139 |
| @@ -5,6 +5,7 @@ namespace App\Console\Commands\Update; | @@ -5,6 +5,7 @@ namespace App\Console\Commands\Update; | ||
| 5 | use App\Helper\Arr; | 5 | use App\Helper\Arr; |
| 6 | use App\Http\Logic\Bside\Product\CategoryLogic; | 6 | use App\Http\Logic\Bside\Product\CategoryLogic; |
| 7 | use App\Models\Blog\Blog; | 7 | use App\Models\Blog\Blog; |
| 8 | +use App\Models\Collect\CollectSource; | ||
| 8 | use App\Models\Collect\CollectTask; | 9 | use App\Models\Collect\CollectTask; |
| 9 | use App\Models\Com\UpdateLog; | 10 | use App\Models\Com\UpdateLog; |
| 10 | use App\Models\News\News; | 11 | use App\Models\News\News; |
| @@ -14,6 +15,7 @@ use App\Models\Product\Product; | @@ -14,6 +15,7 @@ use App\Models\Product\Product; | ||
| 14 | use App\Models\RouteMap\RouteMap; | 15 | use App\Models\RouteMap\RouteMap; |
| 15 | use App\Models\Template\BCustomTemplate; | 16 | use App\Models\Template\BCustomTemplate; |
| 16 | use App\Models\WebSetting\WebSettingReceiving; | 17 | use App\Models\WebSetting\WebSettingReceiving; |
| 18 | +use App\Services\CosService; | ||
| 17 | use App\Services\ProjectServer; | 19 | use App\Services\ProjectServer; |
| 18 | use Illuminate\Console\Command; | 20 | use Illuminate\Console\Command; |
| 19 | use Illuminate\Support\Facades\DB; | 21 | use Illuminate\Support\Facades\DB; |
| @@ -79,10 +81,22 @@ class ProjectUpdate extends Command | @@ -79,10 +81,22 @@ class ProjectUpdate extends Command | ||
| 79 | $domain_arr = parse_url($api_url); | 81 | $domain_arr = parse_url($api_url); |
| 80 | //获取网站配置 | 82 | //获取网站配置 |
| 81 | $link_type = 0; | 83 | $link_type = 0; |
| 84 | + $web_url_domain = $domain_arr['host']; | ||
| 85 | + $home_url = $domain_arr['host']; | ||
| 82 | $url_web_config = 'https://' . $domain_arr['host'] . '/wp-content/cache/user_config.text'; | 86 | $url_web_config = 'https://' . $domain_arr['host'] . '/wp-content/cache/user_config.text'; |
| 83 | $data_config = curl_c($url_web_config); | 87 | $data_config = curl_c($url_web_config); |
| 84 | if ($data_config) { | 88 | if ($data_config) { |
| 85 | - $link_type = $data_config['link_type']; | 89 | + $link_type = $data_config['link_type'] ?? 0; |
| 90 | + | ||
| 91 | + $web_url_arr = parse_url($data_config['web_url_domain'] ?? ''); | ||
| 92 | + if (isset($web_url_arr['host'])) { | ||
| 93 | + $web_url_domain = $web_url_arr['host']; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + $home_url_arr = parse_url($data_config['home_url'] ?? ''); | ||
| 97 | + if (isset($home_url_arr['host'])) { | ||
| 98 | + $home_url = $home_url_arr['host']; | ||
| 99 | + } | ||
| 86 | } | 100 | } |
| 87 | //获取所有语种 | 101 | //获取所有语种 |
| 88 | $language_list = []; | 102 | $language_list = []; |
| @@ -140,11 +154,10 @@ class ProjectUpdate extends Command | @@ -140,11 +154,10 @@ class ProjectUpdate extends Command | ||
| 140 | 'seo_title' => $item['seo_title'] ?? '', | 154 | 'seo_title' => $item['seo_title'] ?? '', |
| 141 | 'seo_keywords' => $item['seo_keywords'] ?? '', | 155 | 'seo_keywords' => $item['seo_keywords'] ?? '', |
| 142 | 'seo_description' => $item['seo_description'] ?? '', | 156 | 'seo_description' => $item['seo_description'] ?? '', |
| 157 | + 'is_upgrade' => 1, | ||
| 143 | 'route' => $route | 158 | 'route' => $route |
| 144 | ]); | 159 | ]); |
| 145 | $this->set_map($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $project_id); | 160 | $this->set_map($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $project_id); |
| 146 | - | ||
| 147 | - CollectTask::_insert($item['url'], $project_id, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $link_type, $language_list, $page_list); | ||
| 148 | } catch (\Exception $e) { | 161 | } catch (\Exception $e) { |
| 149 | echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; | 162 | echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; |
| 150 | continue; | 163 | continue; |
| @@ -224,6 +237,8 @@ class ProjectUpdate extends Command | @@ -224,6 +237,8 @@ class ProjectUpdate extends Command | ||
| 224 | $items = $data_page['data']['data'] ?? []; | 237 | $items = $data_page['data']['data'] ?? []; |
| 225 | 238 | ||
| 226 | $model = new Product(); | 239 | $model = new Product(); |
| 240 | + $category_model = new Category(); | ||
| 241 | + $logic = new CategoryLogic(); | ||
| 227 | 242 | ||
| 228 | foreach ($items as $item) { | 243 | foreach ($items as $item) { |
| 229 | $route = $this->get_url_route($item['url'] ?? ''); | 244 | $route = $this->get_url_route($item['url'] ?? ''); |
| @@ -234,31 +249,39 @@ class ProjectUpdate extends Command | @@ -234,31 +249,39 @@ class ProjectUpdate extends Command | ||
| 234 | $gallery = []; | 249 | $gallery = []; |
| 235 | if ($item['images'] ?? []) { | 250 | if ($item['images'] ?? []) { |
| 236 | foreach ($item['images'] as $k_img => $img) { | 251 | foreach ($item['images'] as $k_img => $img) { |
| 237 | - $gallery[] = ['alt' => '这是一张产品图', 'url' => $img]; | 252 | + $gallery[] = ['alt' => '这是一张产品图', 'url' => $this->source_download($img, $project_id, $domain_arr['host'], $web_url_domain, $home_url)]; |
| 238 | } | 253 | } |
| 239 | } | 254 | } |
| 240 | //分类 | 255 | //分类 |
| 241 | $category_id = ''; | 256 | $category_id = ''; |
| 242 | - if ($item['category'] ?? []) { | ||
| 243 | - $category_arr = []; | 257 | + //产品类型,2Featured Products,3Hot Products |
| 258 | + $product_type = ''; | ||
| 244 | 259 | ||
| 245 | - $pid = 0; | ||
| 246 | - for ($i = 0; $i < count($item['category']); $i++) { | ||
| 247 | - $return = $this->get_category_name_arr($item['category'], $pid); | ||
| 248 | - if ($return) { | ||
| 249 | - $category_arr[] = $this->special2str($return['name'] ?? ''); | ||
| 250 | - $pid = $return['id']; | 260 | + if ($item['category'] ?? []) { |
| 261 | + $type_arr = []; | ||
| 262 | + $new_category = []; | ||
| 263 | + foreach ($item['category'] as $cate) { | ||
| 264 | + if ($cate['parent'] == 0 && $cate['name'] == 'Featured Products') { | ||
| 265 | + $type_arr[] = 2; | ||
| 266 | + } elseif ($cate['parent'] == 0 && $cate['name'] == 'Hot Products') { | ||
| 267 | + $type_arr[] = 3; | ||
| 268 | + } else { | ||
| 269 | + $new_category[] = $cate['id']; | ||
| 251 | } | 270 | } |
| 252 | } | 271 | } |
| 253 | 272 | ||
| 254 | - if ($category_arr) { | ||
| 255 | - $categoryLogic = new CategoryLogic(); | ||
| 256 | - $category_id = $categoryLogic->importProductCategory($project_id, implode('/', $category_arr)); | 273 | + if ($type_arr) { |
| 274 | + $product_type = ',' . implode(',', $type_arr); | ||
| 275 | + } | ||
| 276 | + | ||
| 277 | + if ($new_category) { | ||
| 278 | + $category_arr = $category_model->list(['original_id' => ['in', $new_category]]); | ||
| 279 | + $category_id = $logic->getLastCategory(array_column($category_arr, 'id')); | ||
| 257 | } | 280 | } |
| 258 | } | 281 | } |
| 259 | try { | 282 | try { |
| 260 | $item['ttile'] = $this->special2str($item['ttile'] ?? ''); | 283 | $item['ttile'] = $this->special2str($item['ttile'] ?? ''); |
| 261 | - $id = $model->addReturnId([ | 284 | + $id = $model->insertGetId([ |
| 262 | 'project_id' => $project_id, | 285 | 'project_id' => $project_id, |
| 263 | 'title' => $item['ttile'], | 286 | 'title' => $item['ttile'], |
| 264 | 'intro' => $item['description'] ?? '', | 287 | 'intro' => $item['description'] ?? '', |
| @@ -266,13 +289,18 @@ class ProjectUpdate extends Command | @@ -266,13 +289,18 @@ class ProjectUpdate extends Command | ||
| 266 | 'category_id' => $category_id, | 289 | 'category_id' => $category_id, |
| 267 | 'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '', | 290 | 'thumb' => isset($gallery[0]) ? Arr::a2s($gallery[0]) : '', |
| 268 | 'gallery' => Arr::a2s($gallery), | 291 | 'gallery' => Arr::a2s($gallery), |
| 292 | + 'product_type' => $product_type, | ||
| 269 | 'seo_mate' => Arr::a2s([ | 293 | 'seo_mate' => Arr::a2s([ |
| 270 | 'title' => $item['ttile'], | 294 | 'title' => $item['ttile'], |
| 271 | 'keyword' => $item['keywords'] ?? '', | 295 | 'keyword' => $item['keywords'] ?? '', |
| 272 | 'description' => $item['description'] ?? '' | 296 | 'description' => $item['description'] ?? '' |
| 273 | ]), | 297 | ]), |
| 274 | 'status' => Product::STATUS_ON, | 298 | 'status' => Product::STATUS_ON, |
| 299 | + 'created_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | ||
| 300 | + 'updated_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | ||
| 301 | + 'sort' => $item['sort'] ?? 0, | ||
| 275 | 'is_upgrade' => 1, | 302 | 'is_upgrade' => 1, |
| 303 | + 'six_read' => 1, | ||
| 276 | 'route' => $route | 304 | 'route' => $route |
| 277 | ]); | 305 | ]); |
| 278 | $this->set_map($route, RouteMap::SOURCE_PRODUCT, $id, $project_id); | 306 | $this->set_map($route, RouteMap::SOURCE_PRODUCT, $id, $project_id); |
| @@ -323,19 +351,21 @@ class ProjectUpdate extends Command | @@ -323,19 +351,21 @@ class ProjectUpdate extends Command | ||
| 323 | } else { | 351 | } else { |
| 324 | $image = $item['images'] ?? ''; | 352 | $image = $item['images'] ?? ''; |
| 325 | } | 353 | } |
| 326 | - if (strpos($image, '//') === 0) { | ||
| 327 | - $image = 'https:' . $image; | ||
| 328 | - } | ||
| 329 | - $id = $model->addReturnId([ | 354 | + |
| 355 | + $id = $model->insertGetId([ | ||
| 330 | 'project_id' => $project_id, | 356 | 'project_id' => $project_id, |
| 331 | 'name' => $item['ttile'], | 357 | 'name' => $item['ttile'], |
| 332 | 'seo_title' => $item['ttile'], | 358 | 'seo_title' => $item['ttile'], |
| 333 | 'seo_keywords' => $item['keywords'] ?? '', | 359 | 'seo_keywords' => $item['keywords'] ?? '', |
| 334 | 'seo_description' => $item['description'] ?? '', | 360 | 'seo_description' => $item['description'] ?? '', |
| 335 | 'text' => $item['content'] ?? '', | 361 | 'text' => $item['content'] ?? '', |
| 336 | - 'image' => $image, | 362 | + 'image' => $this->source_download($image, $project_id, $domain_arr['host'], $web_url_domain, $home_url), |
| 337 | 'status' => $api_type == 'news' ? News::STATUS_ONE : Blog::STATUS_ONE, | 363 | 'status' => $api_type == 'news' ? News::STATUS_ONE : Blog::STATUS_ONE, |
| 364 | + 'created_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | ||
| 365 | + 'updated_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | ||
| 366 | + 'sort' => $item['sort'] ?? 0, | ||
| 338 | 'is_upgrade' => 1, | 367 | 'is_upgrade' => 1, |
| 368 | + 'six_read' => 1, | ||
| 339 | 'url' => $route | 369 | 'url' => $route |
| 340 | ]); | 370 | ]); |
| 341 | $this->set_map($route, $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $project_id); | 371 | $this->set_map($route, $api_type == 'news' ? RouteMap::SOURCE_NEWS : RouteMap::SOURCE_BLOG, $id, $project_id); |
| @@ -376,7 +406,7 @@ class ProjectUpdate extends Command | @@ -376,7 +406,7 @@ class ProjectUpdate extends Command | ||
| 376 | if (!$custom) { | 406 | if (!$custom) { |
| 377 | try { | 407 | try { |
| 378 | $item['ttile'] = $this->special2str($item['ttile'] ?? ''); | 408 | $item['ttile'] = $this->special2str($item['ttile'] ?? ''); |
| 379 | - $id = $model->addReturnId([ | 409 | + $id = $model->insertGetId([ |
| 380 | 'project_id' => $project_id, | 410 | 'project_id' => $project_id, |
| 381 | 'name' => $item['ttile'], | 411 | 'name' => $item['ttile'], |
| 382 | 'title' => $item['ttile'], | 412 | 'title' => $item['ttile'], |
| @@ -384,7 +414,10 @@ class ProjectUpdate extends Command | @@ -384,7 +414,10 @@ class ProjectUpdate extends Command | ||
| 384 | 'description' => $item['description'] ?? '', | 414 | 'description' => $item['description'] ?? '', |
| 385 | 'html' => $item['content'] ?? '', | 415 | 'html' => $item['content'] ?? '', |
| 386 | 'status' => 1, | 416 | 'status' => 1, |
| 417 | + 'created_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | ||
| 418 | + 'updated_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | ||
| 387 | 'is_upgrade' => 1, | 419 | 'is_upgrade' => 1, |
| 420 | + 'six_read' => 1, | ||
| 388 | 'url' => $route | 421 | 'url' => $route |
| 389 | ]); | 422 | ]); |
| 390 | $this->set_map($route, RouteMap::SOURCE_PAGE, $id, $project_id); | 423 | $this->set_map($route, RouteMap::SOURCE_PAGE, $id, $project_id); |
| @@ -424,7 +457,7 @@ class ProjectUpdate extends Command | @@ -424,7 +457,7 @@ class ProjectUpdate extends Command | ||
| 424 | return $task_id; | 457 | return $task_id; |
| 425 | } | 458 | } |
| 426 | 459 | ||
| 427 | - $task_list = UpdateLog::where('status', UpdateLog::STATUS_UN)->orderBy('project_id', 'asc')->orderBy('sort', 'asc')->limit(7)->get(); | 460 | + $task_list = UpdateLog::where('project_id', 543)->where('status', UpdateLog::STATUS_UN)->orderBy('project_id', 'asc')->orderBy('sort', 'asc')->limit(7)->get(); |
| 428 | if ($task_list->count() == 0) { | 461 | if ($task_list->count() == 0) { |
| 429 | return false; | 462 | return false; |
| 430 | } | 463 | } |
| @@ -472,6 +505,7 @@ class ProjectUpdate extends Command | @@ -472,6 +505,7 @@ class ProjectUpdate extends Command | ||
| 472 | 'pid' => $pid, | 505 | 'pid' => $pid, |
| 473 | 'keywords' => $item['keywords'] ?? '', | 506 | 'keywords' => $item['keywords'] ?? '', |
| 474 | 'describe' => $item['description'] ?? '', | 507 | 'describe' => $item['description'] ?? '', |
| 508 | + 'original_id' => $item['id'], | ||
| 475 | 'route' => $route | 509 | 'route' => $route |
| 476 | ]); | 510 | ]); |
| 477 | $this->set_map($route, RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id); | 511 | $this->set_map($route, RouteMap::SOURCE_PRODUCT_CATE, $parent_id, $project_id); |
| @@ -490,18 +524,6 @@ class ProjectUpdate extends Command | @@ -490,18 +524,6 @@ class ProjectUpdate extends Command | ||
| 490 | } | 524 | } |
| 491 | } | 525 | } |
| 492 | 526 | ||
| 493 | - //获取分类名称数组 | ||
| 494 | - protected function get_category_name_arr($category, $pid = 0) | ||
| 495 | - { | ||
| 496 | - foreach ($category as $k => $v) { | ||
| 497 | - if ($v['parent'] == $pid) { | ||
| 498 | - return $v; | ||
| 499 | - } | ||
| 500 | - } | ||
| 501 | - | ||
| 502 | - return []; | ||
| 503 | - } | ||
| 504 | - | ||
| 505 | //特殊字符转换 | 527 | //特殊字符转换 |
| 506 | protected function special2str($str) | 528 | protected function special2str($str) |
| 507 | { | 529 | { |
| @@ -547,4 +569,45 @@ class ProjectUpdate extends Command | @@ -547,4 +569,45 @@ class ProjectUpdate extends Command | ||
| 547 | } | 569 | } |
| 548 | } | 570 | } |
| 549 | } | 571 | } |
| 572 | + | ||
| 573 | + //资源下载 | ||
| 574 | + protected function source_download($url, $project_id, $domain, $web_url_domain, $home_url) | ||
| 575 | + { | ||
| 576 | + if (!$url) { | ||
| 577 | + return ''; | ||
| 578 | + } | ||
| 579 | + | ||
| 580 | + $arr = parse_url($url); | ||
| 581 | + $scheme = $arr['scheme'] ?? ''; | ||
| 582 | + $host = $arr['host'] ?? ''; | ||
| 583 | + $path = $arr['path'] ?? ''; | ||
| 584 | + | ||
| 585 | + $url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path; | ||
| 586 | + | ||
| 587 | + if ((empty($host) || $host == $web_url_domain || $host == $home_url) && $path) { | ||
| 588 | + | ||
| 589 | + $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first(); | ||
| 590 | + if (!$source) { | ||
| 591 | + $new_url = CosService::uploadRemote($project_id, 'image_product', $url_complete); | ||
| 592 | + | ||
| 593 | + if ($new_url) { | ||
| 594 | + CollectSource::insert([ | ||
| 595 | + 'project_id' => $project_id, | ||
| 596 | + 'origin' => $url, | ||
| 597 | + 'target' => $new_url, | ||
| 598 | + 'created_at' => date('Y-m-d H:i:s'), | ||
| 599 | + 'updated_at' => date('Y-m-d H:i:s'), | ||
| 600 | + ]); | ||
| 601 | + | ||
| 602 | + return getImageUrl($new_url); | ||
| 603 | + } else { | ||
| 604 | + return $url_complete; | ||
| 605 | + } | ||
| 606 | + } else { | ||
| 607 | + return getImageUrl($source['target']); | ||
| 608 | + } | ||
| 609 | + } else { | ||
| 610 | + return $url_complete; | ||
| 611 | + } | ||
| 612 | + } | ||
| 550 | } | 613 | } |
| @@ -246,6 +246,7 @@ class OptimizeController extends BaseController | @@ -246,6 +246,7 @@ class OptimizeController extends BaseController | ||
| 246 | if($rs === false){ | 246 | if($rs === false){ |
| 247 | $this->response('系统错误,请联系管理员',Code::SYSTEM_ERROR); | 247 | $this->response('系统错误,请联系管理员',Code::SYSTEM_ERROR); |
| 248 | } | 248 | } |
| 249 | + //TODO::通知C端 | ||
| 249 | $this->response('success'); | 250 | $this->response('success'); |
| 250 | } | 251 | } |
| 251 | } | 252 | } |
| @@ -7,6 +7,7 @@ use App\Http\Controllers\Aside\BaseController; | @@ -7,6 +7,7 @@ use App\Http\Controllers\Aside\BaseController; | ||
| 7 | use App\Http\Logic\Aside\Template\ATemplateLogic; | 7 | use App\Http\Logic\Aside\Template\ATemplateLogic; |
| 8 | use App\Http\Requests\Aside\Template\ATemplateRequest; | 8 | use App\Http\Requests\Aside\Template\ATemplateRequest; |
| 9 | use App\Models\Template\Setting; | 9 | use App\Models\Template\Setting; |
| 10 | +use App\Models\Template\Template; | ||
| 10 | 11 | ||
| 11 | /** | 12 | /** |
| 12 | * @remark :A端主题模板管理 | 13 | * @remark :A端主题模板管理 |
| @@ -25,6 +26,7 @@ class ATemplateController extends BaseController | @@ -25,6 +26,7 @@ class ATemplateController extends BaseController | ||
| 25 | */ | 26 | */ |
| 26 | public function lists(ATemplateLogic $aTemplateLogic){ | 27 | public function lists(ATemplateLogic $aTemplateLogic){ |
| 27 | $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; | 28 | $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; |
| 29 | + $this->map['project_id'] = 0; | ||
| 28 | $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); | 30 | $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); |
| 29 | if(!empty($lists) && !empty($lists['list'])){ | 31 | if(!empty($lists) && !empty($lists['list'])){ |
| 30 | foreach ($lists['list'] as $k => $v){ | 32 | foreach ($lists['list'] as $k => $v){ |
| @@ -186,6 +188,7 @@ class ATemplateController extends BaseController | @@ -186,6 +188,7 @@ class ATemplateController extends BaseController | ||
| 186 | } | 188 | } |
| 187 | $filed = ['id','name','status','image','created_at']; | 189 | $filed = ['id','name','status','image','created_at']; |
| 188 | $this->map['test_model'] = 0; | 190 | $this->map['test_model'] = 0; |
| 191 | + $this->map['project_id'] = 0; | ||
| 189 | $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); | 192 | $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); |
| 190 | $data = []; | 193 | $data = []; |
| 191 | if(!empty($lists) && !empty($lists['list'])){ | 194 | if(!empty($lists) && !empty($lists['list'])){ |
| @@ -222,4 +225,25 @@ class ATemplateController extends BaseController | @@ -222,4 +225,25 @@ class ATemplateController extends BaseController | ||
| 222 | } | 225 | } |
| 223 | $this->response('success',Code::SUCCESS,$info); | 226 | $this->response('success',Code::SUCCESS,$info); |
| 224 | } | 227 | } |
| 228 | + | ||
| 229 | + /** | ||
| 230 | + * @remark :私有公共模板 | ||
| 231 | + * @name :getProjectPublicTemplate | ||
| 232 | + * @author :lyh | ||
| 233 | + * @method :post | ||
| 234 | + * @time :2023/6/28 16:34 | ||
| 235 | + */ | ||
| 236 | + public function getProjectPublicTemplate(ATemplateLogic $aTemplateLogic){ | ||
| 237 | + $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; | ||
| 238 | + $this->map['project_id'] = ['!=',0]; | ||
| 239 | + $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); | ||
| 240 | + if(!empty($lists) && !empty($lists['list'])){ | ||
| 241 | + foreach ($lists['list'] as $k => $v){ | ||
| 242 | + $v['image_link'] = getImageUrl($v['image']); | ||
| 243 | + $lists['list'][$k] = $v; | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 247 | + } | ||
| 248 | + | ||
| 225 | } | 249 | } |
| @@ -45,26 +45,25 @@ class CNoticeController extends BaseController | @@ -45,26 +45,25 @@ class CNoticeController extends BaseController | ||
| 45 | 'url' => $request->input('url', []), | 45 | 'url' => $request->input('url', []), |
| 46 | 'language'=> $request->input('language', []), | 46 | 'language'=> $request->input('language', []), |
| 47 | ]; | 47 | ]; |
| 48 | - $result = http_post($url, json_encode($param)); | ||
| 49 | - return $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!'); | ||
| 50 | - | ||
| 51 | - $updateProgressModel = new UpdateProgress(); | ||
| 52 | - $progressInfo = $updateProgressModel->formatQuery(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']])->orderBy('id','desc')->first(); | ||
| 53 | - if((!empty($progressInfo))){ | ||
| 54 | - $progressInfo = $progressInfo->toArray(); | ||
| 55 | - if(($progressInfo['total_num'] > $progressInfo['current_num'])){ | ||
| 56 | - $this->response('当前页面正在生成了,请完成后再点击',Code::SUCCESS,$progressInfo); | ||
| 57 | - } | ||
| 58 | - } | ||
| 59 | - //通知更新 | ||
| 60 | - if($this->param['type'] == UpdateNotify::TYPE_MASTER){ | ||
| 61 | - $this->updateMaster(); | ||
| 62 | - }else{ | ||
| 63 | - $this->updateMinorLanguages(); | ||
| 64 | - } | ||
| 65 | - $urlStr = $this->getString($this->param['type'],$this->param['page']); | ||
| 66 | - curlGet($urlStr); | ||
| 67 | - $this->response('更新成功'); | 48 | + http_post($url, json_encode($param)); |
| 49 | + $this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!'); | ||
| 50 | +// $updateProgressModel = new UpdateProgress(); | ||
| 51 | +// $progressInfo = $updateProgressModel->formatQuery(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']])->orderBy('id','desc')->first(); | ||
| 52 | +// if((!empty($progressInfo))){ | ||
| 53 | +// $progressInfo = $progressInfo->toArray(); | ||
| 54 | +// if(($progressInfo['total_num'] > $progressInfo['current_num'])){ | ||
| 55 | +// $this->response('当前页面正在生成了,请完成后再点击',Code::SUCCESS,$progressInfo); | ||
| 56 | +// } | ||
| 57 | +// } | ||
| 58 | +// //通知更新 | ||
| 59 | +// if($this->param['type'] == UpdateNotify::TYPE_MASTER){ | ||
| 60 | +// $this->updateMaster(); | ||
| 61 | +// }else{ | ||
| 62 | +// $this->updateMinorLanguages(); | ||
| 63 | +// } | ||
| 64 | +// $urlStr = $this->getString($this->param['type'],$this->param['page']); | ||
| 65 | +// curlGet($urlStr); | ||
| 66 | +// $this->response('更新成功'); | ||
| 68 | } | 67 | } |
| 69 | 68 | ||
| 70 | /** | 69 | /** |
| @@ -226,15 +226,9 @@ class ComController extends BaseController | @@ -226,15 +226,9 @@ class ComController extends BaseController | ||
| 226 | case 'news': | 226 | case 'news': |
| 227 | $url_link = $this->user['domain'].RouteMap::SOURCE_NEWS.'/'; | 227 | $url_link = $this->user['domain'].RouteMap::SOURCE_NEWS.'/'; |
| 228 | break; | 228 | break; |
| 229 | - case 'news_category': | ||
| 230 | - $url_link = $this->user['domain'].RouteMap::PATH_NEWS_CATE.'/'; | ||
| 231 | - break; | ||
| 232 | case 'blog': | 229 | case 'blog': |
| 233 | $url_link = $this->user['domain'].RouteMap::SOURCE_BLOG.'/'; | 230 | $url_link = $this->user['domain'].RouteMap::SOURCE_BLOG.'/'; |
| 234 | break; | 231 | break; |
| 235 | - case 'blog_category': | ||
| 236 | - $url_link = $this->user['domain'].RouteMap::PATH_BLOG_CATE.'/'; | ||
| 237 | - break; | ||
| 238 | default: | 232 | default: |
| 239 | $url_link = $this->user['domain']; | 233 | $url_link = $this->user['domain']; |
| 240 | } | 234 | } |
| @@ -284,7 +284,7 @@ class ProductController extends BaseController | @@ -284,7 +284,7 @@ class ProductController extends BaseController | ||
| 284 | */ | 284 | */ |
| 285 | public function getExtendInfo($product_id){ | 285 | public function getExtendInfo($product_id){ |
| 286 | $extendModel = new Extend(); | 286 | $extendModel = new Extend(); |
| 287 | - $list = $extendModel->list([],'id',['type','key','title']); | 287 | + $list = $extendModel->list([],'id',['id','type','key','title']); |
| 288 | if(empty($list)){ | 288 | if(empty($list)){ |
| 289 | return []; | 289 | return []; |
| 290 | } | 290 | } |
| @@ -301,14 +301,15 @@ class ProductController extends BaseController | @@ -301,14 +301,15 @@ class ProductController extends BaseController | ||
| 301 | if($v['type'] == 3){ | 301 | if($v['type'] == 3){ |
| 302 | $arr = json_decode($info['values']); | 302 | $arr = json_decode($info['values']); |
| 303 | foreach ($arr as $k1=>$v1){ | 303 | foreach ($arr as $k1=>$v1){ |
| 304 | - $v1 = getImageUrl($v1); | 304 | + $v1 = (array)$v1; |
| 305 | + $v1['url'] = getImageUrl($v1['url']); | ||
| 305 | $arr[$k1] = $v1; | 306 | $arr[$k1] = $v1; |
| 306 | } | 307 | } |
| 307 | $v['values'] = $arr; | 308 | $v['values'] = $arr; |
| 308 | }elseif($v['type'] == 4){ | 309 | }elseif($v['type'] == 4){ |
| 309 | $arr1 = json_decode($info['values']); | 310 | $arr1 = json_decode($info['values']); |
| 310 | foreach ($arr1 as $k1=>$v1){ | 311 | foreach ($arr1 as $k1=>$v1){ |
| 311 | - $v1 = getImageUrl($v1); | 312 | + $v1 = getFileUrl($v1); |
| 312 | $arr1[$k1] = $v1; | 313 | $arr1[$k1] = $v1; |
| 313 | } | 314 | } |
| 314 | $v['values'] = $arr1; | 315 | $v['values'] = $arr1; |
| @@ -149,4 +149,5 @@ class BTemplateController extends BaseController | @@ -149,4 +149,5 @@ class BTemplateController extends BaseController | ||
| 149 | $BTemplateLogic->saveDetail(); | 149 | $BTemplateLogic->saveDetail(); |
| 150 | $this->response('success'); | 150 | $this->response('success'); |
| 151 | } | 151 | } |
| 152 | + | ||
| 152 | } | 153 | } |
| @@ -24,7 +24,7 @@ class BTemplateModuleController extends BaseController | @@ -24,7 +24,7 @@ class BTemplateModuleController extends BaseController | ||
| 24 | */ | 24 | */ |
| 25 | public function lists(BTemplateModuleLogic $BTemplateModuleLogic){ | 25 | public function lists(BTemplateModuleLogic $BTemplateModuleLogic){ |
| 26 | if(!isset($this->map['test_model'])){ | 26 | if(!isset($this->map['test_model'])){ |
| 27 | - $this->map['test_model'] = 0; | 27 | + $this->map['test_model'] = ['in',[0,1]]; |
| 28 | } | 28 | } |
| 29 | $data = []; | 29 | $data = []; |
| 30 | $list = $BTemplateModuleLogic->ModuleList($this->map,$this->order); | 30 | $list = $BTemplateModuleLogic->ModuleList($this->map,$this->order); |
| @@ -46,4 +46,21 @@ class BTemplateModuleProjectController extends BaseController | @@ -46,4 +46,21 @@ class BTemplateModuleProjectController extends BaseController | ||
| 46 | $logic->moduleProjectSave(); | 46 | $logic->moduleProjectSave(); |
| 47 | return $this->response('success'); | 47 | return $this->response('success'); |
| 48 | } | 48 | } |
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * @remark : | ||
| 52 | + * @name :del | ||
| 53 | + * @author :lyh | ||
| 54 | + * @method :post | ||
| 55 | + * @time :2023/11/28 17:39 | ||
| 56 | + */ | ||
| 57 | + public function del(BTemplateModuleProjectLogic $logic){ | ||
| 58 | + $this->request->validate([ | ||
| 59 | + 'id'=>'required', | ||
| 60 | + ],[ | ||
| 61 | + 'id.required' => 'id不能为空', | ||
| 62 | + ]); | ||
| 63 | + $logic->delModule(); | ||
| 64 | + $this->response('success'); | ||
| 65 | + } | ||
| 49 | } | 66 | } |
| @@ -5,6 +5,7 @@ namespace App\Http\Logic\Aside\Project; | @@ -5,6 +5,7 @@ namespace App\Http\Logic\Aside\Project; | ||
| 5 | 5 | ||
| 6 | use App\Helper\Common; | 6 | use App\Helper\Common; |
| 7 | use App\Http\Logic\Aside\BaseLogic; | 7 | use App\Http\Logic\Aside\BaseLogic; |
| 8 | +use App\Models\Project\DeployOptimize; | ||
| 8 | use App\Models\Project\OnlineCheck; | 9 | use App\Models\Project\OnlineCheck; |
| 9 | use App\Models\Project\Project; | 10 | use App\Models\Project\Project; |
| 10 | 11 | ||
| @@ -29,9 +30,12 @@ class OnlineCheckLogic extends BaseLogic | @@ -29,9 +30,12 @@ class OnlineCheckLogic extends BaseLogic | ||
| 29 | if($info === false){ | 30 | if($info === false){ |
| 30 | $this->fail('项目未提交审核'); | 31 | $this->fail('项目未提交审核'); |
| 31 | } | 32 | } |
| 33 | + //获取项目优化人员 | ||
| 34 | + $optimizeModel = new DeployOptimize(); | ||
| 35 | + $optimizeInfo = $optimizeModel->read(['project_id'=>$this->param['id']]); | ||
| 32 | //查看当前用户是否有权限审核 | 36 | //查看当前用户是否有权限审核 |
| 33 | if($this->param['type'] == 'optimist'){ | 37 | if($this->param['type'] == 'optimist'){ |
| 34 | - if($info['optimist_mid'] != $this->manager['id']){ | 38 | + if(($info['optimist_mid'] != $this->manager['id']) && ($optimizeInfo['assist_mid'] != $this->manager['id'])){ |
| 35 | $this->fail('你无权限提交审核'); | 39 | $this->fail('你无权限提交审核'); |
| 36 | } | 40 | } |
| 37 | }else{ | 41 | }else{ |
| @@ -28,7 +28,6 @@ class ATemplateLogic extends BaseLogic | @@ -28,7 +28,6 @@ class ATemplateLogic extends BaseLogic | ||
| 28 | * @time :2023/6/28 17:03 | 28 | * @time :2023/6/28 17:03 |
| 29 | */ | 29 | */ |
| 30 | public function aTemplateList($map,$page,$row,$order = ['created_at'],$filed = ['*']){ | 30 | public function aTemplateList($map,$page,$row,$order = ['created_at'],$filed = ['*']){ |
| 31 | - $map['project_id'] = 0; | ||
| 32 | $map['deleted_status'] = 0; | 31 | $map['deleted_status'] = 0; |
| 33 | $map['status'] = 0; | 32 | $map['status'] = 0; |
| 34 | $lists = $this->model->lists($map,$page,$row,$order,$filed); | 33 | $lists = $this->model->lists($map,$page,$row,$order,$filed); |
| @@ -79,7 +78,7 @@ class ATemplateLogic extends BaseLogic | @@ -79,7 +78,7 @@ class ATemplateLogic extends BaseLogic | ||
| 79 | * @time :2023/6/28 17:15 | 78 | * @time :2023/6/28 17:15 |
| 80 | */ | 79 | */ |
| 81 | public function aTemplateStatus(){ | 80 | public function aTemplateStatus(){ |
| 82 | - $rs = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]); | 81 | + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 83 | if($rs === false){ | 82 | if($rs === false){ |
| 84 | $this->fail('error'); | 83 | $this->fail('error'); |
| 85 | } | 84 | } |
| @@ -60,6 +60,10 @@ class BTemplateLogLogic extends BaseLogic | @@ -60,6 +60,10 @@ class BTemplateLogLogic extends BaseLogic | ||
| 60 | $commonData = $this->setCommonParam($info); | 60 | $commonData = $this->setCommonParam($info); |
| 61 | $commonTemplateModel = new BTemplateCommon(); | 61 | $commonTemplateModel = new BTemplateCommon(); |
| 62 | $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]); | 62 | $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]); |
| 63 | + //更新所有界面的other | ||
| 64 | + if(!empty($info['other'])){ | ||
| 65 | + $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); | ||
| 66 | + } | ||
| 63 | }catch (\Exception $e){ | 67 | }catch (\Exception $e){ |
| 64 | $this->fail('系统错误,请联系管理员'); | 68 | $this->fail('系统错误,请联系管理员'); |
| 65 | } | 69 | } |
| @@ -93,7 +97,7 @@ class BTemplateLogLogic extends BaseLogic | @@ -93,7 +97,7 @@ class BTemplateLogLogic extends BaseLogic | ||
| 93 | 'head_html'=>$info['head_html'], | 97 | 'head_html'=>$info['head_html'], |
| 94 | 'head_css'=>$info['head_css'], | 98 | 'head_css'=>$info['head_css'], |
| 95 | 'footer_html'=>$info['footer_html'], | 99 | 'footer_html'=>$info['footer_html'], |
| 96 | - 'footer_css'=>$info['footer_css'], | 100 | + 'footer_css'=>$info['footer_css'] |
| 97 | ]; | 101 | ]; |
| 98 | return $this->success($data); | 102 | return $this->success($data); |
| 99 | } | 103 | } |
| @@ -110,12 +114,22 @@ class BTemplateLogLogic extends BaseLogic | @@ -110,12 +114,22 @@ class BTemplateLogLogic extends BaseLogic | ||
| 110 | if($info === false){ | 114 | if($info === false){ |
| 111 | $this->fail('当前数据不存在,或已被删除'); | 115 | $this->fail('当前数据不存在,或已被删除'); |
| 112 | } | 116 | } |
| 117 | + if(empty($info['other'])){ | ||
| 118 | + $info['other'] = str_replace('<header','',characterTruncation($info['text'],"/<link id=\"google-fonts-link\"(.*?)<header/s"));; | ||
| 119 | + } | ||
| 120 | + $html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other']. | ||
| 121 | + $info['head_html'].$info['main_html'].$info['footer_html']; | ||
| 113 | $serviceSettingModel = new ServiceSettingModel(); | 122 | $serviceSettingModel = new ServiceSettingModel(); |
| 114 | $list = $serviceSettingModel->list(['type'=>2],'created_at'); | 123 | $list = $serviceSettingModel->list(['type'=>2],'created_at'); |
| 115 | - $data = [ | ||
| 116 | - 'info' => $info, | ||
| 117 | - 'header_footer'=>$list, | ||
| 118 | - ]; | ||
| 119 | - return $this->success($data); | 124 | + //拼接html |
| 125 | + foreach ($list as $v){ | ||
| 126 | + if($v['key'] == 'head'){ | ||
| 127 | + $html = $v['values'].$html; | ||
| 128 | + } | ||
| 129 | + if($v['key'] == 'footer'){ | ||
| 130 | + $html = $html.$v['values']; | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + return $this->success(['html'=>$html]); | ||
| 120 | } | 134 | } |
| 121 | } | 135 | } |
| @@ -287,7 +287,7 @@ class BTemplateLogic extends BaseLogic | @@ -287,7 +287,7 @@ class BTemplateLogic extends BaseLogic | ||
| 287 | $templateCommonModel->edit($data,['id'=>$info['id']]); | 287 | $templateCommonModel->edit($data,['id'=>$info['id']]); |
| 288 | } | 288 | } |
| 289 | //更新所有界面的other | 289 | //更新所有界面的other |
| 290 | - $templateCommonModel->edit(['other'=>$other],['project_id'=>$this->user['project_id']]); | 290 | + $templateCommonModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$param['template_id']]); |
| 291 | return $this->success(); | 291 | return $this->success(); |
| 292 | } | 292 | } |
| 293 | 293 | ||
| @@ -335,6 +335,7 @@ class BTemplateLogic extends BaseLogic | @@ -335,6 +335,7 @@ class BTemplateLogic extends BaseLogic | ||
| 335 | 'main_css'=>$param['main_css'], | 335 | 'main_css'=>$param['main_css'], |
| 336 | 'footer_html'=>$param['footer_html'], | 336 | 'footer_html'=>$param['footer_html'], |
| 337 | 'footer_css'=>$param['footer_css'], | 337 | 'footer_css'=>$param['footer_css'], |
| 338 | + 'other'=> str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")) | ||
| 338 | ]; | 339 | ]; |
| 339 | $bTemplateLogModel = new BTemplateLog(); | 340 | $bTemplateLogModel = new BTemplateLog(); |
| 340 | return $bTemplateLogModel->add($data); | 341 | return $bTemplateLogModel->add($data); |
| @@ -524,7 +525,9 @@ class BTemplateLogic extends BaseLogic | @@ -524,7 +525,9 @@ class BTemplateLogic extends BaseLogic | ||
| 524 | */ | 525 | */ |
| 525 | public function savePublicTemplateHtml(){ | 526 | public function savePublicTemplateHtml(){ |
| 526 | $this->param['project_id'] = $this->user['project_id']; | 527 | $this->param['project_id'] = $this->user['project_id']; |
| 528 | + $this->param['test_model'] = 2;//未审核模版 | ||
| 527 | $this->param['operator_id'] = $this->user['manager_id'] ?? 0; | 529 | $this->param['operator_id'] = $this->user['manager_id'] ?? 0; |
| 530 | + $this->param['html'] = characterTruncation($this->param['html'],'/<style id="globalsojs-header">(.*?)<\/footer>/s'); | ||
| 528 | $this->param = $this->stringProcessing($this->param); | 531 | $this->param = $this->stringProcessing($this->param); |
| 529 | $publicTemplateModel = new Template(); | 532 | $publicTemplateModel = new Template(); |
| 530 | $rs = $publicTemplateModel->add($this->param); | 533 | $rs = $publicTemplateModel->add($this->param); |
| @@ -38,4 +38,20 @@ class BTemplateModuleProjectLogic extends BaseLogic | @@ -38,4 +38,20 @@ class BTemplateModuleProjectLogic extends BaseLogic | ||
| 38 | } | 38 | } |
| 39 | return $this->success(); | 39 | return $this->success(); |
| 40 | } | 40 | } |
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * @remark : | ||
| 44 | + * @name :delModule | ||
| 45 | + * @author :lyh | ||
| 46 | + * @method :post | ||
| 47 | + * @time :2023/11/28 17:42 | ||
| 48 | + */ | ||
| 49 | + public function delModule(){ | ||
| 50 | + try { | ||
| 51 | + $this->model->del($this->param); | ||
| 52 | + }catch (\Exception $e){ | ||
| 53 | + $this->fail('系统错误,请联系管理员'); | ||
| 54 | + } | ||
| 55 | + return $this->success(); | ||
| 56 | + } | ||
| 41 | } | 57 | } |
| @@ -8,6 +8,7 @@ use App\Models\RouteMap\RouteMap; | @@ -8,6 +8,7 @@ use App\Models\RouteMap\RouteMap; | ||
| 8 | use App\Models\Service\Service as ServiceSettingModel; | 8 | use App\Models\Service\Service as ServiceSettingModel; |
| 9 | use App\Models\Template\BCustomTemplate; | 9 | use App\Models\Template\BCustomTemplate; |
| 10 | use App\Models\Template\BTemplateCommon; | 10 | use App\Models\Template\BTemplateCommon; |
| 11 | +use App\Models\Template\BTemplateLog; | ||
| 11 | use App\Models\Template\Setting; | 12 | use App\Models\Template\Setting; |
| 12 | use App\Models\Template\BTemplate; | 13 | use App\Models\Template\BTemplate; |
| 13 | 14 | ||
| @@ -94,9 +95,16 @@ class CustomTemplateLogic extends BaseLogic | @@ -94,9 +95,16 @@ class CustomTemplateLogic extends BaseLogic | ||
| 94 | $html = $this->param['html']; | 95 | $html = $this->param['html']; |
| 95 | $info = $this->model->read(['id'=>$this->param['id']],['id','is_visualization','url']); | 96 | $info = $this->model->read(['id'=>$this->param['id']],['id','is_visualization','url']); |
| 96 | if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){//非定制项目+可视化页面 | 97 | if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){//非定制项目+可视化页面 |
| 97 | - $this->saveCommonTemplate($html); | 98 | + //获取设置的默认模版 |
| 99 | + $bSettingModel = new Setting(); | ||
| 100 | + $bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]); | ||
| 101 | + if($bSettingInfo === false){ | ||
| 102 | + $this->fail('请先选择模版'); | ||
| 103 | + } | ||
| 104 | + $this->saveCommonTemplate($html,$bSettingInfo['template_id']); | ||
| 98 | $this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'); | 105 | $this->param['html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'); |
| 99 | $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | 106 | $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); |
| 107 | + $this->setTemplateLog($bSettingInfo['template_id'],$html,$this->param['id']); | ||
| 100 | } | 108 | } |
| 101 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 109 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 102 | if($rs === false){ | 110 | if($rs === false){ |
| @@ -108,19 +116,44 @@ class CustomTemplateLogic extends BaseLogic | @@ -108,19 +116,44 @@ class CustomTemplateLogic extends BaseLogic | ||
| 108 | } | 116 | } |
| 109 | 117 | ||
| 110 | /** | 118 | /** |
| 119 | + * @remark :生成记录 | ||
| 120 | + * @name :setTemplateLog | ||
| 121 | + * @author :lyh | ||
| 122 | + * @method :post | ||
| 123 | + * @time :2023/8/23 11:16 | ||
| 124 | + */ | ||
| 125 | + public function setTemplateLog($template_id,$html,$source_id){ | ||
| 126 | + $data = [ | ||
| 127 | + 'template_id'=>$template_id, | ||
| 128 | + 'project_id'=>$this->user['project_id'], | ||
| 129 | + 'operator_id'=>$this->user['id'], | ||
| 130 | + 'text'=>$html, | ||
| 131 | + 'source'=>9, | ||
| 132 | + 'source_id'=>$source_id, | ||
| 133 | + 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'), | ||
| 134 | + 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'), | ||
| 135 | + 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), | ||
| 136 | + 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), | ||
| 137 | + 'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'), | ||
| 138 | + 'main_css' => characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'), | ||
| 139 | + 'other'=> str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")) | ||
| 140 | + ]; | ||
| 141 | + $bTemplateLogModel = new BTemplateLog(); | ||
| 142 | + return $bTemplateLogModel->add($data); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + /** | ||
| 111 | * @remark :保存头部公共数据 | 146 | * @remark :保存头部公共数据 |
| 112 | * @name :saveCommonTemplate | 147 | * @name :saveCommonTemplate |
| 113 | * @author :lyh | 148 | * @author :lyh |
| 114 | * @method :post | 149 | * @method :post |
| 115 | * @time :2023/10/13 14:27 | 150 | * @time :2023/10/13 14:27 |
| 116 | */ | 151 | */ |
| 117 | - public function saveCommonTemplate($html){ | 152 | + public function saveCommonTemplate($html,$template_id){ |
| 118 | $type = $this->getType(); | 153 | $type = $this->getType(); |
| 119 | - //获取设置的默认模版 | ||
| 120 | - $bSettingModel = new Setting(); | ||
| 121 | - $bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]); | 154 | + |
| 122 | $templateCommonModel = new BTemplateCommon(); | 155 | $templateCommonModel = new BTemplateCommon(); |
| 123 | - $info = $templateCommonModel->read(['template_id'=>$bSettingInfo['template_id'],'project_id'=>$this->user['project_id'],'type'=>$type]); | 156 | + $info = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]); |
| 124 | $data = [ | 157 | $data = [ |
| 125 | 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'), | 158 | 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'), |
| 126 | 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'), | 159 | 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'), |
| @@ -129,7 +162,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -129,7 +162,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 129 | ]; | 162 | ]; |
| 130 | $other = str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")); | 163 | $other = str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")); |
| 131 | if($info === false){ | 164 | if($info === false){ |
| 132 | - $data['template_id'] = $bSettingInfo['template_id']; | 165 | + $data['template_id'] = $template_id; |
| 133 | $data['project_id'] = $this->user['project_id']; | 166 | $data['project_id'] = $this->user['project_id']; |
| 134 | $data['type'] = $type; | 167 | $data['type'] = $type; |
| 135 | $templateCommonModel->add($data); | 168 | $templateCommonModel->add($data); |
| @@ -14,6 +14,7 @@ use App\Models\Project\PageSetting; | @@ -14,6 +14,7 @@ use App\Models\Project\PageSetting; | ||
| 14 | use App\Models\Service\Service as ServiceSettingModel; | 14 | use App\Models\Service\Service as ServiceSettingModel; |
| 15 | use App\Models\Template\BTemplate; | 15 | use App\Models\Template\BTemplate; |
| 16 | use App\Models\Template\BTemplateCommon; | 16 | use App\Models\Template\BTemplateCommon; |
| 17 | +use App\Models\Template\BTemplateLog; | ||
| 17 | use App\Models\Template\BTemplateMain; | 18 | use App\Models\Template\BTemplateMain; |
| 18 | use App\Models\Template\Setting; | 19 | use App\Models\Template\Setting; |
| 19 | use App\Models\Template\Template; | 20 | use App\Models\Template\Template; |
| @@ -272,6 +273,9 @@ class VisualizationLogic extends BaseLogic | @@ -272,6 +273,9 @@ class VisualizationLogic extends BaseLogic | ||
| 272 | * @time :2023/11/15 11:47 | 273 | * @time :2023/11/15 11:47 |
| 273 | */ | 274 | */ |
| 274 | public function saveHtml(){ | 275 | public function saveHtml(){ |
| 276 | + if(!isset($this->user['is_visualization']->page_array)){ | ||
| 277 | + $this->fail('当前为定制项目,请先选择定制界面'); | ||
| 278 | + } | ||
| 275 | $page_array = (array)$this->user['is_visualization']->page_array; | 279 | $page_array = (array)$this->user['is_visualization']->page_array; |
| 276 | $type = $this->getType($this->param['source'],$this->param['source_id']); | 280 | $type = $this->getType($this->param['source'],$this->param['source_id']); |
| 277 | try { | 281 | try { |
| @@ -306,6 +310,7 @@ class VisualizationLogic extends BaseLogic | @@ -306,6 +310,7 @@ class VisualizationLogic extends BaseLogic | ||
| 306 | }else{ | 310 | }else{ |
| 307 | $bTemplateModel->edit($this->param,['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]); | 311 | $bTemplateModel->edit($this->param,['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]); |
| 308 | } | 312 | } |
| 313 | + $this->setTemplateLog($this->param['template_id'],$this->param['html'],$this->param['source'],$this->param['source_id']); | ||
| 309 | } | 314 | } |
| 310 | }catch (\Exception $e){ | 315 | }catch (\Exception $e){ |
| 311 | $this->fail('系统错误,请联系管理员'); | 316 | $this->fail('系统错误,请联系管理员'); |
| @@ -315,6 +320,32 @@ class VisualizationLogic extends BaseLogic | @@ -315,6 +320,32 @@ class VisualizationLogic extends BaseLogic | ||
| 315 | } | 320 | } |
| 316 | 321 | ||
| 317 | /** | 322 | /** |
| 323 | + * @remark :生成记录 | ||
| 324 | + * @name :setTemplateLog | ||
| 325 | + * @author :lyh | ||
| 326 | + * @method :post | ||
| 327 | + * @time :2023/8/23 11:16 | ||
| 328 | + */ | ||
| 329 | + public function setTemplateLog($template_id,$html,$source,$source_id){ | ||
| 330 | + $data = [ | ||
| 331 | + 'template_id'=>$template_id, | ||
| 332 | + 'project_id'=>$this->user['project_id'], | ||
| 333 | + 'operator_id'=>$this->user['id'], | ||
| 334 | + 'text'=>$html, | ||
| 335 | + 'source'=>$source, | ||
| 336 | + 'source_id'=>$source_id, | ||
| 337 | + 'main_html'=>characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s'), | ||
| 338 | + 'main_css'=>characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'), | ||
| 339 | + 'head_html'=>characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'), | ||
| 340 | + 'head_css'=>characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'), | ||
| 341 | + 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), | ||
| 342 | + 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), | ||
| 343 | + ]; | ||
| 344 | + $bTemplateLogModel = new BTemplateLog(); | ||
| 345 | + return $bTemplateLogModel->add($data); | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + /** | ||
| 318 | * @remark :保存头部公共数据 | 349 | * @remark :保存头部公共数据 |
| 319 | * @name :saveCommonTemplate | 350 | * @name :saveCommonTemplate |
| 320 | * @author :lyh | 351 | * @author :lyh |
| @@ -341,7 +372,7 @@ class VisualizationLogic extends BaseLogic | @@ -341,7 +372,7 @@ class VisualizationLogic extends BaseLogic | ||
| 341 | $templateCommonModel->edit($data,['id'=>$info['id']]); | 372 | $templateCommonModel->edit($data,['id'=>$info['id']]); |
| 342 | } | 373 | } |
| 343 | //更新所有界面的other | 374 | //更新所有界面的other |
| 344 | - $templateCommonModel->edit(['other'=>$other],['project_id'=>$this->user['project_id']]); | 375 | + $templateCommonModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$template_id]); |
| 345 | return $this->success(); | 376 | return $this->success(); |
| 346 | } | 377 | } |
| 347 | 378 |
| @@ -268,13 +268,21 @@ class BlogLogic extends BaseLogic | @@ -268,13 +268,21 @@ class BlogLogic extends BaseLogic | ||
| 268 | $text = ''; | 268 | $text = ''; |
| 269 | if($data[4]){ | 269 | if($data[4]){ |
| 270 | //处理内容中的图片 | 270 | //处理内容中的图片 |
| 271 | - $pattern = '<img src="(.*?)">'; | ||
| 272 | - preg_match_all($pattern, $data[4], $result); | ||
| 273 | - if($result[1]){ | ||
| 274 | - foreach ($result[1] as $img){ | 271 | + preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result); |
| 272 | + if($result[2]??[]){ | ||
| 273 | + foreach ($result[2] as $img){ | ||
| 275 | $data[4] = str_replace($img,getImageUrl(CosService::uploadRemote($project_id,'image_news',$img)),$data[4]); | 274 | $data[4] = str_replace($img,getImageUrl(CosService::uploadRemote($project_id,'image_news',$img)),$data[4]); |
| 276 | } | 275 | } |
| 277 | } | 276 | } |
| 277 | + | ||
| 278 | + //处理内容中的视频 | ||
| 279 | + preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result_video); | ||
| 280 | + if($result_video[2]??[]){ | ||
| 281 | + foreach ($result_video[2] as $video){ | ||
| 282 | + $data[4] = str_replace($video,getImageUrl(CosService::uploadRemote($project_id,'image_news',$video)),$data[4]); | ||
| 283 | + } | ||
| 284 | + } | ||
| 285 | + | ||
| 278 | $text = $data[4]; | 286 | $text = $data[4]; |
| 279 | } | 287 | } |
| 280 | 288 |
| @@ -304,13 +304,21 @@ class NewsLogic extends BaseLogic | @@ -304,13 +304,21 @@ class NewsLogic extends BaseLogic | ||
| 304 | $text = ''; | 304 | $text = ''; |
| 305 | if($data[4]){ | 305 | if($data[4]){ |
| 306 | //处理内容中的图片 | 306 | //处理内容中的图片 |
| 307 | - $pattern = '<img src="(.*?)">'; | ||
| 308 | - preg_match_all($pattern, $data[4], $result); | ||
| 309 | - if($result[1]){ | ||
| 310 | - foreach ($result[1] as $img){ | 307 | + preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result); |
| 308 | + if($result[2]??[]){ | ||
| 309 | + foreach ($result[2] as $img){ | ||
| 311 | $data[4] = str_replace($img,getImageUrl(CosService::uploadRemote($project_id,'image_news',$img)),$data[4]); | 310 | $data[4] = str_replace($img,getImageUrl(CosService::uploadRemote($project_id,'image_news',$img)),$data[4]); |
| 312 | } | 311 | } |
| 313 | } | 312 | } |
| 313 | + | ||
| 314 | + //处理内容中的视频 | ||
| 315 | + preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result_video); | ||
| 316 | + if($result_video[2]??[]){ | ||
| 317 | + foreach ($result_video[2] as $video){ | ||
| 318 | + $data[4] = str_replace($video,getImageUrl(CosService::uploadRemote($project_id,'image_news',$video)),$data[4]); | ||
| 319 | + } | ||
| 320 | + } | ||
| 321 | + | ||
| 314 | $text = $data[4]; | 322 | $text = $data[4]; |
| 315 | } | 323 | } |
| 316 | 324 |
| @@ -50,6 +50,8 @@ class ProductLogic extends BaseLogic | @@ -50,6 +50,8 @@ class ProductLogic extends BaseLogic | ||
| 50 | if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { | 50 | if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { |
| 51 | $category_ids = $this->getLastCategoryArr($this->param['category_id']); | 51 | $category_ids = $this->getLastCategoryArr($this->param['category_id']); |
| 52 | $this->param['category_id'] = ','.implode(',',$category_ids).','; | 52 | $this->param['category_id'] = ','.implode(',',$category_ids).','; |
| 53 | + }else{ | ||
| 54 | + $this->param['category_id'] = ''; | ||
| 53 | } | 55 | } |
| 54 | DB::connection('custom_mysql')->beginTransaction(); | 56 | DB::connection('custom_mysql')->beginTransaction(); |
| 55 | try { | 57 | try { |
| @@ -111,12 +113,18 @@ class ProductLogic extends BaseLogic | @@ -111,12 +113,18 @@ class ProductLogic extends BaseLogic | ||
| 111 | continue; | 113 | continue; |
| 112 | } | 114 | } |
| 113 | unset($v['title']); | 115 | unset($v['title']); |
| 114 | - if($v['type'] == 3 || $v['type'] == 4){ | 116 | + if($v['type'] == 3){ |
| 115 | foreach ($v['values'] as $k1=>$v1){ | 117 | foreach ($v['values'] as $k1=>$v1){ |
| 116 | $v1['url'] = str_replace_url($v1['url']); | 118 | $v1['url'] = str_replace_url($v1['url']); |
| 117 | $v['values'][$k1] = $v1; | 119 | $v['values'][$k1] = $v1; |
| 118 | } | 120 | } |
| 119 | $v['values'] = json_encode($v['values']); | 121 | $v['values'] = json_encode($v['values']); |
| 122 | + }elseif ($v['type'] == 4){ | ||
| 123 | + foreach ($v['values'] as $k1=>$v1){ | ||
| 124 | + $v1 = str_replace_url($v1); | ||
| 125 | + $v['values'][$k1] = $v1; | ||
| 126 | + } | ||
| 127 | + $v['values'] = json_encode($v['values']); | ||
| 120 | } | 128 | } |
| 121 | $v['project_id'] = $this->user['project_id']; | 129 | $v['project_id'] = $this->user['project_id']; |
| 122 | $v['product_id'] = $product_id; | 130 | $v['product_id'] = $product_id; |
| @@ -146,6 +154,9 @@ class ProductLogic extends BaseLogic | @@ -146,6 +154,9 @@ class ProductLogic extends BaseLogic | ||
| 146 | }else{ | 154 | }else{ |
| 147 | $this->param['thumb'] = Arr::a2s([]); | 155 | $this->param['thumb'] = Arr::a2s([]); |
| 148 | } | 156 | } |
| 157 | + if(isset($this->param['route']) && !empty($this->param['route'])){ | ||
| 158 | + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); | ||
| 159 | + } | ||
| 149 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 160 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 150 | return $this->success(); | 161 | return $this->success(); |
| 151 | } | 162 | } |
| @@ -594,26 +605,42 @@ class ProductLogic extends BaseLogic | @@ -594,26 +605,42 @@ class ProductLogic extends BaseLogic | ||
| 594 | $intro = ''; | 605 | $intro = ''; |
| 595 | if($data[5]){ | 606 | if($data[5]){ |
| 596 | //处理短描述中的图片 | 607 | //处理短描述中的图片 |
| 597 | - $pattern = '/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i'; | ||
| 598 | - preg_match_all($pattern, $data[5], $result_intro); | ||
| 599 | - if($result_intro[2]){ | 608 | + preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[5], $result_intro); |
| 609 | + if($result_intro[2]??[]){ | ||
| 600 | foreach ($result_intro[2] as $vi_img){ | 610 | foreach ($result_intro[2] as $vi_img){ |
| 601 | $data[5] = str_replace($vi_img,getImageUrl(CosService::uploadRemote($project_id,'image_product',$vi_img)),$data[5]); | 611 | $data[5] = str_replace($vi_img,getImageUrl(CosService::uploadRemote($project_id,'image_product',$vi_img)),$data[5]); |
| 602 | } | 612 | } |
| 603 | } | 613 | } |
| 614 | + | ||
| 615 | + //处理短描述中的视频 | ||
| 616 | + preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[5], $result_intro_video); | ||
| 617 | + if($result_intro_video[2]??[]){ | ||
| 618 | + foreach ($result_intro_video[2] as $vi_video){ | ||
| 619 | + $data[5] = str_replace($vi_video,getImageUrl(CosService::uploadRemote($project_id,'image_product',$vi_video)),$data[5]); | ||
| 620 | + } | ||
| 621 | + } | ||
| 622 | + | ||
| 604 | $intro = $data[5]; | 623 | $intro = $data[5]; |
| 605 | } | 624 | } |
| 606 | 625 | ||
| 607 | $content = ''; | 626 | $content = ''; |
| 608 | if($data[6]){ | 627 | if($data[6]){ |
| 609 | //处理内容中的图片 | 628 | //处理内容中的图片 |
| 610 | - $pattern = '/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i'; | ||
| 611 | - preg_match_all($pattern, $data[6], $result_content); | ||
| 612 | - if($result_content[2]){ | 629 | + preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[6], $result_content); |
| 630 | + if($result_content[2]??[]){ | ||
| 613 | foreach ($result_content[2] as $vc_img){ | 631 | foreach ($result_content[2] as $vc_img){ |
| 614 | $data[6] = str_replace($vc_img,getImageUrl(CosService::uploadRemote($project_id,'image_product',$vc_img)),$data[6]); | 632 | $data[6] = str_replace($vc_img,getImageUrl(CosService::uploadRemote($project_id,'image_product',$vc_img)),$data[6]); |
| 615 | } | 633 | } |
| 616 | } | 634 | } |
| 635 | + | ||
| 636 | + //处理内容中的视频 | ||
| 637 | + preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[6], $result_content_video); | ||
| 638 | + if($result_content_video[2]??[]){ | ||
| 639 | + foreach ($result_content_video[2] as $vc_video){ | ||
| 640 | + $data[6] = str_replace($vc_video,getImageUrl(CosService::uploadRemote($project_id,'image_product',$vc_video)),$data[6]); | ||
| 641 | + } | ||
| 642 | + } | ||
| 643 | + | ||
| 617 | $content = $data[6]; | 644 | $content = $data[6]; |
| 618 | } | 645 | } |
| 619 | 646 |
| @@ -311,6 +311,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -311,6 +311,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 311 | Route::any('/setHeadFooter', [Aside\Template\ATemplateController::class, 'setHeadFooter'])->name('admin.template_setHeadFooter'); | 311 | Route::any('/setHeadFooter', [Aside\Template\ATemplateController::class, 'setHeadFooter'])->name('admin.template_setHeadFooter'); |
| 312 | Route::any('/getHeadFooter', [Aside\Template\ATemplateController::class, 'getHeadFooter'])->name('admin.template_getHeadFooter'); | 312 | Route::any('/getHeadFooter', [Aside\Template\ATemplateController::class, 'getHeadFooter'])->name('admin.template_getHeadFooter'); |
| 313 | Route::any('/setPublicTemplate', [Aside\Template\ATemplateController::class, 'setPublicTemplate'])->name('admin.template_setPublicTemplate'); | 313 | Route::any('/setPublicTemplate', [Aside\Template\ATemplateController::class, 'setPublicTemplate'])->name('admin.template_setPublicTemplate'); |
| 314 | + Route::any('/getProjectPublicTemplate', [Aside\Template\ATemplateController::class, 'getProjectPublicTemplate'])->name('admin.template_getProjectPublicTemplate'); | ||
| 314 | // 左侧模块 | 315 | // 左侧模块 |
| 315 | Route::prefix('module')->group(function () { | 316 | Route::prefix('module')->group(function () { |
| 316 | Route::any('/', [Aside\Template\ATemplateModuleController::class, 'lists'])->name('admin.ATemplateModule_lists'); | 317 | Route::any('/', [Aside\Template\ATemplateModuleController::class, 'lists'])->name('admin.ATemplateModule_lists'); |
| @@ -238,6 +238,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -238,6 +238,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 238 | //扩展字段 | 238 | //扩展字段 |
| 239 | Route::any('extend', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'lists'])->name('product_extend'); | 239 | Route::any('extend', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'lists'])->name('product_extend'); |
| 240 | Route::any('extend/save', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'save'])->name('product_extend_save'); | 240 | Route::any('extend/save', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'save'])->name('product_extend_save'); |
| 241 | + Route::any('extend/del', [\App\Http\Controllers\Bside\Product\ExtendController::class, 'del'])->name('product_extend_del'); | ||
| 241 | }); | 242 | }); |
| 242 | 243 | ||
| 243 | 244 | ||
| @@ -326,6 +327,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -326,6 +327,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 326 | //获取所有左侧模版 | 327 | //获取所有左侧模版 |
| 327 | Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'lists'])->name('template_module_project_lists'); | 328 | Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'lists'])->name('template_module_project_lists'); |
| 328 | Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'save'])->name('template_module_project_save'); | 329 | Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'save'])->name('template_module_project_save'); |
| 330 | + Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'del'])->name('template_module_project_del'); | ||
| 329 | }); | 331 | }); |
| 330 | 332 | ||
| 331 | //编辑记录 | 333 | //编辑记录 |
-
请 注册 或 登录 后发表评论