Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
25 个修改的文件
包含
464 行增加
和
229 行删除
app/Console/Commands/Languages.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :Languages.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/11/30 10:29 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands; | ||
| 11 | + | ||
| 12 | +use App\Models\WebSetting\WebLanguage; | ||
| 13 | +use Illuminate\Console\Command; | ||
| 14 | + | ||
| 15 | +class Languages extends Command | ||
| 16 | +{ | ||
| 17 | + /** | ||
| 18 | + * The name and signature of the console command. | ||
| 19 | + * | ||
| 20 | + * @var string | ||
| 21 | + */ | ||
| 22 | + protected $signature = 'update_language'; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * The console command description. | ||
| 26 | + * | ||
| 27 | + * @var string | ||
| 28 | + */ | ||
| 29 | + protected $description = '导入小语种'; | ||
| 30 | + /** | ||
| 31 | + * @name :(定时执行)handle | ||
| 32 | + * @author :lyh | ||
| 33 | + * @method :post | ||
| 34 | + * @time :2023/5/12 14:48 | ||
| 35 | + */ | ||
| 36 | + public function handle() | ||
| 37 | + { | ||
| 38 | + $data = '[{"short":"en","chinese":"英文","english":"English","language":"English"}, | ||
| 39 | + {"short":"zh","chinese":"简体中文","english":"Chinese","language":"Chinese Simplified"}, | ||
| 40 | + {"short":"zh-TW","chinese":"繁体中文","english":"Chinese","language":"Chinese Traditional"}, | ||
| 41 | + {"short":"fr","chinese":"法语","english":"French","language":"Français"}, | ||
| 42 | + {"short":"de","chinese":"德语","english":"German","language":"Deutsch"}, | ||
| 43 | + {"short":"pt","chinese":"葡萄牙语","english":"Portuguese","language":"Português"}, | ||
| 44 | + {"short":"es","chinese":"西班牙语","english":"Spanish","language":"Español"}, | ||
| 45 | + {"short":"ru","chinese":"俄语","english":"Russian","language":"Русский"}, | ||
| 46 | + {"short":"ja","chinese":"日语","english":"Japanese","language":"日本語"}, | ||
| 47 | + {"short":"ko","chinese":"韩语","english":"Korean","language":"한국어"}, | ||
| 48 | + {"short":"ar","chinese":"阿拉伯语","english":"Arabic","language":"العربية"}, | ||
| 49 | + {"short":"ga","chinese":"爱尔兰语","english":"Irish","language":"Gaeilge"}, | ||
| 50 | + {"short":"el","chinese":"希腊语","english":"Greek","language":"Ελληνικά"}, | ||
| 51 | + {"short":"tr","chinese":"土耳其语","english":"Turkish","language":"Türkçe"}, | ||
| 52 | + {"short":"it","chinese":"意大利语","english":"Italian","language":"Italiano"}, | ||
| 53 | + {"short":"da","chinese":"丹麦语","english":"Danish","language":"Dansk"}, | ||
| 54 | + {"short":"ro","chinese":"罗马尼亚语","english":"Romanian","language":"Română"}, | ||
| 55 | + {"short":"id","chinese":"印度尼西亚语","english":"Indonesian","language":"Bahasa Indonesia"}, | ||
| 56 | + {"short":"cs","chinese":"捷克语","english":"Czech","language":"Čeština"}, | ||
| 57 | + {"short":"af","chinese":"南非荷兰语","english":"Afrikaans","language":"Afrikaans"}, | ||
| 58 | + {"short":"sv","chinese":"瑞典语","english":"Swedish","language":"Svenska"}, | ||
| 59 | + {"short":"pl","chinese":"波兰语","english":"Polish","language":"Polski"}, | ||
| 60 | + {"short":"eu","chinese":"巴斯克语","english":"Basque","language":"Euskara"}, | ||
| 61 | + {"short":"ca","chinese":"加泰罗尼亚语","english":"Catalan","language":"Català"}, | ||
| 62 | + {"short":"eo","chinese":"世界语","english":"Esperanto","language":"Esperanto"}, | ||
| 63 | + {"short":"hi","chinese":"北印度语","english":"Hindi","language":"हिन्दी"}, | ||
| 64 | + {"short":"lo","chinese":"老挝语","english":"Lao","language":"Lao"}, | ||
| 65 | + {"short":"sq","chinese":"阿尔巴尼亚语","english":"Albanian","language":"Shqip"}, | ||
| 66 | + {"short":"am","chinese":"阿姆哈拉语","english":"Amharic","language":"አማርኛ"}, | ||
| 67 | + {"short":"hy","chinese":"亚美尼亚语","english":"Armenian","language":"Armenian"}, | ||
| 68 | + {"short":"az","chinese":"阿塞拜疆语","english":"Azerbaijani","language":"Azerbaijani"}, | ||
| 69 | + {"short":"be","chinese":"白俄罗斯语","english":"Belarusian","language":"беларуская м"}, | ||
| 70 | + {"short":"bn","chinese":"孟加拉语","english":"Bengali","language":"বাংলা"}, | ||
| 71 | + {"short":"bs","chinese":"波斯尼亚语","english":"Bosnian","language":"Bosnian"}, | ||
| 72 | + {"short":"bg","chinese":"保加利亚语","english":"Bulgarian","language":"Български"}, | ||
| 73 | + {"short":"ceb","chinese":"宿务语","english":"Cebuano","language":"Cebuano"}, | ||
| 74 | + {"short":"ny","chinese":"齐佩瓦语","english":"Chichewa","language":"Chichewa"}, | ||
| 75 | + {"short":"co","chinese":"科西嘉语","english":"Corsican","language":"Corsican"}, | ||
| 76 | + {"short":"hr","chinese":"克罗地亚语","english":"Croatian","language":"Hrvatski"}, | ||
| 77 | + {"short":"nl","chinese":"荷兰语","english":"Dutch","language":"Nederlands"}, | ||
| 78 | + {"short":"et","chinese":"爱沙尼亚语","english":"Estonian","language":"Eesti Keel"}, | ||
| 79 | + {"short":"tl","chinese":"菲律宾语","english":"Filipino","language":"Tagalog"}, | ||
| 80 | + {"short":"fi","chinese":"芬兰语","english":"Finnish","language":"Suomi"}, | ||
| 81 | + {"short":"fy","chinese":"弗利然语","english":"Frisian","language":"Frisian"}, | ||
| 82 | + {"short":"gl","chinese":"加利西亚语","english":"Galician","language":"Galego"}, | ||
| 83 | + {"short":"ka","chinese":"格鲁吉亚语","english":"Georgian","language":"ქართული"}, | ||
| 84 | + {"short":"gu","chinese":"古吉特拉语","english":"Gujarati","language":"ગુજરાતી"}, | ||
| 85 | + {"short":"ht","chinese":"海地-克里奥尔语","english":"Haitian","language":"Kreyòl Ayisyen"}, | ||
| 86 | + {"short":"ha","chinese":"豪撒语","english":"Hausa","language":"Hausa"}, | ||
| 87 | + {"short":"haw","chinese":"夏威夷语","english":"Hawaiian","language":"Hawaiian"}, | ||
| 88 | + {"short":"iw","chinese":"希伯来语","english":"Hebrew","language":"עברית"}, | ||
| 89 | + {"short":"hmn","chinese":"苗语","english":"Hmong","language":"Hmong"}, | ||
| 90 | + {"short":"hu","chinese":"匈牙利语","english":"Hungarian","language":"Magyar"}, | ||
| 91 | + {"short":"is","chinese":"冰岛语","english":"Icelandic","language":"Íslenska"}, | ||
| 92 | + {"short":"ig","chinese":"伊博语","english":"Igbo","language":"Igbo"}, | ||
| 93 | + {"short":"jw","chinese":"爪哇语","english":"Javanese","language":"Javanese"}, | ||
| 94 | + {"short":"kn","chinese":"坎纳达语","english":"Kannada","language":"ಕನ್ನಡ"}, | ||
| 95 | + {"short":"kk","chinese":"哈萨克语","english":"Kazakh","language":"Kazakh"}, | ||
| 96 | + {"short":"km","chinese":"高棉语","english":"Khmer","language":"Khmer"}, | ||
| 97 | + {"short":"ku","chinese":"库尔德语","english":"Kurdish","language":"ههرێمی کوردستان"}, | ||
| 98 | + {"short":"ky","chinese":"吉尔吉斯斯坦语","english":"Kyrgyz","language":"Kyrgyz"}, | ||
| 99 | + {"short":"la","chinese":"拉丁语","english":"Latin","language":"Latin"}, | ||
| 100 | + {"short":"lv","chinese":"拉脱维亚语","english":"Latvian","language":"Latviešu"}, | ||
| 101 | + {"short":"lt","chinese":"立陶宛语","english":"Lithuanian","language":"Lietuvių"}, | ||
| 102 | + {"short":"lb","chinese":"卢森堡语","english":"Luxembou..","language":"Herzogtum Lëtzebuerg"}, | ||
| 103 | + {"short":"mk","chinese":"马其顿语","english":"Macedonian","language":"македонски"}, | ||
| 104 | + {"short":"mg","chinese":"马尔加什语","english":"Malagasy","language":"Malagasy"}, | ||
| 105 | + {"short":"ms","chinese":"马来语","english":"Malay","language":"Bahasa Melayu"}, | ||
| 106 | + {"short":"ml","chinese":"德拉维族(Dravidian)语","english":"Malayalam","language":"Malayalam "}, | ||
| 107 | + {"short":"mt","chinese":"马其他语","english":"Maltese","language":"Malti"}, | ||
| 108 | + {"short":"mi","chinese":"毛利语","english":"Maori","language":"Maori"}, | ||
| 109 | + {"short":"mr","chinese":"马拉地语","english":"Marathi","language":"Marathi"}, | ||
| 110 | + {"short":"mn","chinese":"蒙古族语","english":"Mongolian","language":"Mongolian"}, | ||
| 111 | + {"short":"my","chinese":"缅甸语","english":"Burmese","language":"Burmese"}, | ||
| 112 | + {"short":"ne","chinese":"尼泊尔语","english":"Nepali","language":"Nepali"}, | ||
| 113 | + {"short":"no","chinese":"挪威语","english":"Norwegian","language":"Norsk"}, | ||
| 114 | + {"short":"ps","chinese":"普什图语","english":"Pashto","language":"Pashto"}, | ||
| 115 | + {"short":"fa","chinese":"波斯语","english":"Persian","language":"فارسی"}, | ||
| 116 | + {"short":"pa","chinese":"旁遮普语","english":"Punjabi","language":"Punjabi"}, | ||
| 117 | + {"short":"sr","chinese":"塞尔维亚语","english":"Serbian","language":"Српски"}, | ||
| 118 | + {"short":"st","chinese":"塞索托语","english":"Sesotho","language":"Sesotho"}, | ||
| 119 | + {"short":"si","chinese":"僧伽罗语","english":"Sinhala","language":"Sinhala"}, | ||
| 120 | + {"short":"sk","chinese":"斯洛伐克语","english":"Slovak","language":"Slovenčina"}, | ||
| 121 | + {"short":"sl","chinese":"斯洛文尼亚语","english":"Slovenian","language":"slovenščina"}, | ||
| 122 | + {"short":"so","chinese":"索马里语","english":"Somali","language":"Somali"}, | ||
| 123 | + {"short":"sm","chinese":"萨摩亚语","english":"Samoan","language":"Samoan"}, | ||
| 124 | + {"short":"gd","chinese":"苏格兰盖尔语","english":"Scots Gaelic","language":"Gàidhlig"}, | ||
| 125 | + {"short":"sn","chinese":"修纳语","english":"Shona","language":"Shona"}, | ||
| 126 | + {"short":"sd","chinese":"信德语","english":"Sindhi","language":"سنڌي"}, | ||
| 127 | + {"short":"su","chinese":"巽他语","english":"Sundanese","language":"Sundanese"}, | ||
| 128 | + {"short":"sw","chinese":"斯瓦西里语","english":"Swahili","language":"Kiswahili"}, | ||
| 129 | + {"short":"tg","chinese":"塔吉克语","english":"Tajik","language":"Tajik"}, | ||
| 130 | + {"short":"ta","chinese":"泰米尔语","english":"Tamil","language":"தமிழ்"}, | ||
| 131 | + {"short":"te","chinese":"泰卢固语","english":"Telugu","language":"తెలుగు"}, | ||
| 132 | + {"short":"th","chinese":"泰语","english":"Thai","language":"ภาษาไทย"}, | ||
| 133 | + {"short":"uk","chinese":"乌克兰语","english":"Ukrainian","language":"Українська"}, | ||
| 134 | + {"short":"ur","chinese":"乌尔都语","english":"Urdu","language":"اردو"}, | ||
| 135 | + {"short":"uz","chinese":"乌兹别克语","english":"Uzbek","language":"Uzbek"}, | ||
| 136 | + {"short":"vi","chinese":"越南语","english":"Vietnamese","language":"Tiếng Việt"}, | ||
| 137 | + {"short":"cy","chinese":"威尔士语","english":"Welsh","language":"Cymraeg"}, | ||
| 138 | + {"short":"xh","chinese":"科萨语","english":"Xhosa","language":"Xhosa"}, | ||
| 139 | + {"short":"yi","chinese":"意地绪语","english":"Yiddish","language":"ײִדיש"}, | ||
| 140 | + {"short":"yo","chinese":"约鲁巴语","english":"Yoruba","language":"Yoruba"}, | ||
| 141 | + {"short":"zu","chinese":"祖鲁语","english":"Zulu","language":"Zulu"}, | ||
| 142 | + {"short":"rw","english":"Kinyarwanda","chinese":"卢旺达","language":"Kinyarwanda"}, | ||
| 143 | + {"short":"tt","english":"Tatar","chinese":"鞑靼语","language":"Татар"}, | ||
| 144 | + {"short":"or","english":"Oriya","chinese":"奥利亚语","language":"ଓଡିଆ"}, | ||
| 145 | + {"short":"tk","english":"Turkmen","chinese":"土库曼语","language":"Türkmenler"}, | ||
| 146 | + {"short":"ug","english":"Uyghur","chinese":"维吾尔语","language":"ئۇيغۇر"}]'; | ||
| 147 | + $data = json_decode($data); | ||
| 148 | + foreach ($data as $v){ | ||
| 149 | + $v = (array)$v; | ||
| 150 | + echo date('Y-m-d H:i:s') . ' start: ' . $v['short'] . PHP_EOL; | ||
| 151 | + $languageModel = new WebLanguage(); | ||
| 152 | + $languageModel->add($v); | ||
| 153 | + echo date('Y-m-d H:i:s') . ' end: ' . $v['short'] . PHP_EOL; | ||
| 154 | + } | ||
| 155 | + return true; | ||
| 156 | + } | ||
| 157 | +} |
| @@ -231,8 +231,11 @@ class SyncProject extends Command | @@ -231,8 +231,11 @@ class SyncProject extends Command | ||
| 231 | $this->createUser($data['project']['mobile'],$id,$data['project']['lead_name']); | 231 | $this->createUser($data['project']['mobile'],$id,$data['project']['lead_name']); |
| 232 | //新增数据抓取任务 | 232 | //新增数据抓取任务 |
| 233 | $task_list = []; | 233 | $task_list = []; |
| 234 | + if(!in_array('category_news',$param['api_type'])){ | ||
| 235 | + array_push($param['api_type'],'category_news'); | ||
| 236 | + } | ||
| 234 | foreach ($param['api_type'] as $v_type){ | 237 | foreach ($param['api_type'] as $v_type){ |
| 235 | - if($v_type == 'category'){ | 238 | + if($v_type == 'category' || $v_type == 'category_news'){ |
| 236 | UpdateLog::createLog($id,$v_type,$param['get_data_url']); | 239 | UpdateLog::createLog($id,$v_type,$param['get_data_url']); |
| 237 | }else{ | 240 | }else{ |
| 238 | $task_list[] = $v_type; | 241 | $task_list[] = $v_type; |
| @@ -10,6 +10,7 @@ namespace App\Console\Commands\Test; | @@ -10,6 +10,7 @@ namespace App\Console\Commands\Test; | ||
| 10 | use App\Helper\Common; | 10 | use App\Helper\Common; |
| 11 | use App\Models\Blog\Blog; | 11 | use App\Models\Blog\Blog; |
| 12 | use App\Models\Devops\ServerConfig; | 12 | use App\Models\Devops\ServerConfig; |
| 13 | +use App\Models\Domain\DomainInfo; | ||
| 13 | use App\Models\File\Image; | 14 | use App\Models\File\Image; |
| 14 | use App\Models\Manage\BelongingGroup; | 15 | use App\Models\Manage\BelongingGroup; |
| 15 | use App\Models\Manage\Dept; | 16 | use App\Models\Manage\Dept; |
| @@ -43,10 +44,10 @@ class Demo extends Command | @@ -43,10 +44,10 @@ class Demo extends Command | ||
| 43 | * | 44 | * |
| 44 | * @return void | 45 | * @return void |
| 45 | */ | 46 | */ |
| 46 | - public function __construct() | ||
| 47 | - { | ||
| 48 | - parent::__construct(); | ||
| 49 | - } | 47 | +// public function __construct() |
| 48 | +// { | ||
| 49 | +// parent::__construct(); | ||
| 50 | +// } | ||
| 50 | 51 | ||
| 51 | public function curlRequest($url, $data, $method = 'POST', $header = [], $time_out = 60) | 52 | public function curlRequest($url, $data, $method = 'POST', $header = [], $time_out = 60) |
| 52 | { | 53 | { |
| @@ -77,6 +78,7 @@ class Demo extends Command | @@ -77,6 +78,7 @@ class Demo extends Command | ||
| 77 | */ | 78 | */ |
| 78 | public function handle() | 79 | public function handle() |
| 79 | { | 80 | { |
| 81 | + return $this->domain(); | ||
| 80 | $result = app(SyncService::class)->projectAcceptAddress(1); | 82 | $result = app(SyncService::class)->projectAcceptAddress(1); |
| 81 | dd($result); | 83 | dd($result); |
| 82 | $data = [ | 84 | $data = [ |
| @@ -293,4 +295,26 @@ class Demo extends Command | @@ -293,4 +295,26 @@ class Demo extends Command | ||
| 293 | } | 295 | } |
| 294 | dd(1); | 296 | dd(1); |
| 295 | } | 297 | } |
| 298 | + | ||
| 299 | + /** | ||
| 300 | + * @remark :获取域名 | ||
| 301 | + * @name :domain | ||
| 302 | + * @author :lyh | ||
| 303 | + * @method :post | ||
| 304 | + * @time :2023/11/29 18:47 | ||
| 305 | + */ | ||
| 306 | + public function domain(){ | ||
| 307 | + $domainModel = new DomainInfo(); | ||
| 308 | + $lists = $domainModel->list(); | ||
| 309 | + foreach ($lists as $k => $v){ | ||
| 310 | + if($v['project_id'] != 0){ | ||
| 311 | + echo date('Y-m-d H:i:s') . ' start: ' . $v['project_id'] . PHP_EOL; | ||
| 312 | + $domain = 'https://'.$v['domain'].'/'; | ||
| 313 | + $url = $domain.'/api/update_robots/?project_id='.$v['project_id']; | ||
| 314 | + http_get($url); | ||
| 315 | + echo date('Y-m-d H:i:s') . ' end: ' . $v['project_id'] . PHP_EOL; | ||
| 316 | + } | ||
| 317 | + } | ||
| 318 | + return true; | ||
| 319 | + } | ||
| 296 | } | 320 | } |
| @@ -3,12 +3,14 @@ | @@ -3,12 +3,14 @@ | ||
| 3 | namespace App\Console\Commands\Update; | 3 | namespace App\Console\Commands\Update; |
| 4 | 4 | ||
| 5 | use App\Helper\Arr; | 5 | use App\Helper\Arr; |
| 6 | +use App\Http\Logic\Bside\News\NewsLogic; | ||
| 6 | use App\Http\Logic\Bside\Product\CategoryLogic; | 7 | use App\Http\Logic\Bside\Product\CategoryLogic; |
| 7 | use App\Models\Blog\Blog; | 8 | use App\Models\Blog\Blog; |
| 8 | use App\Models\Collect\CollectSource; | 9 | use App\Models\Collect\CollectSource; |
| 9 | use App\Models\Collect\CollectTask; | 10 | use App\Models\Collect\CollectTask; |
| 10 | use App\Models\Com\UpdateLog; | 11 | use App\Models\Com\UpdateLog; |
| 11 | use App\Models\News\News; | 12 | use App\Models\News\News; |
| 13 | +use App\Models\News\NewsCategory; | ||
| 12 | use App\Models\Product\Category; | 14 | use App\Models\Product\Category; |
| 13 | use App\Models\Product\Keyword; | 15 | use App\Models\Product\Keyword; |
| 14 | use App\Models\Product\Product; | 16 | use App\Models\Product\Product; |
| @@ -117,7 +119,7 @@ class ProjectUpdate extends Command | @@ -117,7 +119,7 @@ class ProjectUpdate extends Command | ||
| 117 | $project = ProjectServer::useProject($project_id); | 119 | $project = ProjectServer::useProject($project_id); |
| 118 | if ($project) { | 120 | if ($project) { |
| 119 | if ($api_type == 'category') { | 121 | if ($api_type == 'category') { |
| 120 | - //分类 | 122 | + //产品分类 |
| 121 | $url = $api_url . '?' . http_build_query(['w' => 'category']); | 123 | $url = $api_url . '?' . http_build_query(['w' => 'category']); |
| 122 | $data = curl_c($url); | 124 | $data = curl_c($url); |
| 123 | if (isset($data['code']) && $data['code'] == 200) { | 125 | if (isset($data['code']) && $data['code'] == 200) { |
| @@ -126,6 +128,16 @@ class ProjectUpdate extends Command | @@ -126,6 +128,16 @@ class ProjectUpdate extends Command | ||
| 126 | } else { | 128 | } else { |
| 127 | return true; | 129 | return true; |
| 128 | } | 130 | } |
| 131 | + } elseif ($api_type == 'category_news') { | ||
| 132 | + // 新闻分类 | ||
| 133 | + $url = $api_url . '?' . http_build_query(['w' => 'category_news']); | ||
| 134 | + $data = curl_c($url); | ||
| 135 | + if (isset($data['code']) && $data['code'] == 200) { | ||
| 136 | + $items = $data['data'] ?? []; | ||
| 137 | + $this->category_news_insert($project_id, $items, 0); | ||
| 138 | + } else { | ||
| 139 | + return true; | ||
| 140 | + } | ||
| 129 | } elseif ($api_type == 'tag') { | 141 | } elseif ($api_type == 'tag') { |
| 130 | //关键词 | 142 | //关键词 |
| 131 | $url = $api_url . '?' . http_build_query(['w' => 'tag', 'page' => 1, 'pagesize' => 0]); | 143 | $url = $api_url . '?' . http_build_query(['w' => 'tag', 'page' => 1, 'pagesize' => 0]); |
| @@ -334,6 +346,8 @@ class ProjectUpdate extends Command | @@ -334,6 +346,8 @@ class ProjectUpdate extends Command | ||
| 334 | 346 | ||
| 335 | if ($api_type == 'news') { | 347 | if ($api_type == 'news') { |
| 336 | $model = new News(); | 348 | $model = new News(); |
| 349 | + $category_model = new NewsCategory(); | ||
| 350 | + $logic = new NewsLogic(); | ||
| 337 | } else { | 351 | } else { |
| 338 | $model = new Blog(); | 352 | $model = new Blog(); |
| 339 | } | 353 | } |
| @@ -343,6 +357,12 @@ class ProjectUpdate extends Command | @@ -343,6 +357,12 @@ class ProjectUpdate extends Command | ||
| 343 | if ($route) { | 357 | if ($route) { |
| 344 | $news = $model->read(['url' => $route], 'id'); | 358 | $news = $model->read(['url' => $route], 'id'); |
| 345 | if (!$news) { | 359 | if (!$news) { |
| 360 | + //分类 | ||
| 361 | + $category_id = ''; | ||
| 362 | + if ($api_type == 'news' && ($item['category'] ?? [])) { | ||
| 363 | + $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]); | ||
| 364 | + $category_id = $logic->getLastCategory(array_column($category_arr, 'id')); | ||
| 365 | + } | ||
| 346 | try { | 366 | try { |
| 347 | $item['ttile'] = $this->special2str($item['ttile'] ?? ''); | 367 | $item['ttile'] = $this->special2str($item['ttile'] ?? ''); |
| 348 | 368 | ||
| @@ -355,6 +375,7 @@ class ProjectUpdate extends Command | @@ -355,6 +375,7 @@ class ProjectUpdate extends Command | ||
| 355 | $id = $model->insertGetId([ | 375 | $id = $model->insertGetId([ |
| 356 | 'project_id' => $project_id, | 376 | 'project_id' => $project_id, |
| 357 | 'name' => $item['ttile'], | 377 | 'name' => $item['ttile'], |
| 378 | + 'category_id' => $category_id, | ||
| 358 | 'seo_title' => $item['ttile'], | 379 | 'seo_title' => $item['ttile'], |
| 359 | 'seo_keywords' => $item['keywords'] ?? '', | 380 | 'seo_keywords' => $item['keywords'] ?? '', |
| 360 | 'seo_description' => $item['description'] ?? '', | 381 | 'seo_description' => $item['description'] ?? '', |
| @@ -457,7 +478,7 @@ class ProjectUpdate extends Command | @@ -457,7 +478,7 @@ class ProjectUpdate extends Command | ||
| 457 | return $task_id; | 478 | return $task_id; |
| 458 | } | 479 | } |
| 459 | 480 | ||
| 460 | - $task_list = UpdateLog::where('project_id', 543)->where('status', UpdateLog::STATUS_UN)->orderBy('project_id', 'asc')->orderBy('sort', 'asc')->limit(7)->get(); | 481 | + $task_list = UpdateLog::where('project_id', 528)->where('status', UpdateLog::STATUS_UN)->orderBy('project_id', 'asc')->orderBy('sort', 'asc')->limit(8)->get(); |
| 461 | if ($task_list->count() == 0) { | 482 | if ($task_list->count() == 0) { |
| 462 | return false; | 483 | return false; |
| 463 | } | 484 | } |
| @@ -473,7 +494,7 @@ class ProjectUpdate extends Command | @@ -473,7 +494,7 @@ class ProjectUpdate extends Command | ||
| 473 | //获取地址路由 | 494 | //获取地址路由 |
| 474 | protected function get_url_route($url) | 495 | protected function get_url_route($url) |
| 475 | { | 496 | { |
| 476 | - $arr = parse_url($url); | 497 | + $arr = parse_url(urldecode($url)); |
| 477 | if (empty($arr['path'])) { | 498 | if (empty($arr['path'])) { |
| 478 | return ''; | 499 | return ''; |
| 479 | } | 500 | } |
| @@ -485,10 +506,10 @@ class ProjectUpdate extends Command | @@ -485,10 +506,10 @@ class ProjectUpdate extends Command | ||
| 485 | 506 | ||
| 486 | $path_arr = explode('/', $path); | 507 | $path_arr = explode('/', $path); |
| 487 | 508 | ||
| 488 | - return end($path_arr) ? end($path_arr) : $path_arr[count($path_arr) - 2]; | 509 | + return end($path_arr) ? generateRoute(end($path_arr)) : generateRoute($path_arr[count($path_arr) - 2]); |
| 489 | } | 510 | } |
| 490 | 511 | ||
| 491 | - //多级分类入库 | 512 | + //产品多级分类入库 |
| 492 | protected function category_insert($project_id, $items, $pid = 0) | 513 | protected function category_insert($project_id, $items, $pid = 0) |
| 493 | { | 514 | { |
| 494 | $model = new Category(); | 515 | $model = new Category(); |
| @@ -524,6 +545,38 @@ class ProjectUpdate extends Command | @@ -524,6 +545,38 @@ class ProjectUpdate extends Command | ||
| 524 | } | 545 | } |
| 525 | } | 546 | } |
| 526 | 547 | ||
| 548 | + //新闻多级分类入库 | ||
| 549 | + protected function category_news_insert($project_id, $items, $pid = 0) | ||
| 550 | + { | ||
| 551 | + $model = new NewsCategory(); | ||
| 552 | + foreach ($items as $item) { | ||
| 553 | + $item['name'] = $this->special2str($item['name'] ?? ''); | ||
| 554 | + if ($item['name']) { | ||
| 555 | + $parent = $model->read(['pid' => $pid, 'name' => $item['name']], 'id'); | ||
| 556 | + if (!$parent) { | ||
| 557 | + try { | ||
| 558 | + $parent_id = $model->addReturnId([ | ||
| 559 | + 'project_id' => $project_id, | ||
| 560 | + 'name' => $item['name'], | ||
| 561 | + 'pid' => $pid, | ||
| 562 | + 'original_id' => $item['id'] | ||
| 563 | + ]); | ||
| 564 | + $this->set_map($this->get_url_route($item['url'] ?? ''), RouteMap::SOURCE_NEWS_CATE, $parent_id, $project_id); | ||
| 565 | + } catch (\Exception $e) { | ||
| 566 | + echo 'date:' . date('Y-m-d H:i:s') . ', category_news_insert error: ' . $e->getMessage() . PHP_EOL; | ||
| 567 | + continue; | ||
| 568 | + } | ||
| 569 | + } else { | ||
| 570 | + $parent_id = $parent['id']; | ||
| 571 | + } | ||
| 572 | + | ||
| 573 | + if (!empty($item['children'])) { | ||
| 574 | + $this->category_news_insert($project_id, $item['children'], $parent_id); | ||
| 575 | + } | ||
| 576 | + } | ||
| 577 | + } | ||
| 578 | + } | ||
| 579 | + | ||
| 527 | //特殊字符转换 | 580 | //特殊字符转换 |
| 528 | protected function special2str($str) | 581 | protected function special2str($str) |
| 529 | { | 582 | { |
| @@ -83,6 +83,7 @@ class OnlineController extends BaseController | @@ -83,6 +83,7 @@ class OnlineController extends BaseController | ||
| 83 | 'gl_project_deploy_optimize.assist_mid AS optimize_assist_mid', | 83 | 'gl_project_deploy_optimize.assist_mid AS optimize_assist_mid', |
| 84 | 'gl_project_deploy_optimize.tech_mid AS optimize_tech_mid', | 84 | 'gl_project_deploy_optimize.tech_mid AS optimize_tech_mid', |
| 85 | 'gl_project_deploy_optimize.domain AS domain', | 85 | 'gl_project_deploy_optimize.domain AS domain', |
| 86 | + 'gl_project_deploy_optimize.quality_mid AS quality_mid', | ||
| 86 | ]; | 87 | ]; |
| 87 | return $select; | 88 | return $select; |
| 88 | } | 89 | } |
| @@ -108,6 +109,7 @@ class OnlineController extends BaseController | @@ -108,6 +109,7 @@ class OnlineController extends BaseController | ||
| 108 | $item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']); | 109 | $item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']); |
| 109 | $item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']); | 110 | $item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']); |
| 110 | $item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']); | 111 | $item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']); |
| 112 | + $item['quality_mid_name'] = $manageModel->getName($item['quality_mid']); | ||
| 111 | $item['plan'] = Project::planMap()[$item['plan']]; | 113 | $item['plan'] = Project::planMap()[$item['plan']]; |
| 112 | $item['created_at'] = date('Y年m月d日', strtotime($item['created_at'])); | 114 | $item['created_at'] = date('Y年m月d日', strtotime($item['created_at'])); |
| 113 | $item['autologin_code'] = getAutoLoginCode($item['id']); | 115 | $item['autologin_code'] = getAutoLoginCode($item['id']); |
| @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Aside\Optimize; | @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Aside\Optimize; | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | use App\Http\Logic\Aside\Optimize\OptimizeLogic; | 7 | use App\Http\Logic\Aside\Optimize\OptimizeLogic; |
| 8 | +use App\Http\Logic\Aside\Project\ProjectLogic; | ||
| 8 | use App\Models\Ai\AiPrefix; | 9 | use App\Models\Ai\AiPrefix; |
| 9 | use App\Models\ASide\APublicModel; | 10 | use App\Models\ASide\APublicModel; |
| 10 | use App\Models\Channel\Channel; | 11 | use App\Models\Channel\Channel; |
| @@ -73,6 +74,7 @@ class OptimizeController extends BaseController | @@ -73,6 +74,7 @@ class OptimizeController extends BaseController | ||
| 73 | $item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']); | 74 | $item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']); |
| 74 | $item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']); | 75 | $item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']); |
| 75 | $item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']); | 76 | $item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']); |
| 77 | + $item['quality_mid_name'] = $manageModel->getName($item['quality_mid']); | ||
| 76 | $item['plan'] = Project::planMap()[$item['plan']]; | 78 | $item['plan'] = Project::planMap()[$item['plan']]; |
| 77 | $item['created_at'] = date('Y年m月d日', strtotime($item['cooperate_date'])); | 79 | $item['created_at'] = date('Y年m月d日', strtotime($item['cooperate_date'])); |
| 78 | $item['autologin_code'] = getAutoLoginCode($item['id']); | 80 | $item['autologin_code'] = getAutoLoginCode($item['id']); |
| @@ -244,9 +246,20 @@ class OptimizeController extends BaseController | @@ -244,9 +246,20 @@ class OptimizeController extends BaseController | ||
| 244 | $projectModel = new Project(); | 246 | $projectModel = new Project(); |
| 245 | $rs = $projectModel->edit(['robots'=>$this->param['robots']],['id'=>$this->param['project_id']]); | 247 | $rs = $projectModel->edit(['robots'=>$this->param['robots']],['id'=>$this->param['project_id']]); |
| 246 | if($rs === false){ | 248 | if($rs === false){ |
| 247 | - $this->response('系统错误,请联系管理员',Code::SYSTEM_ERROR); | 249 | + $this->response('执行错误,请联系开发人员',Code::SYSTEM_ERROR); |
| 248 | } | 250 | } |
| 249 | //TODO::通知C端 | 251 | //TODO::通知C端 |
| 250 | - $this->response('success'); | 252 | + $projectLogic = new ProjectLogic(); |
| 253 | + $project = $projectLogic->getProjectInfo($this->param['project_id']); | ||
| 254 | + $domain = !empty($project['deploy_optimize']['domain']) ? ((new DomainInfo())->getDomain($project['deploy_optimize']['domain'])) : ''; | ||
| 255 | + if(empty($domain)){ | ||
| 256 | + $domain = $project['deploy_build']['test_domain']; | ||
| 257 | + } | ||
| 258 | + $url = $domain.'api/update_robots/?project_id='.$this->param['project_id']; | ||
| 259 | + $res = curlGet($url); | ||
| 260 | + if(empty($res) || $res['status'] != 200){ | ||
| 261 | + $this->response('生成robots失败,请联系开发人员',Code::SYSTEM_ERROR,['url'=>$url]); | ||
| 262 | + } | ||
| 263 | + $this->response('success',Code::SUCCESS,['url'=>$domain.'robots.txt']); | ||
| 251 | } | 264 | } |
| 252 | } | 265 | } |
| @@ -310,6 +310,7 @@ class ProjectController extends BaseController | @@ -310,6 +310,7 @@ class ProjectController extends BaseController | ||
| 310 | $item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']); | 310 | $item['optimize_optimist'] = $manageModel->getName($item['optimize_optimist_mid']); |
| 311 | $item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']); | 311 | $item['optimize_assist'] = $manageModel->getName($item['optimize_assist_mid']); |
| 312 | $item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']); | 312 | $item['optimize_tech'] = $manageModel->getName($item['optimize_tech_mid']); |
| 313 | + $item['quality_mid_name'] = $manageModel->getName($item['quality_mid']); | ||
| 313 | $item['plan'] = Project::planMap()[$item['plan']]; | 314 | $item['plan'] = Project::planMap()[$item['plan']]; |
| 314 | $item['created_at'] = date('Y年m月d日', strtotime($item['cooperate_date'])); | 315 | $item['created_at'] = date('Y年m月d日', strtotime($item['cooperate_date'])); |
| 315 | $item['autologin_code'] = getAutoLoginCode($item['id']); | 316 | $item['autologin_code'] = getAutoLoginCode($item['id']); |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :LanguageController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/11/30 11:21 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Bside\Setting; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Bside\BaseController; | ||
| 14 | +use App\Models\WebSetting\WebLanguage; | ||
| 15 | + | ||
| 16 | +class LanguageController extends BaseController | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * @remark :获取小语种列表 | ||
| 20 | + * @name :lists | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2023/11/30 10:59 | ||
| 24 | + */ | ||
| 25 | + public function lists(){ | ||
| 26 | + $webLanguageModel = new WebLanguage(); | ||
| 27 | + $lists = $webLanguageModel->list(); | ||
| 28 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 29 | + } | ||
| 30 | +} |
| @@ -69,10 +69,12 @@ class OnlineCheckLogic extends BaseLogic | @@ -69,10 +69,12 @@ class OnlineCheckLogic extends BaseLogic | ||
| 69 | */ | 69 | */ |
| 70 | public function saveOnlineCheck(){ | 70 | public function saveOnlineCheck(){ |
| 71 | $info = $this->model->read(['project_id'=>$this->param['id']]); | 71 | $info = $this->model->read(['project_id'=>$this->param['id']]); |
| 72 | - $projectModel = new Project(); | ||
| 73 | if($info !== false){ | 72 | if($info !== false){ |
| 74 | $this->fail('已提交,请勿重复提交'); | 73 | $this->fail('已提交,请勿重复提交'); |
| 75 | }else{ | 74 | }else{ |
| 75 | + $projectModel = new Project(); | ||
| 76 | + //提交审核修改状态为审核中 | ||
| 77 | + $projectModel->edit(['status'=>$projectModel::STATUS_ONE],['id'=>$this->param['id']]); | ||
| 76 | //组装数据 | 78 | //组装数据 |
| 77 | $data = [ | 79 | $data = [ |
| 78 | 'project_id' => $this->param['id'], | 80 | 'project_id' => $this->param['id'], |
| @@ -85,8 +87,6 @@ class OnlineCheckLogic extends BaseLogic | @@ -85,8 +87,6 @@ class OnlineCheckLogic extends BaseLogic | ||
| 85 | if($rs === false){ | 87 | if($rs === false){ |
| 86 | $this->fail('error'); | 88 | $this->fail('error'); |
| 87 | } | 89 | } |
| 88 | - //提交审核修改状态为审核中 | ||
| 89 | - $projectModel->edit(['status'=>$projectModel::STATUS_ONE],['id'=>$this->param['id']]); | ||
| 90 | } | 90 | } |
| 91 | return $this->success(); | 91 | return $this->success(); |
| 92 | } | 92 | } |
| @@ -64,7 +64,8 @@ class BTemplateLogLogic extends BaseLogic | @@ -64,7 +64,8 @@ class BTemplateLogLogic extends BaseLogic | ||
| 64 | if(!empty($info['other'])){ | 64 | if(!empty($info['other'])){ |
| 65 | $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); | 65 | $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); |
| 66 | }else{ | 66 | }else{ |
| 67 | - $other = str_replace('<header','',characterTruncation($info['text'],"/<link id=\"google-fonts-link\"(.*?)<header/s")); | 67 | + $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s')); |
| 68 | + $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 68 | $commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); | 69 | $commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); |
| 69 | } | 70 | } |
| 70 | }catch (\Exception $e){ | 71 | }catch (\Exception $e){ |
| @@ -118,7 +119,8 @@ class BTemplateLogLogic extends BaseLogic | @@ -118,7 +119,8 @@ class BTemplateLogLogic extends BaseLogic | ||
| 118 | $this->fail('当前数据不存在,或已被删除'); | 119 | $this->fail('当前数据不存在,或已被删除'); |
| 119 | } | 120 | } |
| 120 | if(empty($info['other'])){ | 121 | if(empty($info['other'])){ |
| 121 | - $info['other'] = str_replace('<header','',characterTruncation($info['text'],"/<link id=\"google-fonts-link\"(.*?)<header/s")); | 122 | + $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s')); |
| 123 | + $info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 122 | } | 124 | } |
| 123 | $html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other']. | 125 | $html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other']. |
| 124 | $info['head_html'].$info['main_html'].$info['footer_html']; | 126 | $info['head_html'].$info['main_html'].$info['footer_html']; |
| @@ -277,7 +277,8 @@ class BTemplateLogic extends BaseLogic | @@ -277,7 +277,8 @@ class BTemplateLogic extends BaseLogic | ||
| 277 | 'footer_html'=>$param['footer_html'], | 277 | 'footer_html'=>$param['footer_html'], |
| 278 | 'footer_css'=>$param['footer_css'], | 278 | 'footer_css'=>$param['footer_css'], |
| 279 | ]; | 279 | ]; |
| 280 | - $other = str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")); | 280 | + $footer_other = str_replace('<header','',characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<header/s')); |
| 281 | + $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 281 | if($info === false){ | 282 | if($info === false){ |
| 282 | $data['template_id'] = $param['template_id']; | 283 | $data['template_id'] = $param['template_id']; |
| 283 | $data['project_id'] = $this->user['project_id']; | 284 | $data['project_id'] = $this->user['project_id']; |
| @@ -335,8 +336,9 @@ class BTemplateLogic extends BaseLogic | @@ -335,8 +336,9 @@ class BTemplateLogic extends BaseLogic | ||
| 335 | 'main_css'=>$param['main_css'], | 336 | 'main_css'=>$param['main_css'], |
| 336 | 'footer_html'=>$param['footer_html'], | 337 | 'footer_html'=>$param['footer_html'], |
| 337 | 'footer_css'=>$param['footer_css'], | 338 | 'footer_css'=>$param['footer_css'], |
| 338 | - 'other'=> str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")) | ||
| 339 | ]; | 339 | ]; |
| 340 | + $footer_other = str_replace('<header','',characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<header/s')); | ||
| 341 | + $data['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 340 | $bTemplateLogModel = new BTemplateLog(); | 342 | $bTemplateLogModel = new BTemplateLog(); |
| 341 | return $bTemplateLogModel->add($data); | 343 | return $bTemplateLogModel->add($data); |
| 342 | } | 344 | } |
| @@ -376,8 +378,7 @@ class BTemplateLogic extends BaseLogic | @@ -376,8 +378,7 @@ class BTemplateLogic extends BaseLogic | ||
| 376 | $route = 'all'; | 378 | $route = 'all'; |
| 377 | } | 379 | } |
| 378 | } | 380 | } |
| 379 | - return $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route]); | ||
| 380 | - return $this->success(); | 381 | + return $this->addUpdateNotify($type,$route); |
| 381 | } | 382 | } |
| 382 | 383 | ||
| 383 | /** | 384 | /** |
| @@ -66,8 +66,8 @@ class CustomTemplateLogic extends BaseLogic | @@ -66,8 +66,8 @@ class CustomTemplateLogic extends BaseLogic | ||
| 66 | try { | 66 | try { |
| 67 | $this->param['url'] = str_replace_url($this->param['url']); | 67 | $this->param['url'] = str_replace_url($this->param['url']); |
| 68 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 68 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 69 | - $id = $this->param['id']; | ||
| 70 | - $this->param['url'] = $this->editCustomRoute($this->param['url']); | 69 | + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']); |
| 70 | + $this->editCustomRoute($this->param['url']); | ||
| 71 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 71 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 72 | }else{ | 72 | }else{ |
| 73 | if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ | 73 | if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ |
| @@ -75,9 +75,10 @@ class CustomTemplateLogic extends BaseLogic | @@ -75,9 +75,10 @@ class CustomTemplateLogic extends BaseLogic | ||
| 75 | } | 75 | } |
| 76 | $this->param['project_id'] = $this->user['project_id']; | 76 | $this->param['project_id'] = $this->user['project_id']; |
| 77 | $id = $this->model->addReturnId($this->param); | 77 | $id = $this->model->addReturnId($this->param); |
| 78 | + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); | ||
| 79 | + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route); | ||
| 80 | + $this->model->edit(['url'=>$route],['id'=>$id]); | ||
| 78 | } | 81 | } |
| 79 | - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); | ||
| 80 | - $this->model->edit(['url'=>$route],['id'=>$id]); | ||
| 81 | }catch (\Exception $e){ | 82 | }catch (\Exception $e){ |
| 82 | $this->fail('error'); | 83 | $this->fail('error'); |
| 83 | } | 84 | } |
| @@ -110,8 +111,8 @@ class CustomTemplateLogic extends BaseLogic | @@ -110,8 +111,8 @@ class CustomTemplateLogic extends BaseLogic | ||
| 110 | if($rs === false){ | 111 | if($rs === false){ |
| 111 | $this->fail('系统错误,请联系管理'); | 112 | $this->fail('系统错误,请联系管理'); |
| 112 | } | 113 | } |
| 113 | - $data = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PAGE, 'route'=>$info['url']]; | ||
| 114 | - $this->updateNotify($data); | 114 | + //通知 |
| 115 | + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']); | ||
| 115 | return $this->success(); | 116 | return $this->success(); |
| 116 | } | 117 | } |
| 117 | 118 | ||
| @@ -136,8 +137,9 @@ class CustomTemplateLogic extends BaseLogic | @@ -136,8 +137,9 @@ class CustomTemplateLogic extends BaseLogic | ||
| 136 | 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), | 137 | 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), |
| 137 | 'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'), | 138 | 'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'), |
| 138 | 'main_css' => characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'), | 139 | '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 | ]; | 140 | ]; |
| 141 | + $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); | ||
| 142 | + $data['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 141 | $bTemplateLogModel = new BTemplateLog(); | 143 | $bTemplateLogModel = new BTemplateLog(); |
| 142 | return $bTemplateLogModel->add($data); | 144 | return $bTemplateLogModel->add($data); |
| 143 | } | 145 | } |
| @@ -151,7 +153,6 @@ class CustomTemplateLogic extends BaseLogic | @@ -151,7 +153,6 @@ class CustomTemplateLogic extends BaseLogic | ||
| 151 | */ | 153 | */ |
| 152 | public function saveCommonTemplate($html,$template_id){ | 154 | public function saveCommonTemplate($html,$template_id){ |
| 153 | $type = $this->getType(); | 155 | $type = $this->getType(); |
| 154 | - | ||
| 155 | $templateCommonModel = new BTemplateCommon(); | 156 | $templateCommonModel = new BTemplateCommon(); |
| 156 | $info = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]); | 157 | $info = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]); |
| 157 | $data = [ | 158 | $data = [ |
| @@ -160,7 +161,8 @@ class CustomTemplateLogic extends BaseLogic | @@ -160,7 +161,8 @@ class CustomTemplateLogic extends BaseLogic | ||
| 160 | 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), | 161 | 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), |
| 161 | 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), | 162 | 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), |
| 162 | ]; | 163 | ]; |
| 163 | - $other = str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")); | 164 | + $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); |
| 165 | + $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 164 | if($info === false){ | 166 | if($info === false){ |
| 165 | $data['template_id'] = $template_id; | 167 | $data['template_id'] = $template_id; |
| 166 | $data['project_id'] = $this->user['project_id']; | 168 | $data['project_id'] = $this->user['project_id']; |
| @@ -209,14 +211,10 @@ class CustomTemplateLogic extends BaseLogic | @@ -209,14 +211,10 @@ class CustomTemplateLogic extends BaseLogic | ||
| 209 | $this->fail('404页面链接不可修改'); | 211 | $this->fail('404页面链接不可修改'); |
| 210 | } | 212 | } |
| 211 | if($info['url'] != $route){ | 213 | if($info['url'] != $route){ |
| 212 | - //生成一条删除路由记录 | ||
| 213 | - $data = [ | ||
| 214 | - 'source'=>RouteMap::SOURCE_PAGE, | ||
| 215 | - 'route'=>$info['url'], | ||
| 216 | - ]; | ||
| 217 | - $this->setRouteDeleteSave($data); | 214 | + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route); |
| 215 | + $this->curlDelRoute($info['url']); | ||
| 218 | } | 216 | } |
| 219 | - return $route; | 217 | + return true; |
| 220 | } | 218 | } |
| 221 | 219 | ||
| 222 | /** | 220 | /** |
| @@ -260,11 +258,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -260,11 +258,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 260 | RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); | 258 | RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); |
| 261 | //生成一条删除路由记录 | 259 | //生成一条删除路由记录 |
| 262 | $info = $this->model->read(['id' => $id], ['id', 'url']); | 260 | $info = $this->model->read(['id' => $id], ['id', 'url']); |
| 263 | - $data = [ | ||
| 264 | - 'source' => RouteMap::SOURCE_NEWS, | ||
| 265 | - 'route' => $info['url'], | ||
| 266 | - ]; | ||
| 267 | - $this->setRouteDeleteSave($data); | 261 | + $this->curlDelRoute($info['url']); |
| 268 | return $this->success(); | 262 | return $this->success(); |
| 269 | } | 263 | } |
| 270 | 264 |
| @@ -341,6 +341,8 @@ class VisualizationLogic extends BaseLogic | @@ -341,6 +341,8 @@ class VisualizationLogic extends BaseLogic | ||
| 341 | 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), | 341 | 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), |
| 342 | 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), | 342 | 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), |
| 343 | ]; | 343 | ]; |
| 344 | + $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); | ||
| 345 | + $data['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 344 | $bTemplateLogModel = new BTemplateLog(); | 346 | $bTemplateLogModel = new BTemplateLog(); |
| 345 | return $bTemplateLogModel->add($data); | 347 | return $bTemplateLogModel->add($data); |
| 346 | } | 348 | } |
| @@ -362,7 +364,8 @@ class VisualizationLogic extends BaseLogic | @@ -362,7 +364,8 @@ class VisualizationLogic extends BaseLogic | ||
| 362 | 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), | 364 | 'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'), |
| 363 | 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), | 365 | 'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'), |
| 364 | ]; | 366 | ]; |
| 365 | - $other = str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")); | 367 | + $footer_other = str_replace('<header','',characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<header/s')); |
| 368 | + $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | ||
| 366 | if($info === false){ | 369 | if($info === false){ |
| 367 | $data['template_id'] = $template_id; | 370 | $data['template_id'] = $template_id; |
| 368 | $data['project_id'] = $this->user['project_id']; | 371 | $data['project_id'] = $this->user['project_id']; |
| @@ -142,49 +142,36 @@ class BaseLogic extends Logic | @@ -142,49 +142,36 @@ class BaseLogic extends Logic | ||
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | /** | 144 | /** |
| 145 | - * @name :(通知更新)projectUrl | 145 | + * @name :生成一条新路由记录 |
| 146 | * @author :lyh | 146 | * @author :lyh |
| 147 | * @method :post | 147 | * @method :post |
| 148 | * @time :2023/6/6 14:09 | 148 | * @time :2023/6/6 14:09 |
| 149 | */ | 149 | */ |
| 150 | - function updateNotify($data) | 150 | + public function addUpdateNotify($type,$route) |
| 151 | { | 151 | { |
| 152 | $updateNotifyModel = new UpdateNotify(); | 152 | $updateNotifyModel = new UpdateNotify(); |
| 153 | - if($data['route'] != 'all'){ | ||
| 154 | - $info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>1]); | ||
| 155 | - if($info === false){ | ||
| 156 | - $param = [ | ||
| 157 | - 'project_id'=>$data['project_id'], | ||
| 158 | - 'type'=>$data['type'], | ||
| 159 | - 'route'=>$data['route'], | ||
| 160 | - ]; | ||
| 161 | - $updateNotifyModel->add($param); | ||
| 162 | - } | ||
| 163 | - //单页面直接通知更新 | ||
| 164 | - $url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$data['route']; | 153 | + $info = $updateNotifyModel->read(['project_id'=>$this->user['project_id'],'route'=>$route,'status'=>1]); |
| 154 | + if($info === false){ | ||
| 155 | + $param = [ | ||
| 156 | + 'project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route,'status'=>1 | ||
| 157 | + ]; | ||
| 158 | + $updateNotifyModel->add($param); | ||
| 165 | }else{ | 159 | }else{ |
| 166 | - $url = $this->user['domain'].'api/webInfo/?type=clear_website'; | 160 | + $updateNotifyModel->edit(['route'=>$route],['project_id'=>$this->user['project_id'],'type'=>$type,'status'=>1]); |
| 167 | } | 161 | } |
| 168 | - curlGet($url); | ||
| 169 | return $this->success(); | 162 | return $this->success(); |
| 170 | } | 163 | } |
| 171 | 164 | ||
| 172 | /** | 165 | /** |
| 173 | - * @remark :删除和编辑路由时生成一条记录 | ||
| 174 | - * @name :setRouteDeleteSave | 166 | + * @remark :删除路由通知C端 |
| 167 | + * @name :curlDelRoute | ||
| 175 | * @author :lyh | 168 | * @author :lyh |
| 176 | * @method :post | 169 | * @method :post |
| 177 | - * @time :2023/9/7 9:38 | 170 | + * @time :2023/11/30 14:43 |
| 178 | */ | 171 | */ |
| 179 | - public function setRouteDeleteSave($param){ | ||
| 180 | - $routeDeleteModel = new RouteDelete(); | ||
| 181 | - $data = [ | ||
| 182 | - 'project_id'=>$this->user['project_id'], | ||
| 183 | - 'source'=>$param['source'], | ||
| 184 | - 'created_at'=>date('Y-m-d H:i:s'), | ||
| 185 | - 'route'=>$param['route'], | ||
| 186 | - ]; | ||
| 187 | - $routeDeleteModel->insert($data); | 172 | + public function curlDelRoute($route){ |
| 173 | + $url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$route; | ||
| 174 | + curlGet($url); | ||
| 188 | return $this->success(); | 175 | return $this->success(); |
| 189 | } | 176 | } |
| 190 | } | 177 | } |
| @@ -32,8 +32,7 @@ class BlogCategoryLogic extends BaseLogic | @@ -32,8 +32,7 @@ class BlogCategoryLogic extends BaseLogic | ||
| 32 | DB::beginTransaction(); | 32 | DB::beginTransaction(); |
| 33 | try { | 33 | try { |
| 34 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 34 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 35 | - //查看路由是否更新 | ||
| 36 | - $id = $this->param['id']; | 35 | + $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']); |
| 37 | $this->editCategoryRoute($this->param['id'], $this->param['alias']); | 36 | $this->editCategoryRoute($this->param['id'], $this->param['alias']); |
| 38 | $this->editHandleCategory($this->param['id'],$this->param['pid']); | 37 | $this->editHandleCategory($this->param['id'],$this->param['pid']); |
| 39 | $this->param['operator_id'] = $this->user['id']; | 38 | $this->param['operator_id'] = $this->user['id']; |
| @@ -46,18 +45,17 @@ class BlogCategoryLogic extends BaseLogic | @@ -46,18 +45,17 @@ class BlogCategoryLogic extends BaseLogic | ||
| 46 | //拼接参数 | 45 | //拼接参数 |
| 47 | $this->param = $this->addParamProcessing($this->param); | 46 | $this->param = $this->addParamProcessing($this->param); |
| 48 | $id = $this->model->addReturnId($this->param); | 47 | $id = $this->model->addReturnId($this->param); |
| 48 | + $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); | ||
| 49 | + $this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route); | ||
| 50 | + $this->edit(['alias'=>$route],['id'=>$id]); | ||
| 49 | //处理子集 | 51 | //处理子集 |
| 50 | $this->addProcessingSon($id); | 52 | $this->addProcessingSon($id); |
| 51 | } | 53 | } |
| 52 | - $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); | ||
| 53 | - $this->edit(['alias'=>$route],['id'=>$id]); | ||
| 54 | DB::commit(); | 54 | DB::commit(); |
| 55 | }catch (\Exception $e){ | 55 | }catch (\Exception $e){ |
| 56 | DB::rollBack(); | 56 | DB::rollBack(); |
| 57 | $this->fail('系统错误,请联系管理'); | 57 | $this->fail('系统错误,请联系管理'); |
| 58 | } | 58 | } |
| 59 | - //通知更新 | ||
| 60 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG_CATE, 'route'=>$route]); | ||
| 61 | return $this->success(); | 59 | return $this->success(); |
| 62 | } | 60 | } |
| 63 | 61 | ||
| @@ -114,11 +112,8 @@ class BlogCategoryLogic extends BaseLogic | @@ -114,11 +112,8 @@ class BlogCategoryLogic extends BaseLogic | ||
| 114 | //生成一条删除路由记录 | 112 | //生成一条删除路由记录 |
| 115 | $info = $this->model->read(['id'=>$id],['id','alias']); | 113 | $info = $this->model->read(['id'=>$id],['id','alias']); |
| 116 | if($info['alias'] != $route){ | 114 | if($info['alias'] != $route){ |
| 117 | - $data = [ | ||
| 118 | - 'source'=>RouteMap::SOURCE_NEWS_CATE, | ||
| 119 | - 'route'=>$info['alias'], | ||
| 120 | - ]; | ||
| 121 | - $this->setRouteDeleteSave($data); | 115 | + $this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route); |
| 116 | + $this->curlDelRoute($info['alias']); | ||
| 122 | } | 117 | } |
| 123 | return true; | 118 | return true; |
| 124 | } | 119 | } |
| @@ -311,11 +306,7 @@ class BlogCategoryLogic extends BaseLogic | @@ -311,11 +306,7 @@ class BlogCategoryLogic extends BaseLogic | ||
| 311 | RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); | 306 | RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); |
| 312 | //生成一条删除路由记录 | 307 | //生成一条删除路由记录 |
| 313 | $info = $this->model->read(['id'=>$id],['id','alias']); | 308 | $info = $this->model->read(['id'=>$id],['id','alias']); |
| 314 | - $data = [ | ||
| 315 | - 'source'=>RouteMap::SOURCE_BLOG_CATE, | ||
| 316 | - 'route'=>$info['alias'], | ||
| 317 | - ]; | ||
| 318 | - $this->setRouteDeleteSave($data); | 309 | + $this->curlDelRoute($info['alias']); |
| 319 | return $this->success(); | 310 | return $this->success(); |
| 320 | } | 311 | } |
| 321 | 312 | ||
| @@ -331,27 +322,22 @@ class BlogCategoryLogic extends BaseLogic | @@ -331,27 +322,22 @@ class BlogCategoryLogic extends BaseLogic | ||
| 331 | */ | 322 | */ |
| 332 | public function importBlogCategory($project_id,$user_id,$category){ | 323 | public function importBlogCategory($project_id,$user_id,$category){ |
| 333 | $return = []; | 324 | $return = []; |
| 334 | - | ||
| 335 | $cate_arr = explode('/',$category); | 325 | $cate_arr = explode('/',$category); |
| 336 | - | ||
| 337 | $pid = 0; | 326 | $pid = 0; |
| 338 | foreach ($cate_arr as $v){ | 327 | foreach ($cate_arr as $v){ |
| 339 | if($v){ | 328 | if($v){ |
| 340 | $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]); | 329 | $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]); |
| 341 | if(!$category_info){ | 330 | if(!$category_info){ |
| 342 | $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]); | 331 | $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]); |
| 343 | - | ||
| 344 | $route = RouteMap::setRoute($v, RouteMap::SOURCE_BLOG_CATE, $id, $project_id); | 332 | $route = RouteMap::setRoute($v, RouteMap::SOURCE_BLOG_CATE, $id, $project_id); |
| 345 | $this->model->edit(['alias'=>$route],['id'=>$id]); | 333 | $this->model->edit(['alias'=>$route],['id'=>$id]); |
| 346 | }else{ | 334 | }else{ |
| 347 | $id = $category_info['id']; | 335 | $id = $category_info['id']; |
| 348 | } | 336 | } |
| 349 | - | ||
| 350 | $return[] = $id; | 337 | $return[] = $id; |
| 351 | $pid = $id; | 338 | $pid = $id; |
| 352 | } | 339 | } |
| 353 | } | 340 | } |
| 354 | - | ||
| 355 | return $this->getLastCategory($return); | 341 | return $this->getLastCategory($return); |
| 356 | } | 342 | } |
| 357 | 343 |
| @@ -34,22 +34,20 @@ class BlogLogic extends BaseLogic | @@ -34,22 +34,20 @@ class BlogLogic extends BaseLogic | ||
| 34 | try { | 34 | try { |
| 35 | $this->param = $this->paramProcessing($this->param); | 35 | $this->param = $this->paramProcessing($this->param); |
| 36 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 36 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 37 | - //是否更新路由 | ||
| 38 | - $id = $this->param['id']; | 37 | + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']); |
| 39 | $this->editNewsRoute($this->param['id'],$this->param['url']); | 38 | $this->editNewsRoute($this->param['id'],$this->param['url']); |
| 40 | $this->edit($this->param,['id'=>$this->param['id']]); | 39 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 41 | }else{ | 40 | }else{ |
| 42 | $id = $this->model->addReturnId($this->param); | 41 | $id = $this->model->addReturnId($this->param); |
| 42 | + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); | ||
| 43 | + $this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route); | ||
| 44 | + $this->edit(['url'=>$route],['id'=>$id]); | ||
| 43 | } | 45 | } |
| 44 | - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); | ||
| 45 | - $this->edit(['url'=>$route],['id'=>$id]); | ||
| 46 | DB::commit(); | 46 | DB::commit(); |
| 47 | }catch (\Exception $e){ | 47 | }catch (\Exception $e){ |
| 48 | DB::rollBack(); | 48 | DB::rollBack(); |
| 49 | $this->fail('error'); | 49 | $this->fail('error'); |
| 50 | } | 50 | } |
| 51 | - //通知更新 | ||
| 52 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]); | ||
| 53 | return $this->success(); | 51 | return $this->success(); |
| 54 | } | 52 | } |
| 55 | 53 | ||
| @@ -64,11 +62,8 @@ class BlogLogic extends BaseLogic | @@ -64,11 +62,8 @@ class BlogLogic extends BaseLogic | ||
| 64 | //生成一条删除路由记录 | 62 | //生成一条删除路由记录 |
| 65 | $info = $this->model->read(['id'=>$id],['id','url']); | 63 | $info = $this->model->read(['id'=>$id],['id','url']); |
| 66 | if($info['url'] != $route){ | 64 | if($info['url'] != $route){ |
| 67 | - $data = [ | ||
| 68 | - 'source'=>RouteMap::SOURCE_BLOG, | ||
| 69 | - 'route'=>$info['url'], | ||
| 70 | - ]; | ||
| 71 | - $this->setRouteDeleteSave($data); | 65 | + $this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route); |
| 66 | + $this->curlDelRoute($info['url']); | ||
| 72 | } | 67 | } |
| 73 | return true; | 68 | return true; |
| 74 | } | 69 | } |
| @@ -90,10 +85,11 @@ class BlogLogic extends BaseLogic | @@ -90,10 +85,11 @@ class BlogLogic extends BaseLogic | ||
| 90 | 85 | ||
| 91 | 86 | ||
| 92 | /** | 87 | /** |
| 93 | - * @name :获取数据详情 | ||
| 94 | - * @return array | ||
| 95 | - * @author :liyuhang | ||
| 96 | - * @method | 88 | + * @remark :获取数据详情 |
| 89 | + * @name :blogInfo | ||
| 90 | + * @author :lyh | ||
| 91 | + * @method :post | ||
| 92 | + * @time :2023/11/30 15:17 | ||
| 97 | */ | 93 | */ |
| 98 | public function blogInfo(){ | 94 | public function blogInfo(){ |
| 99 | $info = $this->model->read($this->param); | 95 | $info = $this->model->read($this->param); |
| @@ -110,11 +106,11 @@ class BlogLogic extends BaseLogic | @@ -110,11 +106,11 @@ class BlogLogic extends BaseLogic | ||
| 110 | 106 | ||
| 111 | 107 | ||
| 112 | /** | 108 | /** |
| 113 | - * @name :修改状态 | ||
| 114 | - * @return array | ||
| 115 | - * @throws \App\Exceptions\BsideGlobalException | ||
| 116 | - * @author :liyuhang | ||
| 117 | - * @method | 109 | + * @remark :修改状态 |
| 110 | + * @name :blogStatus | ||
| 111 | + * @author :lyh | ||
| 112 | + * @method :post | ||
| 113 | + * @time :2023/11/30 15:16 | ||
| 118 | */ | 114 | */ |
| 119 | public function blogStatus(){ | 115 | public function blogStatus(){ |
| 120 | $this->param['operator_id'] = $this->user['id']; | 116 | $this->param['operator_id'] = $this->user['id']; |
| @@ -126,10 +122,11 @@ class BlogLogic extends BaseLogic | @@ -126,10 +122,11 @@ class BlogLogic extends BaseLogic | ||
| 126 | } | 122 | } |
| 127 | 123 | ||
| 128 | /** | 124 | /** |
| 129 | - * @name :删除 | ||
| 130 | - * @return void | ||
| 131 | - * @author :liyuhang | ||
| 132 | - * @method | 125 | + * @remark :删除 |
| 126 | + * @name :blogDel | ||
| 127 | + * @author :lyh | ||
| 128 | + * @method :post | ||
| 129 | + * @time :2023/11/30 15:17 | ||
| 133 | */ | 130 | */ |
| 134 | public function blogDel(){ | 131 | public function blogDel(){ |
| 135 | DB::beginTransaction(); | 132 | DB::beginTransaction(); |
| @@ -158,11 +155,7 @@ class BlogLogic extends BaseLogic | @@ -158,11 +155,7 @@ class BlogLogic extends BaseLogic | ||
| 158 | RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); | 155 | RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); |
| 159 | //生成一条删除路由记录 | 156 | //生成一条删除路由记录 |
| 160 | $info = $this->model->read(['id'=>$id],['id','url']); | 157 | $info = $this->model->read(['id'=>$id],['id','url']); |
| 161 | - $data = [ | ||
| 162 | - 'source'=>RouteMap::SOURCE_BLOG, | ||
| 163 | - 'route'=>$info['url'], | ||
| 164 | - ]; | ||
| 165 | - $this->setRouteDeleteSave($data); | 158 | + $this->curlDelRoute($info['url']); |
| 166 | return $this->success(); | 159 | return $this->success(); |
| 167 | } | 160 | } |
| 168 | 161 |
| @@ -55,7 +55,7 @@ class NavLogic extends BaseLogic | @@ -55,7 +55,7 @@ class NavLogic extends BaseLogic | ||
| 55 | $this->model->add($this->param); | 55 | $this->model->add($this->param); |
| 56 | } | 56 | } |
| 57 | //编辑菜单后,通知更新 | 57 | //编辑菜单后,通知更新 |
| 58 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']); | 58 | + $this->addUpdateNotify(RouteMap::SOURCE_NAV, 'all'); |
| 59 | return $this->success(); | 59 | return $this->success(); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| @@ -97,7 +97,7 @@ class NavLogic extends BaseLogic | @@ -97,7 +97,7 @@ class NavLogic extends BaseLogic | ||
| 97 | $this->fail('error'); | 97 | $this->fail('error'); |
| 98 | } | 98 | } |
| 99 | //编辑菜单后,通知更新 | 99 | //编辑菜单后,通知更新 |
| 100 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']); | 100 | + $this->addUpdateNotify(RouteMap::SOURCE_NAV, 'all'); |
| 101 | return $this->success(); | 101 | return $this->success(); |
| 102 | } | 102 | } |
| 103 | 103 |
| @@ -44,11 +44,10 @@ class NewsCategoryLogic extends BaseLogic | @@ -44,11 +44,10 @@ class NewsCategoryLogic extends BaseLogic | ||
| 44 | DB::beginTransaction(); | 44 | DB::beginTransaction(); |
| 45 | try { | 45 | try { |
| 46 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 46 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 47 | - $this->param['operator_id'] = $this->user['id']; | ||
| 48 | - //查看路由是否更新 | ||
| 49 | - $id = $this->param['id']; | 47 | + $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']); |
| 50 | $this->editCategoryRoute($this->param['id'],$this->param['alias']); | 48 | $this->editCategoryRoute($this->param['id'],$this->param['alias']); |
| 51 | $this->editHandleCategory($this->param['id'],$this->param['pid']); | 49 | $this->editHandleCategory($this->param['id'],$this->param['pid']); |
| 50 | + $this->param['operator_id'] = $this->user['id']; | ||
| 52 | $this->edit($this->param,['id'=>$this->param['id']]); | 51 | $this->edit($this->param,['id'=>$this->param['id']]); |
| 53 | }else{ | 52 | }else{ |
| 54 | if(!isset($this->param['alias']) || empty($this->param['alias'])){ | 53 | if(!isset($this->param['alias']) || empty($this->param['alias'])){ |
| @@ -56,18 +55,17 @@ class NewsCategoryLogic extends BaseLogic | @@ -56,18 +55,17 @@ class NewsCategoryLogic extends BaseLogic | ||
| 56 | } | 55 | } |
| 57 | $this->param = $this->addParamProcessing($this->param); | 56 | $this->param = $this->addParamProcessing($this->param); |
| 58 | $id = $this->model->addReturnId($this->param); | 57 | $id = $this->model->addReturnId($this->param); |
| 58 | + $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | ||
| 59 | + $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route); | ||
| 60 | + $this->model->edit(['alias'=>$route],['id'=>$id]); | ||
| 59 | //当父级分类拥有产品时,处理子集 | 61 | //当父级分类拥有产品时,处理子集 |
| 60 | $this->addProcessingSon($id); | 62 | $this->addProcessingSon($id); |
| 61 | } | 63 | } |
| 62 | - $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | ||
| 63 | - $this->model->edit(['alias'=>$route],['id'=>$id]); | ||
| 64 | DB::commit(); | 64 | DB::commit(); |
| 65 | }catch (\Exception $e){ | 65 | }catch (\Exception $e){ |
| 66 | DB::rollBack(); | 66 | DB::rollBack(); |
| 67 | $this->fail('系统错误,请联系管理员'); | 67 | $this->fail('系统错误,请联系管理员'); |
| 68 | } | 68 | } |
| 69 | - //更新通知记录表 | ||
| 70 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$route]); | ||
| 71 | return $this->success(); | 69 | return $this->success(); |
| 72 | } | 70 | } |
| 73 | 71 | ||
| @@ -124,22 +122,19 @@ class NewsCategoryLogic extends BaseLogic | @@ -124,22 +122,19 @@ class NewsCategoryLogic extends BaseLogic | ||
| 124 | //生成一条删除路由记录 | 122 | //生成一条删除路由记录 |
| 125 | $info = $this->model->read(['id'=>$id],['id','alias']); | 123 | $info = $this->model->read(['id'=>$id],['id','alias']); |
| 126 | if($info['alias'] != $route){ | 124 | if($info['alias'] != $route){ |
| 127 | - $data = [ | ||
| 128 | - 'source'=>RouteMap::SOURCE_NEWS_CATE, | ||
| 129 | - 'route'=>$info['alias'], | ||
| 130 | - ]; | ||
| 131 | - $this->setRouteDeleteSave($data); | 125 | + $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route); |
| 126 | + $this->curlDelRoute($info['alias']); | ||
| 132 | } | 127 | } |
| 133 | return true; | 128 | return true; |
| 134 | } | 129 | } |
| 135 | 130 | ||
| 136 | 131 | ||
| 137 | /** | 132 | /** |
| 138 | - * @name :修改状态 | ||
| 139 | - * @return array | ||
| 140 | - * @throws \App\Exceptions\BsideGlobalException | ||
| 141 | - * @author :liyuhang | ||
| 142 | - * @method | 133 | + * @remark :修改状态 |
| 134 | + * @name :status_news_category | ||
| 135 | + * @author :lyh | ||
| 136 | + * @method :post | ||
| 137 | + * @time :2023/11/30 15:13 | ||
| 143 | */ | 138 | */ |
| 144 | public function status_news_category(){ | 139 | public function status_news_category(){ |
| 145 | $this->param['operator_id'] = $this->user['id']; | 140 | $this->param['operator_id'] = $this->user['id']; |
| @@ -291,13 +286,8 @@ class NewsCategoryLogic extends BaseLogic | @@ -291,13 +286,8 @@ class NewsCategoryLogic extends BaseLogic | ||
| 291 | public function delRoute($id){ | 286 | public function delRoute($id){ |
| 292 | //删除路由映射 | 287 | //删除路由映射 |
| 293 | RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | 288 | RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); |
| 294 | - //生成一条删除路由记录 | ||
| 295 | $info = $this->model->read(['id'=>$id],['id','alias']); | 289 | $info = $this->model->read(['id'=>$id],['id','alias']); |
| 296 | - $data = [ | ||
| 297 | - 'source'=>RouteMap::SOURCE_NEWS_CATE, | ||
| 298 | - 'route'=>$info['alias'], | ||
| 299 | - ]; | ||
| 300 | - $this->setRouteDeleteSave($data); | 290 | + $this->curlDelRoute($info['alias']); |
| 301 | return $this->success(); | 291 | return $this->success(); |
| 302 | } | 292 | } |
| 303 | 293 | ||
| @@ -313,22 +303,18 @@ class NewsCategoryLogic extends BaseLogic | @@ -313,22 +303,18 @@ class NewsCategoryLogic extends BaseLogic | ||
| 313 | */ | 303 | */ |
| 314 | public function importNewsCategory($project_id,$user_id,$category){ | 304 | public function importNewsCategory($project_id,$user_id,$category){ |
| 315 | $return = []; | 305 | $return = []; |
| 316 | - | ||
| 317 | $cate_arr = explode('/',$category); | 306 | $cate_arr = explode('/',$category); |
| 318 | - | ||
| 319 | $pid = 0; | 307 | $pid = 0; |
| 320 | foreach ($cate_arr as $v){ | 308 | foreach ($cate_arr as $v){ |
| 321 | if($v){ | 309 | if($v){ |
| 322 | $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]); | 310 | $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]); |
| 323 | if(!$category_info){ | 311 | if(!$category_info){ |
| 324 | $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]); | 312 | $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]); |
| 325 | - | ||
| 326 | $route = RouteMap::setRoute($v, RouteMap::SOURCE_NEWS_CATE, $id, $project_id); | 313 | $route = RouteMap::setRoute($v, RouteMap::SOURCE_NEWS_CATE, $id, $project_id); |
| 327 | $this->model->edit(['alias'=>$route],['id'=>$id]); | 314 | $this->model->edit(['alias'=>$route],['id'=>$id]); |
| 328 | }else{ | 315 | }else{ |
| 329 | $id = $category_info['id']; | 316 | $id = $category_info['id']; |
| 330 | } | 317 | } |
| 331 | - | ||
| 332 | $return[] = $id; | 318 | $return[] = $id; |
| 333 | $pid = $id; | 319 | $pid = $id; |
| 334 | } | 320 | } |
| @@ -63,23 +63,22 @@ class NewsLogic extends BaseLogic | @@ -63,23 +63,22 @@ class NewsLogic extends BaseLogic | ||
| 63 | try { | 63 | try { |
| 64 | $this->param = $this->paramProcessing($this->param); | 64 | $this->param = $this->paramProcessing($this->param); |
| 65 | if (isset($this->param['id']) && !empty($this->param['id'])) { | 65 | if (isset($this->param['id']) && !empty($this->param['id'])) { |
| 66 | + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']); | ||
| 66 | //是否更新路由 | 67 | //是否更新路由 |
| 67 | $this->editNewsRoute($this->param['id'], $this->param['url']); | 68 | $this->editNewsRoute($this->param['id'], $this->param['url']); |
| 68 | - $id = $this->param['id']; | ||
| 69 | $this->edit($this->param, ['id' => $this->param['id']]); | 69 | $this->edit($this->param, ['id' => $this->param['id']]); |
| 70 | } else { | 70 | } else { |
| 71 | $id = $this->model->addReturnId($this->param); | 71 | $id = $this->model->addReturnId($this->param); |
| 72 | + $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); | ||
| 73 | + $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route); | ||
| 74 | + $this->edit(['url' => $route], ['id' => $id]); | ||
| 72 | } | 75 | } |
| 73 | //更新路由 | 76 | //更新路由 |
| 74 | - $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); | ||
| 75 | - $this->edit(['url' => $route], ['id' => $id]); | ||
| 76 | DB::commit(); | 77 | DB::commit(); |
| 77 | } catch (\Exception $e) { | 78 | } catch (\Exception $e) { |
| 78 | DB::rollBack(); | 79 | DB::rollBack(); |
| 79 | $this->fail('系统错误,请联系管理员'); | 80 | $this->fail('系统错误,请联系管理员'); |
| 80 | } | 81 | } |
| 81 | - //通知更新 | ||
| 82 | - $this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]); | ||
| 83 | return $this->success(); | 82 | return $this->success(); |
| 84 | } | 83 | } |
| 85 | 84 | ||
| @@ -95,11 +94,8 @@ class NewsLogic extends BaseLogic | @@ -95,11 +94,8 @@ class NewsLogic extends BaseLogic | ||
| 95 | //生成一条删除路由记录 | 94 | //生成一条删除路由记录 |
| 96 | $info = $this->model->read(['id' => $id], ['id', 'url']); | 95 | $info = $this->model->read(['id' => $id], ['id', 'url']); |
| 97 | if ($info['url'] != $route) { | 96 | if ($info['url'] != $route) { |
| 98 | - $data = [ | ||
| 99 | - 'source' => RouteMap::SOURCE_NEWS, | ||
| 100 | - 'route' => $info['url'], | ||
| 101 | - ]; | ||
| 102 | - $this->setRouteDeleteSave($data); | 97 | + $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route); |
| 98 | + $this->curlDelRoute($info['url']); | ||
| 103 | } | 99 | } |
| 104 | return true; | 100 | return true; |
| 105 | } | 101 | } |
| @@ -271,11 +267,7 @@ class NewsLogic extends BaseLogic | @@ -271,11 +267,7 @@ class NewsLogic extends BaseLogic | ||
| 271 | RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); | 267 | RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); |
| 272 | //生成一条删除路由记录 | 268 | //生成一条删除路由记录 |
| 273 | $info = $this->model->read(['id' => $id], ['id', 'url']); | 269 | $info = $this->model->read(['id' => $id], ['id', 'url']); |
| 274 | - $data = [ | ||
| 275 | - 'source' => RouteMap::SOURCE_NEWS, | ||
| 276 | - 'route' => $info['url'], | ||
| 277 | - ]; | ||
| 278 | - $this->setRouteDeleteSave($data); | 270 | + $this->curlDelRoute($info['url']); |
| 279 | return $this->success(); | 271 | return $this->success(); |
| 280 | } | 272 | } |
| 281 | 273 |
| @@ -113,19 +113,20 @@ class CategoryLogic extends BaseLogic | @@ -113,19 +113,20 @@ class CategoryLogic extends BaseLogic | ||
| 113 | DB::beginTransaction(); | 113 | DB::beginTransaction(); |
| 114 | try { | 114 | try { |
| 115 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 115 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 116 | - //是否编辑路由 | ||
| 117 | - $id = $this->editCategoryRoute($this->param['id'],$this->param['route']); | 116 | + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $this->param['id'], $this->user['project_id']); |
| 117 | + $this->editCategoryRoute($this->param['id'],$this->param['route']); | ||
| 118 | //处理子集 | 118 | //处理子集 |
| 119 | $this->editHandleCategory($this->param['id'],$this->param['pid']); | 119 | $this->editHandleCategory($this->param['id'],$this->param['pid']); |
| 120 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 120 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 121 | }else{ | 121 | }else{ |
| 122 | $this->param['project_id'] = $this->user['project_id']; | 122 | $this->param['project_id'] = $this->user['project_id']; |
| 123 | $id = $this->model->addReturnId($this->param); | 123 | $id = $this->model->addReturnId($this->param); |
| 124 | + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); | ||
| 125 | + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route); | ||
| 126 | + $this->edit(['route'=>$route],['id'=>$id]); | ||
| 124 | //处理子集 | 127 | //处理子集 |
| 125 | $this->addProcessingSon($id); | 128 | $this->addProcessingSon($id); |
| 126 | } | 129 | } |
| 127 | - $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); | ||
| 128 | - $this->edit(['route'=>$route],['id'=>$id]); | ||
| 129 | //清除缓存 | 130 | //清除缓存 |
| 130 | Common::del_user_cache('product_category',$this->user['project_id']); | 131 | Common::del_user_cache('product_category',$this->user['project_id']); |
| 131 | DB::commit(); | 132 | DB::commit(); |
| @@ -133,9 +134,6 @@ class CategoryLogic extends BaseLogic | @@ -133,9 +134,6 @@ class CategoryLogic extends BaseLogic | ||
| 133 | DB::rollBack(); | 134 | DB::rollBack(); |
| 134 | $this->fail('系统错误,请联系管理员'); | 135 | $this->fail('系统错误,请联系管理员'); |
| 135 | } | 136 | } |
| 136 | - //通知更新 | ||
| 137 | - $notifyData = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route]; | ||
| 138 | - $this->updateNotify($notifyData); | ||
| 139 | return $this->success(); | 137 | return $this->success(); |
| 140 | } | 138 | } |
| 141 | 139 | ||
| @@ -234,13 +232,10 @@ class CategoryLogic extends BaseLogic | @@ -234,13 +232,10 @@ class CategoryLogic extends BaseLogic | ||
| 234 | //生成一条删除路由记录 | 232 | //生成一条删除路由记录 |
| 235 | $info = $this->model->read(['id'=>$id],['id','route']); | 233 | $info = $this->model->read(['id'=>$id],['id','route']); |
| 236 | if($info['route'] != $route){ | 234 | if($info['route'] != $route){ |
| 237 | - $data = [ | ||
| 238 | - 'source'=>RouteMap::SOURCE_PRODUCT_CATE, | ||
| 239 | - 'route'=>$info['route'], | ||
| 240 | - ]; | ||
| 241 | - $this->setRouteDeleteSave($data); | 235 | + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route); |
| 236 | + $this->curlDelRoute($info['route']); | ||
| 242 | } | 237 | } |
| 243 | - return $id; | 238 | + return true; |
| 244 | } | 239 | } |
| 245 | 240 | ||
| 246 | /** | 241 | /** |
| @@ -283,11 +278,7 @@ class CategoryLogic extends BaseLogic | @@ -283,11 +278,7 @@ class CategoryLogic extends BaseLogic | ||
| 283 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); | 278 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); |
| 284 | //生成一条删除路由记录 | 279 | //生成一条删除路由记录 |
| 285 | $info = $this->model->read(['id'=>$id],['id','route']); | 280 | $info = $this->model->read(['id'=>$id],['id','route']); |
| 286 | - $data = [ | ||
| 287 | - 'source'=>RouteMap::SOURCE_PRODUCT_CATE, | ||
| 288 | - 'route'=>$info['route'], | ||
| 289 | - ]; | ||
| 290 | - $this->setRouteDeleteSave($data); | 281 | + $this->curlDelRoute($info['route']); |
| 291 | return $this->success(); | 282 | return $this->success(); |
| 292 | } | 283 | } |
| 293 | 284 | ||
| @@ -302,27 +293,22 @@ class CategoryLogic extends BaseLogic | @@ -302,27 +293,22 @@ class CategoryLogic extends BaseLogic | ||
| 302 | */ | 293 | */ |
| 303 | public function importProductCategory($project_id,$category){ | 294 | public function importProductCategory($project_id,$category){ |
| 304 | $return = []; | 295 | $return = []; |
| 305 | - | ||
| 306 | $cate_arr = explode('/',$category); | 296 | $cate_arr = explode('/',$category); |
| 307 | - | ||
| 308 | $pid = 0; | 297 | $pid = 0; |
| 309 | foreach ($cate_arr as $v){ | 298 | foreach ($cate_arr as $v){ |
| 310 | if($v){ | 299 | if($v){ |
| 311 | $category_info = $this->model->read(['title'=>$v,'pid'=>$pid]); | 300 | $category_info = $this->model->read(['title'=>$v,'pid'=>$pid]); |
| 312 | if(!$category_info){ | 301 | if(!$category_info){ |
| 313 | $id = $this->model->addReturnId(['title'=>$v,'pid'=>$pid,'project_id'=>$project_id]); | 302 | $id = $this->model->addReturnId(['title'=>$v,'pid'=>$pid,'project_id'=>$project_id]); |
| 314 | - | ||
| 315 | $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_CATE, $id, $project_id); | 303 | $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_CATE, $id, $project_id); |
| 316 | $this->model->edit(['route'=>$route],['id'=>$id]); | 304 | $this->model->edit(['route'=>$route],['id'=>$id]); |
| 317 | }else{ | 305 | }else{ |
| 318 | $id = $category_info['id']; | 306 | $id = $category_info['id']; |
| 319 | } | 307 | } |
| 320 | - | ||
| 321 | $return[] = $id; | 308 | $return[] = $id; |
| 322 | $pid = $id; | 309 | $pid = $id; |
| 323 | } | 310 | } |
| 324 | } | 311 | } |
| 325 | - | ||
| 326 | //清除缓存 | 312 | //清除缓存 |
| 327 | Common::del_user_cache('product_category',$project_id); | 313 | Common::del_user_cache('product_category',$project_id); |
| 328 | return $this->getLastCategory($return); | 314 | return $this->getLastCategory($return); |
| @@ -56,17 +56,16 @@ class KeywordLogic extends BaseLogic | @@ -56,17 +56,16 @@ class KeywordLogic extends BaseLogic | ||
| 56 | try { | 56 | try { |
| 57 | $this->param = $this->handleSaveParam($this->param); | 57 | $this->param = $this->handleSaveParam($this->param); |
| 58 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 58 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 59 | + //TODO::不能修改路由 | ||
| 59 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 60 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 60 | - $id = $this->param['id']; | ||
| 61 | }else{ | 61 | }else{ |
| 62 | - $this->param['project_id'] = $this->user['project_id']; | ||
| 63 | - $this->param['created_at'] = date('Y-m-d H:i:s'); | ||
| 64 | - $this->param['updated_at'] = $this->param['created_at']; | 62 | + $this->param = $this->addHandleParam($this->param); |
| 65 | $id = $this->model->insertGetId($this->param); | 63 | $id = $this->model->insertGetId($this->param); |
| 64 | + //路由映射 | ||
| 65 | + $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); | ||
| 66 | + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_KEYWORD,$route); | ||
| 67 | + $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 66 | } | 68 | } |
| 67 | - //路由映射 | ||
| 68 | - $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); | ||
| 69 | - $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 70 | //清除缓存 | 69 | //清除缓存 |
| 71 | Common::del_user_cache('product_keyword',$this->user['project_id']); | 70 | Common::del_user_cache('product_keyword',$this->user['project_id']); |
| 72 | DB::commit(); | 71 | DB::commit(); |
| @@ -74,12 +73,24 @@ class KeywordLogic extends BaseLogic | @@ -74,12 +73,24 @@ class KeywordLogic extends BaseLogic | ||
| 74 | DB::rollBack(); | 73 | DB::rollBack(); |
| 75 | $this->fail('保存失败'); | 74 | $this->fail('保存失败'); |
| 76 | } | 75 | } |
| 77 | - //通知更新 | ||
| 78 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_KEYWORD, 'route'=>$route]); | ||
| 79 | return $this->success(); | 76 | return $this->success(); |
| 80 | } | 77 | } |
| 81 | 78 | ||
| 82 | /** | 79 | /** |
| 80 | + * @remark :添加组装数据 | ||
| 81 | + * @name :addHandleParam | ||
| 82 | + * @author :lyh | ||
| 83 | + * @method :post | ||
| 84 | + * @time :2023/11/30 15:00 | ||
| 85 | + */ | ||
| 86 | + public function addHandleParam($param){ | ||
| 87 | + $param['project_id'] = $this->user['project_id']; | ||
| 88 | + $param['created_at'] = date('Y-m-d H:i:s'); | ||
| 89 | + $param['updated_at'] = $param['created_at']; | ||
| 90 | + return $this->success($param); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 83 | * @remark :保存数据时参数处理 | 94 | * @remark :保存数据时参数处理 |
| 84 | * @name :handleSaveParam | 95 | * @name :handleSaveParam |
| 85 | * @author :lyh | 96 | * @author :lyh |
| @@ -174,11 +185,7 @@ class KeywordLogic extends BaseLogic | @@ -174,11 +185,7 @@ class KeywordLogic extends BaseLogic | ||
| 174 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); | 185 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); |
| 175 | //生成一条删除路由记录 | 186 | //生成一条删除路由记录 |
| 176 | $info = $this->model->read(['id'=>$id],['id','route']); | 187 | $info = $this->model->read(['id'=>$id],['id','route']); |
| 177 | - $data = [ | ||
| 178 | - 'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD, | ||
| 179 | - 'route'=>$info['route'], | ||
| 180 | - ]; | ||
| 181 | - $this->setRouteDeleteSave($data); | 188 | + $this->curlDelRoute($info['route']); |
| 182 | return $this->success(); | 189 | return $this->success(); |
| 183 | } | 190 | } |
| 184 | 191 | ||
| @@ -193,9 +200,7 @@ class KeywordLogic extends BaseLogic | @@ -193,9 +200,7 @@ class KeywordLogic extends BaseLogic | ||
| 193 | */ | 200 | */ |
| 194 | public function importProductKeyword($project_id,$keyword){ | 201 | public function importProductKeyword($project_id,$keyword){ |
| 195 | $return = []; | 202 | $return = []; |
| 196 | - | ||
| 197 | $keyword_arr = explode(',',$keyword); | 203 | $keyword_arr = explode(',',$keyword); |
| 198 | - | ||
| 199 | foreach ($keyword_arr as $v){ | 204 | foreach ($keyword_arr as $v){ |
| 200 | $keyword_info = $this->model->read(['title'=>$v]); | 205 | $keyword_info = $this->model->read(['title'=>$v]); |
| 201 | if(!$keyword_info){ | 206 | if(!$keyword_info){ |
| @@ -207,7 +212,6 @@ class KeywordLogic extends BaseLogic | @@ -207,7 +212,6 @@ class KeywordLogic extends BaseLogic | ||
| 207 | } | 212 | } |
| 208 | $return[] = $k_id; | 213 | $return[] = $k_id; |
| 209 | } | 214 | } |
| 210 | - | ||
| 211 | //清除缓存 | 215 | //清除缓存 |
| 212 | Common::del_user_cache('product_keyword',$project_id); | 216 | Common::del_user_cache('product_keyword',$project_id); |
| 213 | return ','.implode(',',$return).','; | 217 | return ','.implode(',',$return).','; |
| @@ -56,16 +56,17 @@ class ProductLogic extends BaseLogic | @@ -56,16 +56,17 @@ class ProductLogic extends BaseLogic | ||
| 56 | DB::connection('custom_mysql')->beginTransaction(); | 56 | DB::connection('custom_mysql')->beginTransaction(); |
| 57 | try { | 57 | try { |
| 58 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 58 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 59 | - $id = $this->param['id']; | 59 | + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); |
| 60 | //查看路由是否更新 | 60 | //查看路由是否更新 |
| 61 | - $this->param['route'] = $this->editProductRoute($this->param['route']); | 61 | + $this->editProductRoute($this->param['id'],$this->param['route']); |
| 62 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 62 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 63 | }else{ | 63 | }else{ |
| 64 | $this->param = $this->addHandleParam($this->param); | 64 | $this->param = $this->addHandleParam($this->param); |
| 65 | $id = $this->model->addReturnId($this->param); | 65 | $id = $this->model->addReturnId($this->param); |
| 66 | + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | ||
| 67 | + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route); | ||
| 68 | + $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 66 | } | 69 | } |
| 67 | - $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | ||
| 68 | - $this->model->edit(['route'=> $this->param['route']],['id'=>$id]); | ||
| 69 | //产品分类关联 | 70 | //产品分类关联 |
| 70 | CategoryRelated::saveRelated($id, $category_ids); | 71 | CategoryRelated::saveRelated($id, $category_ids); |
| 71 | //保存扩展字段 | 72 | //保存扩展字段 |
| @@ -75,8 +76,6 @@ class ProductLogic extends BaseLogic | @@ -75,8 +76,6 @@ class ProductLogic extends BaseLogic | ||
| 75 | DB::connection('custom_mysql')->rollBack(); | 76 | DB::connection('custom_mysql')->rollBack(); |
| 76 | $this->fail('系统错误请联系管理员'); | 77 | $this->fail('系统错误请联系管理员'); |
| 77 | } | 78 | } |
| 78 | - //通知更新 | ||
| 79 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$this->param['route']]); | ||
| 80 | return $this->success(); | 79 | return $this->success(); |
| 81 | } | 80 | } |
| 82 | 81 | ||
| @@ -154,10 +153,15 @@ class ProductLogic extends BaseLogic | @@ -154,10 +153,15 @@ class ProductLogic extends BaseLogic | ||
| 154 | }else{ | 153 | }else{ |
| 155 | $this->param['thumb'] = Arr::a2s([]); | 154 | $this->param['thumb'] = Arr::a2s([]); |
| 156 | } | 155 | } |
| 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']); | 156 | + try { |
| 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 | + $this->editProductRoute($this->param['route']); | ||
| 160 | + } | ||
| 161 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 162 | + }catch (\Exception $e){ | ||
| 163 | + $this->fail('系统错误,请连续管理员');; | ||
| 159 | } | 164 | } |
| 160 | - $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 161 | return $this->success(); | 165 | return $this->success(); |
| 162 | } | 166 | } |
| 163 | 167 | ||
| @@ -285,15 +289,11 @@ class ProductLogic extends BaseLogic | @@ -285,15 +289,11 @@ class ProductLogic extends BaseLogic | ||
| 285 | * @method :post | 289 | * @method :post |
| 286 | * @time :2023/9/7 10:02 | 290 | * @time :2023/9/7 10:02 |
| 287 | */ | 291 | */ |
| 288 | - public function editProductRoute($route){ | ||
| 289 | - $info = $this->model->read(['id'=>$this->param['id']]); | 292 | + public function editProductRoute($id,$route){ |
| 293 | + $info = $this->model->read(['id'=>$id]); | ||
| 290 | if($info['route'] != $route){ | 294 | if($info['route'] != $route){ |
| 291 | - //生成一条删除路由记录 | ||
| 292 | - $data = [ | ||
| 293 | - 'source'=>RouteMap::SOURCE_PRODUCT, | ||
| 294 | - 'route'=>$route, | ||
| 295 | - ]; | ||
| 296 | - $this->setRouteDeleteSave($data); | 295 | + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route); |
| 296 | + $this->curlDelRoute($info['route']); | ||
| 297 | } | 297 | } |
| 298 | return $route; | 298 | return $route; |
| 299 | } | 299 | } |
| @@ -340,11 +340,7 @@ class ProductLogic extends BaseLogic | @@ -340,11 +340,7 @@ class ProductLogic extends BaseLogic | ||
| 340 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | 340 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); |
| 341 | //生成一条删除路由记录 | 341 | //生成一条删除路由记录 |
| 342 | $info = $this->model->read(['id'=>$id],['id','route']); | 342 | $info = $this->model->read(['id'=>$id],['id','route']); |
| 343 | - $data = [ | ||
| 344 | - 'source'=>RouteMap::SOURCE_PRODUCT, | ||
| 345 | - 'route'=>$info['route'], | ||
| 346 | - ]; | ||
| 347 | - $this->setRouteDeleteSave($data); | 343 | + $this->curlDelRoute($info['route']); |
| 348 | return $this->success(); | 344 | return $this->success(); |
| 349 | } | 345 | } |
| 350 | 346 |
| @@ -33,8 +33,8 @@ class UpdateLog extends Model | @@ -33,8 +33,8 @@ class UpdateLog extends Model | ||
| 33 | $log->project_id = $project_id; | 33 | $log->project_id = $project_id; |
| 34 | $log->api_type = $type; | 34 | $log->api_type = $type; |
| 35 | $log->api_url = $url; | 35 | $log->api_url = $url; |
| 36 | - $log->sort = $type == 'category' ? 0 : 1; | ||
| 37 | - $log->collect_status = ($type == 'category' || $type == 'website_info' || $type == 'tag') ? 1 : 0; | 36 | + $log->sort = ($type == 'category' || $type == 'category_news') ? 0 : 1; |
| 37 | + $log->collect_status = ($type == 'category' || $type == 'category_news' || $type == 'website_info' || $type == 'tag') ? 1 : 0; | ||
| 38 | return $log->save(); | 38 | return $log->save(); |
| 39 | } | 39 | } |
| 40 | return true; | 40 | return true; |
app/Models/WebSetting/WebLanguage.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :WebLanguage.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/11/30 10:50 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\WebSetting; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class WebLanguage extends Base | ||
| 15 | +{ | ||
| 16 | + protected $table = 'gl_web_language'; | ||
| 17 | +} |
| @@ -418,6 +418,11 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -418,6 +418,11 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 418 | Route::any('/upload', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'upload'])->name('file_manager_upload'); | 418 | Route::any('/upload', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'upload'])->name('file_manager_upload'); |
| 419 | Route::any('/delete', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'delete'])->name('file_manager_delete'); | 419 | Route::any('/delete', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'delete'])->name('file_manager_delete'); |
| 420 | }); | 420 | }); |
| 421 | + | ||
| 422 | + //小语种 | ||
| 423 | + Route::prefix('language')->group(function () { | ||
| 424 | + Route::any('/', [\App\Http\Controllers\Bside\Setting\LanguageController::class, 'lists'])->name('language_lists'); | ||
| 425 | + }); | ||
| 421 | }); | 426 | }); |
| 422 | //无需登录验证的路由组 | 427 | //无需登录验证的路由组 |
| 423 | Route::group([], function () { | 428 | Route::group([], function () { |
-
请 注册 或 登录 后发表评论