Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
40 个修改的文件
包含
566 行增加
和
177 行删除
| @@ -82,16 +82,17 @@ class Count extends Command | @@ -82,16 +82,17 @@ class Count extends Command | ||
| 82 | $arr['updated_at'] = date('Y-m-d H:i:s'); | 82 | $arr['updated_at'] = date('Y-m-d H:i:s'); |
| 83 | //询盘统计 | 83 | //询盘统计 |
| 84 | $arr = $this->inquiry($arr,$v['test_domain'], $v['id']); | 84 | $arr = $this->inquiry($arr,$v['test_domain'], $v['id']); |
| 85 | - echo date('Y-m-d H:i:s') . json_encode($arr) . '->' . PHP_EOL; | ||
| 86 | - $data[] = $arr; | 85 | + if($arr === false){ |
| 86 | + $data[] = $v['test_domain']; | ||
| 87 | + } | ||
| 88 | + DB::table('gl_count')->insert($arr); | ||
| 89 | + Log::channel('day_count')->error('日期:'.$arr['created_at'].'success: ' .$v['test_domain']); | ||
| 87 | } | 90 | } |
| 88 | - //判断数据是否存在 | ||
| 89 | - DB::table('gl_count')->insert($data); | ||
| 90 | } | 91 | } |
| 91 | }catch (\Exception $e){ | 92 | }catch (\Exception $e){ |
| 92 | - echo date('Y-m-d H:i:s') . ' error: ' . '->' . $e->getMessage() . PHP_EOL; | 93 | + Log::channel('day_count')->error('day_count:->error ' . $e->getMessage()); |
| 93 | } | 94 | } |
| 94 | - echo date('Y-m-d H:i:s') . ' end: ' . PHP_EOL; | 95 | + Log::channel('day_count')->error('success:end'); |
| 95 | echo $this->error; | 96 | echo $this->error; |
| 96 | } | 97 | } |
| 97 | 98 | ||
| @@ -127,6 +128,9 @@ class Count extends Command | @@ -127,6 +128,9 @@ class Count extends Command | ||
| 127 | */ | 128 | */ |
| 128 | public function inquiry($arr,$domain,$project_id){ | 129 | public function inquiry($arr,$domain,$project_id){ |
| 129 | $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); | 130 | $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); |
| 131 | + if($inquiry_list == false){ | ||
| 132 | + return false; | ||
| 133 | + } | ||
| 130 | if($inquiry_list['status'] == self::STATUS_ERROR){ | 134 | if($inquiry_list['status'] == self::STATUS_ERROR){ |
| 131 | $arr['inquiry_num'] = 0; | 135 | $arr['inquiry_num'] = 0; |
| 132 | $countryArr = []; | 136 | $countryArr = []; |
| @@ -6,6 +6,7 @@ use App\Models\Inquiry\InquiryCount as InquiryCountModel; | @@ -6,6 +6,7 @@ use App\Models\Inquiry\InquiryCount as InquiryCountModel; | ||
| 6 | use App\Models\Inquiry\InquiryInfo; | 6 | use App\Models\Inquiry\InquiryInfo; |
| 7 | use Carbon\Carbon; | 7 | use Carbon\Carbon; |
| 8 | use Illuminate\Console\Command; | 8 | use Illuminate\Console\Command; |
| 9 | +use Illuminate\Support\Facades\Log; | ||
| 9 | 10 | ||
| 10 | /** | 11 | /** |
| 11 | * @remark : | 12 | * @remark : |
| @@ -62,6 +63,7 @@ class InquiryCount extends Command | @@ -62,6 +63,7 @@ class InquiryCount extends Command | ||
| 62 | //获取昨天的时间 | 63 | //获取昨天的时间 |
| 63 | $yesterday = Carbon::yesterday()->toDateString(); | 64 | $yesterday = Carbon::yesterday()->toDateString(); |
| 64 | $inquiryInfoModel = new InquiryInfo(); | 65 | $inquiryInfoModel = new InquiryInfo(); |
| 66 | + try { | ||
| 65 | foreach ($this->status as $k=>$v){ | 67 | foreach ($this->status as $k=>$v){ |
| 66 | $total = $inquiryInfoModel->formatQuery(['created_at'=>['between',[$yesterday.' 00:00:00',$yesterday.' 23:59:59']]])->count(); | 68 | $total = $inquiryInfoModel->formatQuery(['created_at'=>['between',[$yesterday.' 00:00:00',$yesterday.' 23:59:59']]])->count(); |
| 67 | $untreated = $inquiryInfoModel->formatQuery(['created_at'=>['between',[$yesterday.' 00:00:00',$yesterday.' 23:59:59']],'status'=>1])->count(); | 69 | $untreated = $inquiryInfoModel->formatQuery(['created_at'=>['between',[$yesterday.' 00:00:00',$yesterday.' 23:59:59']],'status'=>1])->count(); |
| @@ -76,6 +78,9 @@ class InquiryCount extends Command | @@ -76,6 +78,9 @@ class InquiryCount extends Command | ||
| 76 | } | 78 | } |
| 77 | $inquiryCount = new InquiryCountModel(); | 79 | $inquiryCount = new InquiryCountModel(); |
| 78 | $inquiryCount->insert($data); | 80 | $inquiryCount->insert($data); |
| 81 | + }catch (\Exception $e){ | ||
| 82 | + Log::error('inquiry_count : error'); | ||
| 83 | + } | ||
| 79 | return true; | 84 | return true; |
| 80 | } | 85 | } |
| 81 | } | 86 | } |
| @@ -81,7 +81,7 @@ class DeleteBlogCategory extends Command | @@ -81,7 +81,7 @@ class DeleteBlogCategory extends Command | ||
| 81 | echo 'success:' . $item['id'] . PHP_EOL; | 81 | echo 'success:' . $item['id'] . PHP_EOL; |
| 82 | }catch (\Exception $e){ | 82 | }catch (\Exception $e){ |
| 83 | echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; | 83 | echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; |
| 84 | - errorLog('项目初始化失败', $item, $e); | 84 | + errorLog('delete_blog_category删除失败', $item, $e); |
| 85 | } | 85 | } |
| 86 | } | 86 | } |
| 87 | return true; | 87 | return true; |
| @@ -81,7 +81,7 @@ class DeleteCustomCategory extends Command | @@ -81,7 +81,7 @@ class DeleteCustomCategory extends Command | ||
| 81 | echo 'success:' . $item['id'] . PHP_EOL; | 81 | echo 'success:' . $item['id'] . PHP_EOL; |
| 82 | }catch (\Exception $e){ | 82 | }catch (\Exception $e){ |
| 83 | echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; | 83 | echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; |
| 84 | - errorLog('项目初始化失败', $item, $e); | 84 | + errorLog('delete_custom_category删除失败', $item, $e); |
| 85 | } | 85 | } |
| 86 | } | 86 | } |
| 87 | return true; | 87 | return true; |
| @@ -68,7 +68,7 @@ class DeleteNewsCategory extends Command | @@ -68,7 +68,7 @@ class DeleteNewsCategory extends Command | ||
| 68 | } | 68 | } |
| 69 | foreach ($list as $item){ | 69 | foreach ($list as $item){ |
| 70 | echo 'start:' . $item['id'] . PHP_EOL; | 70 | echo 'start:' . $item['id'] . PHP_EOL; |
| 71 | -// try { | 71 | + try { |
| 72 | $projectModel = new Project(); | 72 | $projectModel = new Project(); |
| 73 | $projectInfo = $projectModel->read(['id'=>$item['data']['project_id']]); | 73 | $projectInfo = $projectModel->read(['id'=>$item['data']['project_id']]); |
| 74 | if($projectInfo === false){ | 74 | if($projectInfo === false){ |
| @@ -79,10 +79,10 @@ class DeleteNewsCategory extends Command | @@ -79,10 +79,10 @@ class DeleteNewsCategory extends Command | ||
| 79 | DB::disconnect('custom_mysql'); | 79 | DB::disconnect('custom_mysql'); |
| 80 | $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]); | 80 | $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]); |
| 81 | echo 'success:' . $item['id'] . PHP_EOL; | 81 | echo 'success:' . $item['id'] . PHP_EOL; |
| 82 | -// }catch (\Exception $e){ | ||
| 83 | -// echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; | ||
| 84 | -// errorLog('项目初始化失败', $item, $e); | ||
| 85 | -// } | 82 | + }catch (\Exception $e){ |
| 83 | + echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; | ||
| 84 | + errorLog('delete_news_category删除失败', $item, $e); | ||
| 85 | + } | ||
| 86 | } | 86 | } |
| 87 | return true; | 87 | return true; |
| 88 | } | 88 | } |
| @@ -82,7 +82,7 @@ class DeleteProductCategory extends Command | @@ -82,7 +82,7 @@ class DeleteProductCategory extends Command | ||
| 82 | echo 'success:' . $item['id'] . PHP_EOL; | 82 | echo 'success:' . $item['id'] . PHP_EOL; |
| 83 | }catch (\Exception $e){ | 83 | }catch (\Exception $e){ |
| 84 | echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; | 84 | echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; |
| 85 | - errorLog('项目初始化失败', $item, $e); | 85 | + errorLog('delete_product_category删除失败', $item, $e); |
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| 88 | return true; | 88 | return true; |
| @@ -72,7 +72,6 @@ class DomainInfo extends Command | @@ -72,7 +72,6 @@ class DomainInfo extends Command | ||
| 72 | 'domain_start_time' => $time['start'], | 72 | 'domain_start_time' => $time['start'], |
| 73 | 'domain_end_time' => $time['end'] | 73 | 'domain_end_time' => $time['end'] |
| 74 | ]; | 74 | ]; |
| 75 | - | ||
| 76 | $domainModel->edit($data, ['id' => $v['id']]); | 75 | $domainModel->edit($data, ['id' => $v['id']]); |
| 77 | } | 76 | } |
| 78 | } | 77 | } |
| @@ -47,8 +47,6 @@ class RemainDay extends Command | @@ -47,8 +47,6 @@ class RemainDay extends Command | ||
| 47 | $list = Project::whereIn('type', [2,3,4])->get(); | 47 | $list = Project::whereIn('type', [2,3,4])->get(); |
| 48 | foreach ($list as $item){ | 48 | foreach ($list as $item){ |
| 49 | if($item['type'] == Project::TYPE_TWO){ | 49 | if($item['type'] == Project::TYPE_TWO){ |
| 50 | - //排名达标天数 | ||
| 51 | -// $compliance_day = GoogleRankModel::where(['project_id' => $item['id'], 'lang' => ''])->value('compliance_day') ?: 0; | ||
| 52 | //获取当前项目的达标天数 | 50 | //获取当前项目的达标天数 |
| 53 | $compliance_day = Project::where(['id' => $item['id']])->value('finish_remain_day') ?: 0; | 51 | $compliance_day = Project::where(['id' => $item['id']])->value('finish_remain_day') ?: 0; |
| 54 | $remain_day = $item['deploy_build']['service_duration'] - $compliance_day; | 52 | $remain_day = $item['deploy_build']['service_duration'] - $compliance_day; |
| @@ -42,8 +42,7 @@ class ImportChannel extends Command | @@ -42,8 +42,7 @@ class ImportChannel extends Command | ||
| 42 | 'channel'=>['like','%"user_id": "0"%'], | 42 | 'channel'=>['like','%"user_id": "0"%'], |
| 43 | ]; | 43 | ]; |
| 44 | $lists = $projectModel->list($map); | 44 | $lists = $projectModel->list($map); |
| 45 | -// var_dump($lists); | ||
| 46 | -// die(); | 45 | + if(!empty($lists)){ |
| 47 | foreach ($lists as $k => $v){ | 46 | foreach ($lists as $k => $v){ |
| 48 | $order_id = $v['notice_order_id']; | 47 | $order_id = $v['notice_order_id']; |
| 49 | $api = new OaGlobalsoApi(); | 48 | $api = new OaGlobalsoApi(); |
| @@ -52,6 +51,7 @@ class ImportChannel extends Command | @@ -52,6 +51,7 @@ class ImportChannel extends Command | ||
| 52 | $channel = Channel::getProjectChannel($data['company_id'], $data['username_sales']); | 51 | $channel = Channel::getProjectChannel($data['company_id'], $data['username_sales']); |
| 53 | $projectModel->edit(['channel'=>$channel],['id'=>$v['id']]); | 52 | $projectModel->edit(['channel'=>$channel],['id'=>$v['id']]); |
| 54 | } | 53 | } |
| 55 | - return 1; | 54 | + } |
| 55 | + return true; | ||
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| @@ -30,7 +30,7 @@ class ImportManager extends Command | @@ -30,7 +30,7 @@ class ImportManager extends Command | ||
| 30 | * | 30 | * |
| 31 | * @var string | 31 | * @var string |
| 32 | */ | 32 | */ |
| 33 | - protected $description = '导入数据'; | 33 | + protected $description = '导入数据(同步5.0人事信息)'; |
| 34 | /** | 34 | /** |
| 35 | * @remark :导入5.0管理员数据 | 35 | * @remark :导入5.0管理员数据 |
| 36 | * @name :handle | 36 | * @name :handle |
| @@ -57,13 +57,10 @@ class LastInquiry extends Command | @@ -57,13 +57,10 @@ class LastInquiry extends Command | ||
| 57 | //其他询盘的最新时间 | 57 | //其他询盘的最新时间 |
| 58 | ProjectServer::useProject($item['id']); | 58 | ProjectServer::useProject($item['id']); |
| 59 | $other_last_time = InquiryFormData::orderBy('id', 'desc')->value('submit_at'); | 59 | $other_last_time = InquiryFormData::orderBy('id', 'desc')->value('submit_at'); |
| 60 | - | ||
| 61 | $last_inquiry_time = $last_time > $other_last_time ? $last_time : $other_last_time; | 60 | $last_inquiry_time = $last_time > $other_last_time ? $last_time : $other_last_time; |
| 62 | - | ||
| 63 | if(!$last_inquiry_time){ | 61 | if(!$last_inquiry_time){ |
| 64 | continue; | 62 | continue; |
| 65 | } | 63 | } |
| 66 | - | ||
| 67 | $item->last_inquiry_time = $last_inquiry_time; | 64 | $item->last_inquiry_time = $last_inquiry_time; |
| 68 | $item->save(); | 65 | $item->save(); |
| 69 | } | 66 | } |
| @@ -10,6 +10,7 @@ use App\Services\ProjectServer; | @@ -10,6 +10,7 @@ use App\Services\ProjectServer; | ||
| 10 | use Carbon\Carbon; | 10 | use Carbon\Carbon; |
| 11 | use Illuminate\Console\Command; | 11 | use Illuminate\Console\Command; |
| 12 | use Illuminate\Support\Facades\DB; | 12 | use Illuminate\Support\Facades\DB; |
| 13 | +use Illuminate\Support\Facades\Log; | ||
| 13 | 14 | ||
| 14 | class InquiryMonthlyCount extends Command | 15 | class InquiryMonthlyCount extends Command |
| 15 | { | 16 | { |
| @@ -70,7 +71,12 @@ class InquiryMonthlyCount extends Command | @@ -70,7 +71,12 @@ class InquiryMonthlyCount extends Command | ||
| 70 | $arr['project_id'] = $value['project_id']; | 71 | $arr['project_id'] = $value['project_id']; |
| 71 | // 获取当前日期时间 | 72 | // 获取当前日期时间 |
| 72 | $arr['month'] = Carbon::now()->subMonth()->format('Y-m'); | 73 | $arr['month'] = Carbon::now()->subMonth()->format('Y-m'); |
| 74 | + try { | ||
| 73 | DB::table('gl_month_count')->insert($arr); | 75 | DB::table('gl_month_count')->insert($arr); |
| 76 | + Log::channel('month_count')->error('success:project_id .'.$arr['project_id']); | ||
| 77 | + }catch (\Exception $e){ | ||
| 78 | + Log::channel('month_count')->error('month_count:error ' . $e->getMessage()); | ||
| 79 | + } | ||
| 74 | } | 80 | } |
| 75 | return true; | 81 | return true; |
| 76 | } | 82 | } |
| @@ -80,7 +80,6 @@ class ReplaceHtml extends Command | @@ -80,7 +80,6 @@ class ReplaceHtml extends Command | ||
| 80 | DB::disconnect('custom_mysql'); | 80 | DB::disconnect('custom_mysql'); |
| 81 | } | 81 | } |
| 82 | sleep(10); | 82 | sleep(10); |
| 83 | - return true; | ||
| 84 | } | 83 | } |
| 85 | } | 84 | } |
| 86 | 85 | ||
| @@ -207,7 +206,7 @@ class ReplaceHtml extends Command | @@ -207,7 +206,7 @@ class ReplaceHtml extends Command | ||
| 207 | return $this->getCustomName($source,$source_id,$is_list); | 206 | return $this->getCustomName($source,$source_id,$is_list); |
| 208 | } | 207 | } |
| 209 | if($source == BTemplate::SOURCE_HOME){ | 208 | if($source == BTemplate::SOURCE_HOME){ |
| 210 | - return ['name'=>'','route'=>''];; | 209 | + return ['name'=>'','route'=>'']; |
| 211 | }elseif ($source == BTemplate::SOURCE_PRODUCT){ | 210 | }elseif ($source == BTemplate::SOURCE_PRODUCT){ |
| 212 | return $this->getProductName($source_id,$is_list); | 211 | return $this->getProductName($source_id,$is_list); |
| 213 | }elseif ($source == BTemplate::SOURCE_BLOG){ | 212 | }elseif ($source == BTemplate::SOURCE_BLOG){ |
| @@ -14,6 +14,8 @@ use App\Models\File\File as FileModel; | @@ -14,6 +14,8 @@ use App\Models\File\File as FileModel; | ||
| 14 | use App\Models\File\Image; | 14 | use App\Models\File\Image; |
| 15 | use App\Models\File\Image as ImageModel; | 15 | use App\Models\File\Image as ImageModel; |
| 16 | use App\Models\Product\Keyword; | 16 | use App\Models\Product\Keyword; |
| 17 | +use App\Models\Project\DeployOptimize; | ||
| 18 | +use App\Models\Project\MinorLanguages; | ||
| 17 | use App\Models\Project\Project; | 19 | use App\Models\Project\Project; |
| 18 | use App\Services\AmazonS3Service; | 20 | use App\Services\AmazonS3Service; |
| 19 | use App\Services\ProjectServer; | 21 | use App\Services\ProjectServer; |
| @@ -72,34 +74,34 @@ class Demo extends Command | @@ -72,34 +74,34 @@ class Demo extends Command | ||
| 72 | // return true; | 74 | // return true; |
| 73 | // } | 75 | // } |
| 74 | 76 | ||
| 75 | - public function handle(){ | ||
| 76 | - $keywordVideoModel = new KeywordVideoTask(); | ||
| 77 | - $project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray(); | ||
| 78 | - $projectModel = new Project(); | ||
| 79 | - $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]); | ||
| 80 | - $data = []; | ||
| 81 | - foreach ($list as $v){ | ||
| 82 | - echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | ||
| 83 | - ProjectServer::useProject($v['id']); | ||
| 84 | - $this->saveKeyword(); | ||
| 85 | - DB::disconnect('custom_mysql'); | ||
| 86 | - } | ||
| 87 | - echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | ||
| 88 | - } | ||
| 89 | - | ||
| 90 | - /** | ||
| 91 | - * @remark :关键字有视频的改为1 | ||
| 92 | - * @name :getProductKeywordInfo | ||
| 93 | - * @author :lyh | ||
| 94 | - * @method :post | ||
| 95 | - * @time :2024/5/31 9:54 | ||
| 96 | - */ | ||
| 97 | - public function saveKeyword(){ | ||
| 98 | - $keywordModel = new Keyword(); | ||
| 99 | - $rs = $keywordModel->edit(['is_video_keyword'=>0],['video'=>'']); | ||
| 100 | - echo date('Y-m-d H:i:s') . 'end'.$rs . PHP_EOL; | ||
| 101 | - return true; | ||
| 102 | - } | 77 | +// public function handle(){ |
| 78 | +// $keywordVideoModel = new KeywordVideoTask(); | ||
| 79 | +// $project_id_arr = $keywordVideoModel::where('id','>',0)->pluck('project_id')->toArray(); | ||
| 80 | +// $projectModel = new Project(); | ||
| 81 | +// $list = $projectModel->list(['type'=>['!=',0],'delete_status'=>0,'id'=>['in',$project_id_arr]]); | ||
| 82 | +// $data = []; | ||
| 83 | +// foreach ($list as $v){ | ||
| 84 | +// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | ||
| 85 | +// ProjectServer::useProject($v['id']); | ||
| 86 | +// $this->saveKeyword(); | ||
| 87 | +// DB::disconnect('custom_mysql'); | ||
| 88 | +// } | ||
| 89 | +// echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | ||
| 90 | +// } | ||
| 91 | +// | ||
| 92 | +// /** | ||
| 93 | +// * @remark :关键字有视频的改为1 | ||
| 94 | +// * @name :getProductKeywordInfo | ||
| 95 | +// * @author :lyh | ||
| 96 | +// * @method :post | ||
| 97 | +// * @time :2024/5/31 9:54 | ||
| 98 | +// */ | ||
| 99 | +// public function saveKeyword(){ | ||
| 100 | +// $keywordModel = new Keyword(); | ||
| 101 | +// $rs = $keywordModel->edit(['is_video_keyword'=>0],['video'=>'']); | ||
| 102 | +// echo date('Y-m-d H:i:s') . 'end'.$rs . PHP_EOL; | ||
| 103 | +// return true; | ||
| 104 | +// } | ||
| 103 | 105 | ||
| 104 | // public function handle(){ | 106 | // public function handle(){ |
| 105 | // //切换数据库配置 | 107 | // //切换数据库配置 |
| @@ -50,14 +50,19 @@ class HeaderFooter extends Command | @@ -50,14 +50,19 @@ class HeaderFooter extends Command | ||
| 50 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 50 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 51 | ProjectServer::useProject($v['id']); | 51 | ProjectServer::useProject($v['id']); |
| 52 | DB::table('gl_web_template_com')->truncate(); | 52 | DB::table('gl_web_template_com')->truncate(); |
| 53 | - $templateComModel = new BTemplateCom(); | ||
| 54 | - $templateComModel->truncate(); | ||
| 55 | $this->saveTemplateCom($v['id']); | 53 | $this->saveTemplateCom($v['id']); |
| 56 | DB::disconnect('custom_mysql'); | 54 | DB::disconnect('custom_mysql'); |
| 57 | } | 55 | } |
| 58 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 56 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 59 | } | 57 | } |
| 60 | 58 | ||
| 59 | + /** | ||
| 60 | + * @remark :头部底部分开脚本 | ||
| 61 | + * @name :saveTemplateCom | ||
| 62 | + * @author :lyh | ||
| 63 | + * @method :post | ||
| 64 | + * @time :2024/6/17 14:46 | ||
| 65 | + */ | ||
| 61 | public function saveTemplateCom($project_id){ | 66 | public function saveTemplateCom($project_id){ |
| 62 | //获取当前项目选择的模版 | 67 | //获取当前项目选择的模版 |
| 63 | $settingModel = new Setting(); | 68 | $settingModel = new Setting(); |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ProductFileUpload.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/6/18 15:43 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\Test; | ||
| 11 | + | ||
| 12 | +use App\Models\File\File; | ||
| 13 | +use App\Models\Product\Product; | ||
| 14 | +use App\Services\ProjectServer; | ||
| 15 | +use Illuminate\Console\Command; | ||
| 16 | +use Illuminate\Support\Facades\DB; | ||
| 17 | + | ||
| 18 | +class ProductFileUpload extends Command | ||
| 19 | +{ | ||
| 20 | + /** | ||
| 21 | + * The name and signature of the console command. | ||
| 22 | + * | ||
| 23 | + * @var string | ||
| 24 | + */ | ||
| 25 | + protected $signature = 'files_upload {project_id}'; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * The console command description. | ||
| 29 | + * | ||
| 30 | + * @var string | ||
| 31 | + */ | ||
| 32 | + protected $description = '重新上传文件获取文件后缀'; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * @remark : | ||
| 36 | + * @name :handle | ||
| 37 | + * @author :lyh | ||
| 38 | + * @method :post | ||
| 39 | + * @time :2024/6/18 15:46 | ||
| 40 | + */ | ||
| 41 | + public function handle(){ | ||
| 42 | + $project_id = $this->argument('project_id'); | ||
| 43 | + ProjectServer::useProject($project_id); | ||
| 44 | + $productModel = new Product(); | ||
| 45 | + $lists = $productModel->list(['status'=>1,'id'=>['<=',106]]); | ||
| 46 | + foreach ($lists as $k => $v){ | ||
| 47 | + if(!empty($v['files']) && !empty($v['files']['url'])){ | ||
| 48 | + $url = str_replace_url($v['files']['url']); | ||
| 49 | + //获取当前图片的原名称 | ||
| 50 | + $files = new File(); | ||
| 51 | + $fileInfo = $files->read(['path'=>$url,'project_id'=>$project_id]); | ||
| 52 | + if($fileInfo === false){ | ||
| 53 | + continue; | ||
| 54 | + } | ||
| 55 | + $newName = $fileInfo['name']; | ||
| 56 | + $code = $this->synchronizationFile($url,$newName); | ||
| 57 | + if((int)$code == 200){ | ||
| 58 | + echo date('Y-m-d H:i:s') . '编辑的path为:'. $url .',主键id:'. $v['id'] . PHP_EOL; | ||
| 59 | + $v['files']['url'] = preg_replace('#/[^/]*$#', '/', $url).$newName; | ||
| 60 | + $productModel->edit(['files'=>json_encode($v['files'])],['id'=>$v['id']]); | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + DB::disconnect('custom_mysql'); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * @remark :指定同步文件到獨立177服務器 | ||
| 69 | + * @name :synchronizationFile | ||
| 70 | + * @author :lyh | ||
| 71 | + * @method :post | ||
| 72 | + * @time :2024/4/8 11:10 | ||
| 73 | + */ | ||
| 74 | + public function synchronizationFile($path_name,$newName){ | ||
| 75 | + //同步到大文件 | ||
| 76 | + $file_path = config('filesystems.disks.cos')['cdn1'].$path_name; | ||
| 77 | + echo date('Y-m-d H:i:s') . '编辑的path为:'. $file_path. PHP_EOL; | ||
| 78 | + $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME); | ||
| 79 | + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" -F "file_name='.$newName.'" https://v6-file.globalso.com/fileUploads.php'; | ||
| 80 | + return shell_exec($cmd); | ||
| 81 | + } | ||
| 82 | +} |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :SyncProjectFile.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/6/18 14:53 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\Test; | ||
| 11 | + | ||
| 12 | +use App\Models\File\ErrorFile; | ||
| 13 | +use App\Models\File\File; | ||
| 14 | +use Illuminate\Console\Command; | ||
| 15 | + | ||
| 16 | +class SyncProjectFile extends Command | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * The name and signature of the console command. | ||
| 20 | + * | ||
| 21 | + * @var string | ||
| 22 | + */ | ||
| 23 | + protected $signature = 'sync_project_file {project_id}'; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * The console command description. | ||
| 27 | + * | ||
| 28 | + * @var string | ||
| 29 | + */ | ||
| 30 | + protected $description = '同步图片与文件'; | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + public function handle(){ | ||
| 34 | + $project_id = $this->argument('project_id'); | ||
| 35 | + $fileModel = new File(); | ||
| 36 | + $lists = $fileModel->list(['project_id'=>$project_id]);//未同步成功的图片及文件 | ||
| 37 | + foreach ($lists as $k => $v){ | ||
| 38 | + if(strpos($v['path'], '/181/') !== false ){ | ||
| 39 | + $code = $this->synchronizationFiles($v['path']); | ||
| 40 | + }else{ | ||
| 41 | + $code = $this->synchronizationFile($v['path']); | ||
| 42 | + } | ||
| 43 | + if((int)$code == 200){ | ||
| 44 | + echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL; | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL; | ||
| 48 | + return true; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * @remark :指定同步文件到獨立177服務器 | ||
| 53 | + * @name :synchronizationFile | ||
| 54 | + * @author :lyh | ||
| 55 | + * @method :post | ||
| 56 | + * @time :2024/4/8 11:10 | ||
| 57 | + */ | ||
| 58 | + public function synchronizationFile($path_name){ | ||
| 59 | + //同步到大文件 | ||
| 60 | + $file_path = config('filesystems.disks.cos')['cdn1'].$path_name; | ||
| 61 | + $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME); | ||
| 62 | + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php'; | ||
| 63 | + return shell_exec($cmd); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + public function synchronizationFiles($path_name){ | ||
| 68 | + //同步到大文件 | ||
| 69 | + $file_path = config('filesystems.disks.s3')['cdn'].$path_name; | ||
| 70 | + $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME); | ||
| 71 | + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php'; | ||
| 72 | + return shell_exec($cmd); | ||
| 73 | + } | ||
| 74 | +} |
| @@ -34,44 +34,63 @@ class Temp extends Command | @@ -34,44 +34,63 @@ class Temp extends Command | ||
| 34 | */ | 34 | */ |
| 35 | protected $description = '临时脚本'; | 35 | protected $description = '临时脚本'; |
| 36 | 36 | ||
| 37 | - public function handle() | ||
| 38 | - { | ||
| 39 | - $domain_model = new DomainInfo(); | ||
| 40 | - $notify_model = new Notify(); | ||
| 41 | - $project_model = new Project(); | ||
| 42 | - | ||
| 43 | - $domain_list = $domain_model->list(['amp_status' => 1]); | ||
| 44 | - foreach ($domain_list as $info) { | ||
| 45 | - if ($info['project_id'] > 0) { | ||
| 46 | - $notify_info = $notify_model->read(['project_id' => $info['project_id'], 'type' => 3]); | ||
| 47 | - if (!$notify_info) { | ||
| 48 | - | ||
| 49 | - $domain_array = parse_url($info['domain']); | ||
| 50 | - $host = $domain_array['host'] ?? $domain_array['path']; | ||
| 51 | - $host_array = explode('.', $host); | ||
| 52 | - if (count($host_array) <= 2) { | ||
| 53 | - array_unshift($host_array, 'm'); | ||
| 54 | - } else { | ||
| 55 | - $host_array[0] = 'm'; | ||
| 56 | - } | ||
| 57 | - $amp_domain = implode('.', $host_array); | 37 | + public function handle(){ |
| 38 | + ProjectServer::useProject(1515); | ||
| 58 | 39 | ||
| 59 | - $project_info = $project_model->read(['id' => $info['project_id']]); | 40 | + $products = Product::select(['id','content'])->get(); |
| 60 | 41 | ||
| 61 | - $notify_model->add([ | ||
| 62 | - 'project_id' => $info['project_id'], | ||
| 63 | - 'type' => 3, | ||
| 64 | - 'data' => json_encode(['domain' => $amp_domain, 'url' => [], 'language' => []]), | ||
| 65 | - 'server_id' => $project_info['serve_id'], | ||
| 66 | - ]); | ||
| 67 | - } | ||
| 68 | - } | 42 | + foreach ($products as $product){ |
| 43 | + $content = $product->content; | ||
| 44 | + $content = str_replace('<h1','<h2', $content); | ||
| 45 | + $content = str_replace('</h1','</h2', $content); | ||
| 46 | + | ||
| 47 | + $product->content = $content; | ||
| 48 | + $product->save(); | ||
| 49 | + | ||
| 50 | + $this->output('productID:'.$product->id.',success'); | ||
| 69 | } | 51 | } |
| 52 | + | ||
| 53 | + $this->output('end'); | ||
| 70 | } | 54 | } |
| 71 | 55 | ||
| 72 | // public function handle() | 56 | // public function handle() |
| 73 | // { | 57 | // { |
| 74 | // $domain_model = new DomainInfo(); | 58 | // $domain_model = new DomainInfo(); |
| 59 | +// $notify_model = new Notify(); | ||
| 60 | +// $project_model = new Project(); | ||
| 61 | +// | ||
| 62 | +// $domain_list = $domain_model->list(['amp_status' => 1]); | ||
| 63 | +// foreach ($domain_list as $info) { | ||
| 64 | +// if ($info['project_id'] > 0) { | ||
| 65 | +// $notify_info = $notify_model->read(['project_id' => $info['project_id'], 'type' => 3]); | ||
| 66 | +// if (!$notify_info) { | ||
| 67 | +// | ||
| 68 | +// $domain_array = parse_url($info['domain']); | ||
| 69 | +// $host = $domain_array['host'] ?? $domain_array['path']; | ||
| 70 | +// $host_array = explode('.', $host); | ||
| 71 | +// if (count($host_array) <= 2) { | ||
| 72 | +// array_unshift($host_array, 'm'); | ||
| 73 | +// } else { | ||
| 74 | +// $host_array[0] = 'm'; | ||
| 75 | +// } | ||
| 76 | +// $amp_domain = implode('.', $host_array); | ||
| 77 | +// | ||
| 78 | +// $project_info = $project_model->read(['id' => $info['project_id']]); | ||
| 79 | +// | ||
| 80 | +// $notify_model->add([ | ||
| 81 | +// 'project_id' => $info['project_id'], | ||
| 82 | +// 'type' => 3, | ||
| 83 | +// 'data' => json_encode(['domain' => $amp_domain, 'url' => [], 'language' => []]), | ||
| 84 | +// 'server_id' => $project_info['serve_id'], | ||
| 85 | +// ]); | ||
| 86 | +// } | ||
| 87 | +// } | ||
| 88 | +// } | ||
| 89 | +// } | ||
| 90 | + | ||
| 91 | +// public function handle() | ||
| 92 | +// { | ||
| 93 | +// $domain_model = new DomainInfo(); | ||
| 75 | // $server_model = new ServerConfig(); | 94 | // $server_model = new ServerConfig(); |
| 76 | // $project_model = new Project(); | 95 | // $project_model = new Project(); |
| 77 | // | 96 | // |
| @@ -108,7 +108,15 @@ class KeywordVideoController extends BaseController | @@ -108,7 +108,15 @@ class KeywordVideoController extends BaseController | ||
| 108 | if($info === false){ | 108 | if($info === false){ |
| 109 | $this->response('请先设置域名',Code::SYSTEM_ERROR); | 109 | $this->response('请先设置域名',Code::SYSTEM_ERROR); |
| 110 | } | 110 | } |
| 111 | - $rs = $keywordModel->add($this->param); | 111 | + //组装数据 |
| 112 | + $data = [ | ||
| 113 | + 'project_id'=>$this->param['project_id'], | ||
| 114 | + 'number'=>$this->param['number'], | ||
| 115 | + 'status'=>$this->param['status'] ?? 0, | ||
| 116 | + 'sort'=>$this->param['sort'] ?? 0, | ||
| 117 | + 'keywords'=>$this->param['keywords'] ?? '', | ||
| 118 | + ]; | ||
| 119 | + $rs = $keywordModel->add($data); | ||
| 112 | if($rs === false){ | 120 | if($rs === false){ |
| 113 | $this->response('添加失败',Code::SYSTEM_ERROR); | 121 | $this->response('添加失败',Code::SYSTEM_ERROR); |
| 114 | } | 122 | } |
| @@ -129,9 +137,6 @@ class KeywordVideoController extends BaseController | @@ -129,9 +137,6 @@ class KeywordVideoController extends BaseController | ||
| 129 | 'id.required' => '主键标识不为空', | 137 | 'id.required' => '主键标识不为空', |
| 130 | ]); | 138 | ]); |
| 131 | $keywordModel = new KeywordVideoTask(); | 139 | $keywordModel = new KeywordVideoTask(); |
| 132 | - if($this->param['status'] == 0){ | ||
| 133 | - $this->param['num'] = $this->param['number']; | ||
| 134 | - } | ||
| 135 | $rs = $keywordModel->edit($this->param,['id'=>$this->param['id']]); | 140 | $rs = $keywordModel->edit($this->param,['id'=>$this->param['id']]); |
| 136 | if($rs === false){ | 141 | if($rs === false){ |
| 137 | $this->response('编辑失败',Code::SYSTEM_ERROR); | 142 | $this->response('编辑失败',Code::SYSTEM_ERROR); |
| @@ -157,4 +162,19 @@ class KeywordVideoController extends BaseController | @@ -157,4 +162,19 @@ class KeywordVideoController extends BaseController | ||
| 157 | $this->response('success',Code::SUCCESS,$list); | 162 | $this->response('success',Code::SUCCESS,$list); |
| 158 | } | 163 | } |
| 159 | 164 | ||
| 165 | + | ||
| 166 | + /** | ||
| 167 | + * @remark :获取任务数量 | ||
| 168 | + * @name :taskNum | ||
| 169 | + * @author :lyh | ||
| 170 | + * @method :post | ||
| 171 | + * @time :2024/6/13 16:16 | ||
| 172 | + */ | ||
| 173 | + public function taskNum(){ | ||
| 174 | + $keywordModel = new KeywordVideoTask(); | ||
| 175 | + $data['total'] = $keywordModel->count(); | ||
| 176 | + $data['start_total'] = $keywordModel->formatQuery(['status'=>0])->count(); | ||
| 177 | + $data['end_total'] = $keywordModel->formatQuery(['status'=>1])->count(); | ||
| 178 | + $this->response('success',Code::SUCCESS,$data); | ||
| 179 | + } | ||
| 160 | } | 180 | } |
| @@ -13,6 +13,7 @@ use App\Http\Controllers\Bside\BaseController; | @@ -13,6 +13,7 @@ use App\Http\Controllers\Bside\BaseController; | ||
| 13 | use App\Models\Com\UpdateLog; | 13 | use App\Models\Com\UpdateLog; |
| 14 | use App\Models\Com\UpdateOldInfo; | 14 | use App\Models\Com\UpdateOldInfo; |
| 15 | use App\Models\Domain\DomainInfo; | 15 | use App\Models\Domain\DomainInfo; |
| 16 | +use App\Models\News\NewsCategory; | ||
| 16 | use App\Models\Product\Category; | 17 | use App\Models\Product\Category; |
| 17 | use App\Models\Project\ProjectUpdateTdk; | 18 | use App\Models\Project\ProjectUpdateTdk; |
| 18 | use App\Models\Template\BTemplate; | 19 | use App\Models\Template\BTemplate; |
| @@ -96,17 +97,36 @@ class UpdateController extends BaseController | @@ -96,17 +97,36 @@ class UpdateController extends BaseController | ||
| 96 | $this->fail('已上线项目需填写采集的测试站域名'); | 97 | $this->fail('已上线项目需填写采集的测试站域名'); |
| 97 | } | 98 | } |
| 98 | 99 | ||
| 100 | + $product_cate_type = 0;//产品分类是否重采 | ||
| 101 | + $news_cate_type = 0;//新闻分类是否重采 | ||
| 102 | + | ||
| 99 | if ($this->param['type'] == 1) { | 103 | if ($this->param['type'] == 1) { |
| 100 | - //产品分类重采之前,判断产品分类是否开启了可视化 | ||
| 101 | - $category_list = Category::where('project_id', $this->param['project_id'])->get(); | ||
| 102 | - if ($category_list->count() > 0) { | 104 | + $product_cate_type = 1; |
| 105 | + $news_cate_type = 1; | ||
| 106 | + | ||
| 103 | $bSettingModel = new Setting(); | 107 | $bSettingModel = new Setting(); |
| 104 | $template_info = $bSettingModel->read(['project_id' => $this->param['project_id']]); | 108 | $template_info = $bSettingModel->read(['project_id' => $this->param['project_id']]); |
| 105 | $template_id = $template_info ? $template_info['template_id'] : 0;//获取模版id | 109 | $template_id = $template_info ? $template_info['template_id'] : 0;//获取模版id |
| 110 | + | ||
| 111 | + //产品分类重采之前,判断产品分类是否开启了可视化 | ||
| 112 | + $category_list = Category::where('project_id', $this->param['project_id'])->get(); | ||
| 113 | + if ($category_list->count() > 0) { | ||
| 106 | foreach ($category_list as $category) { | 114 | foreach ($category_list as $category) { |
| 107 | if ($this->getRenovation($this->param['project_id'], BTemplate::SOURCE_PRODUCT, BTemplate::IS_LIST, $template_id, $category['id']) == 1) { | 115 | if ($this->getRenovation($this->param['project_id'], BTemplate::SOURCE_PRODUCT, BTemplate::IS_LIST, $template_id, $category['id']) == 1) { |
| 108 | //有分类开启了可视化 | 116 | //有分类开启了可视化 |
| 109 | - $this->param['type'] = 0; | 117 | + $product_cate_type = 0; |
| 118 | + break; | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + //新闻分类重采之前,判断新闻分类是否开启了可视化 | ||
| 124 | + $category_news_list = NewsCategory::where('project_id', $this->param['project_id'])->get(); | ||
| 125 | + if ($category_news_list->count() > 0) { | ||
| 126 | + foreach ($category_news_list as $category_news) { | ||
| 127 | + if ($this->getRenovation($this->param['project_id'], BTemplate::SOURCE_NEWS, BTemplate::IS_LIST, $template_id, $category_news['id']) == 1) { | ||
| 128 | + //有分类开启了可视化 | ||
| 129 | + $news_cate_type = 0; | ||
| 110 | break; | 130 | break; |
| 111 | } | 131 | } |
| 112 | } | 132 | } |
| @@ -143,13 +163,20 @@ class UpdateController extends BaseController | @@ -143,13 +163,20 @@ class UpdateController extends BaseController | ||
| 143 | } | 163 | } |
| 144 | } | 164 | } |
| 145 | 165 | ||
| 146 | - if ($this->param['type'] == 1) { | 166 | + if ($product_cate_type == 1) { |
| 147 | //需要重新采集产品分类 | 167 | //需要重新采集产品分类 |
| 148 | DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category`"); | 168 | DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category`"); |
| 149 | DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category_related`"); | 169 | DB::connection('custom_mysql')->statement("TRUNCATE `gl_product_category_related`"); |
| 150 | 170 | ||
| 151 | DB::connection('custom_mysql')->statement("DELETE FROM `gl_route_map` WHERE `source` = 'product_category'"); | 171 | DB::connection('custom_mysql')->statement("DELETE FROM `gl_route_map` WHERE `source` = 'product_category'"); |
| 152 | } | 172 | } |
| 173 | + | ||
| 174 | + if ($news_cate_type == 1) { | ||
| 175 | + //需要重新采集新闻分类 | ||
| 176 | + DB::connection('custom_mysql')->statement("TRUNCATE `gl_news_category`"); | ||
| 177 | + | ||
| 178 | + DB::connection('custom_mysql')->statement("DELETE FROM `gl_route_map` WHERE `source` = 'news_category'"); | ||
| 179 | + } | ||
| 153 | } catch (\Exception $e) { | 180 | } catch (\Exception $e) { |
| 154 | errorLog('重新采集升级项目数据', $this->param, $e); | 181 | errorLog('重新采集升级项目数据', $this->param, $e); |
| 155 | 182 | ||
| @@ -171,14 +198,19 @@ class UpdateController extends BaseController | @@ -171,14 +198,19 @@ class UpdateController extends BaseController | ||
| 171 | $old_info->save(); | 198 | $old_info->save(); |
| 172 | } | 199 | } |
| 173 | 200 | ||
| 174 | - if ($this->param['type'] == 1) { | ||
| 175 | - //需要重新采集产品分类,只排除新闻分类 | ||
| 176 | - $not_api_type = ['category_news']; | 201 | + if ($product_cate_type == 1 && $news_cate_type == 1) { |
| 202 | + //需要重新采集产品分类和新闻分类 | ||
| 203 | + $logs = UpdateLog::where('project_id', $this->param['project_id'])->orderBy('sort', 'asc')->get(); | ||
| 204 | + } elseif ($product_cate_type == 1 && $news_cate_type == 0) { | ||
| 205 | + //只重采产品分类 | ||
| 206 | + $logs = UpdateLog::where('project_id', $this->param['project_id'])->where('api_type', '!=', 'category_news')->orderBy('sort', 'asc')->get(); | ||
| 207 | + } elseif ($product_cate_type == 0 && $news_cate_type == 1) { | ||
| 208 | + //只重采新闻分类 | ||
| 209 | + $logs = UpdateLog::where('project_id', $this->param['project_id'])->where('api_type', '!=', 'category')->orderBy('sort', 'asc')->get(); | ||
| 177 | } else { | 210 | } else { |
| 178 | - //无需重新采集产品分类,排除产品分类和新闻分类 | ||
| 179 | - $not_api_type = ['category', 'category_news']; | 211 | + //分类都不重采 |
| 212 | + $logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', ['category', 'category_news'])->orderBy('sort', 'asc')->get(); | ||
| 180 | } | 213 | } |
| 181 | - $logs = UpdateLog::where('project_id', $this->param['project_id'])->whereNotIn('api_type', $not_api_type)->orderBy('sort', 'asc')->get(); | ||
| 182 | 214 | ||
| 183 | foreach ($logs as $log) { | 215 | foreach ($logs as $log) { |
| 184 | $log->status = 0; | 216 | $log->status = 0; |
| @@ -214,6 +214,9 @@ class OptimizeController extends BaseController | @@ -214,6 +214,9 @@ class OptimizeController extends BaseController | ||
| 214 | if(isset($this->map['title']) && !empty($this->map['title'])){ | 214 | if(isset($this->map['title']) && !empty($this->map['title'])){ |
| 215 | $query = $query->where('gl_project.title','like','%'.$this->map['title'].'%'); | 215 | $query = $query->where('gl_project.title','like','%'.$this->map['title'].'%'); |
| 216 | } | 216 | } |
| 217 | + if(isset($this->map['ai_video']) && !empty($this->map['ai_video'])){ | ||
| 218 | + $query = $query->where('gl_project_deploy_optimize.ai_video',$this->map['ai_video']); | ||
| 219 | + } | ||
| 217 | if(isset($this->map['amp_status'])){ | 220 | if(isset($this->map['amp_status'])){ |
| 218 | $query = $query->where('gl_domain_info.amp_status',$this->map['amp_status']); | 221 | $query = $query->where('gl_domain_info.amp_status',$this->map['amp_status']); |
| 219 | } | 222 | } |
| @@ -105,6 +105,7 @@ class ProjectController extends BaseController | @@ -105,6 +105,7 @@ class ProjectController extends BaseController | ||
| 105 | 'gl_project_deploy_build.tech_mid AS tech_mid', | 105 | 'gl_project_deploy_build.tech_mid AS tech_mid', |
| 106 | 'gl_project_deploy_build.test_domain AS test_domain', | 106 | 'gl_project_deploy_build.test_domain AS test_domain', |
| 107 | 'gl_project_deploy_build.plan AS plan', | 107 | 'gl_project_deploy_build.plan AS plan', |
| 108 | + 'gl_project_deploy_build.is_participle AS is_participle', | ||
| 108 | 'gl_project_deploy_optimize.dept_id AS optimize_dept_id', | 109 | 'gl_project_deploy_optimize.dept_id AS optimize_dept_id', |
| 109 | 'gl_project_deploy_optimize.manager_mid AS optimize_manager_mid', | 110 | 'gl_project_deploy_optimize.manager_mid AS optimize_manager_mid', |
| 110 | 'gl_project_deploy_optimize.optimist_mid AS optimize_optimist_mid', | 111 | 'gl_project_deploy_optimize.optimist_mid AS optimize_optimist_mid', |
| @@ -367,7 +368,6 @@ class ProjectController extends BaseController | @@ -367,7 +368,6 @@ class ProjectController extends BaseController | ||
| 367 | $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); | 368 | $item['task_finish_num'] = Task::getNumByProjectId($item['id'], Task::STATUS_DOWN); |
| 368 | $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]); | 369 | $item['task_pending_num'] = Task::getNumByProjectId($item['id'], [Task::STATUS_DONGING, Task::STATUS_WAIT]); |
| 369 | $item['collect_time'] = $item['is_upgrade'] ? UpdateLog::getProjectUpdate($item['id']) : ''; | 370 | $item['collect_time'] = $item['is_upgrade'] ? UpdateLog::getProjectUpdate($item['id']) : ''; |
| 370 | - | ||
| 371 | return $item; | 371 | return $item; |
| 372 | } | 372 | } |
| 373 | 373 | ||
| @@ -389,6 +389,23 @@ class ProjectController extends BaseController | @@ -389,6 +389,23 @@ class ProjectController extends BaseController | ||
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | /** | 391 | /** |
| 392 | + * @remark :逻辑删除 | ||
| 393 | + * @name :deleteMinorLanguages | ||
| 394 | + * @author :lyh | ||
| 395 | + * @method :post | ||
| 396 | + * @time :2024/6/18 11:53 | ||
| 397 | + */ | ||
| 398 | + public function deleteMinorLanguages(ProjectLogic $logic){ | ||
| 399 | + $this->request->validate([ | ||
| 400 | + 'id'=>'required' | ||
| 401 | + ],[ | ||
| 402 | + 'id.required' => 'ID不能为空' | ||
| 403 | + ]); | ||
| 404 | + $data = $logic->deleteMinorLanguages(); | ||
| 405 | + $this->response('success',Code::SUCCESS,$data); | ||
| 406 | + } | ||
| 407 | + | ||
| 408 | + /** | ||
| 392 | * @remark :保存数据 | 409 | * @remark :保存数据 |
| 393 | * @name :save | 410 | * @name :save |
| 394 | * @author :lyh | 411 | * @author :lyh |
| @@ -1007,4 +1024,23 @@ class ProjectController extends BaseController | @@ -1007,4 +1024,23 @@ class ProjectController extends BaseController | ||
| 1007 | $this->response('success'); | 1024 | $this->response('success'); |
| 1008 | } | 1025 | } |
| 1009 | 1026 | ||
| 1027 | + /** | ||
| 1028 | + * @remark :开启与关闭分词搜索 | ||
| 1029 | + * @name :setIsParticiple | ||
| 1030 | + * @author :lyh | ||
| 1031 | + * @method :post | ||
| 1032 | + * @time :2024/6/19 10:07 | ||
| 1033 | + */ | ||
| 1034 | + public function setIsParticiple(){ | ||
| 1035 | + $this->request->validate([ | ||
| 1036 | + 'project_id'=>'required', | ||
| 1037 | + 'is_participle'=>'required' | ||
| 1038 | + ],[ | ||
| 1039 | + 'project_id.required' => '项目id不能为空', | ||
| 1040 | + 'is_participle.required' => '项目id不能为空', | ||
| 1041 | + ]); | ||
| 1042 | + $deployBuildModel = new DeployBuild(); | ||
| 1043 | + $deployBuildModel->edit(['is_participle'=>$this->param['is_participle']],['project_id'=>$this->param['project_id']]); | ||
| 1044 | + $this->response('success'); | ||
| 1045 | + } | ||
| 1010 | } | 1046 | } |
| @@ -343,11 +343,11 @@ class FileController | @@ -343,11 +343,11 @@ class FileController | ||
| 343 | $this->response('指定文件不存在!', Code::USER_ERROR); | 343 | $this->response('指定文件不存在!', Code::USER_ERROR); |
| 344 | } | 344 | } |
| 345 | $fileUrl = getFileUrl($info['path'],$info['is_cos']); | 345 | $fileUrl = getFileUrl($info['path'],$info['is_cos']); |
| 346 | -// $fileName = basename($fileUrl); // 要保存的文件名 | ||
| 347 | // 设置响应头 | 346 | // 设置响应头 |
| 348 | header('Content-Description: File Transfer'); | 347 | header('Content-Description: File Transfer'); |
| 349 | header('Content-Type: application/octet-stream'); | 348 | header('Content-Type: application/octet-stream'); |
| 350 | - header('Content-Disposition: attachment; filename="' . !empty($info['name']) ? $info['name'] : '未命名'.basename($info['path']) . '"'); | 349 | + $name = !empty($info['name']) ? $info['name'] : '未命名'.basename($info['path']); |
| 350 | + header('Content-Disposition: attachment; filename="'.$name.'"'); | ||
| 351 | // 下载文件 | 351 | // 下载文件 |
| 352 | readfile($fileUrl); | 352 | readfile($fileUrl); |
| 353 | } | 353 | } |
| @@ -197,14 +197,11 @@ class ImageController extends Controller | @@ -197,14 +197,11 @@ class ImageController extends Controller | ||
| 197 | if($image_hash !== false){ | 197 | if($image_hash !== false){ |
| 198 | return $this->response('图片资源',Code::SUCCESS,$this->responseData($image_hash['path'], $name)); | 198 | return $this->response('图片资源',Code::SUCCESS,$this->responseData($image_hash['path'], $name)); |
| 199 | } | 199 | } |
| 200 | - //保存路径 | ||
| 201 | - $url = $this->config['root'].$this->path; | ||
| 202 | $image_type = $files->getClientOriginalExtension(); | 200 | $image_type = $files->getClientOriginalExtension(); |
| 203 | if(strlen($image_type) > 7){ | 201 | if(strlen($image_type) > 7){ |
| 204 | $this->response('不支持当前格式',Code::SYSTEM_ERROR); | 202 | $this->response('不支持当前格式',Code::SYSTEM_ERROR); |
| 205 | } | 203 | } |
| 206 | $fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0); | 204 | $fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0); |
| 207 | - | ||
| 208 | //上传到cos | 205 | //上传到cos |
| 209 | if($this->upload_location == 0){ | 206 | if($this->upload_location == 0){ |
| 210 | $cosService = new CosService(); | 207 | $cosService = new CosService(); |
| @@ -290,14 +287,10 @@ class ImageController extends Controller | @@ -290,14 +287,10 @@ class ImageController extends Controller | ||
| 290 | 'name'=>$name, | 287 | 'name'=>$name, |
| 291 | 'en_name'=>$fileName | 288 | 'en_name'=>$fileName |
| 292 | ]; | 289 | ]; |
| 293 | - $imageModel = new ImageModel(); | ||
| 294 | - $info = $imageModel->read(['hash'=>$hash,'project_id'=>$this->cache['project_id'] ?? 0]); | ||
| 295 | - if($info === false){ | ||
| 296 | $rs = $imageModel->add($data); | 290 | $rs = $imageModel->add($data); |
| 297 | if ($rs === false) { | 291 | if ($rs === false) { |
| 298 | return $this->response('添加失败', Code::USER_ERROR); | 292 | return $this->response('添加失败', Code::USER_ERROR); |
| 299 | } | 293 | } |
| 300 | - } | ||
| 301 | return true; | 294 | return true; |
| 302 | } | 295 | } |
| 303 | 296 | ||
| @@ -325,9 +318,9 @@ class ImageController extends Controller | @@ -325,9 +318,9 @@ class ImageController extends Controller | ||
| 325 | private function multi(&$files) { | 318 | private function multi(&$files) { |
| 326 | $data = []; | 319 | $data = []; |
| 327 | foreach ($files as $file) { | 320 | foreach ($files as $file) { |
| 328 | - $imageModel = new ImageModel(); | 321 | + try { |
| 329 | $hash = hash_file('sha256', $file->getPathname()); | 322 | $hash = hash_file('sha256', $file->getPathname()); |
| 330 | - $name = $file->getClientOriginalName(); | 323 | + $imageModel = new ImageModel(); |
| 331 | //查看图片是否已上传 | 324 | //查看图片是否已上传 |
| 332 | $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)]; | 325 | $param = ['hash'=>$hash,'refer'=>$this->param['refer'] ?? 0,'is_cos'=>(($this->upload_location == 0) ? 1 : 0)]; |
| 333 | if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ | 326 | if(isset($this->cache['project_id']) && !empty($this->cache['project_id'])){ |
| @@ -335,11 +328,13 @@ class ImageController extends Controller | @@ -335,11 +328,13 @@ class ImageController extends Controller | ||
| 335 | } | 328 | } |
| 336 | $image_hash = $imageModel->read($param); | 329 | $image_hash = $imageModel->read($param); |
| 337 | if($image_hash !== false){ | 330 | if($image_hash !== false){ |
| 338 | - $data[] = $this->responseData($image_hash['path']); | 331 | + $data[] = $this->responseData($image_hash['path'],$image_hash['name']); |
| 339 | continue; | 332 | continue; |
| 340 | } | 333 | } |
| 341 | - $image_type = $file->getClientOriginalExtension(); | 334 | + $name = $file->getClientOriginalName(); |
| 342 | $fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0); | 335 | $fileName = $this->getOnlyFilename($name,$param['project_id'] ?? 0); |
| 336 | + $image_type = $file->getClientOriginalExtension(); | ||
| 337 | + $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); | ||
| 343 | //同步数据到cos | 338 | //同步数据到cos |
| 344 | if($this->upload_location == 0){ | 339 | if($this->upload_location == 0){ |
| 345 | $cosService = new CosService(); | 340 | $cosService = new CosService(); |
| @@ -349,10 +344,11 @@ class ImageController extends Controller | @@ -349,10 +344,11 @@ class ImageController extends Controller | ||
| 349 | $amazonS3Service = new AmazonS3Service(); | 344 | $amazonS3Service = new AmazonS3Service(); |
| 350 | $amazonS3Service->uploadFiles($file,$this->path,$fileName); | 345 | $amazonS3Service->uploadFiles($file,$this->path,$fileName); |
| 351 | } | 346 | } |
| 352 | - //批量存储 | ||
| 353 | - $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); | ||
| 354 | $this->synchronizationImage($fileName,$this->upload_location); | 347 | $this->synchronizationImage($fileName,$this->upload_location); |
| 355 | $data[] = $this->responseData($this->path.'/'.$fileName,$name); | 348 | $data[] = $this->responseData($this->path.'/'.$fileName,$name); |
| 349 | + }catch (\Exception $e){ | ||
| 350 | + $this->response('图片资源',Code::SUCCESS,$data); | ||
| 351 | + } | ||
| 356 | } | 352 | } |
| 357 | $this->response('图片资源',Code::SUCCESS,$data); | 353 | $this->response('图片资源',Code::SUCCESS,$data); |
| 358 | } | 354 | } |
| @@ -77,7 +77,6 @@ class ProjectLogic extends BaseLogic | @@ -77,7 +77,6 @@ class ProjectLogic extends BaseLogic | ||
| 77 | public function getProjectInfo($id){ | 77 | public function getProjectInfo($id){ |
| 78 | $info = $this->model->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check', 'project_after','inquiry_filter_config','web_traffic_config'])->where(['id'=>$id])->first()->toArray(); | 78 | $info = $this->model->with(['payment', 'deploy_build', 'deploy_optimize', 'online_check', 'project_after','inquiry_filter_config','web_traffic_config'])->where(['id'=>$id])->first()->toArray(); |
| 79 | $info['online_check']['name'] = (new Manage())->getName($info['online_check']['created_manage_id'] ?? 0); | 79 | $info['online_check']['name'] = (new Manage())->getName($info['online_check']['created_manage_id'] ?? 0); |
| 80 | - $info['deploy_optimize']['minor_keywords'] = !empty($info['deploy_optimize']['minor_keywords']) ? json_decode($info['deploy_optimize']['minor_keywords']) : []; | ||
| 81 | $info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain']; | 80 | $info['init_domain'] = $this->getInitDomain($info['serve_id'])['domain']; |
| 82 | if($info['extend_type'] != 0){ | 81 | if($info['extend_type'] != 0){ |
| 83 | $info['type'] = $info['extend_type']; | 82 | $info['type'] = $info['extend_type']; |
| @@ -99,12 +98,27 @@ class ProjectLogic extends BaseLogic | @@ -99,12 +98,27 @@ class ProjectLogic extends BaseLogic | ||
| 99 | if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){ | 98 | if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){ |
| 100 | $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']); | 99 | $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']); |
| 101 | } | 100 | } |
| 101 | + //获取小语种 | ||
| 102 | + $info['minor_languages'] = $this->getProjectMinorLanguages($id); | ||
| 102 | //升级项目采集完成时间 | 103 | //升级项目采集完成时间 |
| 103 | $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : ''; | 104 | $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : ''; |
| 104 | return $this->success($info); | 105 | return $this->success($info); |
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | /** | 108 | /** |
| 109 | + * @remark :获取当前项目的小语种配置 | ||
| 110 | + * @name :getProjectMinorLanguages | ||
| 111 | + * @author :lyh | ||
| 112 | + * @method :post | ||
| 113 | + * @time :2024/6/18 11:05 | ||
| 114 | + */ | ||
| 115 | + public function getProjectMinorLanguages($project_id){ | ||
| 116 | + $projectMinorLanguagesModel = new MinorLanguages(); | ||
| 117 | + $lists = $projectMinorLanguagesModel->list(['project_id'=>$project_id,'is_delete'=>0]); | ||
| 118 | + return $this->success($lists); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + /** | ||
| 108 | * @remark :获取初始域名 | 122 | * @remark :获取初始域名 |
| 109 | * @name :getInitDomain | 123 | * @name :getInitDomain |
| 110 | * @author :lyh | 124 | * @author :lyh |
| @@ -149,8 +163,11 @@ class ProjectLogic extends BaseLogic | @@ -149,8 +163,11 @@ class ProjectLogic extends BaseLogic | ||
| 149 | $this->saveProjectDeployOptimize($this->param['deploy_optimize']); | 163 | $this->saveProjectDeployOptimize($this->param['deploy_optimize']); |
| 150 | //保存售后信息 | 164 | //保存售后信息 |
| 151 | $this->saveProjectAfter($this->param['project_after']); | 165 | $this->saveProjectAfter($this->param['project_after']); |
| 152 | - $this->saveMinorLanguages($this->param['deploy_optimize']['minor_languages'] ?? []); | 166 | + //单独保存小语种配置 |
| 167 | + $this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']); | ||
| 168 | + //同步图片文件 | ||
| 153 | $this->syncImageFile($this->param['project_location'],$this->param['id']); | 169 | $this->syncImageFile($this->param['project_location'],$this->param['id']); |
| 170 | + //同步信息表 | ||
| 154 | (new SyncService())->projectAcceptAddress($this->param['id']); | 171 | (new SyncService())->projectAcceptAddress($this->param['id']); |
| 155 | } | 172 | } |
| 156 | // DB::commit(); | 173 | // DB::commit(); |
| @@ -161,6 +178,13 @@ class ProjectLogic extends BaseLogic | @@ -161,6 +178,13 @@ class ProjectLogic extends BaseLogic | ||
| 161 | return $this->success(); | 178 | return $this->success(); |
| 162 | } | 179 | } |
| 163 | 180 | ||
| 181 | + /** | ||
| 182 | + * @remark :危险项目同步图片与文件 | ||
| 183 | + * @name :syncImageFile | ||
| 184 | + * @author :lyh | ||
| 185 | + * @method :post | ||
| 186 | + * @time :2024/6/18 10:51 | ||
| 187 | + */ | ||
| 164 | public function syncImageFile($location,$project_id){ | 188 | public function syncImageFile($location,$project_id){ |
| 165 | if($location == 1){ | 189 | if($location == 1){ |
| 166 | CopyImageFileJob::dispatch(['project_id'=>$project_id]); | 190 | CopyImageFileJob::dispatch(['project_id'=>$project_id]); |
| @@ -176,6 +200,8 @@ class ProjectLogic extends BaseLogic | @@ -176,6 +200,8 @@ class ProjectLogic extends BaseLogic | ||
| 176 | * @time :2023/8/30 12:14 | 200 | * @time :2023/8/30 12:14 |
| 177 | */ | 201 | */ |
| 178 | public function saveProject($param){ | 202 | public function saveProject($param){ |
| 203 | +// unset($param['payment'],$param['deploy_build'],$param['deploy_optimize'], | ||
| 204 | +// $param['online_check'],$param['project_after'],$param['inquiry_filter_config'],$param['minor_languages']); | ||
| 179 | if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){ | 205 | if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){ |
| 180 | $param['uptime'] = date('Y-m-d H:i:s'); | 206 | $param['uptime'] = date('Y-m-d H:i:s'); |
| 181 | } | 207 | } |
| @@ -207,8 +233,6 @@ class ProjectLogic extends BaseLogic | @@ -207,8 +233,6 @@ class ProjectLogic extends BaseLogic | ||
| 207 | } | 233 | } |
| 208 | $param['remain_day'] = $param['deploy_build']['service_duration'] - $param['finish_remain_day']; | 234 | $param['remain_day'] = $param['deploy_build']['service_duration'] - $param['finish_remain_day']; |
| 209 | $param['remain_day'] = ($param['remain_day'] > 0) ? $param['remain_day'] : 0; | 235 | $param['remain_day'] = ($param['remain_day'] > 0) ? $param['remain_day'] : 0; |
| 210 | - unset($param['payment'],$param['deploy_build'],$param['deploy_optimize'], | ||
| 211 | - $param['online_check'],$param['project_after'],$param['inquiry_filter_config'],$param['minor_language']); | ||
| 212 | //文件上传默认值 | 236 | //文件上传默认值 |
| 213 | if($param['is_upload_manage']){ | 237 | if($param['is_upload_manage']){ |
| 214 | $param['upload_config'] = [ | 238 | $param['upload_config'] = [ |
| @@ -278,9 +302,7 @@ class ProjectLogic extends BaseLogic | @@ -278,9 +302,7 @@ class ProjectLogic extends BaseLogic | ||
| 278 | //更改域名 | 302 | //更改域名 |
| 279 | $this->editDomainStatus($deploy_optimize['domain'],$deploy_optimize['project_id']); | 303 | $this->editDomainStatus($deploy_optimize['domain'],$deploy_optimize['project_id']); |
| 280 | } | 304 | } |
| 281 | - $deploy_optimize['minor_languages'] = Arr::a2s($deploy_optimize['minor_languages'] ?? []); | ||
| 282 | $deploy_optimize['g_top_plan'] = Arr::a2s($deploy_optimize['g_top_plan'] ?? []); | 305 | $deploy_optimize['g_top_plan'] = Arr::a2s($deploy_optimize['g_top_plan'] ?? []); |
| 283 | - $deploy_optimize['minor_keywords'] = Arr::a2s(!empty($deploy_optimize['minor_keywords']) ? $deploy_optimize['minor_keywords'] : []); | ||
| 284 | $deploy_optimize['special'] = !empty($deploy_optimize['special']) ? ','.trim($deploy_optimize['special'],',').',' : ''; | 306 | $deploy_optimize['special'] = !empty($deploy_optimize['special']) ? ','.trim($deploy_optimize['special'],',').',' : ''; |
| 285 | //是否更新了api_no | 307 | //是否更新了api_no |
| 286 | $api_no = DeployOptimize::where('id', $deploy_optimize['id'])->value('api_no'); | 308 | $api_no = DeployOptimize::where('id', $deploy_optimize['id'])->value('api_no'); |
| @@ -324,30 +346,41 @@ class ProjectLogic extends BaseLogic | @@ -324,30 +346,41 @@ class ProjectLogic extends BaseLogic | ||
| 324 | * @method :post | 346 | * @method :post |
| 325 | * @time :2023/8/30 13:57 | 347 | * @time :2023/8/30 13:57 |
| 326 | */ | 348 | */ |
| 327 | - protected function saveMinorLanguages($minor_language){ | 349 | + protected function saveMinorLanguages($minor_language,$project_id){ |
| 328 | $data = []; | 350 | $data = []; |
| 329 | - //查询数据是否存在 | ||
| 330 | $languageModel = new MinorLanguages(); | 351 | $languageModel = new MinorLanguages(); |
| 331 | - $languageModel->del(['project_id'=>$this->param['id']]); | ||
| 332 | if(!empty($minor_language)){ | 352 | if(!empty($minor_language)){ |
| 333 | $webLanguageModel = new WebLanguage(); | 353 | $webLanguageModel = new WebLanguage(); |
| 334 | $result = []; | 354 | $result = []; |
| 335 | - foreach ($minor_language as $k => $v){ | 355 | + foreach ($minor_language as $v){ |
| 336 | if(!empty($v['lang'])){ | 356 | if(!empty($v['lang'])){ |
| 337 | $zh = $webLanguageModel->read(['short'=>$v['lang']],['chinese']); | 357 | $zh = $webLanguageModel->read(['short'=>$v['lang']],['chinese']); |
| 338 | - if(empty($zh)){ | 358 | + if($zh === false){ |
| 339 | continue; | 359 | continue; |
| 340 | } | 360 | } |
| 361 | + $info = $languageModel->read(['lang'=>$v['lang'],'project_id'=>$project_id]); | ||
| 362 | + if($info === false){ | ||
| 341 | //获取小语种达标天数 | 363 | //获取小语种达标天数 |
| 342 | $result['language'] = $zh['chinese']; | 364 | $result['language'] = $zh['chinese']; |
| 343 | $result['lang'] = $v['lang']; | 365 | $result['lang'] = $v['lang']; |
| 344 | $result['created_at'] = date('Y-m-d H:i:s'); | 366 | $result['created_at'] = date('Y-m-d H:i:s'); |
| 345 | $result['updated_at'] = date('Y-m-d H:i:s'); | 367 | $result['updated_at'] = date('Y-m-d H:i:s'); |
| 346 | - $result['project_id'] = $this->param['id']; | ||
| 347 | - $result['service_day'] = $v['service_day']; | ||
| 348 | - $result['type'] = $v['type']; | ||
| 349 | - $result['keywords'] = $v['keywords']; | 368 | + $result['project_id'] = $project_id; |
| 369 | + $result['service_day'] = $v['service_day'] ?? 50; | ||
| 370 | + $result['type'] = $v['type'] ?? 0; | ||
| 371 | + $result['keywords'] = $v['keywords'] ?? 50; | ||
| 372 | + $result['minor_keywords'] = $v['minor_keywords'] ?? ''; | ||
| 350 | $data[] = $result; | 373 | $data[] = $result; |
| 374 | + }else{ | ||
| 375 | + $editParam = [ | ||
| 376 | + 'service_day'=>$v['service_day'], | ||
| 377 | + 'type'=>$v['type'], | ||
| 378 | + 'keywords'=>$v['keywords'], | ||
| 379 | + 'minor_keywords'=>$v['minor_keywords'] ?? '', | ||
| 380 | + 'is_delete'=>0 | ||
| 381 | + ]; | ||
| 382 | + $languageModel->edit($editParam,['id'=>$info['id']]); | ||
| 383 | + } | ||
| 351 | } | 384 | } |
| 352 | } | 385 | } |
| 353 | if(!empty($data)){ | 386 | if(!empty($data)){ |
| @@ -358,6 +391,18 @@ class ProjectLogic extends BaseLogic | @@ -358,6 +391,18 @@ class ProjectLogic extends BaseLogic | ||
| 358 | } | 391 | } |
| 359 | 392 | ||
| 360 | /** | 393 | /** |
| 394 | + * @remark :删除小语种(主键id) | ||
| 395 | + * @name :deleteMinorLanguages | ||
| 396 | + * @author :lyh | ||
| 397 | + * @method :post | ||
| 398 | + * @time :2024/6/18 11:32 | ||
| 399 | + */ | ||
| 400 | + public function deleteMinorLanguages(){ | ||
| 401 | + $languageModel = new MinorLanguages(); | ||
| 402 | + return $languageModel->edit(['is_delete'=>1],['id'=>$this->param['id']]); | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + /** | ||
| 361 | * @remark :创建初始数据 | 406 | * @remark :创建初始数据 |
| 362 | * @name :createProjectData | 407 | * @name :createProjectData |
| 363 | * @author :lyh | 408 | * @author :lyh |
| @@ -131,7 +131,7 @@ class CustomTemplateLogic extends BaseLogic | @@ -131,7 +131,7 @@ class CustomTemplateLogic extends BaseLogic | ||
| 131 | if($rs === false){ | 131 | if($rs === false){ |
| 132 | $this->fail('系统错误,请联系管理'); | 132 | $this->fail('系统错误,请联系管理'); |
| 133 | } | 133 | } |
| 134 | - $this->setTemplateLog($bSettingInfo['template_id'],$html,$this->param['id']); | 134 | + $this->setTemplateLog($bSettingInfo['template_id'] ?? 0,$html,$this->param['id']); |
| 135 | //通知 | 135 | //通知 |
| 136 | $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']); | 136 | $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']); |
| 137 | $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$info['url']]); | 137 | $this->curlDelRoute(['route'=>$info['url'],'new_route'=>$info['url']]); |
| @@ -45,8 +45,8 @@ class NewsCategoryLogic extends BaseLogic | @@ -45,8 +45,8 @@ class NewsCategoryLogic extends BaseLogic | ||
| 45 | public function newsCategorySave(){ | 45 | public function newsCategorySave(){ |
| 46 | //验证名称是否存在 | 46 | //验证名称是否存在 |
| 47 | $this->verifyParamName($this->param['name']); | 47 | $this->verifyParamName($this->param['name']); |
| 48 | - DB::beginTransaction(); | ||
| 49 | - try { | 48 | +// DB::beginTransaction(); |
| 49 | +// try { | ||
| 50 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 50 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 51 | $id = $this->param['id']; | 51 | $id = $this->param['id']; |
| 52 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | 52 | $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); |
| @@ -62,11 +62,11 @@ class NewsCategoryLogic extends BaseLogic | @@ -62,11 +62,11 @@ class NewsCategoryLogic extends BaseLogic | ||
| 62 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); | 62 | $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); |
| 63 | $this->model->edit(['alias'=>$route],['id'=>$id]); | 63 | $this->model->edit(['alias'=>$route],['id'=>$id]); |
| 64 | } | 64 | } |
| 65 | - DB::commit(); | ||
| 66 | - }catch (\Exception $e){ | ||
| 67 | - DB::rollBack(); | ||
| 68 | - $this->fail('系统错误,请联系管理员'); | ||
| 69 | - } | 65 | +// DB::commit(); |
| 66 | +// }catch (\Exception $e){ | ||
| 67 | +// DB::rollBack(); | ||
| 68 | +// $this->fail('系统错误,请联系管理员'); | ||
| 69 | +// } | ||
| 70 | $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route); | 70 | $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route); |
| 71 | $this->curlDelRoute(['new_route'=>$route]); | 71 | $this->curlDelRoute(['new_route'=>$route]); |
| 72 | return $this->success(['id'=>$id]); | 72 | return $this->success(['id'=>$id]); |
| @@ -79,7 +79,7 @@ class CategoryLogic extends BaseLogic | @@ -79,7 +79,7 @@ class CategoryLogic extends BaseLogic | ||
| 79 | * @time :2023/10/18 15:10 | 79 | * @time :2023/10/18 15:10 |
| 80 | */ | 80 | */ |
| 81 | public function getAllSub($id,&$str = []){ | 81 | public function getAllSub($id,&$str = []){ |
| 82 | - $list = $this->model->list(['pid'=>$id,'status'=>0],['id','pid']); | 82 | + $list = $this->model->list(['pid'=>$id,'status'=>1],['id','pid']); |
| 83 | if(!empty($list)){ | 83 | if(!empty($list)){ |
| 84 | foreach ($list as $v){ | 84 | foreach ($list as $v){ |
| 85 | $str[] = $v['id']; | 85 | $str[] = $v['id']; |
| @@ -317,7 +317,8 @@ class CategoryLogic extends BaseLogic | @@ -317,7 +317,8 @@ class CategoryLogic extends BaseLogic | ||
| 317 | */ | 317 | */ |
| 318 | public function copyTemplate($id,$project_id,$save_id){ | 318 | public function copyTemplate($id,$project_id,$save_id){ |
| 319 | $BTemplateModel = new BTemplate(); | 319 | $BTemplateModel = new BTemplate(); |
| 320 | - $list = $BTemplateModel->list(['source'=>BTemplate::SOURCE_PRODUCT,'is_list'=>BTemplate::IS_LIST,'is_custom'=>BTemplate::IS_NO_CUSTOM,'source_id'=>$id,'project_id'=>$project_id]); | 320 | + $list = $BTemplateModel->list(['source'=>BTemplate::SOURCE_PRODUCT,'is_list'=>BTemplate::IS_LIST, |
| 321 | + 'is_custom'=>BTemplate::IS_NO_CUSTOM,'source_id'=>$id,'project_id'=>$project_id]); | ||
| 321 | if(!empty($list)){ | 322 | if(!empty($list)){ |
| 322 | $data = []; | 323 | $data = []; |
| 323 | foreach ($list as $v){ | 324 | foreach ($list as $v){ |
| @@ -154,7 +154,7 @@ class KeywordLogic extends BaseLogic | @@ -154,7 +154,7 @@ class KeywordLogic extends BaseLogic | ||
| 154 | } | 154 | } |
| 155 | } | 155 | } |
| 156 | }catch (\Exception $e){ | 156 | }catch (\Exception $e){ |
| 157 | - return false; | 157 | + $this->fail('保存失败,请联系管理员'); |
| 158 | } | 158 | } |
| 159 | Common::del_user_cache('product_keyword',$this->user['project_id']); | 159 | Common::del_user_cache('product_keyword',$this->user['project_id']); |
| 160 | NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD, ['project_id' => $this->user['project_id']]); | 160 | NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD, ['project_id' => $this->user['project_id']]); |
| @@ -284,11 +284,11 @@ class ProductLogic extends BaseLogic | @@ -284,11 +284,11 @@ class ProductLogic extends BaseLogic | ||
| 284 | $param['thumb'] = Arr::a2s([]); | 284 | $param['thumb'] = Arr::a2s([]); |
| 285 | $param['gallery'] = Arr::a2s([]); | 285 | $param['gallery'] = Arr::a2s([]); |
| 286 | } | 286 | } |
| 287 | - if(isset($param['files']) && !empty($param['files'])){ | 287 | + if(isset($param['files'])){ |
| 288 | $param['files']['url'] = str_replace_url($param['files']['url'] ?? ''); | 288 | $param['files']['url'] = str_replace_url($param['files']['url'] ?? ''); |
| 289 | $param['files'] = Arr::a2s($param['files'] ?? []); | 289 | $param['files'] = Arr::a2s($param['files'] ?? []); |
| 290 | }else{ | 290 | }else{ |
| 291 | - $param['files'] = Arr::a2s([]); | 291 | + $param['files'] = null; |
| 292 | } | 292 | } |
| 293 | if(isset($param['video'])){ | 293 | if(isset($param['video'])){ |
| 294 | $param['video']['url'] = str_replace_url($param['video']['url']); | 294 | $param['video']['url'] = str_replace_url($param['video']['url']); |
| @@ -14,8 +14,10 @@ use App\Models\Com\UpdateLog; | @@ -14,8 +14,10 @@ use App\Models\Com\UpdateLog; | ||
| 14 | use App\Models\RouteMap\RouteMap; | 14 | use App\Models\RouteMap\RouteMap; |
| 15 | use App\Models\User\UserLog; | 15 | use App\Models\User\UserLog; |
| 16 | use App\Models\WebSetting\Translate as TranslateModel; | 16 | use App\Models\WebSetting\Translate as TranslateModel; |
| 17 | +use App\Models\WebSetting\TranslateData; | ||
| 17 | use App\Models\WebSetting\WebLanguage; | 18 | use App\Models\WebSetting\WebLanguage; |
| 18 | use App\Helper\Translate; | 19 | use App\Helper\Translate; |
| 20 | +use Illuminate\Support\Facades\DB; | ||
| 19 | 21 | ||
| 20 | class TranslateLogic extends BaseLogic | 22 | class TranslateLogic extends BaseLogic |
| 21 | { | 23 | { |
| @@ -36,9 +38,9 @@ class TranslateLogic extends BaseLogic | @@ -36,9 +38,9 @@ class TranslateLogic extends BaseLogic | ||
| 36 | public function getTranslateList(){ | 38 | public function getTranslateList(){ |
| 37 | $data = []; | 39 | $data = []; |
| 38 | if($this->param['url'] == 'All' || $this->param['url'] == 'other_all_text'){ | 40 | if($this->param['url'] == 'All' || $this->param['url'] == 'other_all_text'){ |
| 39 | - $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); | ||
| 40 | - if(!empty($info) && !empty($info['data'])){ | ||
| 41 | - $translateInfo = json_decode($info['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | 41 | + $info = $this->model->with('translate_data')->where(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']])->first(); |
| 42 | + if(!empty($info) && !empty($info['translate_data'])){ | ||
| 43 | + $translateInfo = json_decode($info['translate_data']['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | ||
| 42 | foreach ($translateInfo as $k => $v){ | 44 | foreach ($translateInfo as $k => $v){ |
| 43 | $data[] = [$k=>$v]; | 45 | $data[] = [$k=>$v]; |
| 44 | } | 46 | } |
| @@ -50,12 +52,15 @@ class TranslateLogic extends BaseLogic | @@ -50,12 +52,15 @@ class TranslateLogic extends BaseLogic | ||
| 50 | // 需要校对语种 | 52 | // 需要校对语种 |
| 51 | $languageInfo = $this->getLanguage($this->param['language_id']); | 53 | $languageInfo = $this->getLanguage($this->param['language_id']); |
| 52 | // 原始校对内容 | 54 | // 原始校对内容 |
| 53 | - $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); | 55 | + $param = $this->getRouteSource($this->param['url']); |
| 56 | + $param['language_id'] = $this->param['language_id']; | ||
| 57 | + $param['type'] = $this->param['type']; | ||
| 58 | + $info = $this->model->with('translate_data')->where($param)->first(); | ||
| 54 | //获取当前URl的所有文本内容 | 59 | //获取当前URl的所有文本内容 |
| 55 | $text_array = $this->getUrlRead($url); | 60 | $text_array = $this->getUrlRead($url); |
| 56 | // 原始校对程序 | 61 | // 原始校对程序 |
| 57 | $old_key = [];//key值组成数据 | 62 | $old_key = [];//key值组成数据 |
| 58 | - $data_read = json_decode($info ? $info['data'] : '',JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | 63 | + $data_read = json_decode($info && $info['translate_data'] ? $info['translate_data']['data'] : '',JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); |
| 59 | if(!empty($data_read)){ | 64 | if(!empty($data_read)){ |
| 60 | foreach ($data_read as $k => $v){ | 65 | foreach ($data_read as $k => $v){ |
| 61 | $k = urldecode($k); | 66 | $k = urldecode($k); |
| @@ -109,10 +114,10 @@ class TranslateLogic extends BaseLogic | @@ -109,10 +114,10 @@ class TranslateLogic extends BaseLogic | ||
| 109 | */ | 114 | */ |
| 110 | public function getTranslateImageList(){ | 115 | public function getTranslateImageList(){ |
| 111 | if($this->param['url'] == 'All'){ | 116 | if($this->param['url'] == 'All'){ |
| 112 | - $info = $this->model->read(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); | 117 | + $info = $this->model->with('translate_data')->where(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']])->first(); |
| 113 | $data = []; | 118 | $data = []; |
| 114 | - if(!empty($info) && !empty($info['data'])){ | ||
| 115 | - $translateInfo = json_decode($info['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | 119 | + if(!empty($info) && !empty($info['translate_data'])){ |
| 120 | + $translateInfo = json_decode($info['translate_data']['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | ||
| 116 | foreach ($translateInfo as $k => $v){ | 121 | foreach ($translateInfo as $k => $v){ |
| 117 | $data[] = [$k=>$v]; | 122 | $data[] = [$k=>$v]; |
| 118 | } | 123 | } |
| @@ -120,9 +125,12 @@ class TranslateLogic extends BaseLogic | @@ -120,9 +125,12 @@ class TranslateLogic extends BaseLogic | ||
| 120 | return $this->success($data); | 125 | return $this->success($data); |
| 121 | } | 126 | } |
| 122 | $url = $this->user['domain'].(($this->param['url'] != '/') ? $this->param['url'] : ''); | 127 | $url = $this->user['domain'].(($this->param['url'] != '/') ? $this->param['url'] : ''); |
| 123 | - $info = $this->model->read(['url'=>str_replace_url($this->param['url']),'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); | 128 | + $param = $this->getRouteSource($this->param['url']); |
| 129 | + $param['language_id'] = $this->param['language_id']; | ||
| 130 | + $param['type'] = $this->param['type']; | ||
| 131 | + $info = $this->model->with('translate_data')->where($param)->first(); | ||
| 124 | $data = []; | 132 | $data = []; |
| 125 | - if($info === false){ | 133 | + if(empty($info)){ |
| 126 | $new_list = $this->getUrlImageRead($url); | 134 | $new_list = $this->getUrlImageRead($url); |
| 127 | foreach ($new_list as $v){ | 135 | foreach ($new_list as $v){ |
| 128 | $data[] = [ | 136 | $data[] = [ |
| @@ -133,7 +141,7 @@ class TranslateLogic extends BaseLogic | @@ -133,7 +141,7 @@ class TranslateLogic extends BaseLogic | ||
| 133 | } | 141 | } |
| 134 | $new_list = $this->getUrlImageRead($url); | 142 | $new_list = $this->getUrlImageRead($url); |
| 135 | $old_list = []; | 143 | $old_list = []; |
| 136 | - $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | 144 | + $data_read = json_decode($info && $info['translate_data'] ? $info['translate_data']['data'] : '',JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); |
| 137 | foreach ($data_read as $k=>$v){ | 145 | foreach ($data_read as $k=>$v){ |
| 138 | $old_list[] = $k; | 146 | $old_list[] = $k; |
| 139 | $data[] = [ | 147 | $data[] = [ |
| @@ -258,6 +266,7 @@ class TranslateLogic extends BaseLogic | @@ -258,6 +266,7 @@ class TranslateLogic extends BaseLogic | ||
| 258 | } | 266 | } |
| 259 | //解析路由 | 267 | //解析路由 |
| 260 | $sendData = $this->handleRoute($this->param['url']); | 268 | $sendData = $this->handleRoute($this->param['url']); |
| 269 | + DB::beginTransaction(); | ||
| 261 | try { | 270 | try { |
| 262 | $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); | 271 | $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); |
| 263 | if($info === false){ | 272 | if($info === false){ |
| @@ -273,18 +282,19 @@ class TranslateLogic extends BaseLogic | @@ -273,18 +282,19 @@ class TranslateLogic extends BaseLogic | ||
| 273 | 'is_list'=>$sourceInfo['is_list'], | 282 | 'is_list'=>$sourceInfo['is_list'], |
| 274 | 'is_custom'=>$sourceInfo['is_custom'] | 283 | 'is_custom'=>$sourceInfo['is_custom'] |
| 275 | ]; | 284 | ]; |
| 276 | - $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | ||
| 277 | - $rs = $this->model->add($param); | 285 | + $id = $this->model->addReturnId($param); |
| 286 | + TranslateData::insert(['trans_id'=>$id,'data'=>json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]); | ||
| 278 | }else{ | 287 | }else{ |
| 279 | if(!empty($data)){ | 288 | if(!empty($data)){ |
| 280 | - $data = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); | ||
| 281 | - $rs = $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'project_id'=>$this->user['project_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); | 289 | + TranslateData::where(['trans_id'=>$info['id']])->update(['data'=>json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]); |
| 282 | } | 290 | } |
| 283 | } | 291 | } |
| 284 | //写日志 | 292 | //写日志 |
| 285 | $userLogModel = new UserLog(); | 293 | $userLogModel = new UserLog(); |
| 286 | $userLogModel->add(['model'=>'translate/save','remark'=>json_encode($this->param,true),'type'=>0,'operator_id'=>$this->user['id'],'project_id'=>$this->user['project_id']]); | 294 | $userLogModel->add(['model'=>'translate/save','remark'=>json_encode($this->param,true),'type'=>0,'operator_id'=>$this->user['id'],'project_id'=>$this->user['project_id']]); |
| 295 | + DB::commit(); | ||
| 287 | }catch (\Exception $e){ | 296 | }catch (\Exception $e){ |
| 297 | + DB::rollback(); | ||
| 288 | $this->fail('系统错误请联系管理员'); | 298 | $this->fail('系统错误请联系管理员'); |
| 289 | } | 299 | } |
| 290 | $this->sendMessage($sendData); | 300 | $this->sendMessage($sendData); |
| @@ -4,6 +4,7 @@ namespace App\Models; | @@ -4,6 +4,7 @@ namespace App\Models; | ||
| 4 | 4 | ||
| 5 | use Illuminate\Database\Eloquent\Model; | 5 | use Illuminate\Database\Eloquent\Model; |
| 6 | use Illuminate\Support\Facades\DB; | 6 | use Illuminate\Support\Facades\DB; |
| 7 | +use Illuminate\Support\Facades\Schema; | ||
| 7 | 8 | ||
| 8 | class Base extends Model | 9 | class Base extends Model |
| 9 | { | 10 | { |
| @@ -94,6 +95,7 @@ class Base extends Model | @@ -94,6 +95,7 @@ class Base extends Model | ||
| 94 | * @time :2023/8/21 17:18 | 95 | * @time :2023/8/21 17:18 |
| 95 | */ | 96 | */ |
| 96 | public function add($data){ | 97 | public function add($data){ |
| 98 | + $data = $this->filterRequestData($data); | ||
| 97 | $data['created_at'] = date('Y-m-d H:i:s'); | 99 | $data['created_at'] = date('Y-m-d H:i:s'); |
| 98 | $data['updated_at'] = $data['created_at']; | 100 | $data['updated_at'] = $data['created_at']; |
| 99 | return $this->insert($data); | 101 | return $this->insert($data); |
| @@ -107,6 +109,7 @@ class Base extends Model | @@ -107,6 +109,7 @@ class Base extends Model | ||
| 107 | * @time :2023/8/21 17:17 | 109 | * @time :2023/8/21 17:17 |
| 108 | */ | 110 | */ |
| 109 | public function addReturnId($data){ | 111 | public function addReturnId($data){ |
| 112 | + $data = $this->filterRequestData($data); | ||
| 110 | $data['created_at'] = date('Y-m-d H:i:s'); | 113 | $data['created_at'] = date('Y-m-d H:i:s'); |
| 111 | $data['updated_at'] = $data['created_at']; | 114 | $data['updated_at'] = $data['created_at']; |
| 112 | return $this->insertGetId($data); | 115 | return $this->insertGetId($data); |
| @@ -123,6 +126,7 @@ class Base extends Model | @@ -123,6 +126,7 @@ class Base extends Model | ||
| 123 | if(isset($data['id']) && !empty($data['id'])){ | 126 | if(isset($data['id']) && !empty($data['id'])){ |
| 124 | unset($data['id']); | 127 | unset($data['id']); |
| 125 | } | 128 | } |
| 129 | + $data = $this->filterRequestData($data); | ||
| 126 | $query = $this->formatQuery($condition); | 130 | $query = $this->formatQuery($condition); |
| 127 | $data['updated_at'] = date('Y-m-d H:i:s'); | 131 | $data['updated_at'] = date('Y-m-d H:i:s'); |
| 128 | return $query->update($data); | 132 | return $query->update($data); |
| @@ -140,6 +144,7 @@ class Base extends Model | @@ -140,6 +144,7 @@ class Base extends Model | ||
| 140 | $query = $this->formatQuery($condition); | 144 | $query = $this->formatQuery($condition); |
| 141 | return $query->delete(); | 145 | return $query->delete(); |
| 142 | } | 146 | } |
| 147 | + | ||
| 143 | /** | 148 | /** |
| 144 | * @name :参数处理查询 | 149 | * @name :参数处理查询 |
| 145 | * @param $map = ['$k'=>['like',$v],$k1] | 150 | * @param $map = ['$k'=>['like',$v],$k1] |
| @@ -226,8 +231,6 @@ class Base extends Model | @@ -226,8 +231,6 @@ class Base extends Model | ||
| 226 | */ | 231 | */ |
| 227 | protected static function booted() | 232 | protected static function booted() |
| 228 | { | 233 | { |
| 229 | - //保存前数据 $row->original['xx'] | ||
| 230 | - //保存后数据 $row->xx | ||
| 231 | static::saved(function ($row) { | 234 | static::saved(function ($row) { |
| 232 | //删除缓存 | 235 | //删除缓存 |
| 233 | $row->original && static::clearCache($row); | 236 | $row->original && static::clearCache($row); |
| @@ -251,4 +254,21 @@ class Base extends Model | @@ -251,4 +254,21 @@ class Base extends Model | ||
| 251 | return true; | 254 | return true; |
| 252 | } | 255 | } |
| 253 | 256 | ||
| 257 | + /** | ||
| 258 | + * @remark :过滤掉请求数据中不存在于数据库表中的字段 | ||
| 259 | + * @name :filterRequestData | ||
| 260 | + * @author :lyh | ||
| 261 | + * @method :post | ||
| 262 | + * @time :2024/6/14 10:49 | ||
| 263 | + */ | ||
| 264 | + public function filterRequestData(array $data) | ||
| 265 | + { | ||
| 266 | + // 获取表的字段列表 | ||
| 267 | + $columns = Schema::connection($this->connection)->getColumnListing($this->table); | ||
| 268 | + // 过滤数据 | ||
| 269 | + return array_filter($data, function ($key) use ($columns) { | ||
| 270 | + return in_array($key, $columns); | ||
| 271 | + }, ARRAY_FILTER_USE_KEY); | ||
| 272 | + } | ||
| 273 | + | ||
| 254 | } | 274 | } |
| @@ -12,13 +12,13 @@ class DeployOptimize extends Base | @@ -12,13 +12,13 @@ class DeployOptimize extends Base | ||
| 12 | protected $table = 'gl_project_deploy_optimize'; | 12 | protected $table = 'gl_project_deploy_optimize'; |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | - public function setMinorLanguagesAttribute($value){ | ||
| 16 | - $this->attributes['minor_languages'] = Arr::a2s($value); | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | - public function getMinorLanguagesAttribute($value){ | ||
| 20 | - return Arr::s2a($value); | ||
| 21 | - } | 15 | +// public function setMinorLanguagesAttribute($value){ |
| 16 | +// $this->attributes['minor_languages'] = Arr::a2s($value); | ||
| 17 | +// } | ||
| 18 | +// | ||
| 19 | +// public function getMinorLanguagesAttribute($value){ | ||
| 20 | +// return Arr::s2a($value); | ||
| 21 | +// } | ||
| 22 | public function getGTopPlanAttribute($value){ | 22 | public function getGTopPlanAttribute($value){ |
| 23 | return Arr::s2a($value); | 23 | return Arr::s2a($value); |
| 24 | } | 24 | } |
| @@ -34,10 +34,6 @@ class AggregationSetting extends Base | @@ -34,10 +34,6 @@ class AggregationSetting extends Base | ||
| 34 | public function getTopBannerAttribute($value){ | 34 | public function getTopBannerAttribute($value){ |
| 35 | if(!empty($value)){ | 35 | if(!empty($value)){ |
| 36 | $value = Arr::s2a($value); | 36 | $value = Arr::s2a($value); |
| 37 | - foreach ($value as $k => $v){ | ||
| 38 | - $v = getImageUrl($v); | ||
| 39 | - $value[$k] = $v; | ||
| 40 | - } | ||
| 41 | } | 37 | } |
| 42 | return $value; | 38 | return $value; |
| 43 | } | 39 | } |
| @@ -52,10 +48,6 @@ class AggregationSetting extends Base | @@ -52,10 +48,6 @@ class AggregationSetting extends Base | ||
| 52 | public function getFootBannerAttribute($value){ | 48 | public function getFootBannerAttribute($value){ |
| 53 | if(!empty($value)){ | 49 | if(!empty($value)){ |
| 54 | $value = Arr::s2a($value); | 50 | $value = Arr::s2a($value); |
| 55 | - foreach ($value as $k => $v){ | ||
| 56 | - $v = getImageUrl($v); | ||
| 57 | - $value[$k] = $v; | ||
| 58 | - } | ||
| 59 | } | 51 | } |
| 60 | return $value; | 52 | return $value; |
| 61 | } | 53 | } |
| @@ -20,4 +20,15 @@ class Translate extends Base | @@ -20,4 +20,15 @@ class Translate extends Base | ||
| 20 | public static $textType = 1; | 20 | public static $textType = 1; |
| 21 | public static $imageType = 2; | 21 | public static $imageType = 2; |
| 22 | 22 | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 校对详情数据 | ||
| 26 | + * @return \Illuminate\Database\Eloquent\Relations\HasOne | ||
| 27 | + * @author Akun | ||
| 28 | + * @date 2024/06/14 14:54 | ||
| 29 | + */ | ||
| 30 | + public function translate_data() | ||
| 31 | + { | ||
| 32 | + return self::hasOne(TranslateData::class, 'trans_id', 'id'); | ||
| 33 | + } | ||
| 23 | } | 34 | } |
app/Models/WebSetting/TranslateData.php
0 → 100644
| @@ -78,6 +78,18 @@ return [ | @@ -78,6 +78,18 @@ return [ | ||
| 78 | 'via' => \App\Factory\LogFormatterFactory::class, | 78 | 'via' => \App\Factory\LogFormatterFactory::class, |
| 79 | 'prefix' => 'test', | 79 | 'prefix' => 'test', |
| 80 | ], | 80 | ], |
| 81 | + //日记录日志 | ||
| 82 | + 'day_count' => [ | ||
| 83 | + 'driver' => 'custom', | ||
| 84 | + 'via' => \App\Factory\LogFormatterFactory::class, | ||
| 85 | + 'prefix' => 'day_count', | ||
| 86 | + ], | ||
| 87 | + //月记录日志 | ||
| 88 | + 'month_count' => [ | ||
| 89 | + 'driver' => 'custom', | ||
| 90 | + 'via' => \App\Factory\LogFormatterFactory::class, | ||
| 91 | + 'prefix' => 'month_count', | ||
| 92 | + ], | ||
| 81 | 'wechatside' => [ | 93 | 'wechatside' => [ |
| 82 | 'driver' => 'custom', | 94 | 'driver' => 'custom', |
| 83 | 'via' => \App\Factory\LogFormatterFactory::class, | 95 | 'via' => \App\Factory\LogFormatterFactory::class, |
| @@ -162,6 +162,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -162,6 +162,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 162 | Route::get('/', [Aside\Project\ProjectController::class, 'lists'])->name('admin.project'); | 162 | Route::get('/', [Aside\Project\ProjectController::class, 'lists'])->name('admin.project'); |
| 163 | Route::get('/info', [Aside\Project\ProjectController::class, 'info'])->name('admin.project_info'); | 163 | Route::get('/info', [Aside\Project\ProjectController::class, 'info'])->name('admin.project_info'); |
| 164 | Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); | 164 | Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); |
| 165 | + Route::any('/deleteMinorLanguages', [Aside\Project\ProjectController::class, 'deleteMinorLanguages'])->name('admin.project_deleteMinorLanguages'); | ||
| 165 | Route::any('/inquiry_set', [Aside\Project\ProjectController::class, 'inquiry_set'])->name('admin.project_inquiry_set'); | 166 | Route::any('/inquiry_set', [Aside\Project\ProjectController::class, 'inquiry_set'])->name('admin.project_inquiry_set'); |
| 166 | Route::any('/get_process_records', [Aside\Project\ProjectController::class, 'get_process_records'])->name('admin.project_get_process_records'); | 167 | Route::any('/get_process_records', [Aside\Project\ProjectController::class, 'get_process_records'])->name('admin.project_get_process_records'); |
| 167 | Route::any('/save_process_records', [Aside\Project\ProjectController::class, 'save_process_records'])->name('admin.project_save_process_records'); | 168 | Route::any('/save_process_records', [Aside\Project\ProjectController::class, 'save_process_records'])->name('admin.project_save_process_records'); |
| @@ -188,6 +189,8 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -188,6 +189,8 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 188 | Route::any('/saveInquiryFilterConfig', [Aside\Project\ProjectController::class, 'saveInquiryFilterConfig'])->name('admin.project_inquiry_filter_config_save');//保存询盘过滤配置 | 189 | Route::any('/saveInquiryFilterConfig', [Aside\Project\ProjectController::class, 'saveInquiryFilterConfig'])->name('admin.project_inquiry_filter_config_save');//保存询盘过滤配置 |
| 189 | Route::any('/saveWebTrafficConfig', [Aside\Project\ProjectController::class, 'saveWebTrafficConfig'])->name('admin.project_web_traffic_config_save');//保存引流配置 | 190 | Route::any('/saveWebTrafficConfig', [Aside\Project\ProjectController::class, 'saveWebTrafficConfig'])->name('admin.project_web_traffic_config_save');//保存引流配置 |
| 190 | Route::any('/updateProjectManager', [Aside\Project\ProjectController::class, 'updateProjectManager'])->name('admin.project_updateProjectManager');//更改项目人员配置 | 191 | Route::any('/updateProjectManager', [Aside\Project\ProjectController::class, 'updateProjectManager'])->name('admin.project_updateProjectManager');//更改项目人员配置 |
| 192 | + Route::any('/setIsParticiple', [Aside\Project\ProjectController::class, 'setIsParticiple'])->name('admin.project_setIsParticiple');//开启/关闭分词 | ||
| 193 | + | ||
| 191 | //获取关键词前缀和后缀 | 194 | //获取关键词前缀和后缀 |
| 192 | Route::prefix('keyword')->group(function () { | 195 | Route::prefix('keyword')->group(function () { |
| 193 | Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); | 196 | Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); |
| @@ -345,6 +348,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -345,6 +348,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 345 | Route::any('/createKeywordTask', [Aside\Com\KeywordVideoController::class, 'createKeywordTask'])->name('keyword_video_createKeywordTask'); | 348 | Route::any('/createKeywordTask', [Aside\Com\KeywordVideoController::class, 'createKeywordTask'])->name('keyword_video_createKeywordTask'); |
| 346 | Route::any('/edit', [Aside\Com\KeywordVideoController::class, 'edit'])->name('keyword_video_edit'); | 349 | Route::any('/edit', [Aside\Com\KeywordVideoController::class, 'edit'])->name('keyword_video_edit'); |
| 347 | Route::any('/getVideoTaskLog', [Aside\Com\KeywordVideoController::class, 'getVideoTaskLog'])->name('keyword_video_getVideoTaskLog'); | 350 | Route::any('/getVideoTaskLog', [Aside\Com\KeywordVideoController::class, 'getVideoTaskLog'])->name('keyword_video_getVideoTaskLog'); |
| 351 | + Route::any('/taskNum', [Aside\Com\KeywordVideoController::class, 'taskNum'])->name('keyword_video_taskNum'); | ||
| 348 | }); | 352 | }); |
| 349 | 353 | ||
| 350 | // 公共主题模版 | 354 | // 公共主题模版 |
-
请 注册 或 登录 后发表评论