作者 赵彬吉
... ... @@ -43,7 +43,7 @@ class RemainDay extends Command
* @var 暂停的项目
*/
protected $ceaseProjectId = [
354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250, 2193, 2399, 1685, 3931,2273,3647
354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250, 2193, 2399, 1685, 3931,2273,3647,1934
];//需要单独处理的项目
/**
* The console command description.
... ...
... ... @@ -63,7 +63,7 @@ class GeoQuestionRes extends Command
$geoQuestionModel->edit(['status'=>$geoQuestionModel::STATUS_CLOSE],['id'=>$task_id]);
continue;
}
if(empty($taskInfo['question']) || ($taskInfo['project_id'] != 4533) || (empty($taskInfo['keywords']) && empty($taskInfo['url']) && empty($taskInfo['expect_result']))){
if(empty($taskInfo['question']) || (empty($taskInfo['keywords']) && empty($taskInfo['url']) && empty($taskInfo['expect_result']))){
$this->output('task id: ' . $task_id . ', error: 任务数据缺失, continue!');
$geoQuestionModel->edit(['status'=>$geoQuestionModel::STATUS_CLOSE],['id'=>$task_id]);
continue;
... ... @@ -337,13 +337,14 @@ class GeoQuestionRes extends Command
$key = 'geo_task_list';
$task_id = Redis::rpop($key);
if(empty($task_id)){
$questionModel = new GeoQuestion();
$ids = $questionModel->selectField(['status'=>$questionModel::STATUS_OPEN,'next_time'=>['<=',date('Y-m-d')]],'id');
if(!empty($ids)){
# TODO 按照项目进行获取, 一个项目当天需要将所有跑完
$project_id = GeoQuestion::where('status', GeoQuestion::STATUS_OPEN)->where('next_time', '<=', date('Y-m-d'))->value('project_id');
if (empty($project_id))
return $task_id;
$ids = GeoQuestion::where(['project_id' => $project_id, 'status' => GeoQuestion::STATUS_OPEN])->where('current_time', '<>', date('Y-m-d'))->pluck('id');
foreach ($ids as $id) {
Redis::lpush($key, $id);
}
}
$task_id = Redis::rpop($key);
}
return $task_id;
... ...
... ... @@ -8,9 +8,15 @@
namespace App\Console\Commands\Inquiry;
use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\Gpt;
use App\Helper\Translate;
use App\Helper\Validate;
use App\Http\Logic\Aside\Optimize\InquiryForwardLogic;
use App\Models\Ai\AiCommand;
use App\Models\Inquiry\InquiryInfo;
use App\Models\Inquiry\InquiryRelayAi;
use App\Models\Project\InquiryFilterConfig;
use App\Models\Project\Project;
use App\Services\InquiryRelayService;
... ... @@ -221,7 +227,65 @@ class SyncInquiryRelay extends Command
$remark = $this->inquiryFilter($unique_sign, $country, $data['ip'], $data['message'], $data['refer'], $data['email'], $data['phone'], $data['name']);
$status = $remark ? InquiryInfo::STATUS_INVALID : InquiryInfo::STATUS_INIT;
$model->createInquiry($data['name'], $data['phone'], $data['email'], $data['ip'], $country, $data['message'], $message_cn, $type, $data['time'], $data['refer'], $data['title'], $keywords, $message_sign, $data['origin_key'], $data['image'], $email_status, $phone_status, $unique_sign, $status, $remark);
$form_id = $model->createInquiry($data['name'], $data['phone'], $data['email'], $data['ip'], $country, $data['message'], $message_cn, $type, $data['time'], $data['refer'], $data['title'], $keywords, $message_sign, $data['origin_key'], $data['image'], $email_status, $phone_status, $unique_sign, $status, $remark);
if ($form_id && $status == InquiryInfo::STATUS_INIT) {
$inquiry_ai_info = InquiryRelayAi::where('form_id', $form_id)->first();
if (!$inquiry_ai_info) {
//AI匹配询盘关键词
$ai_info = AiCommand::select(['ai'])->where('key', 'inquiry_keyword_extract')->first();
if (!$ai_info) {
$this->output('AI重写指令[inquiry_keyword_extract]未配置');
return true;
}
$ai_command = $ai_info['ai'];
$ai_command = str_replace('{title}', $data['title'], $ai_command);
$ai_command = str_replace('{keywords}', $keywords, $ai_command);
$ai_command = str_replace('{content}', $data['message'], $ai_command);
$ai_keyword = Common::deal_str(Gpt::instance()->openai_chat_qqs($ai_command));
if (!$ai_keyword) {
$this->output('询盘ID:' . $form_id . ',AI提取询盘关键词失败');
return true;
}
//关键词查询项目着陆页:先精准匹配,没有数据再全文索引匹配
$inquiryForwardLogic = new InquiryForwardLogic();
$forward_list = $inquiryForwardLogic->searchKeywords($ai_keyword, 2, 3);
if (count($forward_list) < 3) {
$forward_list_against = $inquiryForwardLogic->searchKeywords($ai_keyword, 1, 3 - count($forward_list));
foreach ($forward_list_against as $against) {
array_push($forward_list, $against);
}
}
if (empty($forward_list)) {
$this->output('询盘ID:' . $form_id . ',根据关键词[' . $ai_keyword . ']查询项目着陆页为空');
return true;
}
//重写询盘内容
$ai_message_list = [];
for ($i = 0; $i < count($forward_list); $i++) {
$message_re = $inquiryForwardLogic->aiRewrite($data['message'], $data['title'], $keywords);
if (isset($message_re['ai_message']) && $message_re['ai_message']) {
$ai_message_list[] = $message_re['ai_message'];
}
}
if (empty($ai_message_list)) {
$this->output('询盘ID:' . $form_id . ',AI重写询盘内容失败');
return true;
}
$inquiry_ai_info = new InquiryRelayAi();
$inquiry_ai_info->form_id = $form_id;
$inquiry_ai_info->keywords = $ai_keyword;
$inquiry_ai_info->forward_url = Arr::a2s($forward_list);
$inquiry_ai_info->message_ai = Arr::a2s($ai_message_list);
$inquiry_ai_info->save();
}
}
return true;
}
... ...
... ... @@ -11,6 +11,7 @@ namespace App\Console\Commands\LyhTest;
use App\Helper\OaGlobalsoApi;
use App\Models\Ai\AiBlog;
use App\Models\Geo\GeoLink;
use App\Models\News\News;
use App\Models\Product\Category;
use App\Models\Project\AggregateKeywordAffix;
... ... @@ -35,6 +36,7 @@ use App\Services\Geo\GeoService;
use App\Services\MidJourneyService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
class lyhDemo extends Command
... ... @@ -57,6 +59,51 @@ class lyhDemo extends Command
return $this->translate_action();
}
public function _actionDa()
{
$geoLinkModel = new GeoLink();
$lists = $geoLinkModel->list(['da'=>0,'time'=>null]);
$geoService = new GeoService();
foreach ($lists as $info){
if(!empty($info['time'])){
$start = Carbon::parse($info['time']);
$end = Carbon::parse(date('Y-m-d'));
$diff = $start->diffInDays($end);
if($diff >= 60){
$host = $this->getDomainWithWWW($info['url']);
$result = $geoService->daResult($host);
}else{
continue;
}
}else{
$host = $this->getDomainWithWWW($info['url']);
$result = $geoService->daResult($host);
}
if(!isset($result['data']) || empty($result['data'])){
$this->model->edit(['time'=>date('Y-m-d')], ['id'=>$info['id']]);
continue;
}
$info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值
$this->model->edit(['time'=>date('Y-m-d'),'da'=>$info['da']], ['id'=>$info['id']]);
}
}
public function getDomainWithWWW($url) {
// 获取 host
$host = parse_url($url, PHP_URL_HOST);
// 去掉端口号等情况
$host = preg_replace('/:\d+$/', '', $host);
// 分割域名
$parts = explode('.', $host);
// 判断是几段
$count = count($parts);
// 如果只有两段,比如 fox8.com、theamericawatch.com,就拼接 www.
if ($count === 2) {
return 'www.' . $host;
}
return $host;
}
/**
* @remark :查看路由是否为空
* @name :_actionRoute
... ...
... ... @@ -54,7 +54,7 @@ class ExternalLinkMake extends Command
continue;
}
$yesterday = RankDataLog::where(['project_id' => $project->id, 'date' => date('Y-m-d', '-1 day')])->first();
$yesterday = RankDataLog::where(['project_id' => $project->id, 'date' => date('Y-m-d', strtotime('-1 day'))])->first();
if (FALSE == empty($yesterday) && $yesterday->is_compliance == 1){
$this->output('项目昨日达标: ' . $project->id . ', 跳过');
continue;
... ...
... ... @@ -33,10 +33,11 @@ class SyncImage extends Command
// public function handle(){
// $str = $this->getProjectConfig(1808);
// $str = $this->getProjectConfig(4240);
// $imageModel = new Image();
// $str_image = '/upload/p/1808/image_product/2024-09/ppp.png,/upload/p/1808/image_product/2024-09/86e4866b-7432-40c1-8c06-d335cd736e29.png,/upload/p/1808/image_product/2024-09/7fd109cc-56f4-457c-a9c4-c3fa8d8195b2.png,/upload/p/1808/image_product/2024-09/1.png,/upload/p/1808/image_product/2024-08/bxb12501-3-1.png,/upload/p/1808/image_product/2024-08/bxa10801-3-1.png,/upload/p/1808/image_product/2024-08/bxa007-3-1.png,/upload/p/1808/image_product/2024-08/auto-parts-rectifier-bxf1070-for-alternator-1-1.png,/upload/p/1808/image_product/2024-08/auto-parts-rectifier-bxd1102-for-alternator-2-1.png,/upload/p/1808/image_product/2024-08/11407-3-1.png,/upload/p/1808/image_product/2024-07/gfjty.jpg,/upload/p/1808/image_product/2024-07/bxn11508-g1-2.png,/upload/p/1808/image_product/2024-07/bxn11508-g1-1.png,/upload/p/1808/image_product/2024-07/bxb12501-2.png,/upload/p/1808/image_product/2024-07/bxb12501-1.png,/upload/p/1808/image_product/2024-07/bxb1209-2.png,/upload/p/1808/image_product/2024-07/bxb1209-1.png,/upload/p/1808/image_product/2024-07/bxa10801-2.png,/upload/p/1808/image_product/2024-07/bxa10801-1.png,/upload/p/1808/image_product/2024-07/bxa007-2.png,/upload/p/1808/image_product/2024-07/bxa007-1.png,/upload/p/1808/image_product/2024-07/auto-parts-rectifier-bxf6102-for-alternator-2.png,/upload/p/1808/image_product/2024-07/auto-parts-rectifier-bxf1070-for-alternator-3.png,/upload/p/1808/image_product/2024-07/auto-parts-rectifier-bxf1070-for-alternator-2.png,/upload/p/1808/image_product/2024-07/auto-parts-rectifier-bxd9410-for-alternator-1.png,/upload/p/1808/image_product/2024-07/auto-parts-rectifier-bxd1102-for-alternator-3.png,/upload/p/1808/image_product/2024-07/auto-parts-rectifier-bxd1102-for-alternator-1.png,/upload/p/1808/image_product/2024-07/auto-parts-rectifier-bxb12807-for-alternator-2.png,/upload/p/1808/image_product/2024-07/auto-parts-rectifier-bxb12807-for-alternator-1.png,/upload/p/1808/image_product/2024-07/11407-2.png,/upload/p/1808/image_product/2024-07/11407-1.png';
// $lists = explode(',',$str_image);
// $strImage = '/upload/p/4240/image_other/2025-09/picture-18-copy-3.jpg,/upload/p/4240/image_other/2025-09/picture-17-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-16-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-12-copy-3.jpg,/upload/p/4240/image_other/2025-09/picture-5-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-6-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-10-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-11-copy-2.jpg,/upload/p/4240/image_other/2025-09/4-1.jpg,/upload/p/4240/image_other/2025-09/picture-18-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-16-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-17-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-15-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-13-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-14-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-12-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-10-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-11-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-20-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-18-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-19-copy-1.jpg,/upload/p/4240/image_other/2025-09/image-1-copy.jpg,/upload/p/4240/image_other/2025-09/image-2-copy.jpg,/upload/p/4240/image_other/2025-09/picture-3-copy.jpg,/upload/p/4240/image_other/2025-09/picture-6-copy.jpg,/upload/p/4240/image_other/2025-09/picture-4-copy.jpg,/upload/p/4240/image_other/2025-09/picture-5-copy.jpg,/upload/p/4240/image_other/2025-09/picture-9-copy.jpg,/upload/p/4240/image_other/2025-09/picture-7-copy.jpg,/upload/p/4240/image_other/2025-09/picture-8-copy.jpg,/upload/p/4240/image_other/2025-09/picture-15-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-14-copy.jpg,/upload/p/4240/image_other/2025-09/picture-13-copy.jpg,/upload/p/4240/image_other/2025-09/picture-12-copy-1.jpg,/upload/p/4240/image_other/2025-08/picture-44-copy.jpg,/upload/p/4240/image_other/2025-08/45.jpg,/upload/p/4240/image_other/2025-09/picture-10-copy.jpg,/upload/p/4240/image_other/2025-09/picture-11-copy.jpg,/upload/p/4240/image_other/2025-08/43.jpg,/upload/p/4240/image_other/2025-08/42.jpg,/upload/p/4240/image_other/2025-08/picture-38-copy.jpg,/upload/p/4240/image_other/2025-08/picture-37-copy.jpg,/upload/p/4240/image_other/2025-08/picture-36-copy.jpg,/upload/p/4240/image_other/2025-08/picture-35-copy-1.jpg,/upload/p/4240/image_other/2025-08/picture-30-copy.jpg,/upload/p/4240/image_other/2025-08/29.jpg,/upload/p/4240/image_other/2025-08/28-1.jpg,/upload/p/4240/image_other/2025-08/27-1.jpg,/upload/p/4240/image_other/2025-08/picture-23-copy.jpg,/upload/p/4240/image_other/2025-08/22-1.jpg,/upload/p/4240/image_other/2025-08/21.jpg,/upload/p/4240/image_other/2025-08/17.jpg,/upload/p/4240/image_other/2025-08/16.jpg,/upload/p/4240/image_other/2025-08/picture-15-copy.jpg,/upload/p/4240/image_other/2025-08/11-2.jpg,/upload/p/4240/image_other/2025-08/10-1.jpg,/upload/p/4240/image_other/2025-08/picture-6.jpg,/upload/p/4240/image_other/2025-08/picture-5.jpg,/upload/p/4240/image_other/2025-08/picture-4.jpg,/upload/p/4240/image_other/2025-08/api-standard-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/gb-standard-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/gost-standard-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/jis-standard-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/asmeastm-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/en-standard-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/api-corrosion-resistant-alloy-cra-pipe.jpg,/upload/p/4240/image_other/2025-08/nickel-alloy-seamless-pipe.jpg,/upload/p/4240/image_other/2025-08/duplexsuper-duplex-seamless-pipe.jpg,/upload/p/4240/image_other/2025-08/super-austenitic-seamless-pipe.jpg,/upload/p/4240/image_other/2025-08/austenitic-stainless-steel-seamless-pipe.jpg,/upload/p/4240/image_other/2025-08/thick-zinc-coated-pipe.jpg,/upload/p/4240/image_other/2025-08/galvanized-fbe-pipe.jpg,/upload/p/4240/image_other/2025-08/electro-galvanized-pipe.jpg,/upload/p/4240/image_other/2025-08/hot-dip-galvanized-pipe.jpg,/upload/p/4240/image_other/2025-08/q235-galvanized-pipe.jpg,/upload/p/4240/image_other/2025-08/q195-galvanized-pipe.jpg,/upload/p/4240/image_other/2025-08/bare-ssaw-steel-pipe.jpg,/upload/p/4240/image_other/2025-08/fbe-coated-ssaw-steel-pipe.jpg,/upload/p/4240/image_other/2025-08/x52-ssaw-steel-pipe.jpg,/upload/p/4240/image_other/2025-08/q235b-ssaw-steel-pipe.jpg,/upload/p/4240/image_other/2025-08/low-alloy-steel-erw-pipe.jpg,/upload/p/4240/image_other/2025-08/carbon-steel-erw-pipe.jpg,/upload/p/4240/image_other/2025-08/black-carbon-steel-pipe.jpg,/upload/p/4240/image_other/2025-08/picture-19-copy.jpg,/upload/p/4240/image_other/2025-08/hydrogen-energy-skid.jpg';
//// $lists = $imageModel->selectField(['project_id'=>4240],'path');
// $lists = explode(',',$strImage);
// $domain = 'http://globalso-v6-1309677403.cos.ap-hongkong.myqcloud.com';//cos域名
// foreach ($lists as $v){
// $url = $domain . $v.'?'.$str;
... ... @@ -51,7 +52,7 @@ class SyncImage extends Command
$data = [];
$domain = 'https://ecdn6.globalso.com/';
$imageModel = new Image();
$lists = $imageModel->list(['project_id'=>1808]);
$lists = $imageModel->list(['project_id'=>4240]);
foreach ($lists as $k => $v){
$url = $domain . $v['path'];
echo date('Y-m-d H:i:s') . '刷新路径:'. $url .',主键id:'. $v['id'] . PHP_EOL;
... ...
... ... @@ -3,13 +3,19 @@
namespace App\Console\Commands\Test;
use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\Gpt;
use App\Http\Logic\Aside\Optimize\InquiryForwardLogic;
use App\Http\Logic\Bside\Product\CategoryLogic;
use App\Models\Ai\AiCommand;
use App\Models\Com\Notify;
use App\Models\CustomModule\CustomModuleContent;
use App\Models\Devops\ServerConfig;
use App\Models\Devops\ServersIp;
use App\Models\Domain\DomainCreateTask;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\InquiryInfo;
use App\Models\Inquiry\InquiryRelayAi;
use App\Models\Product\Category;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Keyword;
... ... @@ -43,7 +49,81 @@ class Temp extends Command
public function handle()
{
$this->inquiryAiCheck(17259, 27468);
}
/**
* AI预处理询盘
* @param $start_id
* @param $end_id
* @return bool
* @author Akun
* @date 2025/10/10 15:45
*/
public function inquiryAiCheck($start_id, $end_id)
{
//AI匹配询盘关键词
$ai_info = AiCommand::select(['ai'])->where('key', 'inquiry_keyword_extract')->first();
if (!$ai_info) {
$this->output('AI重写指令[inquiry_keyword_extract]未配置');
return true;
}
InquiryInfo::select(['id', 'message', 'url_title', 'url_keyword'])->whereBetween('id', [$start_id, $end_id])->where('status', InquiryInfo::STATUS_INIT)->chunk(100, function ($inquiries) use ($ai_info) {
foreach ($inquiries as $inquiry) {
$inquiry_ai_info = InquiryRelayAi::where('form_id', $inquiry['id'])->first();
if (!$inquiry_ai_info) {
$ai_command = $ai_info['ai'];
$ai_command = str_replace('{title}', $inquiry['url_title'], $ai_command);
$ai_command = str_replace('{keywords}', $inquiry['url_keyword'], $ai_command);
$ai_command = str_replace('{content}', $inquiry['message'], $ai_command);
$ai_keyword = Common::deal_str(Gpt::instance()->openai_chat_qqs($ai_command));
if (!$ai_keyword) {
$this->output('询盘ID:' . $inquiry['id'] . ',AI提取询盘关键词失败');
continue;
}
//关键词查询项目着陆页:先精准匹配,没有数据再全文索引匹配
$inquiryForwardLogic = new InquiryForwardLogic();
$forward_list = $inquiryForwardLogic->searchKeywords($ai_keyword, 2, 3);
if (count($forward_list) < 3) {
$forward_list_against = $inquiryForwardLogic->searchKeywords($ai_keyword, 1, 3 - count($forward_list));
foreach ($forward_list_against as $against) {
array_push($forward_list, $against);
}
}
if (empty($forward_list)) {
$this->output('询盘ID:' . $inquiry['id'] . ',根据关键词[' . $ai_keyword . ']查询项目着陆页为空');
continue;
}
//重写询盘内容
$ai_message_list = [];
for ($i = 0; $i < count($forward_list); $i++) {
$message_re = $inquiryForwardLogic->aiRewrite($inquiry['message'], $inquiry['url_title'], $inquiry['url_keyword']);
if (isset($message_re['ai_message']) && $message_re['ai_message']) {
$ai_message_list[] = $message_re['ai_message'];
}
}
if (empty($ai_message_list)) {
$this->output('询盘ID:' . $inquiry['id'] . ',AI重写询盘内容失败');
continue;
}
$inquiry_ai_info = new InquiryRelayAi();
$inquiry_ai_info->form_id = $inquiry['id'];
$inquiry_ai_info->keywords = $ai_keyword;
$inquiry_ai_info->forward_url = Arr::a2s($forward_list);
$inquiry_ai_info->message_ai = Arr::a2s($ai_message_list);
$inquiry_ai_info->save();
$this->output('询盘ID:' . $inquiry['id'] . ',success');
}
}
});
return true;
}
/**
... ...
... ... @@ -15,6 +15,7 @@ use App\Models\Blog\BlogCategory;
use App\Models\News\NewsCategory;
use App\Models\Product\Category;
use App\Models\Product\Keyword;
use App\Models\RouteMap\RouteMap;
use App\Models\Ticket\TicketUploadData;
use App\Services\ProjectServer;
use Illuminate\Http\Request;
... ... @@ -167,6 +168,12 @@ class TicketUploadDataController extends BaseController
'type.required' => '上传类型不能为空',
'text' => '数据详情不为空'
]);
if(empty($this->param['text']['image'])){
$this->response('参数错误',Code::SYSTEM_ERROR);
}
if(empty($this->param['text']['title'])){
$this->response('参数错误,标题不能为空',Code::SYSTEM_ERROR);
}
//验证当前数据是否已提交
$this->param['text'] = json_encode($this->param['text'], true);
if(isset($this->param['id']) && !empty($this->param['id'])){
... ... @@ -202,20 +209,38 @@ class TicketUploadDataController extends BaseController
$this->request->validate([
'project_id' => 'required',
'type' => 'required',
'search' => 'required'
], [
'project_id.required' => 'project_id不能为空',
'type.required' => 'type不能为空',
'search.required' => '搜索参数不能为空',
]);
ProjectServer::useProject($this->param['project_id']);
if ($this->param['type'] == 1) {
ProjectServer::useProject($this->map['project_id']);
if ($this->map['type'] == 1) {
//todo::搜索获取分类
$productCateModel = new Category();
$data = $productCateModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
if(!empty($this->map['search']) && isset($this->map['search'])){
$this->map['name'] = ['like' , '%' . $this->map['search'] . '%'];
unset($this->param['search']);
}
unset($this->map['type']);
$cate_list = $productCateModel->list($this->map, 'sort',['id','title','pid']);
if ($cate_list === false) {
$this->response('无分类');
}
$data = [];
foreach ($cate_list as $v) {
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $cate_list);
$data[] = $v;
}
}
} else {
$keywordModel = new Keyword();
$data = $keywordModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
if(!isset($this->map['search']) || empty($this->map['search'])){
$data = $keywordModel->lists([], 1, 20,'id',['id','title as name']);
}else{
$data = $keywordModel->lists(['title' => ['like','%' . $this->map['search'] . '%']], 1, 20,'id',['id','title as name']);
}
}
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
... ... @@ -232,16 +257,29 @@ class TicketUploadDataController extends BaseController
{
$this->request->validate([
'project_id' => 'required',
'search' => 'required'
], [
'project_id.required' => 'project_id不能为空',
'search.required' => '搜索参数不能为空',
]);
ProjectServer::useProject($this->param['project_id']);
$blogCateModel = new BlogCategory();
$data = $blogCateModel->lists(['name' => ['like' ,'%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']);
ProjectServer::useProject($this->map['project_id']);
$newsCateModel = new NewsCategory();
if(!empty($this->map['search']) && isset($this->map['search'])){
$this->map['name'] = ['like' , '%' . $this->map['search'] . '%'];
unset($this->map['search']);
}
$cate_list = $newsCateModel->list($this->map, 'sort',['id','name as title','pid']);
if ($cate_list === false) {
$this->response('error', Code::USER_ERROR);
}
$list = [];
foreach ($cate_list as $v) {
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $cate_list);
$list[] = $v;
}
}
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
$this->response('success', Code::SUCCESS, $list);
}
/**
... ... @@ -255,15 +293,142 @@ class TicketUploadDataController extends BaseController
{
$this->request->validate([
'project_id' => 'required',
'search' => 'required'
], [
'project_id.required' => 'project_id不能为空',
'search.required' => '搜索参数不能为空',
]);
ProjectServer::useProject($this->param['project_id']);
ProjectServer::useProject($this->map['project_id']);
$newsCateModel = new NewsCategory();
$data = $newsCateModel->lists(['name' => ['like' , '%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']);
if(!empty($this->map['search']) && isset($this->map['search'])){
$this->map['name'] = ['like' , '%' . $this->map['search'] . '%'];
unset($this->map['search']);
}
$cate_list = $newsCateModel->list($this->map, 'sort',['id','name as title','pid']);
if ($cate_list === false) {
$this->response('error', Code::USER_ERROR);
}
$list = [];
foreach ($cate_list as $v) {
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $cate_list);
$list[] = $v;
}
}
$this->response('success', Code::SUCCESS, $list);
}
/**
* @remark :保存关键字
* @name :saveKeyword
* @author :lyh
* @method :post
* @time :2025/10/10 10:50
*/
public function saveKeyword()
{
$this->request->validate([
'project_id' => 'required',
'title' => 'required'
], [
'project_id.required' => 'project_id不能为空',
'title.required' => '分类标题不能为空',
]);
ProjectServer::useProject($this->param['project_id']);
$keywordModel = new Keyword();
$id = $keywordModel->addReturnId(['project_id' => $this->param['project_id'], 'title' => $this->param['title']]);
$route = RouteMap::setRoute($this->param['title'],RouteMap::SOURCE_PRODUCT_KEYWORD,$id,$this->param['project_id']);
$keywordModel->edit(['route'=>$route],['id'=>$id]);
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
$this->response('success', Code::SUCCESS, ['id'=>$id,'title'=>$this->param['title']]);
}
/**
* @remark :新增分类
* @name :saveCategory
* @author :lyh
* @method :post
* @time :2025/10/10 10:13
*/
public function saveCategory()
{
$this->request->validate([
'project_id' => 'required',
'type' => 'required',
'title' => 'required'
], [
'project_id.required' => 'project_id不能为空',
'type.required' => '类型不能为空',
'title.required' => '分类标题不能为空',
]);
ProjectServer::useProject($this->param['project_id']);
if($this->param['type'] == 1){//增加产品分类
$data = $this->addProductCategory($this->param['title'],$this->param['project_id'],$this->param['pid'] ?? 0);
}elseif ($this->param['type'] == 2){//增加blog分类
$data = $this->addBlogCategory($this->param['title'],$this->param['project_id'],$this->param['pid'] ?? 0);
}else{
$data = $this->addNewsCategory($this->param['title'],$this->param['project_id'],$this->param['pid'] ?? 0);
}
DB::disconnect('custom_mysql');
$this->response('success',Code::SUCCESS, $data);
}
/**
* @remark :新增分类
* @name :addProductCategory
* @author :lyh
* @method :post
* @time :2025/10/10 10:43
*/
public function addProductCategory($title,$project_id,$pid){
$productCateModel = new Category();
$info = $productCateModel->read(['title'=>$title],['id','title']);
if($info !== false){
return $info;
}else{
$id = $productCateModel->addReturnId(['title'=>$title,'project_id'=>$project_id,'pid'=>$pid]);
$route = RouteMap::setRoute($title,RouteMap::SOURCE_PRODUCT_CATE,$id,$project_id);
$productCateModel->edit(['route'=>$route],['id'=>$id]);
return ['id'=>$id,'title'=>$title];
}
}
/**
* @remark :新增blog分类
* @name :addBlogCategory
* @author :lyh
* @method :post
* @time :2025/10/10 10:44
*/
public function addBlogCategory($title,$project_id,$pid){
$blogCateModel = new BlogCategory();
$info = $blogCateModel->read(['name'=>$title],['id','name as title']);
if($info !== false){
return $info;
}else{
$id = $blogCateModel->addReturnId(['name'=>$title,'project_id'=>$project_id,'pid'=>$pid]);
$route = RouteMap::setRoute($title,RouteMap::SOURCE_BLOG_CATE,$id,$project_id);
$blogCateModel->edit(['alias'=>$route],['id'=>$id]);
return ['id'=>$id,'title'=>$title];
}
}
/**
* @remark :新增news分类
* @name :addNewsCategory
* @author :lyh
* @method :post
* @time :2025/10/10 10:46
*/
public function addNewsCategory($title,$project_id,$pid){
$newsCateModel = new NewsCategory();//增加新闻分类
$info = $newsCateModel->read(['name'=>$title],['id','name as title']);
if($info !== false){
return $info;
}else{
$id = $newsCateModel->addReturnId(['name'=>$title,'project_id'=>$project_id,'pid'=>$pid]);
$route = RouteMap::setRoute($title,RouteMap::SOURCE_NEWS_CATE,$id,$project_id);
$newsCateModel->edit(['alias'=>$route],['id'=>$id]);
return ['id'=>$id,'title'=>$title];
}
}
}
... ...
... ... @@ -127,4 +127,21 @@ class GeoLinkController extends BaseController
}
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :执行da值返回数据
* @name :daResultData
* @author :lyh
* @method :post
* @time :2025/10/9 09:39
*/
public function daResultData(){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$data = $this->logic->daResultData();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -103,7 +103,7 @@ class InquiryForwardController extends BaseController
'id' => 'required',//ID
'name' => 'required',//名称
'email' => 'required',//邮箱
'ip' => 'required',//ip
'ip' => 'required|max:200',//ip
'forward_url' => 'required',//转发网址
'message' => 'required',//发送内容
], [
... ... @@ -111,6 +111,7 @@ class InquiryForwardController extends BaseController
'name.required' => '名称不能为空',
'email.required' => '邮箱不能为空',
'ip.required' => 'ip不能为空',
'ip.max' => '请使用正确的ipv4地址',
'forward_url.required' => '转发网址不能为空',
'message.required' => '内容不能为空',
]);
... ... @@ -152,7 +153,10 @@ class InquiryForwardController extends BaseController
'type.required' => '搜索类型不能为空',
]);
$lists = $inquiryForwardLogic->searchKeywords();
$keywords = $this->param['keywords'];
$type = $this->param['type'];
$num = $this->param['num'] ?? 3;
$lists = $inquiryForwardLogic->searchKeywords($keywords, $type, $num);
$this->response('success', Code::SUCCESS, $lists);
}
... ... @@ -172,7 +176,8 @@ class InquiryForwardController extends BaseController
'message.required' => '需要重写的文案不能为空',
]);
$data = $inquiryForwardLogic->aiRewrite();
$message = $this->param['message'];
$data = $inquiryForwardLogic->aiRewrite($message);
$this->response('success', Code::SUCCESS, $data);
}
... ...
... ... @@ -109,6 +109,7 @@ class ProjectController extends BaseController
'gl_project_deploy_build.dept_id AS dept_id',
'gl_project_deploy_build.keyword_num AS key',
'gl_project_deploy_build.service_duration AS day',
'gl_project_deploy_build.seo_service_duration AS seo_day',
'gl_project_deploy_build.is_comment AS is_comment',
'gl_project_deploy_build.leader_mid AS leader_mid',
'gl_project_deploy_build.manager_mid AS manager_mid',
... ... @@ -845,6 +846,9 @@ class ProjectController extends BaseController
$domain_array = parse_url($domain_pro ? $domain_pro->domain : '');
$domain = $domain_array['host'] ?? $domain_array['path'];
}
$item['channel']['channel'] = Channel::where('id', $item['channel']['channel_id'])->value('title');
$item['channel']['zone'] = Zone::where('id', $item['channel']['zone_id'])->value('title');
$item['channel']['user'] = User::where('id', $item['channel']['user_id'])->value('name');
$manageHr = new ManageHr();
$param = [
"id" => $item['id'],
... ...
... ... @@ -79,4 +79,21 @@ class LinkDataController extends BaseController
$result = $linkData->del(['id'=>['in',$this->param['id']]]);
$this->response('success',Code::SUCCESS,$result);
}
/**
* @remark :执行da值返回数据
* @name :daResultData
* @author :lyh
* @method :post
* @time :2025/10/9 09:39
*/
public function daResultData(LinkDataLogic $logic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'ID不能为空',
]);
$data = $logic->daResultData();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -10,7 +10,10 @@
namespace App\Http\Logic\Aside\Geo;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\DomainDa;
use App\Models\Geo\GeoLink;
use App\Services\Geo\GeoService;
use Illuminate\Support\Carbon;
/**
* @remark :geo权威新闻(链接数据)
... ... @@ -101,4 +104,70 @@ class GeoLinkLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :返回数据data
* @name :daResultData
* @author :lyh
* @method :post
* @time :2025/10/9 09:43
*/
public function daResultData()
{
$info = $this->model->read(['id'=>$this->param['id']]);
if($info === false){
$this->fail('当前数据不存在或者已被删除');
}
$host = $this->getDomainWithWWW($info['url']);
$domainDaModel = new DomainDa();
$daInfo = $domainDaModel->read(['domain'=>$host]);
if($daInfo !== false){
//判断时间是否大于60天
$start = Carbon::parse(date('Y-m-d', strtotime($daInfo['updated_at'])));
$end = Carbon::parse(date('Y-m-d'));
$diff = $start->diffInDays($end);
if($diff <= 60){
$info['da'] = $daInfo['da'];
$this->model->edit(['da'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]);
return $this->success($info);
}
}
$geoService = new GeoService();
$result = $geoService->daResult($host);
if(!isset($result['data']) || empty($result['data'])){
return $this->success($info);
}
$info['da'] = (int)$result['data']['mozDA'];//获取数据中的da值
//保存数据
if($daInfo !== false){
$domainDaModel->edit(['da'=>$info['da'],'result'=>json_encode($result,true)],['id'=>$daInfo['id']]);
}else{
$domainDaModel->addReturnId(['da'=>$info['da'],'domain'=>$host,'result'=>json_encode($result,true)]);
}
$this->model->edit(['da'=>$info['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]);
return $this->success($info);
}
/**
* @remark :获取域名
* @name :getDomainWithWWW
* @author :lyh
* @method :post
* @time :2025/10/9 10:28
*/
public function getDomainWithWWW($url) {
// 获取 host
$host = parse_url($url, PHP_URL_HOST);
// 去掉端口号等情况
$host = preg_replace('/:\d+$/', '', $host);
// 分割域名
$parts = explode('.', $host);
// 判断是几段
$count = count($parts);
// 如果只有两段,比如 fox8.com、theamericawatch.com,就拼接 www.
if ($count === 2) {
return 'www.' . $host;
}
return $host;
}
}
... ...
... ... @@ -11,8 +11,10 @@ use App\Models\Inquiry\AreaTimezone;
use App\Models\Inquiry\InquiryInfo;
use App\Models\Inquiry\InquiryProject;
use App\Models\Inquiry\InquiryProjectRoute;
use App\Models\Inquiry\InquiryRelayAi;
use App\Models\Inquiry\InquiryRelayDetail;
use App\Models\Inquiry\InquiryRelayDetailLog;
use App\Models\Manage\Manage;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
... ... @@ -102,6 +104,21 @@ class InquiryForwardLogic extends BaseLogic
if ($info === false) {
$this->fail('获取询盘详情失败');
}
$keywords_ai = '';
$forward_url_ai = [];
$message_ai = [];
$inquiry_ai_model = new InquiryRelayAi();
$ai_info = $inquiry_ai_model->read(['form_id' => $this->param['id']], ['keywords', 'forward_url', 'message_ai']);
if ($ai_info) {
$keywords_ai = $ai_info['keywords'];
$forward_url_ai = json_decode($ai_info['forward_url'], true);
$message_ai = json_decode($ai_info['message_ai'], true);
}
$info['keywords_ai'] = $keywords_ai;
$info['forward_url_ai'] = $forward_url_ai;
$info['message_ai'] = $message_ai;
return $this->success($info);
}
... ... @@ -123,16 +140,28 @@ class InquiryForwardLogic extends BaseLogic
$this->fail('当前询盘状态无法转发');
}
DB::beginTransaction();
try {
$num = 0;
$now = date('Y-m-d H:i:s');
if (is_array($this->param['message'])) {
$message_list = $this->param['message'];
} else {
$message_list = [$this->param['message']];
}
$message_count = count($message_list);
if ($message_count == 0) {
$this->fail('内容不能为空');
}
if (is_array($this->param['forward_url'])) {
$forward_url = $this->param['forward_url'];
} else {
$forward_url = explode(',', $this->param['forward_url']);
}
foreach ($forward_url as $url) {
DB::beginTransaction();
try {
$num = 0;
$now = date('Y-m-d H:i:s');
foreach ($forward_url as $key => $url) {
$url = trim($url);
$domain_array = parse_url($url);
$website = $domain_array['host'] ?? '';
... ... @@ -201,7 +230,10 @@ class InquiryForwardLogic extends BaseLogic
$start_at = $now;
}
InquiryRelayDetail::createInquiry($info['id'], $website, $country, $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'] ?? '', $this->param['message'], $is_v6, json_encode([$url]), $start_at);
//获取询盘内容
$message = $message_list[$key % $message_count] ?? $message_list[0];
InquiryRelayDetail::createInquiry($info['id'], $website, $country, $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'] ?? '', $message, $is_v6, json_encode([$url]), $start_at);
$num += 1;
}
... ... @@ -240,22 +272,24 @@ class InquiryForwardLogic extends BaseLogic
/**
* 关键词查询项目着陆页
* @param $keywords
* @param $type
* @param $num
* @return int|mixed
* @author Akun
* @date 2025/02/26 17:13
*/
public function searchKeywords()
public function searchKeywords($keywords, $type, $num)
{
$num = $this->param['num'] ?? 3;
$model = new InquiryProjectRoute();
// if ($this->param['type'] == 1) {
// //使用全文索引搜索
// $routeQuery = $model->select(['project_id', 'route'])->whereRaw("MATCH(title) AGAINST(? IN BOOLEAN MODE)", [$this->param['keywords']]);
// } else {
if ($type == 1) {
//使用全文索引搜索
$routeQuery = $model->select(['project_id', 'route'])->whereRaw("MATCH(title) AGAINST(? IN BOOLEAN MODE)", [$keywords]);
} else {
//使用like查询
$routeQuery = $model->select(['project_id', 'route'])->where('title', 'like', '%' . $this->param['keywords'] . '%');
// }
$routeQuery = $model->select(['project_id', 'route'])->where('title', 'like', '%' . $keywords . '%');
}
$re_route = $routeQuery->inRandomOrder()->take(100)->get()->toArray();
... ... @@ -297,7 +331,8 @@ class InquiryForwardLogic extends BaseLogic
'route' => $vp->domain . $route,
'recent_inquiry' => $vp->recent_inquiry,
'remark' => $vp->remark ?: '',
'version' => $vp->version
'version' => $vp->version,
'type' => $type
];
}
}
... ... @@ -309,22 +344,29 @@ class InquiryForwardLogic extends BaseLogic
/**
* AI重写询盘文案
* @param $in_content
* @param $title
* @param $keywords
* @return array
* @throws \App\Exceptions\AsideGlobalException
* @throws \App\Exceptions\BsideGlobalException
* @author Akun
* @date 2025/02/27 10:40
*/
public function aiRewrite()
public function aiRewrite($in_content, $title = '', $keywords = '')
{
$ai_info = AiCommand::select(['ai', 'not_use_probability'])->where('key', 'inquiry_text_rewrite')->first();
if ($title && $keywords) {
$command_key = 'inquiry_text_rewrite_v2';
} else {
$command_key = 'inquiry_text_rewrite';
}
$ai_info = AiCommand::select(['ai', 'not_use_probability'])->where('key', $command_key)->first();
if (!$ai_info) {
$this->fail('AI重写指令未配置');
}
$ai_command = $ai_info['ai'];
$not_use_probability = $ai_info['not_use_probability'];
$in_content = $this->param['message'];
// 当原始询盘内容长度大于15个字符, 60%几率直接发送原始内容。
if (strlen($in_content) >= 15) {
... ... @@ -340,6 +382,10 @@ class InquiryForwardLogic extends BaseLogic
$lang = 'en';
}
if ($title && $keywords) {
$ai_command = str_replace('{title}', $title, $ai_command);
$ai_command = str_replace('{keywords}', $keywords, $ai_command);
}
$ai_command = str_replace('{incontent}', Arr::random(explode("\r\n", $in_content)), $ai_command);
$text = Gpt::instance()->openai_chat_qqs($ai_command);
... ... @@ -392,6 +438,23 @@ class InquiryForwardLogic extends BaseLogic
{
$model = new InquiryRelayDetail();
$lists = $model->listsWith($map, $page, $row, $order, $filed, 'desc', ['detailLog']);
//获取操作人
$inquiry_info_model = new InquiryInfo();
$manage_model = new Manage();
foreach ($lists['list'] as $k => $v) {
$operator_name = '';
$inquiry_info = $inquiry_info_model->read(['id' => $v['form_id']], ['operator_id']);
if ($inquiry_info) {
$manage_info = $manage_model->read(['id' => $inquiry_info['operator_id']], ['name']);
if ($manage_info) {
$operator_name = $manage_info['name'];
}
}
$lists['list'][$k]['operator_name'] = $operator_name;
}
return $this->success($lists);
}
... ... @@ -438,7 +501,8 @@ class InquiryForwardLogic extends BaseLogic
$data[$s_date] = [
'total' => 0,
'invalid' => 0,
'init' => 0
'init' => 0,
'finish' => 0
];
$s_date = date('Y-m-d', strtotime($s_date . ' + 1 day'));
}
... ... @@ -451,10 +515,10 @@ class InquiryForwardLogic extends BaseLogic
if ($value['status'] == InquiryInfo::STATUS_INVALID) {
$data[$inquiry_date]['invalid'] += 1;
}
if ($value['status'] == InquiryInfo::STATUS_INIT) {
} elseif ($value['status'] == InquiryInfo::STATUS_INIT) {
$data[$inquiry_date]['init'] += 1;
} else {
$data[$inquiry_date]['finish'] += 1;
}
}
... ...
... ... @@ -208,7 +208,7 @@ class ProjectLogic extends BaseLogic
$this->fail('保存失败,请联系管理员');
}
}
return $this->success();
return $this->success($this->param);
}
/**
... ... @@ -440,7 +440,7 @@ class ProjectLogic extends BaseLogic
foreach ($param['payment']['renewal_record'] as &$record) {
if (!is_null($record['expire_at'] ?? null) && $record['expire_at'] === $maxExpireAt) {
// 如果 end_time 不存在或与 expire_at 不一致,则更新
if (!isset($record['end_time']) || $record['end_time'] != $record['expire_at']) {
if (!isset($record['end_time']) || ($record['end_time'] != $record['expire_at'])) {
$record['end_time'] = $record['expire_at']; // ✅ 写回原数据
// 重新计算剩余天数
$diff = (strtotime($record['expire_at']) - strtotime(date('Y-m-d'))) / (60 * 60 * 24);
... ...
... ... @@ -203,13 +203,13 @@ class TicketUploadDataLogic extends BaseLogic
'intro'=>$info['text']['remark'],
'category_id'=>$category_id ?? '',
'keyword_id'=>$keyword_id ?? '',
'status'=>0,
'status'=>1,
];
$id = $productModel->addReturnId($data);
CategoryRelated::saveRelated($id, $info['text']['category_id'] ?? []);//分类关联
KeywordRelated::saveRelated($id,$info['text']['keyword_id'] ?? []);//关键字关联
$route = RouteMap::setRoute($data['title'],RouteMap::SOURCE_PRODUCT,$id,$info['project_id']);
$this->model->edit(['route'=>$route],['id'=>$id]);
$productModel->edit(['route'=>$route],['id'=>$id]);
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
... ... @@ -237,13 +237,13 @@ class TicketUploadDataLogic extends BaseLogic
'image'=>$info['text']['image'],
'text'=>$info['text']['remark'],
'category_id'=>$category_id ?? '',
'status'=>0,
'status'=>1,
];
try {
$blogModel = new Blog();
$id = $blogModel->addReturnId($data);
$route = RouteMap::setRoute($data['name'],RouteMap::SOURCE_BLOG,$id,$info['project_id']);
$this->model->edit(['url'=>$route],['id'=>$id]);
$blogModel->edit(['url'=>$route],['id'=>$id]);
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
... ... @@ -271,13 +271,13 @@ class TicketUploadDataLogic extends BaseLogic
'image'=>$info['text']['image'],
'text'=>$info['text']['remark'],
'category_id'=>$category_id ?? '',
'status'=>0,
'status'=>1,
];
try {
$newsModel = new News();
$id = $newsModel->addReturnId($data);
$route = RouteMap::setRoute($data['name'],RouteMap::SOURCE_NEWS,$id,$info['project_id']);
$this->model->edit(['route'=>$route],['id'=>$id]);
$newsModel->edit(['url'=>$route],['id'=>$id]);
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
... ...
... ... @@ -66,6 +66,7 @@ class AiVideoLogic extends BaseLogic
$aiVideoTaskModel = new AiVideoTask();
$aiVideoService = new AiVideoService($this->user['project_id']);
$storage = $aiVideoTaskModel->videoSetting()[$this->user['video_setting'] ?? 1];
//todo::获取ayr的key
$result = $aiVideoService->createTask($this->param['title'],$this->param['description'],$this->param['images'],$this->param['anchor'] ?? [],$storage);
if($result['status'] == 200){
$aiVideoTaskModel->addReturnId(['task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],'storage'=>$storage]);
... ...
... ... @@ -555,7 +555,7 @@ class RankDataLogic extends BaseLogic
$without_extension_project_ids = [658]; //是否达标只统计主词的
$extension_project_ids = [354]; //扩展词也到达标的
$compliance_project_ids = [2163,257,823,1750,497,1006]; //直接达标处理的
$ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193,2399,1685, 3931,2273,3647];//暂停的项目
$ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193,2399,1685, 3931,2273,3647,1934];//暂停的项目
$uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目
//一个项目多个api_no
$multiple_api_no_project_ids = [
... ...
... ... @@ -10,7 +10,11 @@
namespace App\Http\Logic\Bside\SeoSetting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Geo\DomainDa;
use App\Models\SeoSetting\LinkData;
use App\Services\Geo\GeoService;
use Illuminate\Support\Carbon;
use Nette\Utils\DateTime;
/**
* @remark :获取外链数据
... ... @@ -50,4 +54,70 @@ class LinkDataLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :返回数据data
* @name :daResultData
* @author :lyh
* @method :post
* @time :2025/10/9 09:43
*/
public function daResultData()
{
$info = $this->model->read(['id'=>$this->param['id']]);
if($info === false){
$this->fail('当前数据不存在或者已被删除');
}
$host = $this->getDomainWithWWW($info['url']);
$domainDaModel = new DomainDa();
$daInfo = $domainDaModel->read(['domain'=>$host]);
if($daInfo !== false){
//判断时间是否大于60天
$start = Carbon::parse(date('Y-m-d', strtotime($daInfo['updated_at'])));
$end = Carbon::parse(date('Y-m-d'));
$diff = $start->diffInDays($end);
if($diff <= 60){
$info['da_values'] = $daInfo['da'];
$this->model->edit(['da_values'=>$daInfo['da'],'time'=>date('Y-m-d')], ['id'=>$info['id']]);
return $this->success($info);
}
}
$geoService = new GeoService();
$result = $geoService->daResult($host);
if(!isset($result['data']) || empty($result['data'])){
return $this->success($info);
}
$info['da_values'] = (int)$result['data']['mozDA'];//获取数据中的da值
//保存数据
if($daInfo !== false){
$domainDaModel->edit(['da'=>$info['da_values'],'result'=>json_encode($result,true)],['id'=>$daInfo['id']]);
}else{
$domainDaModel->addReturnId(['da'=>$info['da_values'],'domain'=>$host,'result'=>json_encode($result,true)]);
}
$this->model->edit(['da_values'=>$info['da_values'],'time'=>date('Y-m-d')], ['id'=>$info['id']]);
return $this->success($info);
}
/**
* @remark :获取域名
* @name :getDomainWithWWW
* @author :lyh
* @method :post
* @time :2025/10/9 10:28
*/
public function getDomainWithWWW($url) {
// 获取 host
$host = parse_url($url, PHP_URL_HOST);
// 去掉端口号等情况
$host = preg_replace('/:\d+$/', '', $host);
// 分割域名
$parts = explode('.', $host);
// 判断是几段
$count = count($parts);
// 如果只有两段,比如 fox8.com、theamericawatch.com,就拼接 www.
if ($count === 2) {
return 'www.' . $host;
}
return $host;
}
}
... ...
<?php
/**
* @remark :
* @name :DomainDa.php
* @author :lyh
* @method :post
* @time :2025/10/11 10:18
*/
namespace App\Models\Geo;
use App\Models\Base;
class DomainDa extends Base
{
protected $table = 'gl_domain_da';
}
... ...
... ... @@ -119,7 +119,7 @@ class InquiryInfo extends Base
$self->status = $status;
$self->remark = $remark;
$self->save();
return true;
return $self->id;
} catch (\Exception $e) {
return false;
}
... ...
<?php
namespace App\Models\Inquiry;
use App\Models\Base;
class InquiryRelayAi extends Base
{
protected $table = 'gl_inquiry_relay_ai';
}
... ...
... ... @@ -55,9 +55,12 @@ class AiVideoService
* @method :post
* @time :2025/4/29 17:59
*/
public function createTask($title,$description,$images = [],$anchor = [],$storage = 'CDN'){
public function createTask($title,$description,$images = [],$anchor = [],$storage = 'CDN',$ayrshare_profile_key = ''){
$request_url = $this->url.'api/video/create';
$param = ['title'=>$title, 'description'=>$description, 'images'=>$images,'anchor'=>$anchor,'storage'=>$storage];
if(!empty($ayrshare_profile_key)){
$param['ayrshare_profile_key'] = $ayrshare_profile_key;
}
$param['mch_id'] = $this->mch_id;
$this->sign = $this->generateSign($param,$this->key);
$param['sign'] = $this->sign;
... ...
... ... @@ -137,4 +137,18 @@ class GeoService
$result = Http::post($url, $param);
return $result->json();
}
/**
* @remark :根据域名获取da值
* @name :daResult
* @author :lyh
* @method :post
* @time :2025/10/9 09:33
*/
public function daResult($domain)
{
$url = 'https://www.cmer.site/api/get_domain_da?domain='.$domain;
$result = http_get($url);
return $result;
}
}
... ...
... ... @@ -102,5 +102,7 @@ Route::prefix('ticket_upload')->group(function () {
Route::any('/getProductCate', [\App\Http\Controllers\Api\WorkOrder\TicketUploadDataController::class, 'getProductCate'])->name('ticket_upload.getProductCate');
Route::any('/getBlogCate', [\App\Http\Controllers\Api\WorkOrder\TicketUploadDataController::class, 'getBlogCate'])->name('ticket_upload.getBlogCate');
Route::any('/getNewsCate', [\App\Http\Controllers\Api\WorkOrder\TicketUploadDataController::class, 'getNewsCate'])->name('ticket_upload.getNewsCate');
Route::any('/saveCategory', [\App\Http\Controllers\Api\WorkOrder\TicketUploadDataController::class, 'saveCategory'])->name('ticket_upload.saveCategory');
Route::any('/saveKeyword', [\App\Http\Controllers\Api\WorkOrder\TicketUploadDataController::class, 'saveKeyword'])->name('ticket_upload.saveKeyword');
});
... ...
... ... @@ -583,6 +583,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/info', [Aside\Geo\GeoLinkController::class, 'info'])->name('admin.geo_link_info');
Route::any('/del', [Aside\Geo\GeoLinkController::class, 'del'])->name('admin.geo_link_del');
Route::any('/downloadGeoLink', [Aside\Geo\GeoLinkController::class, 'downloadGeoLink'])->name('admin.geo_link_downloadGeoLink');
Route::any('/daResultData', [Aside\Geo\GeoLinkController::class, 'daResultData'])->name('admin.geo_link_daResultData');
});
});
// 任务相关
... ...
... ... @@ -715,6 +715,7 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/batchSave', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'batchSave'])->name('link_data_batchSave');
Route::any('/info', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'info'])->name('link_data_info');
Route::any('/del', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'del'])->name('link_data_del');
Route::any('/daResultData', [\App\Http\Controllers\Bside\SeoSetting\LinkDataController::class, 'daResultData'])->name('link_data_daResultData');
});
//seo白帽 域名设置
... ...