Merge remote-tracking branch 'origin/master' into akun
正在显示
22 个修改的文件
包含
358 行增加
和
67 行删除
| @@ -67,6 +67,10 @@ class AiBlogAuthorTask extends Command | @@ -67,6 +67,10 @@ class AiBlogAuthorTask extends Command | ||
| 67 | sleep(10); | 67 | sleep(10); |
| 68 | continue; | 68 | continue; |
| 69 | } | 69 | } |
| 70 | + if(empty($result['data'])){ | ||
| 71 | + sleep(20); | ||
| 72 | + continue; | ||
| 73 | + } | ||
| 70 | //保存当前项目ai_blog数据 | 74 | //保存当前项目ai_blog数据 |
| 71 | ProjectServer::useProject($info['project_id']); | 75 | ProjectServer::useProject($info['project_id']); |
| 72 | $this->saveAiBlogAuthor($result['data'] ?? [],$info['project_id']); | 76 | $this->saveAiBlogAuthor($result['data'] ?? [],$info['project_id']); |
| @@ -109,16 +113,19 @@ class AiBlogAuthorTask extends Command | @@ -109,16 +113,19 @@ class AiBlogAuthorTask extends Command | ||
| 109 | return true; | 113 | return true; |
| 110 | } | 114 | } |
| 111 | $aiBlogAuthorModel = new AiBlogAuthor(); | 115 | $aiBlogAuthorModel = new AiBlogAuthor(); |
| 112 | - foreach ($data as $v){ | ||
| 113 | - $param = [ | ||
| 114 | - 'author_id'=>$v['id'], | ||
| 115 | - 'title'=>$v['title'], | ||
| 116 | - 'image'=>str_replace_url($v['picture']), | ||
| 117 | - 'description'=>$v['description'], | ||
| 118 | - ]; | ||
| 119 | - $id = $aiBlogAuthorModel->addReturnId($param); | ||
| 120 | - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); | ||
| 121 | - $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]); | 116 | + $info = $aiBlogAuthorModel->count(['project_id'=>$project_id]); |
| 117 | + if($info === false){ | ||
| 118 | + foreach ($data as $v){ | ||
| 119 | + $param = [ | ||
| 120 | + 'author_id'=>$v['id'], | ||
| 121 | + 'title'=>$v['title'], | ||
| 122 | + 'image'=>str_replace_url($v['picture']), | ||
| 123 | + 'description'=>$v['description'], | ||
| 124 | + ]; | ||
| 125 | + $id = $aiBlogAuthorModel->addReturnId($param); | ||
| 126 | + $route = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); | ||
| 127 | + $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]); | ||
| 128 | + } | ||
| 122 | } | 129 | } |
| 123 | return true; | 130 | return true; |
| 124 | } | 131 | } |
| @@ -77,6 +77,8 @@ class AiBlogListTask extends Command | @@ -77,6 +77,8 @@ class AiBlogListTask extends Command | ||
| 77 | ProjectServer::useProject($v['project_id']); | 77 | ProjectServer::useProject($v['project_id']); |
| 78 | $aiBlogListModel = new AiBlogList(); | 78 | $aiBlogListModel = new AiBlogList(); |
| 79 | if(!empty($saveData)){ | 79 | if(!empty($saveData)){ |
| 80 | + //写一条路由信息 | ||
| 81 | + RouteMap::setRoute('top-blog',RouteMap::SOURCE_AI_BLOG_LIST,0,$v['project_id']); | ||
| 80 | $aiBlogListModel->truncate(); | 82 | $aiBlogListModel->truncate(); |
| 81 | $aiBlogListModel->insertAll($saveData); | 83 | $aiBlogListModel->insertAll($saveData); |
| 82 | } | 84 | } |
| @@ -11,6 +11,7 @@ use App\Helper\Common; | @@ -11,6 +11,7 @@ use App\Helper\Common; | ||
| 11 | use App\Helper\Gpt; | 11 | use App\Helper\Gpt; |
| 12 | use App\Helper\Translate; | 12 | use App\Helper\Translate; |
| 13 | use App\Models\Ai\AiCommand; | 13 | use App\Models\Ai\AiCommand; |
| 14 | +use App\Models\Inquiry\ReInquiryConfig; | ||
| 14 | use App\Models\Inquiry\ReInquiryDetail; | 15 | use App\Models\Inquiry\ReInquiryDetail; |
| 15 | use App\Models\Inquiry\ReInquiryDetailLog; | 16 | use App\Models\Inquiry\ReInquiryDetailLog; |
| 16 | use App\Models\Inquiry\ReInquiryForm; | 17 | use App\Models\Inquiry\ReInquiryForm; |
| @@ -353,6 +354,19 @@ class RelayInquiry extends Command | @@ -353,6 +354,19 @@ class RelayInquiry extends Command | ||
| 353 | { | 354 | { |
| 354 | //通用过滤规则 | 355 | //通用过滤规则 |
| 355 | $config = InquiryFilterConfig::getCacheInfoByProjectId(Project::DEMO_PROJECT_ID); | 356 | $config = InquiryFilterConfig::getCacheInfoByProjectId(Project::DEMO_PROJECT_ID); |
| 357 | + //FB询盘的全局过滤规则 | ||
| 358 | + $fb_config = ReInquiryConfig::getDefaultConfigCache(ReInquiryConfig::TYPE_FILTER_WORDS); | ||
| 359 | + | ||
| 360 | + $fb_config['filter_contents'] = array_filter(explode("\r\n", $fb_config['filter_contents']?:'')); | ||
| 361 | + $fb_config['filter_emails'] = array_filter(explode("\r\n", $fb_config['filter_emails']?:'')); | ||
| 362 | + $fb_config['filter_mobiles'] = array_filter(explode("\r\n", $fb_config['filter_mobiles']?:'')); | ||
| 363 | + $fb_config['filter_names'] = array_filter(explode("\r\n", $fb_config['filter_names']?:'')); | ||
| 364 | + | ||
| 365 | + $config['filter_contents'] = array_unique(array_merge($fb_config['filter_contents'],$config['filter_contents'])); | ||
| 366 | + $config['filter_emails'] = array_unique(array_merge($fb_config['filter_emails'],$config['filter_emails'])); | ||
| 367 | + $config['filter_mobiles'] = array_unique(array_merge($fb_config['filter_mobiles'],$config['filter_mobiles'])); | ||
| 368 | + $config['filter_names'] = array_unique(array_merge($fb_config['filter_names'],$config['filter_names'])); | ||
| 369 | + | ||
| 356 | //过滤内容 | 370 | //过滤内容 |
| 357 | if(!empty($data['message']) && !empty($config['filter_contents'])) { | 371 | if(!empty($data['message']) && !empty($config['filter_contents'])) { |
| 358 | foreach ($config['filter_contents'] as $filter_content) { | 372 | foreach ($config['filter_contents'] as $filter_content) { |
| @@ -7,17 +7,13 @@ | @@ -7,17 +7,13 @@ | ||
| 7 | * @time :2024/9/26 14:19 | 7 | * @time :2024/9/26 14:19 |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | -namespace App\Console\Commands\Project; | 10 | +namespace App\Console\Commands\LyhTest; |
| 11 | 11 | ||
| 12 | use App\Helper\Common; | 12 | use App\Helper\Common; |
| 13 | -use App\Models\Domain\DomainInfo; | ||
| 14 | use App\Models\Product\Category; | 13 | use App\Models\Product\Category; |
| 15 | use App\Models\Product\CategoryRelated; | 14 | use App\Models\Product\CategoryRelated; |
| 16 | -use App\Models\Product\Detail; | ||
| 17 | use App\Models\Product\Product; | 15 | use App\Models\Product\Product; |
| 18 | use App\Models\RouteMap\RouteMap; | 16 | use App\Models\RouteMap\RouteMap; |
| 19 | -use App\Models\Visit\Visit; | ||
| 20 | -use App\Models\Visit\VisitItem; | ||
| 21 | use App\Services\ProjectServer; | 17 | use App\Services\ProjectServer; |
| 22 | use Illuminate\Console\Command; | 18 | use Illuminate\Console\Command; |
| 23 | use Illuminate\Support\Facades\DB; | 19 | use Illuminate\Support\Facades\DB; |
| @@ -41,7 +37,7 @@ class DownloadProject extends Command | @@ -41,7 +37,7 @@ class DownloadProject extends Command | ||
| 41 | protected $description = '导出项目数据'; | 37 | protected $description = '导出项目数据'; |
| 42 | 38 | ||
| 43 | public function handle(){ | 39 | public function handle(){ |
| 44 | - ProjectServer::useProject(1225); | 40 | + ProjectServer::useProject(1646); |
| 45 | echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; | 41 | echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; |
| 46 | $data = $this->downloadProduct(); | 42 | $data = $this->downloadProduct(); |
| 47 | DB::disconnect('custom_mysql'); | 43 | DB::disconnect('custom_mysql'); |
| @@ -52,23 +48,23 @@ class DownloadProject extends Command | @@ -52,23 +48,23 @@ class DownloadProject extends Command | ||
| 52 | public function downloadProduct() | 48 | public function downloadProduct() |
| 53 | { | 49 | { |
| 54 | $product = new Product(); | 50 | $product = new Product(); |
| 55 | - $filed = ['id', 'project_id', 'title' ,'thumb' , 'route' ,'intro','content', | ||
| 56 | - 'category_id', 'status','seo_mate']; | 51 | +// $filed = ['id', 'project_id', 'title' ,'thumb' , 'route' ,'intro','content', |
| 52 | +// 'category_id', 'status','seo_mate']; | ||
| 53 | + $filed = ['id','title']; | ||
| 57 | $this->order = 'sort'; | 54 | $this->order = 'sort'; |
| 58 | $lists = $product->list(['status'=>1],'id',$filed); | 55 | $lists = $product->list(['status'=>1],'id',$filed); |
| 59 | if(!empty($lists)){ | 56 | if(!empty($lists)){ |
| 60 | - $cate_data = $this->getCategoryList();//分类 | 57 | +// $cate_data = $this->getCategoryList();//分类 |
| 61 | foreach ($lists as $k => $v){ | 58 | foreach ($lists as $k => $v){ |
| 62 | echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; | 59 | echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL; |
| 63 | - $v['url'] = 'https://www.autsikinta.com/' . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']); | ||
| 64 | - $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); | ||
| 65 | - //ToDo::处理图片及文件 | ||
| 66 | - if(!empty($v['thumb']) && !empty($v['thumb']['url'])){ | ||
| 67 | - $v['images'] = getImageUrl($v['thumb']['url']); | ||
| 68 | - }else{ | ||
| 69 | - $v['images'] = ''; | ||
| 70 | - } | ||
| 71 | - $v['seo_mate'] = json_encode($v['seo_mate']); | 60 | +// $v['url'] = 'https://www.autsikinta.com/' . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']); |
| 61 | +// $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); | ||
| 62 | +// //ToDo::处理图片及文件 | ||
| 63 | +// if(!empty($v['thumb']) && !empty($v['thumb']['url'])){ | ||
| 64 | +// $v['images'] = getImageUrl($v['thumb']['url']); | ||
| 65 | +// }else{ | ||
| 66 | +// $v['images'] = ''; | ||
| 67 | +// } | ||
| 72 | $lists[$k] = $v; | 68 | $lists[$k] = $v; |
| 73 | } | 69 | } |
| 74 | } | 70 | } |
| @@ -149,23 +145,27 @@ class DownloadProject extends Command | @@ -149,23 +145,27 @@ class DownloadProject extends Command | ||
| 149 | $sheet = $spreadsheet->getActiveSheet(); | 145 | $sheet = $spreadsheet->getActiveSheet(); |
| 150 | // 添加表头 | 146 | // 添加表头 |
| 151 | $sheet->setCellValue('A1', '产品名称'); | 147 | $sheet->setCellValue('A1', '产品名称'); |
| 152 | - $sheet->setCellValue('B1', '产品短描述'); | ||
| 153 | - $sheet->setCellValue('C1', '产品内容'); | ||
| 154 | - $sheet->setCellValue('D1', '产品路由'); | ||
| 155 | - $sheet->setCellValue('E1', '产品分类'); | ||
| 156 | - $sheet->setCellValue('F1', '产品状态'); | ||
| 157 | - $sheet->setCellValue('G1', '产品主图'); | ||
| 158 | - $sheet->setCellValue('H1', '产品TDK'); | 148 | +// $sheet->setCellValue('B1', '产品短描述'); |
| 149 | +// $sheet->setCellValue('C1', '产品内容'); | ||
| 150 | +// $sheet->setCellValue('D1', '产品路由'); | ||
| 151 | +// $sheet->setCellValue('E1', '产品分类'); | ||
| 152 | +// $sheet->setCellValue('F1', '产品状态'); | ||
| 153 | +// $sheet->setCellValue('G1', '产品主图'); | ||
| 154 | +// $sheet->setCellValue('H1', '产品seo_title'); | ||
| 155 | +// $sheet->setCellValue('I1', '产品seo_keyword'); | ||
| 156 | +// $sheet->setCellValue('J1', '产品seo_title'); | ||
| 159 | $rowCount = 2; | 157 | $rowCount = 2; |
| 160 | foreach ($data as $v) { | 158 | foreach ($data as $v) { |
| 161 | $sheet->setCellValue('A' . $rowCount, $v['title']); | 159 | $sheet->setCellValue('A' . $rowCount, $v['title']); |
| 162 | - $sheet->setCellValue('B' . $rowCount, $v['intro']); | ||
| 163 | - $sheet->setCellValue('C' . $rowCount, $v['content']); | ||
| 164 | - $sheet->setCellValue('D' . $rowCount, $v['url']); | ||
| 165 | - $sheet->setCellValue('E' . $rowCount, $v['category_id_text']); | ||
| 166 | - $sheet->setCellValue('F' . $rowCount, '发布中'); | ||
| 167 | - $sheet->setCellValue('G' . $rowCount, $v['images']); | ||
| 168 | - $sheet->setCellValue('H' . $rowCount, $v['seo_mate']); | 160 | +// $sheet->setCellValue('B' . $rowCount, $v['intro']); |
| 161 | +// $sheet->setCellValue('C' . $rowCount, $v['content']); | ||
| 162 | +// $sheet->setCellValue('D' . $rowCount, $v['url']); | ||
| 163 | +// $sheet->setCellValue('E' . $rowCount, $v['category_id_text']); | ||
| 164 | +// $sheet->setCellValue('F' . $rowCount, '发布中'); | ||
| 165 | +// $sheet->setCellValue('G' . $rowCount, $v['images']); | ||
| 166 | +// $sheet->setCellValue('H' . $rowCount, $v['seo_mate']['title']); | ||
| 167 | +// $sheet->setCellValue('I' . $rowCount, $v['seo_mate']['keyword']); | ||
| 168 | +// $sheet->setCellValue('J' . $rowCount, $v['seo_mate']['description']); | ||
| 169 | $rowCount++; | 169 | $rowCount++; |
| 170 | } | 170 | } |
| 171 | // 创建一个新的 Excel Writer 对象 | 171 | // 创建一个新的 Excel Writer 对象 |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :LyhImportTest.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/2/24 14:52 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\LyhTest; | ||
| 11 | + | ||
| 12 | +use App\Models\CustomModule\CustomModuleCategory; | ||
| 13 | +use App\Models\CustomModule\CustomModuleContent; | ||
| 14 | +use App\Models\CustomModule\CustomModuleExtentContent; | ||
| 15 | +use App\Models\RouteMap\RouteMap; | ||
| 16 | +use App\Services\ProjectServer; | ||
| 17 | +use Illuminate\Console\Command; | ||
| 18 | +use Illuminate\Support\Facades\DB; | ||
| 19 | + | ||
| 20 | +class LyhImportTest extends Command | ||
| 21 | +{ | ||
| 22 | + /** | ||
| 23 | + * The name and signature of the console command. | ||
| 24 | + * | ||
| 25 | + * @var string | ||
| 26 | + */ | ||
| 27 | + protected $signature = 'lyh_import_test'; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * The console command description. | ||
| 31 | + * | ||
| 32 | + * @var string | ||
| 33 | + */ | ||
| 34 | + protected $description = '导入数据'; | ||
| 35 | + | ||
| 36 | + public $data = 'GBP201,Rectifier/Bridge Rectifier,GBP,-,100,2,1.10 ,1,60,5,250,-55~+150,-,Active,'; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @remark :统一更新路由 | ||
| 40 | + * @name :handle | ||
| 41 | + * @author :lyh | ||
| 42 | + * @method :post | ||
| 43 | + * @time :2023/11/20 15:13 | ||
| 44 | + */ | ||
| 45 | + public function handle(){ | ||
| 46 | + ProjectServer::useProject(2837); | ||
| 47 | + echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; | ||
| 48 | + $this->importCustomModule($this->data); | ||
| 49 | + DB::disconnect('custom_mysql'); | ||
| 50 | + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * @remark :导入扩展模块数据 | ||
| 55 | + * @name :importCustomModule | ||
| 56 | + * @author :lyh | ||
| 57 | + * @method :post | ||
| 58 | + * @time :2025/2/24 14:54 | ||
| 59 | + */ | ||
| 60 | + public function importCustomModule($text,$project_id = 2837){ | ||
| 61 | + $customContentModel = new CustomModuleContent(); | ||
| 62 | + $customCategoryModel = new CustomModuleCategory();; | ||
| 63 | + $customExtendContentTModel = new CustomModuleExtentContent(); | ||
| 64 | + $data = explode("\n", $text); | ||
| 65 | + foreach ($data as $k => $item){ | ||
| 66 | + $item = trim($item,','); | ||
| 67 | + //按照逗号转为数组 | ||
| 68 | + $array = explode(",", $item); | ||
| 69 | + //添加分类 | ||
| 70 | + if(empty($array[0])){ | ||
| 71 | + continue; | ||
| 72 | + } | ||
| 73 | + //添加内容 | ||
| 74 | + $contentId = $customContentModel->addReturnId(['name'=>$array[0],'module_id'=>2,'project_id'=>$project_id]); | ||
| 75 | + echo date('Y-m-d H:i:s') . '当前扩展数据id:'. $contentId . PHP_EOL; | ||
| 76 | + //注册路由 | ||
| 77 | + $route = RouteMap::setRoute($array[0], RouteMap::SOURCE_MODULE, | ||
| 78 | + $contentId, $project_id); | ||
| 79 | + $customContentModel->edit(['route'=>$route],['id'=>$contentId]); | ||
| 80 | + if(!empty($array[1])){ | ||
| 81 | + $categoryId = ','; | ||
| 82 | + $cateArr = explode('/',$array[1]); | ||
| 83 | + foreach ($cateArr as $cateV){ | ||
| 84 | + $cateInfo = $customCategoryModel->read(['name'=>$cateV,'module_id'=>2,'project_id'=>$project_id]); | ||
| 85 | + if($cateInfo !== false){ | ||
| 86 | + $categoryId .= $cateInfo['id'].','; | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + $customContentModel->edit(['category_id'=>$categoryId],['id'=>$contentId]); | ||
| 90 | + } | ||
| 91 | + $saveData = [ | ||
| 92 | + ['key'=>'pd_extended_field_1', 'type'=>1, 'values'=>$array[2], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 93 | + ['key'=>'pd_extended_field_2', 'type'=>1, 'values'=>$array[4], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 94 | + ['key'=>'pd_extended_field_3', 'type'=>1, 'values'=>$array[5], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 95 | + ['key'=>'pd_extended_field_4', 'type'=>1, 'values'=>$array[3], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 96 | + ['key'=>'pd_extended_field_5', 'type'=>1, 'values'=>$array[8], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 97 | + ['key'=>'pd_extended_field_6', 'type'=>1, 'values'=>$array[6], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 98 | + ['key'=>'pd_extended_field_7', 'type'=>1, 'values'=>$array[9], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 99 | + ['key'=>'pd_extended_field_8', 'type'=>1, 'values'=>$array[10], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 100 | + ['key'=>'pd_extended_field_9', 'type'=>1, 'values'=>$array[11], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 101 | + ['key'=>'pd_extended_field_10', 'type'=>1, 'values'=>$array[12], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 102 | + ['key'=>'pd_extended_field_11', 'type'=>1, 'values'=>$array[13], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 103 | + ['key'=>'pd_extended_field_12', 'type'=>1, 'values'=>$array[14] ?? '', 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 104 | + ['key'=>'pd_extended_field_13', 'type'=>1, 'values'=>$array[7], 'content_id'=>$contentId, 'project_id'=>$project_id, 'module_id'=>2, 'created_at'=>date('Y-m-d H:i:s'), 'updated_at'=>date('Y-m-d H:i:s')], | ||
| 105 | + ]; | ||
| 106 | + $customExtendContentTModel->insert($saveData); | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | +} |
| @@ -16,13 +16,16 @@ use App\Models\HomeCount\Count; | @@ -16,13 +16,16 @@ use App\Models\HomeCount\Count; | ||
| 16 | use App\Models\News\News; | 16 | use App\Models\News\News; |
| 17 | use App\Models\Product\Product; | 17 | use App\Models\Product\Product; |
| 18 | use App\Models\Project\Project; | 18 | use App\Models\Project\Project; |
| 19 | +use App\Models\ProjectAssociation\ProjectAssociation; | ||
| 19 | use App\Models\RankData\ExternalLinks; | 20 | use App\Models\RankData\ExternalLinks; |
| 20 | use App\Models\RankData\RankData; | 21 | use App\Models\RankData\RankData; |
| 21 | use App\Models\RankData\RankWeek; | 22 | use App\Models\RankData\RankWeek; |
| 23 | +use App\Models\Workchat\MessagePush; | ||
| 22 | use App\Services\ProjectServer; | 24 | use App\Services\ProjectServer; |
| 23 | use Carbon\Carbon; | 25 | use Carbon\Carbon; |
| 24 | use Illuminate\Console\Command; | 26 | use Illuminate\Console\Command; |
| 25 | use Illuminate\Support\Facades\DB; | 27 | use Illuminate\Support\Facades\DB; |
| 28 | +use Illuminate\Support\Facades\Log; | ||
| 26 | 29 | ||
| 27 | class WeekProject extends Command | 30 | class WeekProject extends Command |
| 28 | { | 31 | { |
| @@ -97,8 +100,10 @@ class WeekProject extends Command | @@ -97,8 +100,10 @@ class WeekProject extends Command | ||
| 97 | $data['keyword_ten_num'] = $rankInfo['first_ten_pages_num'] ?? 0; | 100 | $data['keyword_ten_num'] = $rankInfo['first_ten_pages_num'] ?? 0; |
| 98 | $productModel = new Product(); | 101 | $productModel = new Product(); |
| 99 | $data['product_num'] = $productModel->counts(['status'=>1]) ?? 0; | 102 | $data['product_num'] = $productModel->counts(['status'=>1]) ?? 0; |
| 103 | + $data['week_product_num'] = $productModel->counts(['status'=>1,'created_at'=>['between',[$startOfLastWeek,$endOfLastWeek]]]) ?? 0; | ||
| 100 | $newsModel = new News(); | 104 | $newsModel = new News(); |
| 101 | $data['news_num'] = $newsModel->counts(['status'=>1]) ?? 0; | 105 | $data['news_num'] = $newsModel->counts(['status'=>1]) ?? 0; |
| 106 | + $data['week_news_num'] = $newsModel->counts(['status'=>1,'created_at'=>['between',[$startOfLastWeek,$endOfLastWeek]]]) ?? 0; | ||
| 102 | $blogModel = new Blog(); | 107 | $blogModel = new Blog(); |
| 103 | $data['blog_num'] = $blogModel->counts(['status'=>1]) ?? 0; | 108 | $data['blog_num'] = $blogModel->counts(['status'=>1]) ?? 0; |
| 104 | $notifyModel = new Notify(); | 109 | $notifyModel = new Notify(); |
| @@ -117,4 +122,81 @@ class WeekProject extends Command | @@ -117,4 +122,81 @@ class WeekProject extends Command | ||
| 117 | $v6WeeklyReportModel->add($data); | 122 | $v6WeeklyReportModel->add($data); |
| 118 | return true; | 123 | return true; |
| 119 | } | 124 | } |
| 125 | + | ||
| 126 | + /** | ||
| 127 | + * @remark :推送消息 | ||
| 128 | + * @name :workChatMessage | ||
| 129 | + * @author :lyh | ||
| 130 | + * @method :post | ||
| 131 | + * @time :2025/2/26 10:15 | ||
| 132 | + */ | ||
| 133 | + public function workChatMessage($data,$project_id){ | ||
| 134 | + //项目是否有绑定群 | ||
| 135 | + $friend_id = ProjectAssociation::where('project_id', $project_id) | ||
| 136 | + ->where('status', ProjectAssociation::STATUS_NORMAL) | ||
| 137 | + ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT) | ||
| 138 | + ->value('friend_id'); | ||
| 139 | + if(!$friend_id){ | ||
| 140 | + echo date('Y-m-d H:i:s') . '没有绑定企微群:'.$project_id . PHP_EOL; | ||
| 141 | + return false; | ||
| 142 | + } | ||
| 143 | + $content1 = ''; | ||
| 144 | + if(!empty($data['inquiry_total'])){ | ||
| 145 | + $content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,'; | ||
| 146 | + if(!empty($data['week_inquiry_total'])){ | ||
| 147 | + $content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。'; | ||
| 148 | + } | ||
| 149 | + if(!empty($data['inquiry_country'])){ | ||
| 150 | + $data['inquiry_country'] = json_decode($data['inquiry_country']); | ||
| 151 | + arsort($data); | ||
| 152 | + $data['inquiry_country'] = array_slice($data, 0, 4, true); | ||
| 153 | + $country = ''; | ||
| 154 | + foreach ($data['inquiry_country'] as $k => $v){ | ||
| 155 | + $country .= $k.'、'; | ||
| 156 | + }; | ||
| 157 | + trim($country,'、'); | ||
| 158 | + $content1 = '询盘主要来源于'.$country.'等国家地区'; | ||
| 159 | + } | ||
| 160 | + $content1 .= '如有高质量客户,请您密切关注与跟进;'; | ||
| 161 | + } | ||
| 162 | + $content2 = ''; | ||
| 163 | + if(!empty($data['google_indexed_num']) || !empty($data['google_links_num']) || !empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num']) || !empty($data['daily_average_num'])){ | ||
| 164 | + $content2 .= '项目截止目前'; | ||
| 165 | + if(!empty($data['google_indexed_num'])){ | ||
| 166 | + $content2 .= '谷歌收录量:'.$data['google_indexed_num'].'条,'; | ||
| 167 | + } | ||
| 168 | + if(!empty($data['google_links_num'])){ | ||
| 169 | + $content2 .= '外链量:'.$data['google_links_num'].'条,'; | ||
| 170 | + } | ||
| 171 | + if(!empty($data['keyword_home_num'])){ | ||
| 172 | + $content2 .= '谷歌搜索排名首页关键词数量为:'.$data['keyword_home_num'].'个,'; | ||
| 173 | + } | ||
| 174 | + if(!empty($data['keyword_three_num'])){ | ||
| 175 | + $content2 .= '前三页关键词数量为:'.$data['keyword_three_num'].'个,'; | ||
| 176 | + } | ||
| 177 | + if(!empty($data['keyword_five_num'])){ | ||
| 178 | + $content2 .= '前五页关键词数量为:'.$data['keyword_five_num'].'个,'; | ||
| 179 | + } | ||
| 180 | + if(!empty($data['keyword_ten_num'])){ | ||
| 181 | + $content2 .= '前十页关键词数量为:'.$data['keyword_ten_num'].'个,'; | ||
| 182 | + } | ||
| 183 | + if(!empty($data['daily_average_num'])){ | ||
| 184 | + $content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。'; | ||
| 185 | + } | ||
| 186 | + $content2 .= '全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;'; | ||
| 187 | + } | ||
| 188 | + $content3 = ''; | ||
| 189 | + if(!empty($data['product_num']) || !empty($data['news_num']) || !empty($data['week_product_num']) || !empty($data['week_news_num'])){ | ||
| 190 | + | ||
| 191 | + } | ||
| 192 | + $param = [ | ||
| 193 | + 'project_id'=>$project_id, | ||
| 194 | + 'friend_id'=>$friend_id, | ||
| 195 | + 'type'=>MessagePush::TYPE_WEEK, | ||
| 196 | + 'content'=>'', | ||
| 197 | + ]; | ||
| 198 | + //写入一条推送消息 自动消费 | ||
| 199 | + $messagePushModel = new MessagePush(); | ||
| 200 | + | ||
| 201 | + } | ||
| 120 | } | 202 | } |
| @@ -241,8 +241,16 @@ class UpdateSeoTdk extends Command | @@ -241,8 +241,16 @@ class UpdateSeoTdk extends Command | ||
| 241 | $notify_master = $notify_keyword = false; | 241 | $notify_master = $notify_keyword = false; |
| 242 | //更新统计 | 242 | //更新统计 |
| 243 | $update = []; | 243 | $update = []; |
| 244 | - $ai_commands = AiCommand::where('is_batch', 1)->select('key', 'scene', 'ai')->get()->toArray(); | 244 | + //AI指令 是否有定制指令 |
| 245 | + $ai_commands = AiCommand::where('is_batch', 1)->where('project_id', 0)->select('key', 'scene', 'ai')->get()->toArray(); | ||
| 246 | + $project_ai_commands = AiCommand::where('is_batch', 1)->where('project_id', $project_id)->select('key', 'scene', 'ai')->get()->toArray(); | ||
| 245 | $ai_commands = Arr::setValueToKey($ai_commands, 'key'); | 247 | $ai_commands = Arr::setValueToKey($ai_commands, 'key'); |
| 248 | + $project_ai_commands = Arr::setValueToKey($project_ai_commands, 'key'); | ||
| 249 | + foreach ($ai_commands as $k => $ai_command){ | ||
| 250 | + if(!empty($project_ai_commands[$k])){ | ||
| 251 | + $ai_commands[$k] = $project_ai_commands[$k]; | ||
| 252 | + } | ||
| 253 | + } | ||
| 246 | foreach ($this->maps as $table => $map) { | 254 | foreach ($this->maps as $table => $map) { |
| 247 | $total_page = DB::connection('custom_mysql')->table($table)->count(); | 255 | $total_page = DB::connection('custom_mysql')->table($table)->count(); |
| 248 | $update[$table] = ['total_page'=>$total_page, 'title'=>0, 'keyword'=>0, 'des'=>0,'keyword_title'=>0,'keyword_content'=>0]; | 256 | $update[$table] = ['total_page'=>$total_page, 'title'=>0, 'keyword'=>0, 'des'=>0,'keyword_title'=>0,'keyword_content'=>0]; |
| @@ -505,7 +513,7 @@ class UpdateSeoTdk extends Command | @@ -505,7 +513,7 @@ class UpdateSeoTdk extends Command | ||
| 505 | $info = $this->getDeployOptimize($project_id); | 513 | $info = $this->getDeployOptimize($project_id); |
| 506 | if (!empty($info['keyword_' . $type])) { | 514 | if (!empty($info['keyword_' . $type])) { |
| 507 | $fix_keyword = explode(",", $info['keyword_' . $type]); | 515 | $fix_keyword = explode(",", $info['keyword_' . $type]); |
| 508 | - | 516 | + $fix_keyword = array_filter($fix_keyword); |
| 509 | //去掉标题存在的词 | 517 | //去掉标题存在的词 |
| 510 | if ($topic) { | 518 | if ($topic) { |
| 511 | foreach ($fix_keyword as $k=>$keyword) { | 519 | foreach ($fix_keyword as $k=>$keyword) { |
| @@ -67,6 +67,16 @@ class UpdateRoute extends Command | @@ -67,6 +67,16 @@ class UpdateRoute extends Command | ||
| 67 | echo date('Y-m-d H:i:s') . 'end'.json_encode($data) . PHP_EOL; | 67 | echo date('Y-m-d H:i:s') . 'end'.json_encode($data) . PHP_EOL; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | + /** | ||
| 71 | + * @remark :导入数据 | ||
| 72 | + * @name :importCustomModule | ||
| 73 | + * @author :lyh | ||
| 74 | + * @method :post | ||
| 75 | + * @time :2025/2/24 14:44 | ||
| 76 | + */ | ||
| 77 | + public function importCustomModule(){ | ||
| 78 | + | ||
| 79 | + } | ||
| 70 | 80 | ||
| 71 | public function ceshi($api_no = null) | 81 | public function ceshi($api_no = null) |
| 72 | { | 82 | { |
| @@ -1097,6 +1097,7 @@ function getPrefixKeyword($project_id, $type, $num) | @@ -1097,6 +1097,7 @@ function getPrefixKeyword($project_id, $type, $num) | ||
| 1097 | $info = getDeployOptimize($project_id); | 1097 | $info = getDeployOptimize($project_id); |
| 1098 | if (!empty($info['keyword_' . $type])) { | 1098 | if (!empty($info['keyword_' . $type])) { |
| 1099 | $fix_keyword = explode(",", $info['keyword_' . $type]); | 1099 | $fix_keyword = explode(",", $info['keyword_' . $type]); |
| 1100 | + $fix_keyword = array_filter($fix_keyword); | ||
| 1100 | //随机取 | 1101 | //随机取 |
| 1101 | shuffle($fix_keyword); | 1102 | shuffle($fix_keyword); |
| 1102 | if (count($fix_keyword) < $num) | 1103 | if (count($fix_keyword) < $num) |
| @@ -98,7 +98,7 @@ class AdsController extends BaseController | @@ -98,7 +98,7 @@ class AdsController extends BaseController | ||
| 98 | $item['cost'] = ReInquiryCost::getCostByAdIds($item['ad_id']); | 98 | $item['cost'] = ReInquiryCost::getCostByAdIds($item['ad_id']); |
| 99 | } | 99 | } |
| 100 | $result['relay_site_total'] = $relay_site_total; | 100 | $result['relay_site_total'] = $relay_site_total; |
| 101 | - $result['default_ai_param'] = ReInquiryConfig::getDefaultConfigCache(); | 101 | + $result['default_ai_param'] = ReInquiryConfig::getDefaultConfigCache(ReInquiryConfig::TYPE_AI_PARAM); |
| 102 | 102 | ||
| 103 | return $this->response('success', Code::SUCCESS, $result); | 103 | return $this->response('success', Code::SUCCESS, $result); |
| 104 | } | 104 | } |
| @@ -388,8 +388,9 @@ class AdsController extends BaseController | @@ -388,8 +388,9 @@ class AdsController extends BaseController | ||
| 388 | * @author zbj | 388 | * @author zbj |
| 389 | * @date 2025/2/12 | 389 | * @date 2025/2/12 |
| 390 | */ | 390 | */ |
| 391 | - public function fbAdsDefaultSet(){ | ||
| 392 | - $config = ReInquiryConfig::get(); | 391 | + public function fbAdsDefaultSet(Request $request){ |
| 392 | + $type = $request->input('type')?: ReInquiryConfig::TYPE_AI_PARAM; | ||
| 393 | + $config = ReInquiryConfig::where('type', $type)->get(); | ||
| 393 | if($this->request->isMethod('get')){ | 394 | if($this->request->isMethod('get')){ |
| 394 | return $this->response('success', Code::SUCCESS, $config); | 395 | return $this->response('success', Code::SUCCESS, $config); |
| 395 | } | 396 | } |
| @@ -397,7 +398,7 @@ class AdsController extends BaseController | @@ -397,7 +398,7 @@ class AdsController extends BaseController | ||
| 397 | DB::beginTransaction(); | 398 | DB::beginTransaction(); |
| 398 | try { | 399 | try { |
| 399 | foreach ($config as $item){ | 400 | foreach ($config as $item){ |
| 400 | - if(empty($this->param[$item->key])){ | 401 | + if($type == ReInquiryConfig::TYPE_AI_PARAM && empty($this->param[$item->key])){ |
| 401 | throw new \Exception($item->title . '不能为空!'); | 402 | throw new \Exception($item->title . '不能为空!'); |
| 402 | } | 403 | } |
| 403 | $item->content = $this->param[$item->key]; | 404 | $item->content = $this->param[$item->key]; |
| @@ -418,7 +419,7 @@ class AdsController extends BaseController | @@ -418,7 +419,7 @@ class AdsController extends BaseController | ||
| 418 | * @date 2025/2/12 | 419 | * @date 2025/2/12 |
| 419 | */ | 420 | */ |
| 420 | public function fbAdsSetBatch(){ | 421 | public function fbAdsSetBatch(){ |
| 421 | - $config = ReInquiryConfig::find($this->param['id']); | 422 | + $config = ReInquiryConfig::where('type', ReInquiryConfig::TYPE_AI_PARAM)->where('id', $this->param['id'])->first(); |
| 422 | if(!$config){ | 423 | if(!$config){ |
| 423 | return $this->response('配置不存在', Code::USER_ERROR, []); | 424 | return $this->response('配置不存在', Code::USER_ERROR, []); |
| 424 | } | 425 | } |
| @@ -9,6 +9,7 @@ use App\Http\Requests\Bside\Ai\AiBlogRequest; | @@ -9,6 +9,7 @@ use App\Http\Requests\Bside\Ai\AiBlogRequest; | ||
| 9 | use App\Models\Ai\AiBlog; | 9 | use App\Models\Ai\AiBlog; |
| 10 | use App\Models\Ai\AiBlogAuthor; | 10 | use App\Models\Ai\AiBlogAuthor; |
| 11 | use App\Models\Ai\AiBlogList; | 11 | use App\Models\Ai\AiBlogList; |
| 12 | +use App\Models\RouteMap\RouteMap; | ||
| 12 | use App\Services\AiBlogService; | 13 | use App\Services\AiBlogService; |
| 13 | use App\Services\ProjectServer; | 14 | use App\Services\ProjectServer; |
| 14 | use Illuminate\Support\Facades\DB; | 15 | use Illuminate\Support\Facades\DB; |
| @@ -59,10 +60,13 @@ class AiBlogController extends BaseController | @@ -59,10 +60,13 @@ class AiBlogController extends BaseController | ||
| 59 | * @time :2025/2/14 13:59 | 60 | * @time :2025/2/14 13:59 |
| 60 | */ | 61 | */ |
| 61 | public function getAiBlog(AiBlog $aiBlog){ | 62 | public function getAiBlog(AiBlog $aiBlog){ |
| 62 | - $lists = $aiBlog->lists($this->map,$this->page,$this->row,'id',['id','new_title','image','task_id','status','created_at','updated_at']); | 63 | + $lists = $aiBlog->lists($this->map,$this->page,$this->row,'id',['id','keyword','new_title','route','image','task_id','status','created_at','updated_at']); |
| 63 | if(!empty($lists) && !empty($lists['list'])){ | 64 | if(!empty($lists) && !empty($lists['list'])){ |
| 64 | foreach ($lists['list'] as $k => $v){ | 65 | foreach ($lists['list'] as $k => $v){ |
| 65 | $v['image'] = getImageUrl($v['image']); | 66 | $v['image'] = getImageUrl($v['image']); |
| 67 | + if(!empty($v['route'])){ | ||
| 68 | + $v['route'] = $this->user['test_domain'] . 'blog/' . $v['route']; | ||
| 69 | + } | ||
| 66 | $lists['list'][$k] = $v; | 70 | $lists['list'][$k] = $v; |
| 67 | } | 71 | } |
| 68 | } | 72 | } |
| @@ -99,6 +103,13 @@ class AiBlogController extends BaseController | @@ -99,6 +103,13 @@ class AiBlogController extends BaseController | ||
| 99 | public function getAiBlogAuthor(AiBlogAuthor $aiBlogAuthor){ | 103 | public function getAiBlogAuthor(AiBlogAuthor $aiBlogAuthor){ |
| 100 | $field = ['id','route','author_id','title','image','created_at','updated_at']; | 104 | $field = ['id','route','author_id','title','image','created_at','updated_at']; |
| 101 | $lists = $aiBlogAuthor->lists($this->map,$this->page,$this->row,'id',$field); | 105 | $lists = $aiBlogAuthor->lists($this->map,$this->page,$this->row,'id',$field); |
| 106 | + if(!empty($lists) && !empty($lists['list'])){ | ||
| 107 | + foreach ($lists['list'] as $k => $v){ | ||
| 108 | + $v['image'] = getImageUrl($v['image']); | ||
| 109 | + $v['route'] = $this->user['test_domain'] . 'user/' . $v['route']; | ||
| 110 | + $lists['list'][$k] = $v; | ||
| 111 | + } | ||
| 112 | + } | ||
| 102 | $this->response('success',Code::SUCCESS,$lists); | 113 | $this->response('success',Code::SUCCESS,$lists); |
| 103 | } | 114 | } |
| 104 | 115 | ||
| @@ -143,7 +154,7 @@ class AiBlogController extends BaseController | @@ -143,7 +154,7 @@ class AiBlogController extends BaseController | ||
| 143 | public function delete(AiBlogLogic $aiBlogLogic) | 154 | public function delete(AiBlogLogic $aiBlogLogic) |
| 144 | { | 155 | { |
| 145 | $this->request->validate([ | 156 | $this->request->validate([ |
| 146 | - 'ids'=>['required', new Ids()] | 157 | + 'ids'=>['required'], |
| 147 | ],[ | 158 | ],[ |
| 148 | 'ids.required' => 'ID不能为空' | 159 | 'ids.required' => 'ID不能为空' |
| 149 | ]); | 160 | ]); |
| @@ -160,6 +171,14 @@ class AiBlogController extends BaseController | @@ -160,6 +171,14 @@ class AiBlogController extends BaseController | ||
| 160 | */ | 171 | */ |
| 161 | public function getAiBlogList(AiBlogList $aiBlogList){ | 172 | public function getAiBlogList(AiBlogList $aiBlogList){ |
| 162 | $lists = $aiBlogList->lists($this->map,$this->page,$this->row,'id',['id','route','created_at','updated_at']); | 173 | $lists = $aiBlogList->lists($this->map,$this->page,$this->row,'id',['id','route','created_at','updated_at']); |
| 174 | + if(!empty($lists) && !empty($lists['list'])){ | ||
| 175 | + foreach ($lists['list'] as $k => $v){ | ||
| 176 | + if(!empty($v['route'])){ | ||
| 177 | + $v['route'] = $this->user['test_domain'] . 'blog/' . $v['route']; | ||
| 178 | + } | ||
| 179 | + $lists['list'][$k] = $v; | ||
| 180 | + } | ||
| 181 | + } | ||
| 163 | $this->response('success',Code::SUCCESS,$lists); | 182 | $this->response('success',Code::SUCCESS,$lists); |
| 164 | } | 183 | } |
| 165 | 184 |
| @@ -37,12 +37,26 @@ class AiCommandLogic extends BaseLogic | @@ -37,12 +37,26 @@ class AiCommandLogic extends BaseLogic | ||
| 37 | */ | 37 | */ |
| 38 | public function ai_add(){ | 38 | public function ai_add(){ |
| 39 | $condition = [ | 39 | $condition = [ |
| 40 | - 'key'=>$this->param['key'] | 40 | + 'key'=>$this->param['key'], |
| 41 | + 'project_id'=>$this->param['project_id']??0, | ||
| 41 | ]; | 42 | ]; |
| 42 | $info = $this->model->read($condition); | 43 | $info = $this->model->read($condition); |
| 43 | if($info !== false){ | 44 | if($info !== false){ |
| 44 | $this->fail('当前指令已存在'); | 45 | $this->fail('当前指令已存在'); |
| 45 | } | 46 | } |
| 47 | + if($condition['project_id']){ | ||
| 48 | + $where = [ | ||
| 49 | + 'key'=>$this->param['key'], | ||
| 50 | + 'project_id'=>0, | ||
| 51 | + 'is_batch'=>1, | ||
| 52 | + ]; | ||
| 53 | + $valid_key = $this->model->read($where); | ||
| 54 | + if(!$valid_key){ | ||
| 55 | + $this->fail('指令字段不正确'); | ||
| 56 | + } | ||
| 57 | + $this->param['is_batch'] = 1; | ||
| 58 | + } | ||
| 59 | + | ||
| 46 | $this->param['operator_id'] = $this->manager['id']; | 60 | $this->param['operator_id'] = $this->manager['id']; |
| 47 | $this->param['create_id'] = $this->manager['id']; | 61 | $this->param['create_id'] = $this->manager['id']; |
| 48 | $rs = $this->model->add($this->param); | 62 | $rs = $this->model->add($this->param); |
| @@ -61,12 +75,25 @@ class AiCommandLogic extends BaseLogic | @@ -61,12 +75,25 @@ class AiCommandLogic extends BaseLogic | ||
| 61 | public function ai_edit(){ | 75 | public function ai_edit(){ |
| 62 | $condition = [ | 76 | $condition = [ |
| 63 | 'id'=>['!=',$this->param['id']], | 77 | 'id'=>['!=',$this->param['id']], |
| 64 | - 'key'=>$this->param['key'] | 78 | + 'key'=>$this->param['key'], |
| 79 | + 'project_id'=>$this->param['project_id']??0, | ||
| 65 | ]; | 80 | ]; |
| 66 | $info = $this->model->read($condition); | 81 | $info = $this->model->read($condition); |
| 67 | if($info !== false){ | 82 | if($info !== false){ |
| 68 | $this->fail('当前编辑的指令key已存在'); | 83 | $this->fail('当前编辑的指令key已存在'); |
| 69 | } | 84 | } |
| 85 | + if($condition['project_id']){ | ||
| 86 | + $where = [ | ||
| 87 | + 'key'=>$this->param['key'], | ||
| 88 | + 'project_id'=>0, | ||
| 89 | + 'is_batch'=>1, | ||
| 90 | + ]; | ||
| 91 | + $valid_key = $this->model->read($where); | ||
| 92 | + if(!$valid_key){ | ||
| 93 | + $this->fail('指令字段不正确'); | ||
| 94 | + } | ||
| 95 | + $this->param['is_batch'] = 1; | ||
| 96 | + } | ||
| 70 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | 97 | $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 71 | if($rs === false){ | 98 | if($rs === false){ |
| 72 | $this->fail('error'); | 99 | $this->fail('error'); |
| @@ -248,7 +248,7 @@ class ProjectLogic extends BaseLogic | @@ -248,7 +248,7 @@ class ProjectLogic extends BaseLogic | ||
| 248 | public function createAuthor($project_id,$mch_id,$key){ | 248 | public function createAuthor($project_id,$mch_id,$key){ |
| 249 | //查看当前项目是否已经创建了作者 | 249 | //查看当前项目是否已经创建了作者 |
| 250 | $aiBlogTaskModel = new AiBlogTask(); | 250 | $aiBlogTaskModel = new AiBlogTask(); |
| 251 | - $count = $aiBlogTaskModel->counts(); | 251 | + $count = $aiBlogTaskModel->counts(['project_id'=>$project_id]); |
| 252 | if($count > 0){ | 252 | if($count > 0){ |
| 253 | return true; | 253 | return true; |
| 254 | } | 254 | } |
| @@ -55,7 +55,7 @@ class AiBlogLogic extends BaseLogic | @@ -55,7 +55,7 @@ class AiBlogLogic extends BaseLogic | ||
| 55 | $aiBlogService = new AiBlogService(); | 55 | $aiBlogService = new AiBlogService(); |
| 56 | $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | 56 | $aiBlogService->mch_id = $aiSettingInfo['mch_id']; |
| 57 | $aiBlogService->key = $aiSettingInfo['key']; | 57 | $aiBlogService->key = $aiSettingInfo['key']; |
| 58 | - $aiBlogService->updateDetail(['title'=>$this->param['title'],'thumb'=>$this->param['image'],'route'=>$this->param['route'],'author_id'=>$this->param['author_id']]); | 58 | + $aiBlogService->updateDetail(['title'=>$this->param['new_title'],'thumb'=>$this->param['image'],'route'=>$this->param['route'],'author_id'=>$this->param['author_id']]); |
| 59 | }catch (\Exception $e){ | 59 | }catch (\Exception $e){ |
| 60 | $this->fail('保存失败,请联系管理员'); | 60 | $this->fail('保存失败,请联系管理员'); |
| 61 | } | 61 | } |
| @@ -99,7 +99,7 @@ class AiBlogLogic extends BaseLogic | @@ -99,7 +99,7 @@ class AiBlogLogic extends BaseLogic | ||
| 99 | $aiBlogService = new AiBlogService(); | 99 | $aiBlogService = new AiBlogService(); |
| 100 | $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | 100 | $aiBlogService->mch_id = $aiSettingInfo['mch_id']; |
| 101 | $aiBlogService->key = $aiSettingInfo['key']; | 101 | $aiBlogService->key = $aiSettingInfo['key']; |
| 102 | - $aiBlogService->route = generateRoute(Translate::tran($this->param['route'], 'en')); | 102 | + $aiBlogService->route = generateRoute(Translate::tran($this->param['keyword'], 'en')); |
| 103 | $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']); | 103 | $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']); |
| 104 | if($result['status'] == 200){ | 104 | if($result['status'] == 200){ |
| 105 | $aiBlogTaskModel = new AiBlogTask(); | 105 | $aiBlogTaskModel = new AiBlogTask(); |
| @@ -26,7 +26,11 @@ class AiCommandLogic extends BaseLogic | @@ -26,7 +26,11 @@ class AiCommandLogic extends BaseLogic | ||
| 26 | * @date 2023/11/22 | 26 | * @date 2023/11/22 |
| 27 | */ | 27 | */ |
| 28 | public function getPrompt($is_batch = 0){ | 28 | public function getPrompt($is_batch = 0){ |
| 29 | - $ai_command = $this->model->where('key', $this->param['key'])->first(); | 29 | + //是否有项目指令 |
| 30 | + $ai_command = $this->model->where('key', $this->param['key'])->where('project_id', $this->project['id'])->first(); | ||
| 31 | + if(!$ai_command){ | ||
| 32 | + $ai_command = $this->model->where('key', $this->param['key'])->where('project_id', 0)->first(); | ||
| 33 | + } | ||
| 30 | if(!$ai_command){ | 34 | if(!$ai_command){ |
| 31 | $this->fail('指令不存在'); | 35 | $this->fail('指令不存在'); |
| 32 | } | 36 | } |
| @@ -488,6 +488,7 @@ class RankDataLogic extends BaseLogic | @@ -488,6 +488,7 @@ class RankDataLogic extends BaseLogic | ||
| 488 | $without_project_ids = []; //不用处理排名的项目 | 488 | $without_project_ids = []; //不用处理排名的项目 |
| 489 | $without_extension_project_ids = [658]; //是否达标只统计主词的 | 489 | $without_extension_project_ids = [658]; //是否达标只统计主词的 |
| 490 | $extension_project_ids = [354]; //扩展词也到达标的 | 490 | $extension_project_ids = [354]; //扩展词也到达标的 |
| 491 | + $compliance_project_ids = [2163]; //直接达标处理的 | ||
| 491 | $ceaseProjectId = [ | 492 | $ceaseProjectId = [ |
| 492 | 47, | 493 | 47, |
| 493 | 354, | 494 | 354, |
| @@ -575,6 +576,9 @@ class RankDataLogic extends BaseLogic | @@ -575,6 +576,9 @@ class RankDataLogic extends BaseLogic | ||
| 575 | if(in_array($project_id, $extension_project_ids)){ | 576 | if(in_array($project_id, $extension_project_ids)){ |
| 576 | $is_compliance = $first_page_extension_num >= $keyword_num; | 577 | $is_compliance = $first_page_extension_num >= $keyword_num; |
| 577 | } | 578 | } |
| 579 | + if(in_array($project_id, $compliance_project_ids)){ | ||
| 580 | + $is_compliance = 1; //直接达标处理 | ||
| 581 | + } | ||
| 578 | if ($keyword_num && $type == Project::TYPE_TWO && $is_compliance) { | 582 | if ($keyword_num && $type == Project::TYPE_TWO && $is_compliance) { |
| 579 | Log::channel('rank_data')->info('项目' . $project_id . ':关键词达标'. $keyword_num .' - ' . $first_page_num . ' - ' . $first_page_without_extension_num); | 583 | Log::channel('rank_data')->info('项目' . $project_id . ':关键词达标'. $keyword_num .' - ' . $first_page_num . ' - ' . $first_page_without_extension_num); |
| 580 | //项目表更新 | 584 | //项目表更新 |
| @@ -60,11 +60,15 @@ class WebSettingTextLogic extends BaseLogic | @@ -60,11 +60,15 @@ class WebSettingTextLogic extends BaseLogic | ||
| 60 | DB::beginTransaction(); | 60 | DB::beginTransaction(); |
| 61 | try { | 61 | try { |
| 62 | //更新描文本设置 | 62 | //更新描文本设置 |
| 63 | + if($this->param['anchor_is_enable'] == 0){ | ||
| 64 | + $this->param['anchor_keyword_is_enable'] = 0; | ||
| 65 | + } | ||
| 63 | $data = [ | 66 | $data = [ |
| 64 | 'anchor_setting'=>$this->param['anchor_setting'], | 67 | 'anchor_setting'=>$this->param['anchor_setting'], |
| 65 | 'anchor_is_enable'=>$this->param['anchor_is_enable'], | 68 | 'anchor_is_enable'=>$this->param['anchor_is_enable'], |
| 66 | 'anchor_num'=>$this->param['anchor_num'] ?? 0, | 69 | 'anchor_num'=>$this->param['anchor_num'] ?? 0, |
| 67 | - 'anchor_page_num'=>$this->param['anchor_page_num'] ?? 0 | 70 | + 'anchor_page_num'=>$this->param['anchor_page_num'] ?? 0, |
| 71 | + 'anchor_keyword_is_enable'=>$this->param['anchor_keyword_is_enable'] ?? 0 | ||
| 68 | ]; | 72 | ]; |
| 69 | $web_setting->edit($data,['project_id'=>$this->user['project_id']]); | 73 | $web_setting->edit($data,['project_id'=>$this->user['project_id']]); |
| 70 | $this->model->del(['project_id'=>$this->user['project_id']]); | 74 | $this->model->del(['project_id'=>$this->user['project_id']]); |
| @@ -24,18 +24,14 @@ class AiBlogRequest extends FormRequest | @@ -24,18 +24,14 @@ class AiBlogRequest extends FormRequest | ||
| 24 | public function rules() | 24 | public function rules() |
| 25 | { | 25 | { |
| 26 | return [ | 26 | return [ |
| 27 | - 'keywords'=>'required', | ||
| 28 | 'new_title'=>'required', | 27 | 'new_title'=>'required', |
| 29 | - 'text'=>'required', | ||
| 30 | ]; | 28 | ]; |
| 31 | } | 29 | } |
| 32 | 30 | ||
| 33 | public function messages() | 31 | public function messages() |
| 34 | { | 32 | { |
| 35 | return [ | 33 | return [ |
| 36 | - 'keywords.required' => '关键字不能为空', | ||
| 37 | 'new_title.required' => '新标题不能为空', | 34 | 'new_title.required' => '新标题不能为空', |
| 38 | - 'text.required' => '内容不能为空', | ||
| 39 | ]; | 35 | ]; |
| 40 | } | 36 | } |
| 41 | } | 37 | } |
| @@ -15,21 +15,23 @@ use Illuminate\Support\Facades\Cache; | @@ -15,21 +15,23 @@ use Illuminate\Support\Facades\Cache; | ||
| 15 | */ | 15 | */ |
| 16 | class ReInquiryConfig extends Base | 16 | class ReInquiryConfig extends Base |
| 17 | { | 17 | { |
| 18 | + const TYPE_AI_PARAM = 'ai_param'; | ||
| 19 | + const TYPE_FILTER_WORDS = 'filter_words'; | ||
| 18 | 20 | ||
| 19 | //设置关联表名 | 21 | //设置关联表名 |
| 20 | protected $table = 'gl_re_inquiry_config'; | 22 | protected $table = 'gl_re_inquiry_config'; |
| 21 | 23 | ||
| 22 | 24 | ||
| 23 | - public static function getDefaultConfigCache(){ | 25 | + public static function getDefaultConfigCache($type){ |
| 24 | $cache_key = 'ReInquiryDefaultConfigCache'; | 26 | $cache_key = 'ReInquiryDefaultConfigCache'; |
| 25 | $data = Cache::get($cache_key); | 27 | $data = Cache::get($cache_key); |
| 26 | if(!$data){ | 28 | if(!$data){ |
| 27 | - $data = self::pluck('content', 'key'); | 29 | + $data = self::all(); |
| 28 | if($data){ | 30 | if($data){ |
| 29 | Cache::put($cache_key, $data); | 31 | Cache::put($cache_key, $data); |
| 30 | } | 32 | } |
| 31 | } | 33 | } |
| 32 | - return $data; | 34 | + return $data->where('type', $type)->pluck('content', 'key'); |
| 33 | } | 35 | } |
| 34 | 36 | ||
| 35 | public static function delCache(){ | 37 | public static function delCache(){ |
| @@ -92,6 +92,6 @@ class ReInquiryTask extends Base | @@ -92,6 +92,6 @@ class ReInquiryTask extends Base | ||
| 92 | 92 | ||
| 93 | public function getAiParamAttribute($value) | 93 | public function getAiParamAttribute($value) |
| 94 | { | 94 | { |
| 95 | - return Arr::s2a($value) ?: ReInquiryConfig::getDefaultConfigCache(); | 95 | + return Arr::s2a($value) ?: ReInquiryConfig::getDefaultConfigCache(ReInquiryConfig::TYPE_AI_PARAM); |
| 96 | } | 96 | } |
| 97 | } | 97 | } |
| @@ -35,6 +35,7 @@ class RouteMap extends Base | @@ -35,6 +35,7 @@ class RouteMap extends Base | ||
| 35 | const SOURCE_MODULE = 'module'; | 35 | const SOURCE_MODULE = 'module'; |
| 36 | const SOURCE_AI_BLOG = 'ai_blog'; | 36 | const SOURCE_AI_BLOG = 'ai_blog'; |
| 37 | const SOURCE_AI_BLOG_AUTHOR = 'ai_blog_author';//ai博客作者 | 37 | const SOURCE_AI_BLOG_AUTHOR = 'ai_blog_author';//ai博客作者 |
| 38 | + const SOURCE_AI_BLOG_LIST = 'ai_blog_list'; | ||
| 38 | //自定义模块分类 | 39 | //自定义模块分类 |
| 39 | const SOURCE_MODULE_CATE = 'module_category'; | 40 | const SOURCE_MODULE_CATE = 'module_category'; |
| 40 | 41 |
| @@ -25,7 +25,7 @@ class MessagePush extends Base | @@ -25,7 +25,7 @@ class MessagePush extends Base | ||
| 25 | const STATUS_ERROR = 9; | 25 | const STATUS_ERROR = 9; |
| 26 | 26 | ||
| 27 | const TYPE_INQUIRY = 'inquiry'; | 27 | const TYPE_INQUIRY = 'inquiry'; |
| 28 | - | 28 | + const TYPE_WEEK = 'week'; |
| 29 | //设置关联表名 | 29 | //设置关联表名 |
| 30 | /** | 30 | /** |
| 31 | * @var mixed | 31 | * @var mixed |
-
请 注册 或 登录 后发表评论