Merge remote-tracking branch 'origin/master' into zhl
正在显示
25 个修改的文件
包含
564 行增加
和
47 行删除
| @@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command | @@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command | ||
| 33 | protected $description = '升级项目统计'; | 33 | protected $description = '升级项目统计'; |
| 34 | 34 | ||
| 35 | public function handle(){ | 35 | public function handle(){ |
| 36 | - $project_id = 439; | 36 | + $project_id = 450; |
| 37 | ProjectServer::useProject($project_id); | 37 | ProjectServer::useProject($project_id); |
| 38 | $this->count($project_id); | 38 | $this->count($project_id); |
| 39 | DB::disconnect('custom_mysql'); | 39 | DB::disconnect('custom_mysql'); |
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | namespace App\Console\Commands\MonthlyCount; | 10 | namespace App\Console\Commands\MonthlyCount; |
| 11 | 11 | ||
| 12 | use App\Helper\FormGlobalsoApi; | 12 | use App\Helper\FormGlobalsoApi; |
| 13 | +use App\Models\Com\UpdateOldInfo; | ||
| 13 | use App\Models\HomeCount\MonthCount; | 14 | use App\Models\HomeCount\MonthCount; |
| 14 | use App\Models\Project\Project; | 15 | use App\Models\Project\Project; |
| 15 | use App\Models\Visit\Visit; | 16 | use App\Models\Visit\Visit; |
| @@ -35,8 +36,10 @@ class UpgradeProjectCount extends Command | @@ -35,8 +36,10 @@ class UpgradeProjectCount extends Command | ||
| 35 | protected $description = '升级项目统计'; | 36 | protected $description = '升级项目统计'; |
| 36 | 37 | ||
| 37 | public function handle(){ | 38 | public function handle(){ |
| 38 | - $project_id = 439; | ||
| 39 | - $url = 'www.cnzyl.com'; | 39 | + $project_id = 450; |
| 40 | + $oldModel = new UpdateOldInfo(); | ||
| 41 | + $info = $oldModel->read(['project_id'=>$project_id]); | ||
| 42 | + $url = $info['old_domain_online']; | ||
| 40 | ProjectServer::useProject($project_id); | 43 | ProjectServer::useProject($project_id); |
| 41 | $this->count($project_id,$url); | 44 | $this->count($project_id,$url); |
| 42 | 45 |
| @@ -544,21 +544,15 @@ class ProjectUpdate extends Command | @@ -544,21 +544,15 @@ class ProjectUpdate extends Command | ||
| 544 | $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]); | 544 | $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]); |
| 545 | $data = curl_c($url); | 545 | $data = curl_c($url); |
| 546 | if (isset($data['code']) && $data['code'] == 200) { | 546 | if (isset($data['code']) && $data['code'] == 200) { |
| 547 | - $category = $data['data']['category'] ?? []; | ||
| 548 | - if (empty($category)) { | ||
| 549 | - $route_model = new RouteMap(); | ||
| 550 | - $route_page = $route_model->read(['source' => 'page', 'route' => $custom_info['route']], 'id'); | ||
| 551 | - if (!$route_page) { | ||
| 552 | $category = [ | 547 | $category = [ |
| 553 | [ | 548 | [ |
| 554 | 'id' => 0, | 549 | 'id' => 0, |
| 555 | 'name' => $custom_info['route'], | 550 | 'name' => $custom_info['route'], |
| 556 | 'url' => '/' . $custom_info['route'], | 551 | 'url' => '/' . $custom_info['route'], |
| 557 | - 'parent' => 0 | 552 | + 'parent' => 0, |
| 553 | + 'children' => $data['data']['category'] ?? [] | ||
| 558 | ] | 554 | ] |
| 559 | ]; | 555 | ]; |
| 560 | - } | ||
| 561 | - } | ||
| 562 | $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); | 556 | $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); |
| 563 | 557 | ||
| 564 | $count = $data['data']['count'] ?? 0; | 558 | $count = $data['data']['count'] ?? 0; |
| @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command | @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command | ||
| 50 | public function handle(){ | 50 | public function handle(){ |
| 51 | //获取所有项目 | 51 | //获取所有项目 |
| 52 | $projectModel = new Project(); | 52 | $projectModel = new Project(); |
| 53 | - $list = $projectModel->list(['type'=>['in',[1,2,3,4]]],'id',['id']); | 53 | + $list = $projectModel->list(['id'=>['in',[218]]],'id',['id']); |
| 54 | echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; | 54 | echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; |
| 55 | try { | 55 | try { |
| 56 | foreach ($list as $v) { | 56 | foreach ($list as $v) { |
| @@ -94,9 +94,8 @@ class UpdateProductCategory extends Command | @@ -94,9 +94,8 @@ class UpdateProductCategory extends Command | ||
| 94 | if(!empty($cate_arr) && is_array($cate_arr)){ | 94 | if(!empty($cate_arr) && is_array($cate_arr)){ |
| 95 | foreach ($cate_arr as $v){ | 95 | foreach ($cate_arr as $v){ |
| 96 | $categoryModel = new Category(); | 96 | $categoryModel = new Category(); |
| 97 | - $info = $categoryModel->read(['pid'=>$v],['id']); | ||
| 98 | - if($info !== false){ | ||
| 99 | - //有下级时,跳过 | 97 | + $info = $categoryModel->read(['id'=>$v],['id']); |
| 98 | + if($info === false){ | ||
| 100 | continue; | 99 | continue; |
| 101 | }else{ | 100 | }else{ |
| 102 | //更新关联表 | 101 | //更新关联表 |
| @@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
| 10 | namespace App\Console\Commands; | 10 | namespace App\Console\Commands; |
| 11 | 11 | ||
| 12 | use App\Helper\Arr; | 12 | use App\Helper\Arr; |
| 13 | +use App\Helper\Translate; | ||
| 13 | use App\Models\CustomModule\CustomModuleCategory; | 14 | use App\Models\CustomModule\CustomModuleCategory; |
| 14 | use App\Models\CustomModule\CustomModuleContent; | 15 | use App\Models\CustomModule\CustomModuleContent; |
| 15 | use App\Models\Product\CategoryRelated; | 16 | use App\Models\Product\CategoryRelated; |
| @@ -54,16 +55,16 @@ class UpdateRoute extends Command | @@ -54,16 +55,16 @@ class UpdateRoute extends Command | ||
| 54 | */ | 55 | */ |
| 55 | public function handle(){ | 56 | public function handle(){ |
| 56 | $projectModel = new Project(); | 57 | $projectModel = new Project(); |
| 57 | - $list = $projectModel->list(['id'=>99]); | 58 | + $list = $projectModel->list(['id'=>426]); |
| 58 | foreach ($list as $v){ | 59 | foreach ($list as $v){ |
| 59 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 60 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 60 | ProjectServer::useProject($v['id']); | 61 | ProjectServer::useProject($v['id']); |
| 61 | // $this->getProduct(); | 62 | // $this->getProduct(); |
| 62 | -// $this->setProductKeyword(); | 63 | + $this->setProductKeyword(); |
| 63 | // $this->getRouteMap(); | 64 | // $this->getRouteMap(); |
| 64 | // $this->getProductCategory(); | 65 | // $this->getProductCategory(); |
| 65 | // $this->delRouteMap(); | 66 | // $this->delRouteMap(); |
| 66 | - $this->setCustomRoute($v['id']); | 67 | +// $this->setCustomRoute($v['id']); |
| 67 | DB::disconnect('custom_mysql'); | 68 | DB::disconnect('custom_mysql'); |
| 68 | } | 69 | } |
| 69 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 70 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| @@ -100,10 +101,15 @@ class UpdateRoute extends Command | @@ -100,10 +101,15 @@ class UpdateRoute extends Command | ||
| 100 | if(!empty($v['route'])){ | 101 | if(!empty($v['route'])){ |
| 101 | $tag = "-tag"; | 102 | $tag = "-tag"; |
| 102 | if (!(substr($v['route'], -strlen($tag)) === $tag)) { | 103 | if (!(substr($v['route'], -strlen($tag)) === $tag)) { |
| 103 | - $route = $v['route'].$tag; | 104 | +// $route = Translate::tran($v['route'], 'en').$tag; |
| 104 | // 如果不是以 '-tag' 结尾,则拼接上 '-tag' | 105 | // 如果不是以 '-tag' 结尾,则拼接上 '-tag' |
| 106 | + $route = $v['route'].$tag; | ||
| 105 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); | 107 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); |
| 106 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | 108 | $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 109 | +// }else{ | ||
| 110 | +// $route = Translate::tran($v['title'], 'en').$tag; | ||
| 111 | +// $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); | ||
| 112 | +// $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 107 | } | 113 | } |
| 108 | }else{ | 114 | }else{ |
| 109 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | 115 | echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; |
| @@ -9,7 +9,6 @@ | @@ -9,7 +9,6 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Controllers\Aside\Com; | 10 | namespace App\Http\Controllers\Aside\Com; |
| 11 | 11 | ||
| 12 | -use App\Helper\Common; | ||
| 13 | use App\Http\Controllers\Bside\BaseController; | 12 | use App\Http\Controllers\Bside\BaseController; |
| 14 | use App\Models\Com\UpdateLog; | 13 | use App\Models\Com\UpdateLog; |
| 15 | use App\Models\Com\UpdateOldInfo; | 14 | use App\Models\Com\UpdateOldInfo; |
| @@ -17,7 +16,6 @@ use App\Models\Domain\DomainInfo; | @@ -17,7 +16,6 @@ use App\Models\Domain\DomainInfo; | ||
| 17 | use App\Models\Project\ProjectUpdateTdk; | 16 | use App\Models\Project\ProjectUpdateTdk; |
| 18 | use App\Services\ProjectServer; | 17 | use App\Services\ProjectServer; |
| 19 | use Illuminate\Support\Facades\DB; | 18 | use Illuminate\Support\Facades\DB; |
| 20 | -use Illuminate\Support\Facades\Redis; | ||
| 21 | 19 | ||
| 22 | /** | 20 | /** |
| 23 | * @remark :b端网站更新相关 | 21 | * @remark :b端网站更新相关 |
| @@ -105,12 +103,23 @@ class UpdateController extends BaseController | @@ -105,12 +103,23 @@ class UpdateController extends BaseController | ||
| 105 | //关闭数据库 | 103 | //关闭数据库 |
| 106 | DB::disconnect('custom_mysql'); | 104 | DB::disconnect('custom_mysql'); |
| 107 | 105 | ||
| 108 | - $update = ['collect_status' => 0]; | ||
| 109 | - if ($this->param['type'] == 2 && !$domain_info) { | ||
| 110 | - $update['status'] = 0; | 106 | + if ($domain_info) { |
| 107 | + $old_info = UpdateOldInfo::where('project_id', $this->param['project_id'])->first(); | ||
| 108 | + if (!$old_info) { | ||
| 109 | + $old_info = new UpdateOldInfo(); | ||
| 110 | + $old_info->project_id = $this->param['project_id']; | ||
| 111 | + $old_info->link_type = 0; | ||
| 112 | + $old_info->old_domain_online = $domain_info->domain; | ||
| 113 | + } | ||
| 114 | + $old_info->old_domain_test = $test_domain; | ||
| 115 | + $old_info->save(); | ||
| 111 | } | 116 | } |
| 112 | 117 | ||
| 113 | - UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update); | 118 | + UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news', 'website_info', 'tag'])->update(['collect_status' => 0]); |
| 119 | + | ||
| 120 | + if ($this->param['type'] == 2 && !$domain_info) { | ||
| 121 | + UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->update(['status' => 0]); | ||
| 122 | + } | ||
| 114 | 123 | ||
| 115 | $this->response('采集任务添加成功'); | 124 | $this->response('采集任务添加成功'); |
| 116 | } | 125 | } |
| @@ -70,7 +70,7 @@ class AyrReleaseController extends BaseController | @@ -70,7 +70,7 @@ class AyrReleaseController extends BaseController | ||
| 70 | //参数处理 | 70 | //参数处理 |
| 71 | $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data); | 71 | $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data); |
| 72 | //时间处理 | 72 | //时间处理 |
| 73 | - $datetime = new \DateTime($this->param['schedule_date']); | 73 | + $datetime = new \DateTime($this->param['schedule_date'] ?? date('Y-m-d H:i:s')); |
| 74 | $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z"); | 74 | $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z"); |
| 75 | //统一生成发布 | 75 | //统一生成发布 |
| 76 | $param = [ | 76 | $param = [ |
| @@ -275,4 +275,37 @@ class BlogController extends BaseController | @@ -275,4 +275,37 @@ class BlogController extends BaseController | ||
| 275 | $logic->setSort(); | 275 | $logic->setSort(); |
| 276 | $this->response('success'); | 276 | $this->response('success'); |
| 277 | } | 277 | } |
| 278 | + | ||
| 279 | + /** | ||
| 280 | + * @remark :批量排序 | ||
| 281 | + * @name :allSort | ||
| 282 | + * @author :lyh | ||
| 283 | + * @method :post | ||
| 284 | + * @time :2024/1/11 9:46 | ||
| 285 | + */ | ||
| 286 | + public function allSort(BlogLogic $logic){ | ||
| 287 | + $logic->setAllSort(); | ||
| 288 | + $this->response('success'); | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + /** | ||
| 292 | + * @remark :批量设置产品分类及状态 | ||
| 293 | + * @name :batchSetCategory | ||
| 294 | + * @author :lyh | ||
| 295 | + * @method :post | ||
| 296 | + * @time :2023/8/15 17:51 | ||
| 297 | + */ | ||
| 298 | + public function batchSetCategory(BlogLogic $logic){ | ||
| 299 | + $this->request->validate([ | ||
| 300 | + 'id'=>'required', | ||
| 301 | + 'category_id'=>'required', | ||
| 302 | + 'status'=>'required' | ||
| 303 | + ],[ | ||
| 304 | + 'id.required' => '产品ID不能为空', | ||
| 305 | + 'category_id.required' => '分类ID不能为空', | ||
| 306 | + 'status.required'=>'状态不能为空' | ||
| 307 | + ]); | ||
| 308 | + $logic->batchSetCategory(); | ||
| 309 | + $this->response('success'); | ||
| 310 | + } | ||
| 278 | } | 311 | } |
| @@ -299,9 +299,4 @@ class LoginController extends BaseController | @@ -299,9 +299,4 @@ class LoginController extends BaseController | ||
| 299 | } | 299 | } |
| 300 | return $data; | 300 | return $data; |
| 301 | } | 301 | } |
| 302 | - | ||
| 303 | - public function ceshi(){ | ||
| 304 | - $ceshi = Translate::tran('Полностью Сварной Пластинчатый Теплообменник', 'en'); | ||
| 305 | - return $ceshi; | ||
| 306 | - } | ||
| 307 | } | 302 | } |
| @@ -267,4 +267,38 @@ class NewsController extends BaseController | @@ -267,4 +267,38 @@ class NewsController extends BaseController | ||
| 267 | $newsLogic->setSort(); | 267 | $newsLogic->setSort(); |
| 268 | $this->response('success'); | 268 | $this->response('success'); |
| 269 | } | 269 | } |
| 270 | + | ||
| 271 | + /** | ||
| 272 | + * @remark :批量排序 | ||
| 273 | + * @name :allSort | ||
| 274 | + * @author :lyh | ||
| 275 | + * @method :post | ||
| 276 | + * @time :2024/1/11 9:47 | ||
| 277 | + */ | ||
| 278 | + public function allSort(NewsLogic $newsLogic){ | ||
| 279 | + $newsLogic->setAllSort(); | ||
| 280 | + $this->response('success'); | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + | ||
| 284 | + /** | ||
| 285 | + * @remark :批量设置产品分类及状态 | ||
| 286 | + * @name :batchSetCategory | ||
| 287 | + * @author :lyh | ||
| 288 | + * @method :post | ||
| 289 | + * @time :2023/8/15 17:51 | ||
| 290 | + */ | ||
| 291 | + public function batchSetCategory(NewsLogic $logic){ | ||
| 292 | + $this->request->validate([ | ||
| 293 | + 'id'=>'required', | ||
| 294 | + 'category_id'=>'required', | ||
| 295 | + 'status'=>'required' | ||
| 296 | + ],[ | ||
| 297 | + 'id.required' => '产品ID不能为空', | ||
| 298 | + 'category_id.required' => '分类ID不能为空', | ||
| 299 | + 'status.required'=>'状态不能为空' | ||
| 300 | + ]); | ||
| 301 | + $logic->batchSetCategory(); | ||
| 302 | + $this->response('success'); | ||
| 303 | + } | ||
| 270 | } | 304 | } |
| @@ -238,7 +238,11 @@ class ProductController extends BaseController | @@ -238,7 +238,11 @@ class ProductController extends BaseController | ||
| 238 | } | 238 | } |
| 239 | $v['keyword_id_text'] = trim($v['keyword_id_text'],','); | 239 | $v['keyword_id_text'] = trim($v['keyword_id_text'],','); |
| 240 | } | 240 | } |
| 241 | + if(!empty($v['status'])){ | ||
| 241 | $v['status_text'] = Product::statusMap()[$v['status']] ?? ''; | 242 | $v['status_text'] = Product::statusMap()[$v['status']] ?? ''; |
| 243 | + }else{ | ||
| 244 | + $v['status_text'] = ''; | ||
| 245 | + } | ||
| 242 | //获取当前用户选择的模版 | 246 | //获取当前用户选择的模版 |
| 243 | $v['video'] = json_decode($v['video'] ?? ''); | 247 | $v['video'] = json_decode($v['video'] ?? ''); |
| 244 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL); | 248 | $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL); |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :TranslateController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/1/12 9:39 | ||
| 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\Http\Logic\Bside\Setting\TranslateLogic; | ||
| 15 | +use App\Models\WebSetting\WebLanguage; | ||
| 16 | + | ||
| 17 | +class TranslateController extends BaseController | ||
| 18 | +{ | ||
| 19 | + /** | ||
| 20 | + * @remark :获取翻译校队列表 | ||
| 21 | + * @name :lists | ||
| 22 | + * @author :lyh | ||
| 23 | + * @method :post | ||
| 24 | + * @time :2024/1/12 9:39 | ||
| 25 | + */ | ||
| 26 | + public function lists(TranslateLogic $logic){ | ||
| 27 | + $this->request->validate([ | ||
| 28 | + 'type'=>'required', | ||
| 29 | + 'language_id'=>'required', | ||
| 30 | + 'url'=>'required', | ||
| 31 | + ],[ | ||
| 32 | + 'type.required' => 'type不能为空', | ||
| 33 | + 'language_id.required' => 'language_id不能为空', | ||
| 34 | + 'url.required' => 'url不能为空', | ||
| 35 | + ]); | ||
| 36 | + $data = $logic->getTranslateList(); | ||
| 37 | + $this->response('success',Code::SUCCESS,$data); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * @remark :图片列表 | ||
| 42 | + * @name :imageList | ||
| 43 | + * @author :lyh | ||
| 44 | + * @method :post | ||
| 45 | + * @time :2024/1/12 11:18 | ||
| 46 | + */ | ||
| 47 | + public function imageList(TranslateLogic $logic){ | ||
| 48 | + $this->request->validate([ | ||
| 49 | + 'type'=>'required', | ||
| 50 | + 'language_id'=>'required', | ||
| 51 | + 'url'=>'required', | ||
| 52 | + ],[ | ||
| 53 | + 'type.required' => 'type不能为空', | ||
| 54 | + 'language_id.required' => 'language_id不能为空', | ||
| 55 | + 'url.required' => 'url不能为空', | ||
| 56 | + ]); | ||
| 57 | + $data = $logic->getTranslateImageList(); | ||
| 58 | + $this->response('success',Code::SUCCESS,$data); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * @remark :保存数据 | ||
| 63 | + * @name :save | ||
| 64 | + * @author :lyh | ||
| 65 | + * @method :post | ||
| 66 | + * @time :2024/1/12 11:19 | ||
| 67 | + */ | ||
| 68 | + public function save(TranslateLogic $logic){ | ||
| 69 | + $this->request->validate([ | ||
| 70 | + 'type'=>'required', | ||
| 71 | + 'language_id'=>'required', | ||
| 72 | + 'url'=>'required', | ||
| 73 | + 'alias'=>'required', | ||
| 74 | + ],[ | ||
| 75 | + 'type.required' => 'type不能为空', | ||
| 76 | + 'language_id.required' => 'language_id不能为空', | ||
| 77 | + 'url.required' => 'url不能为空', | ||
| 78 | + 'alias.required' => 'url不能为空', | ||
| 79 | + ]); | ||
| 80 | + $logic->translateSave(); | ||
| 81 | + $this->response('success'); | ||
| 82 | + } | ||
| 83 | +} |
| @@ -38,7 +38,7 @@ class InitHtmlController extends BaseController | @@ -38,7 +38,7 @@ class InitHtmlController extends BaseController | ||
| 38 | 'type.required' => '类型不能为空', | 38 | 'type.required' => '类型不能为空', |
| 39 | ]); | 39 | ]); |
| 40 | $html = $logic->getDetailHtml(); | 40 | $html = $logic->getDetailHtml(); |
| 41 | - $this->response('success',Code::SUCCESS,['html'=>$html]); | 41 | + $this->response('success',Code::SUCCESS,$html); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | /** | 44 | /** |
| @@ -116,7 +116,7 @@ class CustomModuleLogic extends BaseLogic | @@ -116,7 +116,7 @@ class CustomModuleLogic extends BaseLogic | ||
| 116 | public function checkIsName($name,$id = 0){ | 116 | public function checkIsName($name,$id = 0){ |
| 117 | $param['name'] = $name; | 117 | $param['name'] = $name; |
| 118 | if(!empty($id)){ | 118 | if(!empty($id)){ |
| 119 | - $param['id'] = ['id'=>['!=',$id],]; | 119 | + $param['id'] = ['id'=>['!=',$id]]; |
| 120 | } | 120 | } |
| 121 | $info = (new CustomModule())->read($param); | 121 | $info = (new CustomModule())->read($param); |
| 122 | if($info !== false){ | 122 | if($info !== false){ |
| @@ -60,6 +60,12 @@ class CreateKeywordLogic extends BaseLogic | @@ -60,6 +60,12 @@ class CreateKeywordLogic extends BaseLogic | ||
| 60 | if($info !== false){ | 60 | if($info !== false){ |
| 61 | $this->fail('当前名称已存在'); | 61 | $this->fail('当前名称已存在'); |
| 62 | } | 62 | } |
| 63 | + }else{ | ||
| 64 | + $data['id'] = ['!=',$param['id']]; | ||
| 65 | + $info = $this->model->read($data); | ||
| 66 | + if($info !== false){ | ||
| 67 | + $this->fail('当前名称已存在'); | ||
| 68 | + } | ||
| 63 | } | 69 | } |
| 64 | return $this->success($data); | 70 | return $this->success($data); |
| 65 | } | 71 | } |
| @@ -149,7 +149,7 @@ class BTemplateLogic extends BaseLogic | @@ -149,7 +149,7 @@ class BTemplateLogic extends BaseLogic | ||
| 149 | return false; | 149 | return false; |
| 150 | } | 150 | } |
| 151 | //TODO::默认模块定制 | 151 | //TODO::默认模块定制 |
| 152 | - $html = $this->isCustomizedPage($source,$is_list);//获取定制页面的html | 152 | + $html = $this->isCustomizedPage($source,$is_list,$is_custom);//获取定制页面的html |
| 153 | if(!empty($html)){ | 153 | if(!empty($html)){ |
| 154 | return $this->success(['html'=>$html,'template_id'=>$template_id]); | 154 | return $this->success(['html'=>$html,'template_id'=>$template_id]); |
| 155 | } | 155 | } |
| @@ -361,7 +361,7 @@ class BTemplateLogic extends BaseLogic | @@ -361,7 +361,7 @@ class BTemplateLogic extends BaseLogic | ||
| 361 | 'template_id' => $template_id, | 361 | 'template_id' => $template_id, |
| 362 | 'project_id' => $this->user['project_id'], | 362 | 'project_id' => $this->user['project_id'], |
| 363 | 'type'=>$type, | 363 | 'type'=>$type, |
| 364 | - 'is_custom'=>$is_custom, | 364 | + 'is_custom'=>0, |
| 365 | ]; | 365 | ]; |
| 366 | $commonTemplateModel = new BTemplateCommon(); | 366 | $commonTemplateModel = new BTemplateCommon(); |
| 367 | $commonInfo = $commonTemplateModel->read($data); | 367 | $commonInfo = $commonTemplateModel->read($data); |
| @@ -38,6 +38,7 @@ class InitHtmlLogic extends BaseLogic | @@ -38,6 +38,7 @@ class InitHtmlLogic extends BaseLogic | ||
| 38 | $template_id = $this->getTemplateId(); | 38 | $template_id = $this->getTemplateId(); |
| 39 | $is_custom = $this->param['is_custom'] ?? 0;//TODO::1:代表扩展模块 | 39 | $is_custom = $this->param['is_custom'] ?? 0;//TODO::1:代表扩展模块 |
| 40 | $is_list = $this->param['is_list'] ?? 0;//TODO::1:代表分类列表模块 | 40 | $is_list = $this->param['is_list'] ?? 0;//TODO::1:代表分类列表模块 |
| 41 | + $data = array(); | ||
| 41 | //获取设置的默认中间部分 | 42 | //获取设置的默认中间部分 |
| 42 | $bTemplateMainModel = new BTemplateMain(); | 43 | $bTemplateMainModel = new BTemplateMain(); |
| 43 | $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_list'=>$is_list,'is_custom'=>$is_custom]); | 44 | $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_list'=>$is_list,'is_custom'=>$is_custom]); |
| @@ -47,11 +48,14 @@ class InitHtmlLogic extends BaseLogic | @@ -47,11 +48,14 @@ class InitHtmlLogic extends BaseLogic | ||
| 47 | }else{ | 48 | }else{ |
| 48 | $main_html = $mainInfo['main_html']; | 49 | $main_html = $mainInfo['main_html']; |
| 49 | $main_style = $mainInfo['main_css']; | 50 | $main_style = $mainInfo['main_css']; |
| 51 | + $data['id'] = $mainInfo['id']; | ||
| 52 | + $data['updated_at'] = $mainInfo['updated_at']; | ||
| 50 | } | 53 | } |
| 51 | $commonInfo = $this->getCommonHtml($this->param['type'],$is_list,$template_id,$is_custom); //获取头部 | 54 | $commonInfo = $this->getCommonHtml($this->param['type'],$is_list,$template_id,$is_custom); //获取头部 |
| 52 | $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html']; | 55 | $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].$commonInfo['head_html'].$main_html.$commonInfo['footer_html']; |
| 53 | $html = $this->getHeadFooter($html);//组装数据 | 56 | $html = $this->getHeadFooter($html);//组装数据 |
| 54 | - return $this->success($html); | 57 | + $data['html'] = $html; |
| 58 | + return $this->success($data); | ||
| 55 | } | 59 | } |
| 56 | 60 | ||
| 57 | /** | 61 | /** |
| @@ -259,14 +263,20 @@ class InitHtmlLogic extends BaseLogic | @@ -259,14 +263,20 @@ class InitHtmlLogic extends BaseLogic | ||
| 259 | */ | 263 | */ |
| 260 | public function getCustomizedHtml(){ | 264 | public function getCustomizedHtml(){ |
| 261 | $is_list = $this->param['is_list'] ?? 0; | 265 | $is_list = $this->param['is_list'] ?? 0; |
| 266 | + $is_custom = $this->param['is_custom'] ?? 0; | ||
| 262 | $bTemplateMainModel = new BTemplateMain(); | 267 | $bTemplateMainModel = new BTemplateMain(); |
| 263 | - $info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]); | 268 | + $info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]); |
| 264 | if($info === false){ | 269 | if($info === false){ |
| 265 | $html = ''; | 270 | $html = ''; |
| 266 | }else{ | 271 | }else{ |
| 272 | + //扩展模块获取头部 | ||
| 273 | + if($is_custom == BTemplate::IS_CUSTOM){ | ||
| 274 | + $type = $this->param['type']; | ||
| 275 | + }else{ | ||
| 267 | $type = $this->getCustomizedType($this->param['type'],$is_list); | 276 | $type = $this->getCustomizedType($this->param['type'],$is_list); |
| 277 | + } | ||
| 268 | $commonTemplateModel = new BTemplateCommon(); | 278 | $commonTemplateModel = new BTemplateCommon(); |
| 269 | - $commonInfo = $commonTemplateModel->read(['template_id' => 0,'type'=>$type]); | 279 | + $commonInfo = $commonTemplateModel->read(['template_id' => 0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]); |
| 270 | if($commonInfo !== false){ | 280 | if($commonInfo !== false){ |
| 271 | $info['main_html'] = $this->handleAllHtml($commonInfo,$info['main_html']); | 281 | $info['main_html'] = $this->handleAllHtml($commonInfo,$info['main_html']); |
| 272 | } | 282 | } |
| @@ -303,21 +313,23 @@ class InitHtmlLogic extends BaseLogic | @@ -303,21 +313,23 @@ class InitHtmlLogic extends BaseLogic | ||
| 303 | public function saveCustomizedHtml(){ | 313 | public function saveCustomizedHtml(){ |
| 304 | try { | 314 | try { |
| 305 | $is_list = $this->param['is_list'] ?? 0; | 315 | $is_list = $this->param['is_list'] ?? 0; |
| 316 | + $is_custom = $this->param['is_custom'] ?? 0; | ||
| 306 | $bTemplateMainModel = new BTemplateMain(); | 317 | $bTemplateMainModel = new BTemplateMain(); |
| 307 | - $mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]); | 318 | + $mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]); |
| 308 | if($mainInfo === false){ | 319 | if($mainInfo === false){ |
| 309 | $mainData = [ | 320 | $mainData = [ |
| 310 | 'project_id'=>$this->user['project_id'], | 321 | 'project_id'=>$this->user['project_id'], |
| 311 | 'type'=>$this->param['type'], | 322 | 'type'=>$this->param['type'], |
| 312 | 'is_list'=>$is_list, | 323 | 'is_list'=>$is_list, |
| 313 | - 'main_html'=>$this->param['html'] | 324 | + 'main_html'=>$this->param['html'], |
| 325 | + 'is_custom'=>$is_custom | ||
| 314 | ]; | 326 | ]; |
| 315 | $bTemplateMainModel->add($mainData); | 327 | $bTemplateMainModel->add($mainData); |
| 316 | }else{ | 328 | }else{ |
| 317 | $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]); | 329 | $bTemplateMainModel->edit(['main_html'=>$this->param['html']],['id'=>$mainInfo['id']]); |
| 318 | } | 330 | } |
| 319 | //更新头部底部 | 331 | //更新头部底部 |
| 320 | - $this->saveCustomizeCommon($this->param['html'],$this->param['type'],$is_list); | 332 | + $this->saveCustomizeCommon($this->param['html'],$this->param['type'],$is_list,$is_custom); |
| 321 | }catch (\Exception $exception){ | 333 | }catch (\Exception $exception){ |
| 322 | $this->fail('保存失败,请联系开发人员'); | 334 | $this->fail('保存失败,请联系开发人员'); |
| 323 | } | 335 | } |
| @@ -331,16 +343,21 @@ class InitHtmlLogic extends BaseLogic | @@ -331,16 +343,21 @@ class InitHtmlLogic extends BaseLogic | ||
| 331 | * @method :post | 343 | * @method :post |
| 332 | * @time :2024/1/6 10:29 | 344 | * @time :2024/1/6 10:29 |
| 333 | */ | 345 | */ |
| 334 | - public function saveCustomizeCommon($html,$source,$is_list){ | 346 | + public function saveCustomizeCommon($html,$source,$is_list,$is_custom){ |
| 347 | + if($is_custom == BTemplate::IS_CUSTOM){ | ||
| 348 | + $type = $source; | ||
| 349 | + }else{ | ||
| 335 | $type = $this->getCustomizedType($source,$is_list); | 350 | $type = $this->getCustomizedType($source,$is_list); |
| 351 | + } | ||
| 336 | $templateCommonModel = new BTemplateCommon(); | 352 | $templateCommonModel = new BTemplateCommon(); |
| 337 | - $commonInfo = $templateCommonModel->read(['template_id'=>0,'type'=>$type]);//查看当前头部是否存在 | 353 | + $commonInfo = $templateCommonModel->read(['template_id'=>0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]);//查看当前头部是否存在 |
| 338 | $handleInfo = $this->handleCommonParam($html); | 354 | $handleInfo = $this->handleCommonParam($html); |
| 339 | if($commonInfo === false){ | 355 | if($commonInfo === false){ |
| 340 | $data = [ | 356 | $data = [ |
| 341 | 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'], | 357 | 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'], |
| 342 | 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], | 358 | 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], |
| 343 | 'type'=>$type,'template_id'=>0, 'project_id'=>$this->user['project_id'], | 359 | 'type'=>$type,'template_id'=>0, 'project_id'=>$this->user['project_id'], |
| 360 | + 'is_custom'=>$is_custom,'is_list'=>$is_list | ||
| 344 | ]; | 361 | ]; |
| 345 | $templateCommonModel->add($data); | 362 | $templateCommonModel->add($data); |
| 346 | }else{ | 363 | }else{ |
| @@ -234,6 +234,20 @@ class BlogLogic extends BaseLogic | @@ -234,6 +234,20 @@ class BlogLogic extends BaseLogic | ||
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | /** | 236 | /** |
| 237 | + * @remark : | ||
| 238 | + * @name :setAllSort | ||
| 239 | + * @author :lyh | ||
| 240 | + * @method :post | ||
| 241 | + * @time :2024/1/10 15:40 | ||
| 242 | + */ | ||
| 243 | + public function setAllSort(){ | ||
| 244 | + foreach ($this->param['data'] as $k => $v){ | ||
| 245 | + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]); | ||
| 246 | + } | ||
| 247 | + return $this->success(); | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + /** | ||
| 237 | * 博客导入 | 251 | * 博客导入 |
| 238 | * @param $project_id | 252 | * @param $project_id |
| 239 | * @param $user_id | 253 | * @param $user_id |
| @@ -348,4 +362,32 @@ class BlogLogic extends BaseLogic | @@ -348,4 +362,32 @@ class BlogLogic extends BaseLogic | ||
| 348 | 362 | ||
| 349 | return false; | 363 | return false; |
| 350 | } | 364 | } |
| 365 | + | ||
| 366 | + /** | ||
| 367 | + * @remark :批量设置产品分类及状态 | ||
| 368 | + * @name :batchSetCategory | ||
| 369 | + * @author :lyh | ||
| 370 | + * @method :post | ||
| 371 | + * @time :2023/8/15 17:53 | ||
| 372 | + */ | ||
| 373 | + public function batchSetCategory(){ | ||
| 374 | + if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { | ||
| 375 | + DB::connection('custom_mysql')->beginTransaction(); | ||
| 376 | + $this->param['category_id'] = ','.implode(',',$this->param['category_id']).','; | ||
| 377 | + try { | ||
| 378 | + //批量 | ||
| 379 | + $param = [ | ||
| 380 | + 'category_id'=>$this->param['category_id'], | ||
| 381 | + 'status'=>$this->param['status'] | ||
| 382 | + ]; | ||
| 383 | + $this->model->edit($param,['id'=>['in',$this->param['id']]]); | ||
| 384 | + DB::connection('custom_mysql')->commit(); | ||
| 385 | + //对应添加关联表 | ||
| 386 | + }catch (\Exception $e){ | ||
| 387 | + DB::connection('custom_mysql')->rollBack(); | ||
| 388 | + $this->fail('系统错误,请联系管理员'); | ||
| 389 | + } | ||
| 390 | + } | ||
| 391 | + return $this->success(); | ||
| 392 | + } | ||
| 351 | } | 393 | } |
| @@ -250,6 +250,21 @@ class NewsLogic extends BaseLogic | @@ -250,6 +250,21 @@ class NewsLogic extends BaseLogic | ||
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | /** | 252 | /** |
| 253 | + * @remark : | ||
| 254 | + * @name :setAllSort | ||
| 255 | + * @author :lyh | ||
| 256 | + * @method :post | ||
| 257 | + * @time :2024/1/10 15:40 | ||
| 258 | + */ | ||
| 259 | + public function setAllSort(){ | ||
| 260 | + foreach ($this->param['data'] as $k => $v){ | ||
| 261 | + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]); | ||
| 262 | + } | ||
| 263 | + return $this->success(); | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + | ||
| 267 | + /** | ||
| 253 | * @remark :删除路由 | 268 | * @remark :删除路由 |
| 254 | * @name :delRoute | 269 | * @name :delRoute |
| 255 | * @author :lyh | 270 | * @author :lyh |
| @@ -381,4 +396,32 @@ class NewsLogic extends BaseLogic | @@ -381,4 +396,32 @@ class NewsLogic extends BaseLogic | ||
| 381 | 396 | ||
| 382 | return false; | 397 | return false; |
| 383 | } | 398 | } |
| 399 | + | ||
| 400 | + /** | ||
| 401 | + * @remark :批量设置产品分类及状态 | ||
| 402 | + * @name :batchSetCategory | ||
| 403 | + * @author :lyh | ||
| 404 | + * @method :post | ||
| 405 | + * @time :2023/8/15 17:53 | ||
| 406 | + */ | ||
| 407 | + public function batchSetCategory(){ | ||
| 408 | + if(isset($this->param['category_id']) && !empty($this->param['category_id'])) { | ||
| 409 | + DB::connection('custom_mysql')->beginTransaction(); | ||
| 410 | + $this->param['category_id'] = ','.implode(',',$this->param['category_id']).','; | ||
| 411 | + try { | ||
| 412 | + //批量 | ||
| 413 | + $param = [ | ||
| 414 | + 'category_id'=>$this->param['category_id'], | ||
| 415 | + 'status'=>$this->param['status'] | ||
| 416 | + ]; | ||
| 417 | + $this->model->edit($param,['id'=>['in',$this->param['id']]]); | ||
| 418 | + DB::connection('custom_mysql')->commit(); | ||
| 419 | + //对应添加关联表 | ||
| 420 | + }catch (\Exception $e){ | ||
| 421 | + DB::connection('custom_mysql')->rollBack(); | ||
| 422 | + $this->fail('系统错误,请联系管理员'); | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + return $this->success(); | ||
| 426 | + } | ||
| 384 | } | 427 | } |
| @@ -82,6 +82,7 @@ class RankDataLogic extends BaseLogic | @@ -82,6 +82,7 @@ class RankDataLogic extends BaseLogic | ||
| 82 | $lang_data = $quanqiusou_api->getLangRankData($api_no); | 82 | $lang_data = $quanqiusou_api->getLangRankData($api_no); |
| 83 | $lang_data = Arr::setValueToKey($lang_data, 'language'); | 83 | $lang_data = Arr::setValueToKey($lang_data, 'language'); |
| 84 | $data['langs'] = []; | 84 | $data['langs'] = []; |
| 85 | + if(isset($project['deploy_optimize']['minor_languages']) && !empty($project['deploy_optimize']['minor_languages']) && is_array($project['deploy_optimize']['minor_languages'])){ | ||
| 85 | foreach($project['deploy_optimize']['minor_languages']??[] as $lang){ | 86 | foreach($project['deploy_optimize']['minor_languages']??[] as $lang){ |
| 86 | $remain_day = $lang_data[$lang['tl']]['dabiao_day'] ?? 0; | 87 | $remain_day = $lang_data[$lang['tl']]['dabiao_day'] ?? 0; |
| 87 | $data['langs'][$lang['tl'] ?? ''] = [ | 88 | $data['langs'][$lang['tl'] ?? ''] = [ |
| @@ -93,8 +94,7 @@ class RankDataLogic extends BaseLogic | @@ -93,8 +94,7 @@ class RankDataLogic extends BaseLogic | ||
| 93 | 'type' => $lang['type'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数 | 94 | 'type' => $lang['type'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数 |
| 94 | ]; | 95 | ]; |
| 95 | } | 96 | } |
| 96 | - | ||
| 97 | - | 97 | + } |
| 98 | //测速 | 98 | //测速 |
| 99 | $data['speed'] = $speed['data'] ?? []; | 99 | $data['speed'] = $speed['data'] ?? []; |
| 100 | 100 |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :TranslateLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/1/12 9:42 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Bside\Setting; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 14 | +use App\Models\WebSetting\Proofreading; | ||
| 15 | +use App\Models\WebSetting\Translate as TranslateModel; | ||
| 16 | +use App\Models\WebSetting\WebLanguage; | ||
| 17 | +use App\Helper\Translate; | ||
| 18 | +use Illuminate\Support\Facades\DB; | ||
| 19 | + | ||
| 20 | +class TranslateLogic extends BaseLogic | ||
| 21 | +{ | ||
| 22 | + public function __construct() | ||
| 23 | + { | ||
| 24 | + parent::__construct(); | ||
| 25 | + $this->model = new TranslateModel(); | ||
| 26 | + $this->param = $this->requestAll; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * @remark : | ||
| 31 | + * @name :getTranslateList | ||
| 32 | + * @author :lyh | ||
| 33 | + * @method :post | ||
| 34 | + * @time :2024/1/12 9:43 | ||
| 35 | + */ | ||
| 36 | + public function getTranslateList(){ | ||
| 37 | + $languageInfo = $this->getLanguage($this->param['language_id']); | ||
| 38 | + $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); | ||
| 39 | + //获取当前URl的所有文本内容 | ||
| 40 | + $new_key = $this->getUrlRead($this->param['url']); | ||
| 41 | + if($info === false){ | ||
| 42 | + $data = []; | ||
| 43 | + $translate_list = Translate::tran($new_key, $languageInfo['short']); | ||
| 44 | + foreach ($new_key as $k=>$v){ | ||
| 45 | + $data[] = [ | ||
| 46 | + trim($v)=>$translate_list[$k], | ||
| 47 | + ]; | ||
| 48 | + } | ||
| 49 | + return $this->response('success',Code::SUCCESS,$data); | ||
| 50 | + } | ||
| 51 | + $old_key = [];//key值组成数据 | ||
| 52 | + $data = json_decode($info['data'],true); | ||
| 53 | + foreach ($data as $k => $v){ | ||
| 54 | + $old_key[] = $k; | ||
| 55 | + } | ||
| 56 | + $arr2 = array_values(array_diff($new_key, $old_key)); | ||
| 57 | + if(!empty($arr2)){ | ||
| 58 | + $translate_list = Translate::tran($arr2, $languageInfo['short']); | ||
| 59 | + foreach ($arr2 as $k1=>$v1){ | ||
| 60 | + $data[] = [ | ||
| 61 | + trim($v1)=>$translate_list[$k1] | ||
| 62 | + ]; | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + $this->response('success',Code::SUCCESS,$data); | ||
| 66 | + } | ||
| 67 | + /** | ||
| 68 | + * @remark :获取图片列表 | ||
| 69 | + * @name :imageList | ||
| 70 | + * @author :lyh | ||
| 71 | + * @method :post | ||
| 72 | + * @time :2023/11/23 17:29 | ||
| 73 | + */ | ||
| 74 | + public function getTranslateImageList(){ | ||
| 75 | + $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); | ||
| 76 | + $data = []; | ||
| 77 | + if($info === false){ | ||
| 78 | + $new_list = $this->getUrlImageRead($this->param['url']); | ||
| 79 | + foreach ($new_list as $v){ | ||
| 80 | + $data[] = [ | ||
| 81 | + $v=>$v, | ||
| 82 | + ]; | ||
| 83 | + } | ||
| 84 | + return $this->response('success',Code::SUCCESS,$data); | ||
| 85 | + } | ||
| 86 | + $new_list = $this->getUrlImageRead($this->param['url']); | ||
| 87 | + $old_list = []; | ||
| 88 | + $data = json_decode($info['data'],true); | ||
| 89 | + foreach ($data as $k=>$v){ | ||
| 90 | + $old_list[] = $v; | ||
| 91 | + $data[] = [ | ||
| 92 | + $k=>$v, | ||
| 93 | + ]; | ||
| 94 | + } | ||
| 95 | + $arr2 = array_values(array_diff($new_list, $old_list)); | ||
| 96 | + if(!empty($arr2)){ | ||
| 97 | + foreach ($arr2 as $v1){ | ||
| 98 | + $data[] = [ | ||
| 99 | + $v1=>$v1 | ||
| 100 | + ]; | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + $this->response('success',Code::SUCCESS,$data); | ||
| 104 | + } | ||
| 105 | + /** | ||
| 106 | + * @remark :获取语种信息 | ||
| 107 | + * @name :getLanguage | ||
| 108 | + * @author :lyh | ||
| 109 | + * @method :post | ||
| 110 | + * @time :2024/1/12 9:45 | ||
| 111 | + */ | ||
| 112 | + public function getLanguage($language_id){ | ||
| 113 | + //获取语种信息 | ||
| 114 | + $languageModel = new WebLanguage(); | ||
| 115 | + $languageInfo = $languageModel->read(['id'=>$language_id]); | ||
| 116 | + if($languageInfo === false){ | ||
| 117 | + $this->fail('请选择语种'); | ||
| 118 | + } | ||
| 119 | + return $this->success($languageInfo); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * @remark :获取Url内容 | ||
| 124 | + * @name :getUrlRead | ||
| 125 | + * @author :lyh | ||
| 126 | + * @method :post | ||
| 127 | + * @time :2023/11/22 10:02 | ||
| 128 | + */ | ||
| 129 | + public function getUrlRead($url){ | ||
| 130 | + $contextOptions = [ | ||
| 131 | + 'ssl' => [ | ||
| 132 | + 'verify_peer' => false, | ||
| 133 | + 'verify_peer_name' => false, | ||
| 134 | + ], | ||
| 135 | + ]; | ||
| 136 | + $context = stream_context_create($contextOptions); | ||
| 137 | + $sourceCode = file_get_contents($url, false, $context); | ||
| 138 | + $pattern = '/<style\b[^>]*>(.*?)<\/style>/s'; // 定义匹配`<style>`标签及其内容的正则表达式 | ||
| 139 | + $strippedContent = preg_replace($pattern, '', $sourceCode); // 删除`<style>`标签及其内容 | ||
| 140 | + $pattern = '/<script\b[^>]*>(.*?)<\/script>/s'; // 定义匹配`<script>`标签及其内容的正则表达式 | ||
| 141 | + $strippedContent = preg_replace($pattern, '', $strippedContent); // 删除`<script>`标签及其内容 | ||
| 142 | + $pattern = '/<link\b[^>]*>/'; // 定义匹配 `<link>` 标签的正则表达式 | ||
| 143 | + $strippedContent = preg_replace($pattern, '', $strippedContent); // 删除 `<link>` 标签 | ||
| 144 | + $pattern = '/>([^<]+)</'; // 定义匹配中间内容不是标签的正则表达式 | ||
| 145 | + $matches = array(); | ||
| 146 | + preg_match_all($pattern, $strippedContent, $matches); | ||
| 147 | + $textContentArray = array_filter($matches[1], function($item) { | ||
| 148 | + return !empty(trim($item)); | ||
| 149 | + }); | ||
| 150 | + $data = []; | ||
| 151 | + foreach ($textContentArray as $v){ | ||
| 152 | + $content = trim($v); | ||
| 153 | + $trimmedString = preg_replace('/\s+/', ' ', $content); | ||
| 154 | + $data[] = $trimmedString; | ||
| 155 | + } | ||
| 156 | + $data = array_values($data); | ||
| 157 | + return $data; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + /** | ||
| 161 | + * @remark :获取Url内容 | ||
| 162 | + * @name :getUrlRead | ||
| 163 | + * @author :lyh | ||
| 164 | + * @method :post | ||
| 165 | + * @time :2023/11/22 10:02 | ||
| 166 | + */ | ||
| 167 | + public function getUrlImageRead($url){ | ||
| 168 | + $contextOptions = [ | ||
| 169 | + 'ssl' => [ | ||
| 170 | + 'verify_peer' => false, | ||
| 171 | + 'verify_peer_name' => false, | ||
| 172 | + ], | ||
| 173 | + ]; | ||
| 174 | + $pattern = '/<img.*?src="(.*?)".*?>/i'; | ||
| 175 | + $matches = array(); | ||
| 176 | + $context = stream_context_create($contextOptions); | ||
| 177 | + $sourceCode = file_get_contents($url, false, $context); | ||
| 178 | + preg_match_all($pattern, $sourceCode, $matches); | ||
| 179 | + $textContentArray = $matches[1]; | ||
| 180 | + $data = []; | ||
| 181 | + foreach ($textContentArray as $v){ | ||
| 182 | + if(!empty($v)){ | ||
| 183 | + $data[] = $v; | ||
| 184 | + } | ||
| 185 | + } | ||
| 186 | + $uniqueArray = array_unique($data); | ||
| 187 | + $data = array_values($uniqueArray); | ||
| 188 | + return $data; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + /** | ||
| 192 | + * @name :(新增/更新多语言)save | ||
| 193 | + * @author :lyh | ||
| 194 | + * @method :post | ||
| 195 | + * @time :2023/6/12 10:52 | ||
| 196 | + */ | ||
| 197 | + public function translateSave(){ | ||
| 198 | + try { | ||
| 199 | + $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); | ||
| 200 | + if($info === false){ | ||
| 201 | + $param = [ | ||
| 202 | + 'type'=>1, | ||
| 203 | + 'project_id'=>$this->user['project_id'], | ||
| 204 | + 'url'=>$this->param['url'], | ||
| 205 | + 'language_id'=>$this->param['language_id'], | ||
| 206 | + 'alias'=>$this->param['alias'], | ||
| 207 | + ]; | ||
| 208 | + $param['data'] = json_encode($this->param['data'],true); | ||
| 209 | + $this->model->add($param); | ||
| 210 | + }else{ | ||
| 211 | + $data = json_encode($this->param['data'],true); | ||
| 212 | + $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); | ||
| 213 | + } | ||
| 214 | + }catch (\Exception $e){ | ||
| 215 | + $this->fail('系统错误请联系管理员'); | ||
| 216 | + } | ||
| 217 | + $this->response('success'); | ||
| 218 | + } | ||
| 219 | +} |
| @@ -27,6 +27,7 @@ class AyrReleaseRequest extends FormRequest | @@ -27,6 +27,7 @@ class AyrReleaseRequest extends FormRequest | ||
| 27 | 'content'=>'required', | 27 | 'content'=>'required', |
| 28 | 'share_id'=>'required', | 28 | 'share_id'=>'required', |
| 29 | 'platforms'=>'required|array', | 29 | 'platforms'=>'required|array', |
| 30 | + 'schedule_date'=>'required' | ||
| 30 | ]; | 31 | ]; |
| 31 | } | 32 | } |
| 32 | 33 |
| @@ -2,9 +2,10 @@ | @@ -2,9 +2,10 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Models\Com; | 3 | namespace App\Models\Com; |
| 4 | 4 | ||
| 5 | +use App\Models\Base; | ||
| 5 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
| 6 | 7 | ||
| 7 | -class UpdateOldInfo extends Model | 8 | +class UpdateOldInfo extends Base |
| 8 | { | 9 | { |
| 9 | //设置关联表名 | 10 | //设置关联表名 |
| 10 | protected $table = 'gl_update_old_info'; | 11 | protected $table = 'gl_update_old_info'; |
app/Models/WebSetting/Translate.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :Translate.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/1/12 9:38 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\WebSetting; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +class Translate extends Base | ||
| 15 | +{ | ||
| 16 | + protected $table = 'gl_translate'; | ||
| 17 | + //连接数据库 | ||
| 18 | + protected $connection = 'custom_mysql'; | ||
| 19 | +} |
| @@ -74,6 +74,8 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -74,6 +74,8 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 74 | Route::any('/del', [\App\Http\Controllers\Bside\News\NewsController::class, 'del'])->name('news_del'); | 74 | Route::any('/del', [\App\Http\Controllers\Bside\News\NewsController::class, 'del'])->name('news_del'); |
| 75 | Route::any('/status', [\App\Http\Controllers\Bside\News\NewsController::class, 'status'])->name('news_status'); | 75 | Route::any('/status', [\App\Http\Controllers\Bside\News\NewsController::class, 'status'])->name('news_status'); |
| 76 | Route::any('/sort', [\App\Http\Controllers\Bside\News\NewsController::class, 'sort'])->name('news_sort'); | 76 | Route::any('/sort', [\App\Http\Controllers\Bside\News\NewsController::class, 'sort'])->name('news_sort'); |
| 77 | + Route::any('/allSort', [\App\Http\Controllers\Bside\News\NewsController::class, 'allSort'])->name('news_allSort'); | ||
| 78 | + Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\News\NewsController::class, 'batchSetCategory'])->name('news_batchSetCategory'); | ||
| 77 | Route::any('/statusNum', [\App\Http\Controllers\Bside\News\NewsController::class, 'getStatusNumber'])->name('news_statusNum'); | 79 | Route::any('/statusNum', [\App\Http\Controllers\Bside\News\NewsController::class, 'getStatusNumber'])->name('news_statusNum'); |
| 78 | }); | 80 | }); |
| 79 | 81 | ||
| @@ -89,6 +91,8 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -89,6 +91,8 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 89 | Route::any('/del', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'del'])->name('blog_del'); | 91 | Route::any('/del', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'del'])->name('blog_del'); |
| 90 | Route::any('/status', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'status'])->name('blog_status'); | 92 | Route::any('/status', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'status'])->name('blog_status'); |
| 91 | Route::any('/sort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'sort'])->name('blog_sort'); | 93 | Route::any('/sort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'sort'])->name('blog_sort'); |
| 94 | + Route::any('/allSort', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'allSort'])->name('blog_allSort'); | ||
| 95 | + Route::any('/batchSetCategory', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'batchSetCategory'])->name('blog_batchSetCategory'); | ||
| 92 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum'); | 96 | Route::any('/statusNum', [\App\Http\Controllers\Bside\Blog\BlogController::class, 'getStatusNumber'])->name('blog_statusNum'); |
| 93 | //分类 | 97 | //分类 |
| 94 | Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists'); | 98 | Route::any('/category/', [\App\Http\Controllers\Bside\Blog\BlogCategoryController::class, 'lists'])->name('blog_category_lists'); |
| @@ -172,7 +176,12 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -172,7 +176,12 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 172 | Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'save'])->name('web_proofreading_save'); | 176 | Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'save'])->name('web_proofreading_save'); |
| 173 | Route::any('/saveImage', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'saveImage'])->name('web_proofreading_saveImage'); | 177 | Route::any('/saveImage', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'saveImage'])->name('web_proofreading_saveImage'); |
| 174 | }); | 178 | }); |
| 175 | - | 179 | + //新版翻译校队 |
| 180 | + Route::prefix('translate_check')->group(function () {//languageList | ||
| 181 | + Route::any('/', [\App\Http\Controllers\Bside\Setting\TranslateController::class, 'lists'])->name('translate_check_lists'); | ||
| 182 | + Route::any('/imageList', [\App\Http\Controllers\Bside\Setting\TranslateController::class, 'imageList'])->name('translate_checkg_imageList'); | ||
| 183 | + Route::any('/save', [\App\Http\Controllers\Bside\Setting\TranslateController::class, 'save'])->name('translate_check_save'); | ||
| 184 | + }); | ||
| 176 | //seo设置 | 185 | //seo设置 |
| 177 | Route::prefix('seo')->group(function () { | 186 | Route::prefix('seo')->group(function () { |
| 178 | Route::any('/info', [\App\Http\Controllers\Bside\Setting\WebSettingSeoController::class, 'info'])->name('web_seo_info'); | 187 | Route::any('/info', [\App\Http\Controllers\Bside\Setting\WebSettingSeoController::class, 'info'])->name('web_seo_info'); |
-
请 注册 或 登录 后发表评论