Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
36 个修改的文件
包含
1227 行增加
和
132 行删除
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AiBlogTask.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/2/14 11:14 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\AiBlog; | ||
| 11 | + | ||
| 12 | +use App\Models\Ai\AiBlog; | ||
| 13 | +use App\Models\Ai\AiBlogAuthor; | ||
| 14 | +use App\Models\Ai\AiBlogList; | ||
| 15 | +use App\Models\Project\ProjectAiSetting; | ||
| 16 | +use App\Models\RouteMap\RouteMap; | ||
| 17 | +use App\Services\AiBlogService; | ||
| 18 | +use App\Services\ProjectServer; | ||
| 19 | +use Illuminate\Console\Command; | ||
| 20 | +use App\Models\Project\AiBlogTask as AiBlogTaskModel; | ||
| 21 | +use Illuminate\Support\Facades\Cache; | ||
| 22 | +use Illuminate\Support\Facades\DB; | ||
| 23 | +use function Symfony\Component\String\s; | ||
| 24 | + | ||
| 25 | +class AiBlogListTask extends Command | ||
| 26 | +{ | ||
| 27 | + /** | ||
| 28 | + * The name and signature of the console command. | ||
| 29 | + * | ||
| 30 | + * @var string | ||
| 31 | + */ | ||
| 32 | + protected $signature = 'save_ai_blog_list {project_id}'; | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * The console command description. | ||
| 36 | + * | ||
| 37 | + * @var string | ||
| 38 | + */ | ||
| 39 | + protected $description = '生成blog列表'; | ||
| 40 | + | ||
| 41 | + public function handle(){ | ||
| 42 | + $project_id = $this->argument('project_id'); | ||
| 43 | + ProjectServer::useProject($project_id); | ||
| 44 | + $projectAiSettingModel = new ProjectAiSetting(); | ||
| 45 | + $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]); | ||
| 46 | + $this->updateBlogList($aiSettingInfo); | ||
| 47 | + DB::disconnect('custom_mysql'); | ||
| 48 | + return true; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * @remark :更新列表页数据 | ||
| 53 | + * @name :updateBlogList | ||
| 54 | + * @author :lyh | ||
| 55 | + * @method :post | ||
| 56 | + * @time :2025/3/5 11:07 | ||
| 57 | + */ | ||
| 58 | + public function updateBlogList($aiSettingInfo){ | ||
| 59 | + $aiBlogService = new AiBlogService(); | ||
| 60 | + $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | ||
| 61 | + $aiBlogService->key = $aiSettingInfo['key']; | ||
| 62 | + $page = 1; | ||
| 63 | + $saveData = []; | ||
| 64 | + $result = $aiBlogService->getAiBlogList($page,15); | ||
| 65 | + if(!isset($result['status']) && $result['status'] != 200){ | ||
| 66 | + return true; | ||
| 67 | + } | ||
| 68 | + $total_page = $result['data']['total_page']; | ||
| 69 | + //组装数据保存 | ||
| 70 | + $saveData[] = [ | ||
| 71 | + 'route'=>$page, | ||
| 72 | + 'text'=>$result['data']['section'], | ||
| 73 | + ]; | ||
| 74 | + while ($total_page > $page){ | ||
| 75 | + $page++; | ||
| 76 | + $result = $aiBlogService->getAiBlogList($page,15); | ||
| 77 | + if(isset($result['status']) && $result['status'] == 200){ | ||
| 78 | + $saveData[] = [ | ||
| 79 | + 'route'=>$page, | ||
| 80 | + 'text'=>$result['data']['section'], | ||
| 81 | + ]; | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + $aiBlogListModel = new AiBlogList(); | ||
| 85 | + if(!empty($saveData)){ | ||
| 86 | + //写一条路由信息 | ||
| 87 | + $aiBlogListModel->truncate(); | ||
| 88 | + $aiBlogListModel->insertAll($saveData); | ||
| 89 | + } | ||
| 90 | + return true; | ||
| 91 | + } | ||
| 92 | +} |
| @@ -41,52 +41,76 @@ class AiBlogTask extends Command | @@ -41,52 +41,76 @@ class AiBlogTask extends Command | ||
| 41 | public function handle(){ | 41 | public function handle(){ |
| 42 | $aiBlogTaskModel = new AiBlogTaskModel(); | 42 | $aiBlogTaskModel = new AiBlogTaskModel(); |
| 43 | while (true){ | 43 | while (true){ |
| 44 | - $info = $aiBlogTaskModel->where('status',1)->where('type',2)->inRandomOrder()->first(); | ||
| 45 | - if(empty($info)){ | 44 | + $list = $aiBlogTaskModel->list(['status'=>1,'type'=>2],'id',['*'],'asc',1000); |
| 45 | + if(empty($list)){ | ||
| 46 | sleep(300); | 46 | sleep(300); |
| 47 | continue; | 47 | continue; |
| 48 | } | 48 | } |
| 49 | - $info = $info->toArray(); | ||
| 50 | - echo '开始->任务id:' . $info['task_id'] . PHP_EOL . date('Y-m-d H:i:s'); | ||
| 51 | - //获取配置 | ||
| 52 | - $aiSettingInfo = $this->getSetting($info['project_id']); | ||
| 53 | - $aiBlogService = new AiBlogService(); | ||
| 54 | - $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | ||
| 55 | - $aiBlogService->key = $aiSettingInfo['key']; | ||
| 56 | - $aiBlogService->task_id = $info['task_id']; | ||
| 57 | - $result = $aiBlogService->getDetail(); | ||
| 58 | - if(!isset($result['status'])){ | ||
| 59 | - continue; | ||
| 60 | - } | ||
| 61 | - if($result['status'] != 200){ | ||
| 62 | - sleep(10); | ||
| 63 | - continue; | ||
| 64 | - } | ||
| 65 | - //保存当前项目ai_blog数据 | ||
| 66 | - ProjectServer::useProject($info['project_id']); | ||
| 67 | - $aiBlogModel = new AiBlog(); | ||
| 68 | - $aiBlogInfo = $aiBlogModel->read(['task_id'=>$info['task_id']],['id']); | ||
| 69 | - if($aiBlogInfo === false){ | ||
| 70 | - $aiBlogTaskModel->edit(['status'=>2],['id'=>$info['id']]); | ||
| 71 | - continue; | 49 | + $updateProject = []; |
| 50 | + foreach ($list as $item){ | ||
| 51 | + echo '开始->任务id:' . $item['task_id'] . PHP_EOL . date('Y-m-d H:i:s'); | ||
| 52 | + //获取配置 | ||
| 53 | + $aiSettingInfo = $this->getSetting($item['project_id']); | ||
| 54 | + $aiBlogService = new AiBlogService(); | ||
| 55 | + $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | ||
| 56 | + $aiBlogService->key = $aiSettingInfo['key']; | ||
| 57 | + $aiBlogService->task_id = $item['task_id']; | ||
| 58 | + $result = $aiBlogService->getDetail(); | ||
| 59 | + if($result['status'] != 200){ | ||
| 60 | + sleep(5); | ||
| 61 | + continue; | ||
| 62 | + } | ||
| 63 | + //保存当前项目ai_blog数据 | ||
| 64 | + ProjectServer::useProject($item['project_id']); | ||
| 65 | + $aiBlogModel = new AiBlog(); | ||
| 66 | + $aiBlogInfo = $aiBlogModel->read(['task_id'=>$item['task_id']],['id']); | ||
| 67 | + if($aiBlogInfo === false){ | ||
| 68 | + $aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]); | ||
| 69 | + continue; | ||
| 70 | + } | ||
| 71 | + if (!in_array($result['data']['author_id'], $updateProject[$item['project_id']] ?? [])) { | ||
| 72 | + $updateProject[$item['project_id']][] = $result['data']['author_id']; | ||
| 73 | + } | ||
| 74 | + //拿到返回的路由查看是否重复 | ||
| 75 | + $route = RouteMap::setRoute($result['data']['url'], RouteMap::SOURCE_AI_BLOG, $aiBlogInfo['id'], $item['project_id']); | ||
| 76 | + if($route != $result['data']['url']){ | ||
| 77 | + $aiBlogService->updateDetail(['route'=>$this->param['route']]); | ||
| 78 | + } | ||
| 79 | + $aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'], 'route'=>$route ,'status'=>2], ['task_id'=>$item['task_id']]); | ||
| 80 | + DB::disconnect('custom_mysql'); | ||
| 81 | + $aiBlogTaskModel->edit(['status'=>2],['id'=>$item['id']]); | ||
| 72 | } | 82 | } |
| 73 | - //拿到返回的路由查看是否重复 | ||
| 74 | - $route = RouteMap::setRoute($result['data']['url'], RouteMap::SOURCE_AI_BLOG, $aiBlogInfo['id'], $info['project_id']); | ||
| 75 | - if($route != $result['data']['url']){ | ||
| 76 | - $aiBlogService->updateDetail(['route'=>$this->param['route']]); | ||
| 77 | - } | ||
| 78 | - $aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'], 'route'=>$route ,'status'=>2], ['task_id'=>$info['task_id']]); | ||
| 79 | - $this->updateAiBlogAuthor($aiSettingInfo,$result['data']['author_id']); | 83 | + //TODO::更新列表页及作者 |
| 84 | + $this->updateProject($updateProject); | ||
| 85 | + echo '结束->任务id:' . $item['task_id'] . PHP_EOL . date('Y-m-d H:i:s'); | ||
| 86 | + } | ||
| 87 | + return true; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * @remark :更新项目作者页面及列表页 | ||
| 92 | + * @name :updateProject | ||
| 93 | + * @author :lyh | ||
| 94 | + * @method :post | ||
| 95 | + * @time :2025/3/4 10:25 | ||
| 96 | + */ | ||
| 97 | + public function updateProject($updateProject){ | ||
| 98 | + if(empty($updateProject)){ | ||
| 99 | + return true; | ||
| 100 | + } | ||
| 101 | + foreach ($updateProject as $project_id => $author){ | ||
| 102 | + ProjectServer::useProject($project_id); | ||
| 103 | + $aiSettingInfo = $this->getSetting($project_id); | ||
| 80 | $this->updateBlogList($aiSettingInfo); | 104 | $this->updateBlogList($aiSettingInfo); |
| 105 | + //更新作者 | ||
| 106 | + foreach ($author as $val){ | ||
| 107 | + $this->updateAiBlogAuthor($aiSettingInfo,$val); | ||
| 108 | + } | ||
| 81 | DB::disconnect('custom_mysql'); | 109 | DB::disconnect('custom_mysql'); |
| 82 | - //修改任务状态 | ||
| 83 | - $aiBlogTaskModel->edit(['status'=>2],['id'=>$info['id']]); | ||
| 84 | - echo '结束->任务id:' . $info['task_id'] . PHP_EOL . date('Y-m-d H:i:s'); | ||
| 85 | } | 110 | } |
| 86 | return true; | 111 | return true; |
| 87 | } | 112 | } |
| 88 | 113 | ||
| 89 | - | ||
| 90 | /** | 114 | /** |
| 91 | * @remark :获取项目配置 | 115 | * @remark :获取项目配置 |
| 92 | * @name :getSetting | 116 | * @name :getSetting |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\Industry; | ||
| 4 | + | ||
| 5 | +use App\Helper\Arr; | ||
| 6 | +use App\Helper\Common; | ||
| 7 | +use App\Helper\Gpt; | ||
| 8 | +use App\Models\Ai\AiCommand; | ||
| 9 | +use App\Models\Domain\DomainInfo; | ||
| 10 | +use App\Models\Industry\ProjectIndustry; | ||
| 11 | +use App\Models\Industry\ProjectIndustryRelated; | ||
| 12 | +use Illuminate\Console\Command; | ||
| 13 | + | ||
| 14 | +class CheckProjectIndustry extends Command | ||
| 15 | +{ | ||
| 16 | + /** | ||
| 17 | + * The name and signature of the console command. | ||
| 18 | + * | ||
| 19 | + * @var string | ||
| 20 | + */ | ||
| 21 | + protected $signature = 'check_project_industry'; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * The console command description. | ||
| 25 | + * | ||
| 26 | + * @var string | ||
| 27 | + */ | ||
| 28 | + protected $description = '匹配上线项目所属行业'; | ||
| 29 | + | ||
| 30 | + public function handle() | ||
| 31 | + { | ||
| 32 | + $ai_command = AiCommand::where('key', 'project_industry')->value('ai'); | ||
| 33 | + if (!$ai_command) { | ||
| 34 | + $this->output('AI指令未配置'); | ||
| 35 | + return; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + $industry_list = ProjectIndustry::where('status', 1)->pluck('industry_name')->toArray(); | ||
| 39 | + if (!$industry_list) { | ||
| 40 | + $this->output('行业匹配数据为空'); | ||
| 41 | + return; | ||
| 42 | + } | ||
| 43 | + $industry_names = implode(',', $industry_list); | ||
| 44 | + | ||
| 45 | + $domainModel = new DomainInfo(); | ||
| 46 | + $list = $domainModel->select(['id', 'domain', 'project_id'])->where('status', 1)->where('project_id', '>', 0)->get()->toArray(); | ||
| 47 | + | ||
| 48 | + foreach ($list as $value) { | ||
| 49 | + $project_id = $value['project_id']; | ||
| 50 | + $domain = $value['domain']; | ||
| 51 | + | ||
| 52 | + $has_related_count = ProjectIndustryRelated::select(['id'])->where('project_id', $project_id)->count(); | ||
| 53 | + if ($has_related_count > 0) { | ||
| 54 | + $this->output('project_id:' . $project_id . ' , domain:' . $domain . ' | 已分析过滤'); | ||
| 55 | + continue; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + $project_industry = $this->getIndustryByAI($ai_command, $industry_names, $domain); | ||
| 59 | + | ||
| 60 | + if ($project_industry) { | ||
| 61 | + $project_industry_name = Arr::splitFilterToArray($project_industry); | ||
| 62 | + | ||
| 63 | + $project_industry_id = ProjectIndustry::where('status', 1)->whereIn('industry_name', $project_industry_name)->pluck('id')->toArray(); | ||
| 64 | + | ||
| 65 | + ProjectIndustryRelated::saveRelated($project_id, $project_industry_id); | ||
| 66 | + | ||
| 67 | + $this->output('project_id:' . $project_id . ' , domain:' . $domain . ' | success'); | ||
| 68 | + } else { | ||
| 69 | + $this->output('project_id:' . $project_id . ' , domain:' . $domain . ' | AI分析行业失败'); | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * AI分析行业 | ||
| 76 | + * @param $ai_command | ||
| 77 | + * @param $industry_names | ||
| 78 | + * @param $domain | ||
| 79 | + * @return string|string[] | ||
| 80 | + * @author Akun | ||
| 81 | + * @date 2025/03/05 10:42 | ||
| 82 | + */ | ||
| 83 | + public function getIndustryByAI($ai_command, $industry_names, $domain) | ||
| 84 | + { | ||
| 85 | + $ai_command = str_replace('{domain}', 'https://' . $domain, $ai_command); | ||
| 86 | + $ai_command = str_replace('{industry}', $industry_names, $ai_command); | ||
| 87 | + | ||
| 88 | + $text = Gpt::instance()->openai_chat_qqs($ai_command); | ||
| 89 | + | ||
| 90 | + return Common::deal_str($text); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public function output($msg) | ||
| 94 | + { | ||
| 95 | + echo date('Y-m-d H:i:s') . ' | ' . $msg . PHP_EOL; | ||
| 96 | + } | ||
| 97 | +} |
| @@ -46,8 +46,12 @@ class SyncInquiryRelay extends Command | @@ -46,8 +46,12 @@ class SyncInquiryRelay extends Command | ||
| 46 | { | 46 | { |
| 47 | $this->output('开始同步表单系统询盘'); | 47 | $this->output('开始同步表单系统询盘'); |
| 48 | $this->getInquiryForm(); | 48 | $this->getInquiryForm(); |
| 49 | - $this->output('开始同步asp采集询盘'); | 49 | + |
| 50 | + $this->output('开始同步SC平台询盘'); | ||
| 50 | $this->getInquirySzcm(); | 51 | $this->getInquirySzcm(); |
| 52 | + | ||
| 53 | + $this->output('开始同步FS平台询盘'); | ||
| 54 | + $this->getInquiryFs(); | ||
| 51 | } | 55 | } |
| 52 | 56 | ||
| 53 | /** | 57 | /** |
| @@ -65,9 +69,6 @@ class SyncInquiryRelay extends Command | @@ -65,9 +69,6 @@ class SyncInquiryRelay extends Command | ||
| 65 | //+86区号过滤 | 69 | //+86区号过滤 |
| 66 | continue; | 70 | continue; |
| 67 | } | 71 | } |
| 68 | - if (strpos($item['refer'], 'findsupply.com') !== false) { | ||
| 69 | - $item['source_type'] = InquiryInfo::TYPE_FIND_SUPPLY; | ||
| 70 | - } | ||
| 71 | $this->saveDate($item, $item['source_type']); | 72 | $this->saveDate($item, $item['source_type']); |
| 72 | } | 73 | } |
| 73 | } | 74 | } |
| @@ -112,6 +113,37 @@ class SyncInquiryRelay extends Command | @@ -112,6 +113,37 @@ class SyncInquiryRelay extends Command | ||
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | /** | 115 | /** |
| 116 | + * @return bool | ||
| 117 | + * @throws \Exception | ||
| 118 | + * @author Akun | ||
| 119 | + * @date 2025/03/04 11:48 | ||
| 120 | + */ | ||
| 121 | + public function getInquiryFs() | ||
| 122 | + { | ||
| 123 | + $service = new InquiryRelayService(); | ||
| 124 | + $next_page_url = 'https://www.findsupply.com/api/external?page=1&pagesize=50'; | ||
| 125 | + $model = new InquiryInfo(); | ||
| 126 | + while ($next_page_url) { | ||
| 127 | + $result = $service->getInquiryFs($next_page_url); | ||
| 128 | + $data = $result['data']; | ||
| 129 | + $next_page_url = $result['next_page_url']; | ||
| 130 | + | ||
| 131 | + if ($data) { | ||
| 132 | + foreach ($data as $item) { | ||
| 133 | + $message_sign = md5($item['name'] . $item['email'] . $item['phone'] . $item['ip'] . $item['time']); | ||
| 134 | + $inquiry_info = $model->where('message_sign', $message_sign)->first(); | ||
| 135 | + if ($inquiry_info) { | ||
| 136 | + $next_page_url = null; | ||
| 137 | + break; | ||
| 138 | + } | ||
| 139 | + $this->saveDate($item, InquiryInfo::TYPE_FIND_SUPPLY); | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + return true; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + /** | ||
| 115 | * 询盘数据入库 | 147 | * 询盘数据入库 |
| 116 | * @param $data | 148 | * @param $data |
| 117 | * @param $type | 149 | * @param $type |
| @@ -148,6 +180,7 @@ class SyncInquiryRelay extends Command | @@ -148,6 +180,7 @@ class SyncInquiryRelay extends Command | ||
| 148 | $html = curl_c($data['refer'], false); | 180 | $html = curl_c($data['refer'], false); |
| 149 | 181 | ||
| 150 | if (empty($data['title'])) { | 182 | if (empty($data['title'])) { |
| 183 | + $data['title'] = ''; | ||
| 151 | preg_match_all('/<title>([\w\W]*?)<\/title>/', $html, $matches); | 184 | preg_match_all('/<title>([\w\W]*?)<\/title>/', $html, $matches); |
| 152 | if (!empty($matches[1])) { | 185 | if (!empty($matches[1])) { |
| 153 | $data['title'] = substr($matches[1][0], 0, 255); | 186 | $data['title'] = substr($matches[1][0], 0, 255); |
| @@ -14,6 +14,9 @@ use App\Models\CustomModule\CustomModuleContent; | @@ -14,6 +14,9 @@ use App\Models\CustomModule\CustomModuleContent; | ||
| 14 | use App\Models\CustomModule\CustomModuleExtentContent; | 14 | use App\Models\CustomModule\CustomModuleExtentContent; |
| 15 | use App\Models\News\News; | 15 | use App\Models\News\News; |
| 16 | use App\Models\Product\Category; | 16 | use App\Models\Product\Category; |
| 17 | +use App\Models\Product\CategoryRelated; | ||
| 18 | +use App\Models\Product\Column; | ||
| 19 | +use App\Models\Product\Detail; | ||
| 17 | use App\Models\Product\Product; | 20 | use App\Models\Product\Product; |
| 18 | use App\Models\RouteMap\RouteMap; | 21 | use App\Models\RouteMap\RouteMap; |
| 19 | use App\Models\Template\BTemplate; | 22 | use App\Models\Template\BTemplate; |
| @@ -48,10 +51,10 @@ class LyhImportTest extends Command | @@ -48,10 +51,10 @@ class LyhImportTest extends Command | ||
| 48 | * @time :2023/11/20 15:13 | 51 | * @time :2023/11/20 15:13 |
| 49 | */ | 52 | */ |
| 50 | public function handle(){ | 53 | public function handle(){ |
| 51 | - ProjectServer::useProject(3283); | ||
| 52 | - echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; | ||
| 53 | - $this->importProduct('https://ecdn6.globalso.com/upload/p/1/file/2025-03/zy_boss_price_copy1.csv',3283); | ||
| 54 | - DB::disconnect('custom_mysql'); | 54 | +// ProjectServer::useProject(3283); |
| 55 | +// echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; | ||
| 56 | +// $this->importProduct('https://ecdn6.globalso.com/upload/p/1/file/2025-03/zy_boss_price_copy1.csv',3283); | ||
| 57 | +// DB::disconnect('custom_mysql'); | ||
| 55 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 58 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 56 | } | 59 | } |
| 57 | 60 | ||
| @@ -81,6 +84,8 @@ class LyhImportTest extends Command | @@ -81,6 +84,8 @@ class LyhImportTest extends Command | ||
| 81 | fclose($file_handle); | 84 | fclose($file_handle); |
| 82 | $cateModel = new Category(); | 85 | $cateModel = new Category(); |
| 83 | $productModel = new Product(); | 86 | $productModel = new Product(); |
| 87 | + $detailModel = new Detail(); | ||
| 88 | + $columnModel = new Column(); | ||
| 84 | foreach ($line_of_text as $k => $val){ | 89 | foreach ($line_of_text as $k => $val){ |
| 85 | if($k < 2){ | 90 | if($k < 2){ |
| 86 | continue; | 91 | continue; |
| @@ -94,7 +99,7 @@ class LyhImportTest extends Command | @@ -94,7 +99,7 @@ class LyhImportTest extends Command | ||
| 94 | if($val[0] ?? ''){ | 99 | if($val[0] ?? ''){ |
| 95 | $cateInfo = $cateModel->read(['seo_title'=>trim($val[0])]); | 100 | $cateInfo = $cateModel->read(['seo_title'=>trim($val[0])]); |
| 96 | if($cateInfo !== false){ | 101 | if($cateInfo !== false){ |
| 97 | - $saveData['category_id'] = $cateInfo['id']; | 102 | + $saveData['category_id'] = ','.$cateInfo['id'].','; |
| 98 | } | 103 | } |
| 99 | } | 104 | } |
| 100 | $saveData['intro'] = $val[2]; | 105 | $saveData['intro'] = $val[2]; |
| @@ -105,7 +110,49 @@ class LyhImportTest extends Command | @@ -105,7 +110,49 @@ class LyhImportTest extends Command | ||
| 105 | $gallery = [['alt'=>'主图','url'=>str_replace('/public','',$val[6])]]; | 110 | $gallery = [['alt'=>'主图','url'=>str_replace('/public','',$val[6])]]; |
| 106 | $saveData['thumb'] = json_encode($thumb,true); | 111 | $saveData['thumb'] = json_encode($thumb,true); |
| 107 | $saveData['gallery'] = json_encode($gallery,true); | 112 | $saveData['gallery'] = json_encode($gallery,true); |
| 113 | + $id = $productModel->addReturnId($saveData); | ||
| 114 | + echo date('Y-m-d H:i:s') . '新增产品id:'.$id . PHP_EOL; | ||
| 115 | + //设置关联关系 | ||
| 116 | + if($cateInfo !== false){ | ||
| 117 | + CategoryRelated::saveRelated($id,[$cateInfo['id']]); | ||
| 118 | + } | ||
| 119 | + //设置路由 | ||
| 120 | + $route = RouteMap::setRoute($val[1],RouteMap::SOURCE_PRODUCT,$id,$project_id); | ||
| 121 | + $productModel->edit(['route'=>$route],['id'=>$id]); | ||
| 122 | + //设置产品描述 | ||
| 123 | + $detail = [ | ||
| 124 | + 'product_id'=>$id, | ||
| 125 | + 'column_id'=>1, | ||
| 126 | + 'text_type'=>1, | ||
| 127 | + 'content'=>json_encode(['content'=>$val[3]]) | ||
| 128 | + ]; | ||
| 129 | + $detailModel->addReturnId($detail); | ||
| 130 | + //扩展描述设置 | ||
| 131 | + $detailFaq = [ | ||
| 132 | + 'column_name'=>'FAQs', | ||
| 133 | + 'product_id'=>$id | ||
| 134 | + ]; | ||
| 135 | + $faqId = $columnModel->addReturnId($detailFaq); | ||
| 136 | + | ||
| 137 | + $faqsDetail = json_decode($val[4],true); | ||
| 138 | + $faqContent = ''; | ||
| 139 | + if(!empty($faqsDetail) && is_array($faqsDetail)){ | ||
| 140 | + foreach ($faqsDetail as $faq_Val){ | ||
| 141 | + $faqContent .= "question:".$faq_Val['question'] . "<br />" . "answer:".$faq_Val['answer']. "<br />"; | ||
| 142 | + } | ||
| 143 | + $detailFaqInfo = [ | ||
| 144 | + 'product_id'=>$id, | ||
| 145 | + 'column_id'=>$faqId, | ||
| 146 | + 'text_type'=>1, | ||
| 147 | + 'content'=>json_encode(['content'=>$faqContent]) | ||
| 148 | + ]; | ||
| 149 | + $detailModel->addReturnId($detailFaqInfo); | ||
| 150 | + }else{ | ||
| 151 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export('产品标题:'. $val[1] . PHP_EOL .'faqs数据有问题:' . $val[4], true) . PHP_EOL, FILE_APPEND); | ||
| 152 | + echo date('Y-m-d H:i:s') . '产品标题:'. $val[1] . PHP_EOL .'faqs数据有问题:' . $val[4]; | ||
| 153 | + } | ||
| 108 | } | 154 | } |
| 155 | + return true; | ||
| 109 | } | 156 | } |
| 110 | 157 | ||
| 111 | public function handleCatePid(){ | 158 | public function handleCatePid(){ |
| @@ -7,21 +7,18 @@ | @@ -7,21 +7,18 @@ | ||
| 7 | * @time :2023/11/20 15:07 | 7 | * @time :2023/11/20 15:07 |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | -namespace App\Console\Commands\Test; | 10 | +namespace App\Console\Commands\LyhTest; |
| 11 | 11 | ||
| 12 | use App\Helper\Arr; | 12 | use App\Helper\Arr; |
| 13 | use App\Helper\Translate; | 13 | use App\Helper\Translate; |
| 14 | use App\Models\Blog\Blog; | 14 | use App\Models\Blog\Blog; |
| 15 | -use App\Models\CustomModule\CustomModuleCategory; | ||
| 16 | use App\Models\CustomModule\CustomModuleContent; | 15 | use App\Models\CustomModule\CustomModuleContent; |
| 17 | use App\Models\Product\CategoryRelated; | 16 | use App\Models\Product\CategoryRelated; |
| 18 | use App\Models\Product\Keyword; | 17 | use App\Models\Product\Keyword; |
| 19 | use App\Models\Product\Product; | 18 | use App\Models\Product\Product; |
| 20 | -use App\Models\Project\ProcessRecords; | ||
| 21 | use App\Models\Project\Project; | 19 | use App\Models\Project\Project; |
| 22 | use App\Models\RouteMap\RouteMap; | 20 | use App\Models\RouteMap\RouteMap; |
| 23 | -use App\Models\Template\BTemplate; | ||
| 24 | -use App\Models\Template\Setting; | 21 | +use App\Models\WebSetting\WebSetting; |
| 25 | use App\Services\ProjectServer; | 22 | use App\Services\ProjectServer; |
| 26 | use App\Utils\HttpUtils; | 23 | use App\Utils\HttpUtils; |
| 27 | use GuzzleHttp\Exception\GuzzleException; | 24 | use GuzzleHttp\Exception\GuzzleException; |
| @@ -61,46 +58,21 @@ class UpdateRoute extends Command | @@ -61,46 +58,21 @@ class UpdateRoute extends Command | ||
| 61 | * @time :2023/11/20 15:13 | 58 | * @time :2023/11/20 15:13 |
| 62 | */ | 59 | */ |
| 63 | public function handle(){ | 60 | public function handle(){ |
| 64 | - | ||
| 65 | - $data = $this->ceshi(); | ||
| 66 | - | ||
| 67 | - echo date('Y-m-d H:i:s') . 'end'.json_encode($data) . PHP_EOL; | ||
| 68 | - } | ||
| 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 | - } | ||
| 80 | - | ||
| 81 | - public function ceshi($api_no = null) | ||
| 82 | - { | ||
| 83 | - $key = 'extend_projects_list'; | ||
| 84 | - $data = Cache::get($key); | ||
| 85 | - if (!$data) { | ||
| 86 | - $api_url = 'http://api.quanqiusou.cn/google-rank/api/extend_projects.php'; | ||
| 87 | - try { | ||
| 88 | - $data = HttpUtils::get($api_url, []); | ||
| 89 | - if ($data) { | ||
| 90 | - $data = Arr::s2a($data); | ||
| 91 | - Cache::put($key, $data, 4 * 3600); | ||
| 92 | - } | ||
| 93 | - } catch (\Exception | GuzzleException $e) { | ||
| 94 | - errorLog('复制站点项目获取失败', [], $e); | ||
| 95 | - return false; | 61 | + $projectModel = new Project(); |
| 62 | + $lists = $projectModel->list(['delete_status'=>0],'id',['id']); | ||
| 63 | + foreach ($lists as $v){ | ||
| 64 | + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | ||
| 65 | + ProjectServer::useProject($v['id']); | ||
| 66 | + $webSettingModel = new WebSetting(); | ||
| 67 | + $settingInfo = $webSettingModel->read(['project_id'=>$v['id']]); | ||
| 68 | + if($settingInfo !== false && ($settingInfo['anchor_num'] > 3)){ | ||
| 69 | + $webSettingModel->edit(['anchor_num'=>3],['project_id'=>$v['id']]); | ||
| 96 | } | 70 | } |
| 71 | + DB::disconnect('custom_mysql'); | ||
| 97 | } | 72 | } |
| 98 | - if ($api_no !== null) { | ||
| 99 | - $data = collect($data)->where('apino', $api_no)->first(); | ||
| 100 | - return $data ?: []; | ||
| 101 | - } | ||
| 102 | - return $data; | 73 | + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 103 | } | 74 | } |
| 75 | + | ||
| 104 | /** | 76 | /** |
| 105 | * @remark :更新产品 | 77 | * @remark :更新产品 |
| 106 | * @name :updateProduct | 78 | * @name :updateProduct |
| @@ -41,10 +41,10 @@ class Validate | @@ -41,10 +41,10 @@ class Validate | ||
| 41 | * @author zbj | 41 | * @author zbj |
| 42 | * @date 2025/2/27 | 42 | * @date 2025/2/27 |
| 43 | */ | 43 | */ |
| 44 | - public static function phone($email) | 44 | + public static function phone($phone) |
| 45 | { | 45 | { |
| 46 | try { | 46 | try { |
| 47 | - $res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $email]); | 47 | + $res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $phone]); |
| 48 | $res = Arr::s2a($res); | 48 | $res = Arr::s2a($res); |
| 49 | $status = $res['data']['valid_status'] ?? 0; | 49 | $status = $res['data']['valid_status'] ?? 0; |
| 50 | } catch (\Exception | GuzzleException $e) { | 50 | } catch (\Exception | GuzzleException $e) { |
| @@ -52,4 +52,21 @@ class Validate | @@ -52,4 +52,21 @@ class Validate | ||
| 52 | } | 52 | } |
| 53 | return !($status == 2); | 53 | return !($status == 2); |
| 54 | } | 54 | } |
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * @remark :验证 | ||
| 58 | + * @name :check_data | ||
| 59 | + * @author :lyh | ||
| 60 | + * @method :post | ||
| 61 | + * @time :2025/3/4 17:16 | ||
| 62 | + */ | ||
| 63 | + public static function check_data($data,$type) | ||
| 64 | + { | ||
| 65 | + if($type == 1){ | ||
| 66 | + $res = HttpUtils::get('https://fob.ai.cc/api/check_email', ['email' => $data]); | ||
| 67 | + }else{ | ||
| 68 | + $res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $data]); | ||
| 69 | + } | ||
| 70 | + return Arr::s2a($res); | ||
| 71 | + } | ||
| 55 | } | 72 | } |
| @@ -739,7 +739,7 @@ if (!function_exists('getAutoLoginCode')) { | @@ -739,7 +739,7 @@ if (!function_exists('getAutoLoginCode')) { | ||
| 739 | function getAutoLoginCode($project_id) | 739 | function getAutoLoginCode($project_id) |
| 740 | { | 740 | { |
| 741 | $encrypt = new EncryptUtils(); | 741 | $encrypt = new EncryptUtils(); |
| 742 | - return $encrypt->authcode(json_encode(['project_id' => $project_id]), 'ENCODE', 'autologin', 3600); | 742 | + return $encrypt->authcode(json_encode(['project_id' => $project_id]), 'ENCODE', 'autologin', 300); |
| 743 | } | 743 | } |
| 744 | } | 744 | } |
| 745 | 745 |
| @@ -92,7 +92,6 @@ class InquiryForwardController extends BaseController | @@ -92,7 +92,6 @@ class InquiryForwardController extends BaseController | ||
| 92 | 'id' => 'required',//ID | 92 | 'id' => 'required',//ID |
| 93 | 'name' => 'required',//名称 | 93 | 'name' => 'required',//名称 |
| 94 | 'email' => 'required',//邮箱 | 94 | 'email' => 'required',//邮箱 |
| 95 | - 'phone' => 'required',//电话号码 | ||
| 96 | 'ip' => 'required',//ip | 95 | 'ip' => 'required',//ip |
| 97 | 'forward_url' => 'required',//转发网址 | 96 | 'forward_url' => 'required',//转发网址 |
| 98 | 'message' => 'required',//发送内容 | 97 | 'message' => 'required',//发送内容 |
| @@ -100,7 +99,6 @@ class InquiryForwardController extends BaseController | @@ -100,7 +99,6 @@ class InquiryForwardController extends BaseController | ||
| 100 | 'id.required' => 'ID不能为空', | 99 | 'id.required' => 'ID不能为空', |
| 101 | 'name.required' => '名称不能为空', | 100 | 'name.required' => '名称不能为空', |
| 102 | 'email.required' => '邮箱不能为空', | 101 | 'email.required' => '邮箱不能为空', |
| 103 | - 'phone.required' => '电话号码不能为空', | ||
| 104 | 'ip.required' => 'ip不能为空', | 102 | 'ip.required' => 'ip不能为空', |
| 105 | 'forward_url.required' => '转发网址不能为空', | 103 | 'forward_url.required' => '转发网址不能为空', |
| 106 | 'message.required' => '内容不能为空', | 104 | 'message.required' => '内容不能为空', |
| @@ -387,7 +387,7 @@ class OptimizeController extends BaseController | @@ -387,7 +387,7 @@ class OptimizeController extends BaseController | ||
| 387 | } | 387 | } |
| 388 | $url = $domain.'api/update_robots/?project_id='.$this->param['project_id']; | 388 | $url = $domain.'api/update_robots/?project_id='.$this->param['project_id']; |
| 389 | $res = curlGet($url); | 389 | $res = curlGet($url); |
| 390 | - if(empty($res) || $res['status'] != 200){ | 390 | + if(empty($res) || !isset($res['status']) || $res['status'] != 200){ |
| 391 | $this->response('生成robots失败,请联系开发人员',Code::SYSTEM_ERROR,['url'=>$url]); | 391 | $this->response('生成robots失败,请联系开发人员',Code::SYSTEM_ERROR,['url'=>$url]); |
| 392 | } | 392 | } |
| 393 | $this->response('success',Code::SUCCESS,['url'=>$domain.'robots.txt']); | 393 | $this->response('success',Code::SUCCESS,['url'=>$domain.'robots.txt']); |
| @@ -20,6 +20,7 @@ use App\Models\Devops\ServerConfig; | @@ -20,6 +20,7 @@ use App\Models\Devops\ServerConfig; | ||
| 20 | use App\Models\Domain\DomainInfo; | 20 | use App\Models\Domain\DomainInfo; |
| 21 | use App\Models\Domain\DomainInfo as DomainInfoModel; | 21 | use App\Models\Domain\DomainInfo as DomainInfoModel; |
| 22 | use App\Models\HomeCount\Count; | 22 | use App\Models\HomeCount\Count; |
| 23 | +use App\Models\Industry\ProjectIndustry; | ||
| 23 | use App\Models\Inquiry\InquirySet; | 24 | use App\Models\Inquiry\InquirySet; |
| 24 | use App\Models\Manage\BelongingGroup; | 25 | use App\Models\Manage\BelongingGroup; |
| 25 | use App\Models\Manage\ManageHr; | 26 | use App\Models\Manage\ManageHr; |
| @@ -1130,4 +1131,16 @@ class ProjectController extends BaseController | @@ -1130,4 +1131,16 @@ class ProjectController extends BaseController | ||
| 1130 | } | 1131 | } |
| 1131 | $this->response('success'); | 1132 | $this->response('success'); |
| 1132 | } | 1133 | } |
| 1134 | + | ||
| 1135 | + /** | ||
| 1136 | + * 获取项目所有行业列表 | ||
| 1137 | + * @author Akun | ||
| 1138 | + * @date 2025/03/05 11:40 | ||
| 1139 | + */ | ||
| 1140 | + public function industryList() | ||
| 1141 | + { | ||
| 1142 | + $model = new ProjectIndustry(); | ||
| 1143 | + $lists = $model->list(['status' => 1], 'id', ['id', 'industry_name'], 'asc'); | ||
| 1144 | + $this->response('success', Code::SUCCESS, $lists); | ||
| 1145 | + } | ||
| 1133 | } | 1146 | } |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ProjectMenuSeoController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/4 15:28 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Aside\User; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Aside\BaseController; | ||
| 14 | +use App\Http\Logic\Aside\User\ProjectMenuSeoLogic; | ||
| 15 | +use App\Models\User\ProjectMenuSeo; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark :设置白帽菜单 | ||
| 19 | + * @name :ProjectMenuSeoController | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2025/3/4 15:28 | ||
| 23 | + */ | ||
| 24 | +class ProjectMenuSeoController extends BaseController | ||
| 25 | +{ | ||
| 26 | + /** | ||
| 27 | + * @remark :白帽菜单列表 | ||
| 28 | + * @name :lists | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2025/3/4 15:33 | ||
| 32 | + */ | ||
| 33 | + public function lists(ProjectMenuSeo $projectMenuSeo){ | ||
| 34 | + $lists = $projectMenuSeo->list($this->map,'sort'); | ||
| 35 | + $menu = array(); | ||
| 36 | + foreach ($lists as $k => $v){ | ||
| 37 | + $v = (array)$v; | ||
| 38 | + if ($v['pid'] == 0) { | ||
| 39 | + $v['sub'] = _get_child($v['id'], $lists); | ||
| 40 | + $menu[] = $v; | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + $this->response('success',Code::SUCCESS,$menu); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * @remark :获取白帽详情 | ||
| 48 | + * @name :info | ||
| 49 | + * @author :lyh | ||
| 50 | + * @method :post | ||
| 51 | + * @time :2025/3/4 15:34 | ||
| 52 | + */ | ||
| 53 | + public function info(ProjectMenuSeo $projectMenuSeo){ | ||
| 54 | + $this->request->validate([ | ||
| 55 | + 'id'=>'required' | ||
| 56 | + ],[ | ||
| 57 | + 'id.required' => 'ID不能为空' | ||
| 58 | + ]); | ||
| 59 | + $info = $projectMenuSeo->read($this->param); | ||
| 60 | + $this->response('success',Code::SUCCESS,$info); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * @remark :添加菜单 | ||
| 65 | + * @name :add | ||
| 66 | + * @author :lyh | ||
| 67 | + * @method :post | ||
| 68 | + * @time :2025/3/4 15:38 | ||
| 69 | + */ | ||
| 70 | + public function add(ProjectMenuSeoLogic $projectMenuSeoLogic){ | ||
| 71 | + $this->request->validate([ | ||
| 72 | + 'name'=>'required' | ||
| 73 | + ],[ | ||
| 74 | + 'name.required' => '名称不能为空' | ||
| 75 | + ]); | ||
| 76 | + $projectMenuSeoLogic->menu_add(); | ||
| 77 | + $this->response('success'); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + /** | ||
| 81 | + * @remark :编辑菜单 | ||
| 82 | + * @name :edit | ||
| 83 | + * @author :lyh | ||
| 84 | + * @method :post | ||
| 85 | + * @time :2025/3/4 15:42 | ||
| 86 | + */ | ||
| 87 | + public function edit(ProjectMenuSeoLogic $projectMenuSeoLogic){ | ||
| 88 | + $this->request->validate([ | ||
| 89 | + 'name'=>'required' | ||
| 90 | + ],[ | ||
| 91 | + 'name.required' => '名称不能为空' | ||
| 92 | + ]); | ||
| 93 | + $projectMenuSeoLogic->menu_edit(); | ||
| 94 | + $this->response('success'); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * @remark :删除菜单 | ||
| 99 | + * @name :del | ||
| 100 | + * @author :lyh | ||
| 101 | + * @method :post | ||
| 102 | + * @time :2025/3/4 15:43 | ||
| 103 | + */ | ||
| 104 | + public function del(ProjectMenuSeoLogic $projectMenuSeoLogic){ | ||
| 105 | + $this->request->validate([ | ||
| 106 | + 'id'=>['required','array'], | ||
| 107 | + ],[ | ||
| 108 | + 'id.required' => 'ID不能为空', | ||
| 109 | + 'id.array' => 'ID为数组', | ||
| 110 | + ]); | ||
| 111 | + $projectMenuSeoLogic->menu_del(); | ||
| 112 | + $this->response('success'); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + /** | ||
| 116 | + * @remark :获取子菜单 | ||
| 117 | + * @name :getSonMenu | ||
| 118 | + * @author :lyh | ||
| 119 | + * @method :post | ||
| 120 | + * @time :2023/8/3 14:19 | ||
| 121 | + */ | ||
| 122 | + public function getMenu(ProjectMenuSeoLogic $projectMenuSeoLogic){ | ||
| 123 | + $list = $projectMenuSeoLogic->roleMenuInfo(); | ||
| 124 | + $this->response('success',Code::SUCCESS,$list); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * @remark :排序 | ||
| 129 | + * @name :setSort | ||
| 130 | + * @author :lyh | ||
| 131 | + * @method :post | ||
| 132 | + * @time :2023/8/10 16:40 | ||
| 133 | + */ | ||
| 134 | + public function sort(ProjectMenuSeoLogic $projectMenuSeoLogic){ | ||
| 135 | + $this->request->validate([ | ||
| 136 | + 'id'=>'required', | ||
| 137 | + ],[ | ||
| 138 | + 'id.required' => 'ID不能为空', | ||
| 139 | + ]); | ||
| 140 | + $projectMenuSeoLogic->setParamStatus(); | ||
| 141 | + $this->response('success'); | ||
| 142 | + } | ||
| 143 | +} |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AiVideoController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/5 11:00 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Bside\Ai; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Bside\BaseController; | ||
| 14 | +use App\Http\Logic\Bside\Ai\AiVideoLogic; | ||
| 15 | +use App\Models\Ai\AiVideo; | ||
| 16 | + | ||
| 17 | +class AiVideoController extends BaseController | ||
| 18 | +{ | ||
| 19 | + /** | ||
| 20 | + * @remark :获取aiVideo列表 | ||
| 21 | + * @name :lists | ||
| 22 | + * @author :lyh | ||
| 23 | + * @method :post | ||
| 24 | + * @time :2025/3/5 14:12 | ||
| 25 | + */ | ||
| 26 | + public function lists(AiVideo $aiVideo){ | ||
| 27 | + $lists = $aiVideo->lists($this->map,$this->page,$this->row,'id',['id','keyword','new_title','route','image','task_id','status','created_at','updated_at']); | ||
| 28 | + if(!empty($lists) && !empty($lists['list'])){ | ||
| 29 | + foreach ($lists['list'] as $k => $v){ | ||
| 30 | + $v['image'] = getImageUrl($v['image']); | ||
| 31 | + if(!empty($v['route'])){ | ||
| 32 | + $v['route'] = $this->user['test_domain'] . 'video/' . $v['route']; | ||
| 33 | + } | ||
| 34 | + $lists['list'][$k] = $v; | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * @remark :获取详情 | ||
| 42 | + * @name :getInfo | ||
| 43 | + * @author :lyh | ||
| 44 | + * @method :post | ||
| 45 | + * @time :2025/3/5 14:22 | ||
| 46 | + */ | ||
| 47 | + public function getInfo(AiVideo $aiVideo){ | ||
| 48 | + $this->request->validate([ | ||
| 49 | + 'id'=>['required'], | ||
| 50 | + ],[ | ||
| 51 | + 'id.required' => '主键不能为空', | ||
| 52 | + ]); | ||
| 53 | + $info = $aiVideo->read(['id'=>$this->param['id']]); | ||
| 54 | + $info['image'] = getImageUrl($info['image']); | ||
| 55 | + $this->response('success',Code::SUCCESS,$info); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * @remark :发布任务 | ||
| 60 | + * @name :sendTask | ||
| 61 | + * @author :lyh | ||
| 62 | + * @method :post | ||
| 63 | + * @time :2025/3/5 14:29 | ||
| 64 | + */ | ||
| 65 | + public function sendTask(AiVideoLogic $aiVideoLogic){ | ||
| 66 | + $this->request->validate([ | ||
| 67 | + 'keyword'=>['required'], | ||
| 68 | + 'type'=>['required'], | ||
| 69 | + ],[ | ||
| 70 | + 'keyword.required' => '关键字不能为空', | ||
| 71 | + 'type.required' => '场景不能为空', | ||
| 72 | + ]); | ||
| 73 | + //获取当前项目的ai_blog设置 | ||
| 74 | + $result = $aiVideoLogic->sendTask(); | ||
| 75 | + $this->response('success',Code::SUCCESS,$result); | ||
| 76 | + } | ||
| 77 | +} |
| @@ -13,9 +13,9 @@ use App\Models\Project\DeployBuild; | @@ -13,9 +13,9 @@ use App\Models\Project\DeployBuild; | ||
| 13 | use App\Models\Project\Project; | 13 | use App\Models\Project\Project; |
| 14 | use App\Models\RouteMap\RouteMap; | 14 | use App\Models\RouteMap\RouteMap; |
| 15 | use App\Models\User\ProjectMenu as ProjectMenuModel; | 15 | use App\Models\User\ProjectMenu as ProjectMenuModel; |
| 16 | +use App\Models\User\ProjectMenuSeo; | ||
| 16 | use App\Models\User\ProjectRole as ProjectRoleModel; | 17 | use App\Models\User\ProjectRole as ProjectRoleModel; |
| 17 | use App\Models\User\User; | 18 | use App\Models\User\User; |
| 18 | -use Illuminate\Support\Facades\Artisan; | ||
| 19 | use Illuminate\Support\Facades\Cache; | 19 | use Illuminate\Support\Facades\Cache; |
| 20 | 20 | ||
| 21 | /*** | 21 | /*** |
| @@ -36,9 +36,6 @@ class ComController extends BaseController | @@ -36,9 +36,6 @@ class ComController extends BaseController | ||
| 36 | }else{ | 36 | }else{ |
| 37 | $this->map = $this->getAdminMenuCondition(); | 37 | $this->map = $this->getAdminMenuCondition(); |
| 38 | } | 38 | } |
| 39 | - if(!isset($this->map['type'])){//默认获取6.0菜单 | ||
| 40 | - $this->map['type'] = 0; | ||
| 41 | - } | ||
| 42 | $lists = $projectMenuModel->list($this->map,'sort'); | 39 | $lists = $projectMenuModel->list($this->map,'sort'); |
| 43 | $menu = array(); | 40 | $menu = array(); |
| 44 | foreach ($lists as $k => $v){ | 41 | foreach ($lists as $k => $v){ |
| @@ -52,6 +49,27 @@ class ComController extends BaseController | @@ -52,6 +49,27 @@ class ComController extends BaseController | ||
| 52 | } | 49 | } |
| 53 | 50 | ||
| 54 | /** | 51 | /** |
| 52 | + * @remark :白帽seo获取菜单 | ||
| 53 | + * @name :seo_get_menu | ||
| 54 | + * @author :lyh | ||
| 55 | + * @method :post | ||
| 56 | + * @time :2025/3/4 14:48 | ||
| 57 | + */ | ||
| 58 | + public function seo_get_menu(){ | ||
| 59 | + $seoMenuModel = new ProjectMenuSeo(); | ||
| 60 | + $lists = $seoMenuModel->list($this->map,'sort'); | ||
| 61 | + $menu = array(); | ||
| 62 | + foreach ($lists as $k => $v){ | ||
| 63 | + $v = (array)$v; | ||
| 64 | + if ($v['pid'] == 0) { | ||
| 65 | + $v['sub'] = _get_child($v['id'], $lists); | ||
| 66 | + $menu[] = $v; | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + $this->response('当前用户菜单列表',Code::SUCCESS,$menu); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 55 | * @remark :获取当前菜单的自定义模块 | 73 | * @remark :获取当前菜单的自定义模块 |
| 56 | * @name :getProjectCustomMenu | 74 | * @name :getProjectCustomMenu |
| 57 | * @author :lyh | 75 | * @author :lyh |
| @@ -4,8 +4,10 @@ namespace App\Http\Controllers\Bside\Inquiry; | @@ -4,8 +4,10 @@ namespace App\Http\Controllers\Bside\Inquiry; | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | use App\Enums\Common\Code; | 6 | use App\Enums\Common\Code; |
| 7 | +use App\Helper\Validate; | ||
| 7 | use App\Http\Controllers\Bside\BaseController; | 8 | use App\Http\Controllers\Bside\BaseController; |
| 8 | use App\Http\Logic\Bside\Inquiry\InquiryLogic; | 9 | use App\Http\Logic\Bside\Inquiry\InquiryLogic; |
| 10 | +use App\Models\Inquiry\EmailData; | ||
| 9 | use App\Models\Inquiry\InquiryForm; | 11 | use App\Models\Inquiry\InquiryForm; |
| 10 | use App\Models\Inquiry\PhoneData; | 12 | use App\Models\Inquiry\PhoneData; |
| 11 | use App\Rules\Ids; | 13 | use App\Rules\Ids; |
| @@ -37,6 +39,13 @@ class InquiryController extends BaseController | @@ -37,6 +39,13 @@ class InquiryController extends BaseController | ||
| 37 | $this->response('success',Code::SUCCESS,$data); | 39 | $this->response('success',Code::SUCCESS,$data); |
| 38 | } | 40 | } |
| 39 | 41 | ||
| 42 | + /** | ||
| 43 | + * @remark :精准询盘列表 | ||
| 44 | + * @name :index | ||
| 45 | + * @author :lyh | ||
| 46 | + * @method :post | ||
| 47 | + * @time :2025/3/5 9:48 | ||
| 48 | + */ | ||
| 40 | public function index(InquiryLogic $logic) | 49 | public function index(InquiryLogic $logic) |
| 41 | { | 50 | { |
| 42 | if(!empty($this->param['form_id'])){ | 51 | if(!empty($this->param['form_id'])){ |
| @@ -47,31 +56,86 @@ class InquiryController extends BaseController | @@ -47,31 +56,86 @@ class InquiryController extends BaseController | ||
| 47 | $data = $logic->getApiList(); | 56 | $data = $logic->getApiList(); |
| 48 | } | 57 | } |
| 49 | if(!empty($data) && !empty($data['list'])){ | 58 | if(!empty($data) && !empty($data['list'])){ |
| 50 | - $phone = []; | 59 | + $email = $phone = []; |
| 51 | foreach ($data['list'] as $v){ | 60 | foreach ($data['list'] as $v){ |
| 52 | if(!empty($v['phone'])){ | 61 | if(!empty($v['phone'])){ |
| 53 | $phone[] = $v['phone']; | 62 | $phone[] = $v['phone']; |
| 63 | + } | ||
| 64 | + if(!empty($v['email'])){ | ||
| 65 | + $email[] = $v['email']; | ||
| 66 | + } | ||
| 54 | } | 67 | } |
| 55 | } | 68 | } |
| 56 | if(!empty($phone)){ | 69 | if(!empty($phone)){ |
| 57 | - $phoneDataModel = new PhoneData(); | ||
| 58 | - $phoneDataList = $phoneDataModel->list(['phone'=>['in',$phone]]); | ||
| 59 | - foreach ($data['list'] as $key => $value){ | ||
| 60 | - $value['phone_data'] = []; | ||
| 61 | - foreach ($phoneDataList as $valuePhone){ | ||
| 62 | - if($value['phone'] == $valuePhone['phone']){ | ||
| 63 | - $value['phone_data'] = $valuePhone; | ||
| 64 | - break; | ||
| 65 | - } | 70 | + $phoneDataModel = new PhoneData(); |
| 71 | + $phoneDataList = $phoneDataModel->list(['phone'=>['in',$phone]]); | ||
| 72 | + foreach ($data['list'] as $key => $value){ | ||
| 73 | + $value['phone_data'] = []; | ||
| 74 | + foreach ($phoneDataList as $valuePhone){ | ||
| 75 | + if($value['phone'] == $valuePhone['phone']){ | ||
| 76 | + $value['phone_data'] = $valuePhone; | ||
| 77 | + break; | ||
| 66 | } | 78 | } |
| 67 | - $data['list'][$key] = $value; | ||
| 68 | } | 79 | } |
| 80 | + $data['list'][$key] = $value; | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + if(!empty($email)){ | ||
| 84 | + $emailDataModel = new EmailData(); | ||
| 85 | + $emailDataList = $emailDataModel->list(['email'=>['in',$email]]); | ||
| 86 | + foreach ($data['list'] as $key => $value){ | ||
| 87 | + $value['email_data'] = []; | ||
| 88 | + foreach ($emailDataList as $valuePhone){ | ||
| 89 | + if($value['email'] == $valuePhone['email']){ | ||
| 90 | + $value['email_data'] = $valuePhone; | ||
| 91 | + break; | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + $data['list'][$key] = $value; | ||
| 69 | } | 95 | } |
| 70 | } | 96 | } |
| 71 | $this->response('success',Code::SUCCESS,$data); | 97 | $this->response('success',Code::SUCCESS,$data); |
| 72 | } | 98 | } |
| 73 | 99 | ||
| 74 | /** | 100 | /** |
| 101 | + * @remark :验证邮箱 | ||
| 102 | + * @name :checkEmail | ||
| 103 | + * @author :lyh | ||
| 104 | + * @method :post | ||
| 105 | + * @time :2025/3/4 17:09 | ||
| 106 | + */ | ||
| 107 | + public function checkEmail(){ | ||
| 108 | + $this->request->validate([ | ||
| 109 | + 'email' => 'required', | ||
| 110 | + ],[ | ||
| 111 | + 'email.required' => 'email不能为空' | ||
| 112 | + ]); | ||
| 113 | + $emailModel = new EmailData(); | ||
| 114 | + $data = $emailModel->read(['email'=>$this->param['email']]); | ||
| 115 | + if($data !== false){ | ||
| 116 | + $this->response('success',Code::SUCCESS,$data); | ||
| 117 | + } | ||
| 118 | + $result = Validate::check_data($this->param['email'],1); | ||
| 119 | + if(isset($result) && ($result['status'] == 200)){ | ||
| 120 | + //保存数据 | ||
| 121 | + $param = [ | ||
| 122 | + 'email'=>$this->param['email'], | ||
| 123 | + 'alt'=>$result['data']['alt'], | ||
| 124 | + 'status'=>$result['data']['status'] | ||
| 125 | + ]; | ||
| 126 | + $emailModel = new EmailData(); | ||
| 127 | + $emailModel->add($param); | ||
| 128 | + }else{ | ||
| 129 | + $param = [ | ||
| 130 | + 'email'=>$this->param['email'], | ||
| 131 | + 'alt'=>'未知邮箱', | ||
| 132 | + 'status'=>9 | ||
| 133 | + ]; | ||
| 134 | + } | ||
| 135 | + $this->response('success',Code::SUCCESS,$param); | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + /** | ||
| 75 | * @remark :发送请求(获取手机号码对应信息) | 139 | * @remark :发送请求(获取手机号码对应信息) |
| 76 | * @name :sendMobileVerifyData | 140 | * @name :sendMobileVerifyData |
| 77 | * @author :lyh | 141 | * @author :lyh |
| @@ -50,7 +50,7 @@ class ProductController extends BaseController | @@ -50,7 +50,7 @@ class ProductController extends BaseController | ||
| 50 | { | 50 | { |
| 51 | $filed = ['id', 'project_id', 'title', 'sort' ,'thumb' ,'product_type' , 'route' , | 51 | $filed = ['id', 'project_id', 'title', 'sort' ,'thumb' ,'product_type' , 'route' , |
| 52 | 'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read']; | 52 | 'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read']; |
| 53 | - $this->order = $this->order ?? 'sort'; | 53 | + $this->order = $this->param['order'] ?? 'sort'; |
| 54 | $query = $product->orderBy($this->order ,$this->order_type)->orderBy('id','desc'); | 54 | $query = $product->orderBy($this->order ,$this->order_type)->orderBy('id','desc'); |
| 55 | $query = $this->searchParam($query); | 55 | $query = $this->searchParam($query); |
| 56 | $lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page); | 56 | $lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page); |
| @@ -79,6 +79,7 @@ class AiCommandLogic extends BaseLogic | @@ -79,6 +79,7 @@ class AiCommandLogic extends BaseLogic | ||
| 79 | 'project_id'=>$this->param['project_id']??0, | 79 | 'project_id'=>$this->param['project_id']??0, |
| 80 | ]; | 80 | ]; |
| 81 | $info = $this->model->read($condition); | 81 | $info = $this->model->read($condition); |
| 82 | + | ||
| 82 | if($info !== false){ | 83 | if($info !== false){ |
| 83 | $this->fail('当前编辑的指令key已存在'); | 84 | $this->fail('当前编辑的指令key已存在'); |
| 84 | } | 85 | } |
| @@ -176,7 +176,7 @@ class InquiryForwardLogic extends BaseLogic | @@ -176,7 +176,7 @@ class InquiryForwardLogic extends BaseLogic | ||
| 176 | $start_at = $now; | 176 | $start_at = $now; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | - InquiryRelayDetail::createInquiry($info['id'], $website, $info['country'], $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'], $this->param['message'], $is_v6, json_encode([$url]), $start_at); | 179 | + InquiryRelayDetail::createInquiry($info['id'], $website, $info['country'], $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'] ?? '', $this->param['message'], $is_v6, json_encode([$url]), $start_at); |
| 180 | 180 | ||
| 181 | $num += 1; | 181 | $num += 1; |
| 182 | } | 182 | } |
| @@ -21,6 +21,7 @@ use App\Models\Com\UpdateLog; | @@ -21,6 +21,7 @@ use App\Models\Com\UpdateLog; | ||
| 21 | use App\Models\Devops\Servers; | 21 | use App\Models\Devops\Servers; |
| 22 | use App\Models\Devops\ServersIp; | 22 | use App\Models\Devops\ServersIp; |
| 23 | use App\Models\Domain\DomainInfo; | 23 | use App\Models\Domain\DomainInfo; |
| 24 | +use App\Models\Industry\ProjectIndustryRelated; | ||
| 24 | use App\Models\Inquiry\InquiryIP; | 25 | use App\Models\Inquiry\InquiryIP; |
| 25 | use App\Models\Inquiry\InquirySet; | 26 | use App\Models\Inquiry\InquirySet; |
| 26 | use App\Models\Manage\Manage; | 27 | use App\Models\Manage\Manage; |
| @@ -109,6 +110,8 @@ class ProjectLogic extends BaseLogic | @@ -109,6 +110,8 @@ class ProjectLogic extends BaseLogic | ||
| 109 | $info['minor_languages'] = $this->getProjectMinorLanguages($id); | 110 | $info['minor_languages'] = $this->getProjectMinorLanguages($id); |
| 110 | //升级项目采集完成时间 | 111 | //升级项目采集完成时间 |
| 111 | $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : ''; | 112 | $info['collect_time'] = $info['is_upgrade'] ? UpdateLog::getProjectUpdate($id) : ''; |
| 113 | + //获取项目所属行业 | ||
| 114 | + $info['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray(); | ||
| 112 | 115 | ||
| 113 | return $this->success($info); | 116 | return $this->success($info); |
| 114 | } | 117 | } |
| @@ -179,6 +182,8 @@ class ProjectLogic extends BaseLogic | @@ -179,6 +182,8 @@ class ProjectLogic extends BaseLogic | ||
| 179 | $this->saveProjectAfter($this->param['project_after']); | 182 | $this->saveProjectAfter($this->param['project_after']); |
| 180 | //单独保存小语种配置 | 183 | //单独保存小语种配置 |
| 181 | $this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']); | 184 | $this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']); |
| 185 | + //单独保存行业信息 | ||
| 186 | + ProjectIndustryRelated::saveRelated($this->param['id'],$this->param['industry'] ?? []); | ||
| 182 | //同步图片文件 | 187 | //同步图片文件 |
| 183 | $this->syncImageFile($this->param['project_location'],$this->param['id']); | 188 | $this->syncImageFile($this->param['project_location'],$this->param['id']); |
| 184 | //同步信息表 | 189 | //同步信息表 |
| @@ -369,6 +374,10 @@ class ProjectLogic extends BaseLogic | @@ -369,6 +374,10 @@ class ProjectLogic extends BaseLogic | ||
| 369 | } | 374 | } |
| 370 | $param['upload_config'] = json_encode($param['upload_config'] ?? []); | 375 | $param['upload_config'] = json_encode($param['upload_config'] ?? []); |
| 371 | $param['web_traffic_config'] = json_encode($param['web_traffic_config'] ?? []); | 376 | $param['web_traffic_config'] = json_encode($param['web_traffic_config'] ?? []); |
| 377 | + $robots = $this->model->read(['id'=>$param['id']],['robots'])['robots']; | ||
| 378 | + if($robots == Project::TYPE_ONE){//开启 | ||
| 379 | + $param['robots'] = Project::TYPE_ONE; | ||
| 380 | + } | ||
| 372 | $this->model->edit($param,['id'=>$param['id']]); | 381 | $this->model->edit($param,['id'=>$param['id']]); |
| 373 | Common::del_user_cache($this->model->getTable(),$param['id']); | 382 | Common::del_user_cache($this->model->getTable(),$param['id']); |
| 374 | return $this->success(); | 383 | return $this->success(); |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Aside\User; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 6 | +use App\Models\User\ProjectMenuSeo; | ||
| 7 | + | ||
| 8 | +class ProjectMenuSeoLogic extends BaseLogic | ||
| 9 | +{ | ||
| 10 | + public function __construct() | ||
| 11 | + { | ||
| 12 | + parent::__construct(); | ||
| 13 | + $this->model = new ProjectMenuSeo(); | ||
| 14 | + $this->param = $this->requestAll; | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * @remark :添加菜单 | ||
| 19 | + * @name :menu_add | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2025/3/4 15:39 | ||
| 23 | + */ | ||
| 24 | + public function menu_add(){ | ||
| 25 | + //查询当前名称是否存在 | ||
| 26 | + $info = $this->model->read(['name'=>$this->param['name']]); | ||
| 27 | + if($info !== false){ | ||
| 28 | + $this->fail('当前菜单名称已存在'); | ||
| 29 | + } | ||
| 30 | + $rs = $this->model->add($this->param); | ||
| 31 | + if($rs === false){ | ||
| 32 | + $this->fail('添加失败'); | ||
| 33 | + } | ||
| 34 | + return $this->success(); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * @name :编辑菜单 | ||
| 39 | + * @return void | ||
| 40 | + * @author :liyuhang | ||
| 41 | + * @method | ||
| 42 | + */ | ||
| 43 | + public function menu_edit(){ | ||
| 44 | + //查询当前名称是否存在 | ||
| 45 | + $info = $this->model->read(['name'=>$this->param['name'],'id'=>['!=',$this->param['id']]]); | ||
| 46 | + if($info !== false){ | ||
| 47 | + $this->fail('当前菜单名称已存在'); | ||
| 48 | + } | ||
| 49 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 50 | + return $this->success(); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * @name :删除菜单 | ||
| 55 | + * @return void | ||
| 56 | + * @author :liyuhang | ||
| 57 | + * @method | ||
| 58 | + */ | ||
| 59 | + public function menu_del(){ | ||
| 60 | + $ids = $this->param['id']; | ||
| 61 | + //查看当前菜单是否有子菜单 | ||
| 62 | + foreach ($ids as $v){ | ||
| 63 | + $info = $this->model->read(['pid'=>$v],['id','name']); | ||
| 64 | + if($info !== false){ | ||
| 65 | + $this->fail('当前分类存在子分类:'.$info['name'].',不允许删除'); | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + $this->param['id'] = ['in',$this->param['id']]; | ||
| 69 | + $rs = $this->model->del($this->param); | ||
| 70 | + if($rs === false){ | ||
| 71 | + $this->fail('编辑失败'); | ||
| 72 | + } | ||
| 73 | + return $this->success(); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * @remark :添加时获取菜单列表 | ||
| 78 | + * @name :MenuList | ||
| 79 | + * @author :lyh | ||
| 80 | + * @method :post | ||
| 81 | + * @time :2023/6/21 17:26 | ||
| 82 | + */ | ||
| 83 | + public function MenuList($map){ | ||
| 84 | + $lists = $this->model->list($map,'sort'); | ||
| 85 | + $menu = array(); | ||
| 86 | + foreach ($lists as $k => $v){ | ||
| 87 | + $v = (array)$v; | ||
| 88 | + if ($v['pid'] == 0) { | ||
| 89 | + $v['sub'] = _get_child($v['id'], $lists); | ||
| 90 | + $menu[] = $v; | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + return $this->success($menu); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * @remark :保存时获取菜单 | ||
| 98 | + * @name :roleMenuInfo | ||
| 99 | + * @author :lyh | ||
| 100 | + * @method :post | ||
| 101 | + * @time :2023/8/2 16:24 | ||
| 102 | + */ | ||
| 103 | + public function roleMenuInfo(){ | ||
| 104 | + if(empty($this->param['id'])){ | ||
| 105 | + $lists = $this->model->list([],'sort'); | ||
| 106 | + }else{ | ||
| 107 | + //排除掉自己+自己的下级 | ||
| 108 | + $lists = $this->model->list(['id'=>['!=',$this->param['id']],'pid'=>['!=',$this->param['id']]],'sort'); | ||
| 109 | + } | ||
| 110 | + $menu = array(); | ||
| 111 | + if(!empty($lists)){ | ||
| 112 | + foreach ($lists as $k => $v){ | ||
| 113 | + $v = (array)$v; | ||
| 114 | + if ($v['pid'] == 0) { | ||
| 115 | + $v['sub'] = _get_child($v['id'], $lists); | ||
| 116 | + $menu[] = $v; | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + return $this->success($menu); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * @remark :设置排序 | ||
| 125 | + * @name :setSort | ||
| 126 | + * @author :lyh | ||
| 127 | + * @method :post | ||
| 128 | + * @time :2023/8/10 16:42 | ||
| 129 | + */ | ||
| 130 | + public function setParamStatus(){ | ||
| 131 | + $rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]); | ||
| 132 | + if($rs === false){ | ||
| 133 | + $this->fail('修改失败'); | ||
| 134 | + } | ||
| 135 | + return $this->success(); | ||
| 136 | + } | ||
| 137 | +} |
| @@ -67,6 +67,9 @@ class UserLogic extends BaseLogic | @@ -67,6 +67,9 @@ class UserLogic extends BaseLogic | ||
| 67 | $this->param['password'] = base64_encode(md5($this->param['password'] ?? '123456')); | 67 | $this->param['password'] = base64_encode(md5($this->param['password'] ?? '123456')); |
| 68 | $rs = $this->model->add($this->param); | 68 | $rs = $this->model->add($this->param); |
| 69 | } | 69 | } |
| 70 | + if(isset($this->param['is_password'])){ | ||
| 71 | + $this->model->edit(['is_password'=>$this->param['is_password']],['mobile'=>$this->param['mobile']]); | ||
| 72 | + } | ||
| 70 | if ($rs === false) { | 73 | if ($rs === false) { |
| 71 | $this->fail('添加失败'); | 74 | $this->fail('添加失败'); |
| 72 | } | 75 | } |
| @@ -6,6 +6,7 @@ use App\Helper\Translate; | @@ -6,6 +6,7 @@ use App\Helper\Translate; | ||
| 6 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 7 | use App\Models\Ai\AiBlog; | 7 | use App\Models\Ai\AiBlog; |
| 8 | use App\Models\Ai\AiBlogAuthor; | 8 | use App\Models\Ai\AiBlogAuthor; |
| 9 | +use App\Models\Ai\AiBlogList; | ||
| 9 | use App\Models\Project\AiBlogTask; | 10 | use App\Models\Project\AiBlogTask; |
| 10 | use App\Models\Project\Project; | 11 | use App\Models\Project\Project; |
| 11 | use App\Models\Project\ProjectAiSetting; | 12 | use App\Models\Project\ProjectAiSetting; |
| @@ -120,15 +121,23 @@ class AiBlogLogic extends BaseLogic | @@ -120,15 +121,23 @@ class AiBlogLogic extends BaseLogic | ||
| 120 | */ | 121 | */ |
| 121 | public function blogDelete(){ | 122 | public function blogDelete(){ |
| 122 | try { | 123 | try { |
| 124 | + $aiSettingInfo = $this->getProjectAiSetting(); | ||
| 125 | + $aiBlogService = new AiBlogService(); | ||
| 123 | foreach ($this->param['ids'] as $id) { | 126 | foreach ($this->param['ids'] as $id) { |
| 127 | + $info = $this->model->read(['id'=>$id],['task_id']); | ||
| 128 | + $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | ||
| 129 | + $aiBlogService->key = $aiSettingInfo['key']; | ||
| 130 | + $aiBlogService->delDetail($info['task_id']); | ||
| 124 | //删除路由映射 | 131 | //删除路由映射 |
| 125 | RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']); | 132 | RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']); |
| 126 | $this->model->del(['id'=>$id]); | 133 | $this->model->del(['id'=>$id]); |
| 127 | } | 134 | } |
| 135 | + shell_exec('php artisan save_ai_blog_list '.$this->user['project_id'].' > /dev/null 2>&1 &'); | ||
| 128 | }catch (\Exception $e){ | 136 | }catch (\Exception $e){ |
| 129 | $this->fail('删除失败'); | 137 | $this->fail('删除失败'); |
| 130 | } | 138 | } |
| 131 | return $this->success(); | 139 | return $this->success(); |
| 132 | } | 140 | } |
| 133 | 141 | ||
| 142 | + | ||
| 134 | } | 143 | } |
app/Http/Logic/Bside/Ai/AiVideoLogic.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Bside\Ai; | ||
| 4 | + | ||
| 5 | +use App\Helper\Translate; | ||
| 6 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 7 | +use App\Models\Ai\AiBlogAuthor; | ||
| 8 | +use App\Models\Ai\AiVideo; | ||
| 9 | +use App\Models\Project\AiBlogTask; | ||
| 10 | +use App\Models\Project\ProjectAiSetting; | ||
| 11 | +use App\Models\RouteMap\RouteMap; | ||
| 12 | +use App\Services\AiBlogService; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @remark :视频模块 | ||
| 16 | + * @name :AiVideoLogic | ||
| 17 | + * @author :lyh | ||
| 18 | + * @method :post | ||
| 19 | + * @time :2025/3/5 14:11 | ||
| 20 | + */ | ||
| 21 | +class AiVideoLogic extends BaseLogic | ||
| 22 | +{ | ||
| 23 | + public function __construct() | ||
| 24 | + { | ||
| 25 | + parent::__construct(); | ||
| 26 | + $this->param = $this->requestAll; | ||
| 27 | + $this->model = new AiVideo(); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * @remark :获取配置信息 | ||
| 32 | + * @name :getProjectAiSetting | ||
| 33 | + * @author :lyh | ||
| 34 | + * @method :post | ||
| 35 | + * @time :2025/2/21 14:51 | ||
| 36 | + */ | ||
| 37 | + public function getProjectAiSetting(){ | ||
| 38 | + $projectAiSettingModel = new ProjectAiSetting(); | ||
| 39 | + $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$this->user['project_id']]); | ||
| 40 | + if($aiSettingInfo === false){ | ||
| 41 | + $this->fail('请先联系管理员开启Ai配置'); | ||
| 42 | + } | ||
| 43 | + return $aiSettingInfo; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * @remark :ai发布博客 | ||
| 48 | + * @name :blogSave | ||
| 49 | + * @author :lyh | ||
| 50 | + * @method :post | ||
| 51 | + * @time :2023/7/5 14:46 | ||
| 52 | + */ | ||
| 53 | + public function blogSave(){ | ||
| 54 | + try { | ||
| 55 | + if(!empty($this->param['image'])){ | ||
| 56 | + $this->param['image'] = str_replace_url($this->param['image']); | ||
| 57 | + } | ||
| 58 | + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG, $this->param['id'], $this->user['project_id']); | ||
| 59 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 60 | + $aiSettingInfo = $this->getProjectAiSetting(); | ||
| 61 | + $aiBlogService = new AiBlogService(); | ||
| 62 | + $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | ||
| 63 | + $aiBlogService->key = $aiSettingInfo['key']; | ||
| 64 | + $aiBlogService->updateDetail(['title'=>$this->param['new_title'],'thumb'=>$this->param['image'],'route'=>$this->param['route'],'author_id'=>$this->param['author_id']]); | ||
| 65 | + }catch (\Exception $e){ | ||
| 66 | + $this->fail('保存失败,请联系管理员'); | ||
| 67 | + } | ||
| 68 | + return $this->success(); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /** | ||
| 72 | + * @remark :编辑作者 | ||
| 73 | + * @name :saveAuthor | ||
| 74 | + * @author :lyh | ||
| 75 | + * @method :post | ||
| 76 | + * @time :2025/2/21 14:46 | ||
| 77 | + */ | ||
| 78 | + public function saveBlogAuthor(){ | ||
| 79 | + try { | ||
| 80 | + $aiAuthorModel = new AiBlogAuthor(); | ||
| 81 | + if(!empty($this->param['image'])){ | ||
| 82 | + $this->param['image'] = str_replace_url($this->param['image']); | ||
| 83 | + } | ||
| 84 | + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $this->param['id'], $this->user['project_id']); | ||
| 85 | + $aiAuthorModel->edit($this->param,['id'=>$this->param['id']]); | ||
| 86 | + $aiBlogService = new AiBlogService(); | ||
| 87 | + $aiBlogService->updateAuthorInfo(['author_id'=>$this->param['author_id'],'title'=>$this->param['title'],'picture'=>$this->param['image'],'description'=>$this->param['description']]); | ||
| 88 | + }catch (\Exception $e){ | ||
| 89 | + $this->fail('保存失败,请联系管理员'); | ||
| 90 | + } | ||
| 91 | + return $this->success(); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + /** | ||
| 95 | + * @remark :发布任务 | ||
| 96 | + * @name :sendTask | ||
| 97 | + * @author :lyh | ||
| 98 | + * @method :post | ||
| 99 | + * @time :2025/2/14 10:28 | ||
| 100 | + * @detail :type=2/生成文章 type=3/更新列表页记录 | ||
| 101 | + * @detail :status=1/待执行 | ||
| 102 | + */ | ||
| 103 | + public function sendTask(){ | ||
| 104 | + $aiSettingInfo = $this->getProjectAiSetting(); | ||
| 105 | + $aiBlogService = new AiBlogService(); | ||
| 106 | + $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | ||
| 107 | + $aiBlogService->key = $aiSettingInfo['key']; | ||
| 108 | + $aiBlogService->route = generateRoute(Translate::tran($this->param['keyword'], 'en')); | ||
| 109 | + $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type'],'video'); | ||
| 110 | + if($result['status'] == 200){ | ||
| 111 | + $aiBlogTaskModel = new AiBlogTask(); | ||
| 112 | + $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'type'=>3,'task_id'=>$result['data']['task_id'],'status'=>1]); | ||
| 113 | + $this->model->addReturnId(['keyword'=>$this->param['keyword'],'status'=>1,'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id']]); | ||
| 114 | + } | ||
| 115 | + return $this->success(); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + /** | ||
| 119 | + * @remark :删除 | ||
| 120 | + * @name :blogDelete | ||
| 121 | + * @author :lyh | ||
| 122 | + * @method :post | ||
| 123 | + * @time :2025/2/20 18:21 | ||
| 124 | + */ | ||
| 125 | + public function blogDelete(){ | ||
| 126 | + try { | ||
| 127 | + $aiSettingInfo = $this->getProjectAiSetting(); | ||
| 128 | + $aiBlogService = new AiBlogService(); | ||
| 129 | + foreach ($this->param['ids'] as $id) { | ||
| 130 | + $info = $this->model->read(['id'=>$id],['task_id']); | ||
| 131 | + $aiBlogService->mch_id = $aiSettingInfo['mch_id']; | ||
| 132 | + $aiBlogService->key = $aiSettingInfo['key']; | ||
| 133 | + $aiBlogService->delDetail($info['task_id']); | ||
| 134 | + //删除路由映射 | ||
| 135 | + RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']); | ||
| 136 | + $this->model->del(['id'=>$id]); | ||
| 137 | + } | ||
| 138 | + shell_exec('php artisan save_ai_blog_list '.$this->user['project_id'].' > /dev/null 2>&1 &'); | ||
| 139 | + }catch (\Exception $e){ | ||
| 140 | + $this->fail('删除失败'); | ||
| 141 | + } | ||
| 142 | + return $this->success(); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + | ||
| 146 | +} |
| @@ -149,10 +149,10 @@ class UserLoginLogic | @@ -149,10 +149,10 @@ class UserLoginLogic | ||
| 149 | $smsInfo = $smsModel->formatQuery(['mobile'=>$mobile,'type'=>$smsModel::TYPE_LOGIN])->orderBy('id','desc')->first(); | 149 | $smsInfo = $smsModel->formatQuery(['mobile'=>$mobile,'type'=>$smsModel::TYPE_LOGIN])->orderBy('id','desc')->first(); |
| 150 | if(!empty($smsInfo)){ | 150 | if(!empty($smsInfo)){ |
| 151 | if(($password != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){ | 151 | if(($password != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){ |
| 152 | - $this->fail('验证码错误,如需账号密码登录,请联系管理员开启'); | 152 | + $this->fail('验证码错误/验证码已过期,请输入正确的验证码'); |
| 153 | } | 153 | } |
| 154 | }else{ | 154 | }else{ |
| 155 | - $this->fail('验证码错误,如需账号密码登录,请联系管理员开启'); | 155 | + $this->fail('验证码错误,请输入正确的验证码'); |
| 156 | } | 156 | } |
| 157 | $list = $this->model->list(['mobile'=>$this->param['mobile'],'status'=>$this->model::STATUS_ZERO],['id','project_id']); | 157 | $list = $this->model->list(['mobile'=>$this->param['mobile'],'status'=>$this->model::STATUS_ZERO],['id','project_id']); |
| 158 | return $this->success($list); | 158 | return $this->success($list); |
app/Models/Ai/AiVideo.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :AiVideo.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/5 14:03 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Ai; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @remark :ai视频 | ||
| 16 | + * @name :AiVideo | ||
| 17 | + * @author :lyh | ||
| 18 | + * @method :post | ||
| 19 | + * @time :2025/3/5 14:04 | ||
| 20 | + */ | ||
| 21 | +class AiVideo extends Base | ||
| 22 | +{ | ||
| 23 | + protected $table = 'gl_ai_video'; | ||
| 24 | +} |
app/Models/Industry/ProjectIndustry.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Industry; | ||
| 4 | + | ||
| 5 | +use App\Helper\Arr; | ||
| 6 | +use App\Models\Base; | ||
| 7 | + | ||
| 8 | +class ProjectIndustryRelated extends Base | ||
| 9 | +{ | ||
| 10 | + protected $table = 'gl_project_industry_related'; | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 项目行业数据关联 | ||
| 15 | + * @param $project_id | ||
| 16 | + * @param $industry_ids | ||
| 17 | + * @author Akun | ||
| 18 | + * @date 2025/03/05 10:52 | ||
| 19 | + */ | ||
| 20 | + public static function saveRelated($project_id, $industry_ids) | ||
| 21 | + { | ||
| 22 | + if (!is_array($industry_ids)) { | ||
| 23 | + $industry_ids = array_filter(Arr::splitFilterToArray($industry_ids), 'intval'); | ||
| 24 | + } | ||
| 25 | + //先删除 | ||
| 26 | + self::where('project_id', $project_id)->delete(); | ||
| 27 | + | ||
| 28 | + //批量保存 | ||
| 29 | + if (!empty($industry_ids)) { | ||
| 30 | + $data = []; | ||
| 31 | + foreach ($industry_ids as $industry_id) { | ||
| 32 | + $data[] = [ | ||
| 33 | + 'project_id' => $project_id, | ||
| 34 | + 'industry_id' => $industry_id, | ||
| 35 | + 'created_at' => date('Y-m-d H:i:s'), | ||
| 36 | + 'updated_at' => date('Y-m-d H:i:s') | ||
| 37 | + ]; | ||
| 38 | + } | ||
| 39 | + self::insert($data); | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | +} |
app/Models/Inquiry/EmailData.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :EmailData.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/4 17:53 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Inquiry; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @remark :邮箱库 | ||
| 16 | + * @name :EmailData | ||
| 17 | + * @author :lyh | ||
| 18 | + * @method :post | ||
| 19 | + * @time :2025/3/4 17:54 | ||
| 20 | + */ | ||
| 21 | +class EmailData extends Base | ||
| 22 | +{ | ||
| 23 | + protected $table = 'gl_email_data'; | ||
| 24 | +} |
| @@ -36,8 +36,9 @@ class InquiryInfo extends Base | @@ -36,8 +36,9 @@ class InquiryInfo extends Base | ||
| 36 | const TYPE_SITE_GROUP = 1; | 36 | const TYPE_SITE_GROUP = 1; |
| 37 | const TYPE_ADS = 2; | 37 | const TYPE_ADS = 2; |
| 38 | const TYPE_AI_SITE_GROUP = 3; | 38 | const TYPE_AI_SITE_GROUP = 3; |
| 39 | - const TYPE_SPIDER = 4; | ||
| 40 | - const TYPE_FIND_SUPPLY = 5; | 39 | + const TYPE_PROMOTION = 4; |
| 40 | + const TYPE_SPIDER = 5; | ||
| 41 | + const TYPE_FIND_SUPPLY = 6; | ||
| 41 | 42 | ||
| 42 | /** | 43 | /** |
| 43 | * 状态映射 | 44 | * 状态映射 |
| @@ -60,9 +61,10 @@ class InquiryInfo extends Base | @@ -60,9 +61,10 @@ class InquiryInfo extends Base | ||
| 60 | public function typeMap() | 61 | public function typeMap() |
| 61 | { | 62 | { |
| 62 | return [ | 63 | return [ |
| 63 | - self::TYPE_SITE_GROUP => '站群询盘', | 64 | + self::TYPE_SITE_GROUP => '自建AI站', |
| 64 | self::TYPE_ADS => 'ADS采集站', | 65 | self::TYPE_ADS => 'ADS采集站', |
| 65 | - self::TYPE_AI_SITE_GROUP => '自建AI站群', | 66 | + self::TYPE_AI_SITE_GROUP => '客户AI站', |
| 67 | + self::TYPE_PROMOTION => '客户推广到期站', | ||
| 66 | self::TYPE_SPIDER => 'SC平台', | 68 | self::TYPE_SPIDER => 'SC平台', |
| 67 | self::TYPE_FIND_SUPPLY => 'FS平台', | 69 | self::TYPE_FIND_SUPPLY => 'FS平台', |
| 68 | ]; | 70 | ]; |
app/Models/User/ProjectMenuSeo.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :ProjectMenuSeo.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2025/3/4 15:24 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\User; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @remark :白帽seo菜单 | ||
| 16 | + * @name :ProjectMenuSeo | ||
| 17 | + * @author :lyh | ||
| 18 | + * @method :post | ||
| 19 | + * @time :2025/3/4 15:25 | ||
| 20 | + */ | ||
| 21 | +class ProjectMenuSeo extends Base | ||
| 22 | +{ | ||
| 23 | + protected $table = 'gl_project_menu_seo'; | ||
| 24 | +} |
| @@ -233,4 +233,22 @@ class AiBlogService | @@ -233,4 +233,22 @@ class AiBlogService | ||
| 233 | $result = http_post($request_url,json_encode($param,true)); | 233 | $result = http_post($request_url,json_encode($param,true)); |
| 234 | return $result; | 234 | return $result; |
| 235 | } | 235 | } |
| 236 | + | ||
| 237 | + /** | ||
| 238 | + * @remark :删除文章 | ||
| 239 | + * @name :updateAuthorInfo | ||
| 240 | + * @author :lyh | ||
| 241 | + * @method :post | ||
| 242 | + * @time :2025/3/4 16:22 | ||
| 243 | + * @param :task_id | ||
| 244 | + */ | ||
| 245 | + public function delDetail($task_id){ | ||
| 246 | + $param['task_id'] = $task_id; | ||
| 247 | + $request_url = $this->url.'api/result/delete'; | ||
| 248 | + $param['mch_id'] = $this->mch_id; | ||
| 249 | + $this->sign = $this->generateSign($param,$this->key); | ||
| 250 | + $param['sign'] = $this->sign; | ||
| 251 | + $result = http_post($request_url,json_encode($param,true)); | ||
| 252 | + return $result; | ||
| 253 | + } | ||
| 236 | } | 254 | } |
| @@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
| 5 | * Date: 2025/2/13 | 5 | * Date: 2025/2/13 |
| 6 | * Time: 11:01 | 6 | * Time: 11:01 |
| 7 | */ | 7 | */ |
| 8 | + | ||
| 8 | namespace App\Services; | 9 | namespace App\Services; |
| 9 | 10 | ||
| 10 | use Illuminate\Support\Facades\Log; | 11 | use Illuminate\Support\Facades\Log; |
| @@ -37,30 +38,30 @@ class InquiryRelayService | @@ -37,30 +38,30 @@ class InquiryRelayService | ||
| 37 | { | 38 | { |
| 38 | try { | 39 | try { |
| 39 | // 获取数据 | 40 | // 获取数据 |
| 40 | - $url = "https://api.szcmapi.com/get_inquiry.aspx?id=".$id; | 41 | + $url = "https://api.szcmapi.com/get_inquiry.aspx?id=" . $id; |
| 41 | $json = $this->szcmCurl($url); | 42 | $json = $this->szcmCurl($url); |
| 42 | // 兼容过去到的数据, 比较乱 | 43 | // 兼容过去到的数据, 比较乱 |
| 43 | - $json = trim(str_replace("\r\n", '\n', (string) $json)); | ||
| 44 | - $json = str_replace('3/4"','3/4',$json); | ||
| 45 | - $json = str_replace('"Steklopribor"','Steklopribor',$json); | ||
| 46 | - $json = str_replace('"Net30 days"','Net30 days',$json); | 44 | + $json = trim(str_replace("\r\n", '\n', (string)$json)); |
| 45 | + $json = str_replace('3/4"', '3/4', $json); | ||
| 46 | + $json = str_replace('"Steklopribor"', 'Steklopribor', $json); | ||
| 47 | + $json = str_replace('"Net30 days"', 'Net30 days', $json); | ||
| 47 | $json = trim($json); | 48 | $json = trim($json); |
| 48 | - $json = str_replace("\n",'',$json); | ||
| 49 | - $array = json_decode($json,true); | 49 | + $json = str_replace("\n", '', $json); |
| 50 | + $array = json_decode($json, true); | ||
| 50 | 51 | ||
| 51 | if (empty($array)) | 52 | if (empty($array)) |
| 52 | return false; | 53 | return false; |
| 53 | 54 | ||
| 54 | // 整合最终数据 | 55 | // 整合最终数据 |
| 55 | $title = base64_decode($array['title']); | 56 | $title = base64_decode($array['title']); |
| 56 | - $title = str_replace("'",'',$title); | 57 | + $title = str_replace("'", '', $title); |
| 57 | $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8'); | 58 | $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8'); |
| 58 | - $title = str_replace("'",'',$title); | 59 | + $title = str_replace("'", '', $title); |
| 59 | $message = html_entity_decode(addslashes(base64_decode($array['Message'])), ENT_QUOTES, 'UTF-8'); | 60 | $message = html_entity_decode(addslashes(base64_decode($array['Message'])), ENT_QUOTES, 'UTF-8'); |
| 60 | - $message = str_replace("'",'',$message); | 61 | + $message = str_replace("'", '', $message); |
| 61 | $email = trim($array['Email']); | 62 | $email = trim($array['Email']); |
| 62 | - $name = html_entity_decode($array['Name'], ENT_QUOTES, 'UTF-8'); | ||
| 63 | - $name = str_replace("'",'',$name); | 63 | + $name = html_entity_decode($array['Name'], ENT_QUOTES, 'UTF-8'); |
| 64 | + $name = str_replace("'", '', $name); | ||
| 64 | 65 | ||
| 65 | $result = [ | 66 | $result = [ |
| 66 | 'image' => $array['image'] ?: '', | 67 | 'image' => $array['image'] ?: '', |
| @@ -106,7 +107,43 @@ class InquiryRelayService | @@ -106,7 +107,43 @@ class InquiryRelayService | ||
| 106 | return $result; | 107 | return $result; |
| 107 | } | 108 | } |
| 108 | 109 | ||
| 110 | + /** | ||
| 111 | + * 获取findsupply询盘 | ||
| 112 | + * @param $url | ||
| 113 | + * @return array | ||
| 114 | + * @throws \Exception | ||
| 115 | + * @author Akun | ||
| 116 | + * @date 2025/03/04 10:48 | ||
| 117 | + */ | ||
| 118 | + public function getInquiryFs($url) | ||
| 119 | + { | ||
| 120 | + $re = curl_get($url); | ||
| 121 | + $result = []; | ||
| 122 | + $next_page_url = ''; | ||
| 123 | + if (isset($re['status']) && $re['status'] == 200) { | ||
| 124 | + $next_page_url = $re['data']['next_page_url']; | ||
| 125 | + foreach ($re['data']['data'] as $v) { | ||
| 126 | + $dateTime = new \DateTime($v['created_at']); | ||
| 127 | + $time = $dateTime->format('Y-m-d H:i:s'); | ||
| 128 | + $result[] = [ | ||
| 129 | + 'time' => $time, | ||
| 130 | + 'name' => $v['NAME'] ?: '', | ||
| 131 | + 'email' => $v['email'] ?: '', | ||
| 132 | + 'phone' => $v['phone_number'] ?: '', | ||
| 133 | + 'refer' => $v['page_url'] ?: '', | ||
| 134 | + 'message' => $v['content'] ?: '', | ||
| 135 | + 'ip' => $v['ip'] ?: '', | ||
| 136 | + 'source_address' => 'www.findsupply.com', | ||
| 137 | + 'title' => $v['products_title'] ?: '', | ||
| 138 | + 'submit_country' => $v['country'] ?: '' | ||
| 139 | + ]; | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + return ['next_page_url' => $next_page_url, 'data' => $result]; | ||
| 144 | + } | ||
| 145 | + | ||
| 109 | ######################################################################################################################## | 146 | ######################################################################################################################## |
| 110 | # 询盘结束, 同步项目及路由 # | 147 | # 询盘结束, 同步项目及路由 # |
| 111 | ######################################################################################################################## | 148 | ######################################################################################################################## |
| 112 | -} | ||
| 149 | +} |
| @@ -50,7 +50,16 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -50,7 +50,16 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 50 | Route::any('/routes', [Aside\User\ProjectMenuController::class, 'routes'])->name('admin.user_menu_routes'); | 50 | Route::any('/routes', [Aside\User\ProjectMenuController::class, 'routes'])->name('admin.user_menu_routes'); |
| 51 | Route::any('/sort', [Aside\User\ProjectMenuController::class, 'sort'])->name('admin.user_menu_sort'); | 51 | Route::any('/sort', [Aside\User\ProjectMenuController::class, 'sort'])->name('admin.user_menu_sort'); |
| 52 | }); | 52 | }); |
| 53 | - | 53 | + //seo白帽菜单管理 |
| 54 | + Route::prefix('seo_menu')->group(function () { | ||
| 55 | + Route::any('/', [Aside\User\ProjectMenuSeoController::class, 'lists'])->name('admin.user_menu_lists'); | ||
| 56 | + Route::any('/info', [Aside\User\ProjectMenuSeoController::class, 'info'])->name('admin.user_menu_info'); | ||
| 57 | + Route::any('/add', [Aside\User\ProjectMenuSeoController::class, 'add'])->name('admin.user_menu_add'); | ||
| 58 | + Route::any('/edit', [Aside\User\ProjectMenuSeoController::class, 'edit'])->name('admin.user_menu_edit'); | ||
| 59 | + Route::any('/del', [Aside\User\ProjectMenuSeoController::class, 'del'])->name('admin.user_menu_del'); | ||
| 60 | + Route::any('/getMenu', [Aside\User\ProjectMenuSeoController::class, 'getMenu'])->name('admin.user_menu_getSonMenu'); | ||
| 61 | + Route::any('/sort', [Aside\User\ProjectMenuSeoController::class, 'sort'])->name('admin.user_menu_sort'); | ||
| 62 | + }); | ||
| 54 | //用户组 | 63 | //用户组 |
| 55 | Route::prefix('dept')->group(function () { | 64 | Route::prefix('dept')->group(function () { |
| 56 | Route::any('/', [Aside\User\ProjectDeptController::class, 'lists'])->name('admin.user_group_lists'); | 65 | Route::any('/', [Aside\User\ProjectDeptController::class, 'lists'])->name('admin.user_group_lists'); |
| @@ -519,6 +528,10 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -519,6 +528,10 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 519 | Route::any('/', [Aside\Project\AllProjectController::class, 'lists'])->name('admin.all_project_lists'); | 528 | Route::any('/', [Aside\Project\AllProjectController::class, 'lists'])->name('admin.all_project_lists'); |
| 520 | }); | 529 | }); |
| 521 | 530 | ||
| 531 | + //项目行业相关 | ||
| 532 | + Route::prefix('industry')->group(function () { | ||
| 533 | + Route::any('/', [Aside\Project\ProjectController::class, 'industryList'])->name('admin.industryList'); | ||
| 534 | + }); | ||
| 522 | }); | 535 | }); |
| 523 | 536 | ||
| 524 | //无需登录验证的路由组 | 537 | //无需登录验证的路由组 |
| @@ -13,6 +13,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -13,6 +13,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 13 | Route::any('/unbindWechat', [\App\Http\Controllers\Bside\BCom\ComController::class, 'unbindWechat'])->name('unbindWechat'); | 13 | Route::any('/unbindWechat', [\App\Http\Controllers\Bside\BCom\ComController::class, 'unbindWechat'])->name('unbindWechat'); |
| 14 | //获取当前登录用户菜单 | 14 | //获取当前登录用户菜单 |
| 15 | Route::any('/get_menu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'get_menu'])->name('get_menu'); | 15 | Route::any('/get_menu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'get_menu'])->name('get_menu'); |
| 16 | + Route::any('/seo_get_menu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'seo_get_menu'])->name('seo_get_menu'); | ||
| 16 | //自定义菜单 | 17 | //自定义菜单 |
| 17 | Route::any('/getCustomMenu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'getCustomMenu'])->name('get_getCustomMenu'); | 18 | Route::any('/getCustomMenu', [\App\Http\Controllers\Bside\BCom\ComController::class, 'getCustomMenu'])->name('get_getCustomMenu'); |
| 18 | //获取当前登录用户项目详情 | 19 | //获取当前登录用户项目详情 |
| @@ -362,6 +363,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -362,6 +363,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 362 | Route::any('/delete', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'delete'])->name('inquiry_delete'); | 363 | Route::any('/delete', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'delete'])->name('inquiry_delete'); |
| 363 | Route::any('/export', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'export'])->name('inquiry_export'); | 364 | Route::any('/export', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'export'])->name('inquiry_export'); |
| 364 | Route::any('/send', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'sendMobileVerifyData'])->name('inquiry_sendMobileVerifyData'); | 365 | Route::any('/send', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'sendMobileVerifyData'])->name('inquiry_sendMobileVerifyData'); |
| 366 | + Route::any('/checkEmail', [\App\Http\Controllers\Bside\Inquiry\InquiryController::class, 'checkEmail'])->name('inquiry_checkEmail'); | ||
| 365 | }); | 367 | }); |
| 366 | 368 | ||
| 367 | //生成路由 | 369 | //生成路由 |
-
请 注册 或 登录 后发表评论