作者 ZhengBing He

Merge remote-tracking branch 'origin/master' into workorder

  1 +<?php
  2 +
  3 +namespace App\Console\Commands\Inquiry;
  4 +
  5 +use App\Models\Domain\DomainInfo;
  6 +use App\Models\Inquiry\ReInquiryCount;
  7 +use Illuminate\Console\Command;
  8 +
  9 +/**
  10 + * Class FBInquiryRemainDay
  11 + * @package App\Console\Commands\Inquiry
  12 + */
  13 +class FBInquiryRemainDay extends Command
  14 +{
  15 + /**
  16 + * The name and signature of the console command.
  17 + *
  18 + * @var string
  19 + */
  20 + protected $signature = 'fb_inquiry_remain_day';
  21 +
  22 + /**
  23 + * The console command description.
  24 + *
  25 + * @var string
  26 + */
  27 + protected $description = '执行询盘请求';
  28 +
  29 + /**
  30 + * Create a new command instance.
  31 + *
  32 + * @return void
  33 + */
  34 + public function __construct()
  35 + {
  36 + parent::__construct();
  37 + }
  38 +
  39 +
  40 +
  41 + public function handle()
  42 + {
  43 + $list = ReInquiryCount::all();
  44 + foreach ($list as $item){
  45 + $this->output('start:' . $item['id']);
  46 +
  47 + $tasks = $item->tasks; //调用访问器
  48 + $is_v6 = 0;
  49 + foreach ($tasks as $task){
  50 + if($task['is_v6']){
  51 + $is_v6 = 1;
  52 + }
  53 + }
  54 + if($is_v6){
  55 + $project_id = DomainInfo::where('domain', $item['domain'])->value('project_id') ?: 0;
  56 + }else{
  57 + $project_id = 0;
  58 + }
  59 + //获取剩余天数
  60 + $remaining_days = ReInquiryCount::getRemainingDays($item['domain'], $item['type'], $project_id);
  61 + $item->remaining_days = $remaining_days;
  62 + $item->save();
  63 + }
  64 +
  65 + }
  66 +
  67 + public function output($message)
  68 + {
  69 + echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL;
  70 + }
  71 +}
@@ -57,36 +57,15 @@ class lyhDemo extends Command @@ -57,36 +57,15 @@ class lyhDemo extends Command
57 57
58 public function handle(){ 58 public function handle(){
59 $projectModel = new Project(); 59 $projectModel = new Project();
60 - $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']); 60 + $lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']);
61 foreach ($lists as $item){ 61 foreach ($lists as $item){
62 - echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL; 62 +// echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
63 ProjectServer::useProject($item['id']); 63 ProjectServer::useProject($item['id']);
64 - $authorModel = new AiBlogAuthor();  
65 - $author_list = $authorModel->list(['id'=>['>',0]]);  
66 - if(empty($author_list)){  
67 - echo '跳过的项目id:'.$item['id'].PHP_EOL;  
68 - DB::disconnect('custom_mysql');  
69 - continue;  
70 - }  
71 - $projectAiSettingModel = new ProjectAiSetting();  
72 - $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$item['id']]);  
73 - if($aiSettingInfo === false){  
74 - echo '跳过的项目id:'.$item['id'].PHP_EOL;  
75 - DB::disconnect('custom_mysql');  
76 - continue;  
77 - }  
78 - $aiBlogService = new AiBlogService($item['id']);  
79 - foreach ($author_list as $val){  
80 - $aiBlogService->author_id = $val['author_id'];  
81 - $result = $aiBlogService->getAuthorDetail();  
82 - if(isset($result['status']) && $result['status'] == 200){  
83 - //当前作者的页面  
84 - $aiBlogAuthorModel = new AiBlogAuthor();  
85 - $authorInfo = $aiBlogAuthorModel->read(['author_id'=>$val['author_id']],['id','route']);  
86 - if($authorInfo !== false && !empty($result['data']['section'])){  
87 - $aiBlogAuthorModel->edit(['text'=>$result['data']['section']],['author_id'=>$val['author_id']]);  
88 - }  
89 - } 64 + $webSettingModel = new WebSetting();
  65 + $info = $webSettingModel->read(['project_id'=>$item['id']]);
  66 + if($info === false){
  67 + $webSettingModel->addReturnId(['project_id'=>$item['id']]);
  68 + echo '当前数据为空:'.$item['id'].PHP_EOL;
90 } 69 }
91 DB::disconnect('custom_mysql'); 70 DB::disconnect('custom_mysql');
92 } 71 }
@@ -51,14 +51,14 @@ class Temp extends Command @@ -51,14 +51,14 @@ class Temp extends Command
51 */ 51 */
52 public function setDomain301() 52 public function setDomain301()
53 { 53 {
54 - $domain = 'www.lvtopsun.com'; 54 + $domain = 'www.cisfoshan.com';
55 55
56 $domain_extend_config = DomainInfo::where('domain', $domain)->value('extend_config'); 56 $domain_extend_config = DomainInfo::where('domain', $domain)->value('extend_config');
57 57
58 $domain_origin_list = $domain_extend_config ? array_column($domain_extend_config, 'origin') : []; 58 $domain_origin_list = $domain_extend_config ? array_column($domain_extend_config, 'origin') : [];
59 59
60 //读取csv文件 60 //读取csv文件
61 - $file = 'C:\Users\Akun\Desktop\广东绿达新能源有限公司设置301页面.csv'; 61 + $file = 'C:\Users\Akun\Desktop\加至527聚合页301.csv';
62 $line_of_text = []; 62 $line_of_text = [];
63 try { 63 try {
64 $file_handle = fopen($file, 'r'); 64 $file_handle = fopen($file, 'r');
@@ -71,10 +71,12 @@ class Temp extends Command @@ -71,10 +71,12 @@ class Temp extends Command
71 } 71 }
72 72
73 if (count($line_of_text) > 1) { 73 if (count($line_of_text) > 1) {
  74 +// $language = ['fr', 'de', 'pt', 'es', 'ru', 'ja', 'ko', 'ar', 'tr', 'it', 'id', 'pl', 'hi', 'nl', 'ms', 'fa', 'th', 'vi'];
  75 + $language = [];
74 foreach ($line_of_text as $k => $v) { 76 foreach ($line_of_text as $k => $v) {
75 if ($k > 0 && $v) { 77 if ($k > 0 && $v) {
76 - $origin = str_replace('https://'.$domain, '', $v[0]);  
77 - $target = str_replace('https://'.$domain, '', $v[1]); 78 + $origin = str_replace('https://' . $domain, '', $v[0]);
  79 + $target = str_replace('https://' . $domain, '', $v[1]);
78 80
79 if (!in_array($origin, $domain_origin_list)) { 81 if (!in_array($origin, $domain_origin_list)) {
80 $domain_extend_config[] = [ 82 $domain_extend_config[] = [
@@ -82,6 +84,15 @@ class Temp extends Command @@ -82,6 +84,15 @@ class Temp extends Command
82 'target' => $target 84 'target' => $target
83 ]; 85 ];
84 } 86 }
  87 + foreach ($language as $vl) {
  88 + $origin_minor = '/' . $vl . $origin;
  89 + if (!in_array($origin_minor, $domain_origin_list)) {
  90 + $domain_extend_config[] = [
  91 + 'origin' => $origin_minor,
  92 + 'target' => $target
  93 + ];
  94 + }
  95 + }
85 } 96 }
86 } 97 }
87 } 98 }
@@ -39,6 +39,8 @@ class Kernel extends ConsoleKernel @@ -39,6 +39,8 @@ class Kernel extends ConsoleKernel
39 $schedule->command('sync_ad_cost')->everyThirtyMinutes()->withoutOverlapping(1); 39 $schedule->command('sync_ad_cost')->everyThirtyMinutes()->withoutOverlapping(1);
40 // 优化预设关键词 同步 20点会开始TDK生成 40 // 优化预设关键词 同步 20点会开始TDK生成
41 $schedule->command('optimize_set_keyword_sync')->dailyAt('20:00')->withoutOverlapping(1); 41 $schedule->command('optimize_set_keyword_sync')->dailyAt('20:00')->withoutOverlapping(1);
  42 + //FB询盘剩余时间
  43 + $schedule->command('fb_inquiry_remain_day')->dailyAt('02:00')->withoutOverlapping(1);
42 } 44 }
43 45
44 /** 46 /**
@@ -310,4 +310,25 @@ class QuanqiusouApi @@ -310,4 +310,25 @@ class QuanqiusouApi
310 } 310 }
311 } 311 }
312 312
  313 + /**
  314 + * 获取代理信息
  315 + * @param $domain
  316 + * @return array|mixed
  317 + * @author zbj
  318 + * @date 2024/10/26
  319 + */
  320 + public function getV5RemainDay($domain){
  321 + $token = md5($domain.'qqs');
  322 + try {
  323 + $client = new \GuzzleHttp\Client();
  324 + $res = $client->request('GET', 'https://quanqiusou.cn/extend_api/api/get_remain_day_by_domain.php?'.http_build_query(['token' => $token, 'domain' => $domain]), [
  325 + 'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号
  326 + ])->getBody()->getContents();
  327 + return Arr::s2a($res);
  328 + } catch (\Exception | GuzzleException $e) {
  329 + errorLog('获取代理失败', [$domain], $e);
  330 + return [];
  331 + }
  332 + }
  333 +
313 } 334 }
@@ -879,7 +879,7 @@ function getRouteMap($source,$source_id,$is_upgrade = 0, $returnModel = false){ @@ -879,7 +879,7 @@ function getRouteMap($source,$source_id,$is_upgrade = 0, $returnModel = false){
879 $route = $info['route']; 879 $route = $info['route'];
880 } 880 }
881 } 881 }
882 - if($returnModel){ 882 + if($returnModel && ($info !== false)){
883 return $info; 883 return $info;
884 } 884 }
885 return $route; 885 return $route;
@@ -35,6 +35,18 @@ class DomainApplicantLogController extends BaseController @@ -35,6 +35,18 @@ class DomainApplicantLogController extends BaseController
35 } 35 }
36 36
37 /** 37 /**
  38 + * @remark :获取详情
  39 + * @name :info
  40 + * @author :lyh
  41 + * @method :post
  42 + * @time :2025/5/30 14:35
  43 + */
  44 + public function info(){
  45 + $lists = $this->logic->info();
  46 + $this->response('success',Code::SUCCESS,$lists);
  47 + }
  48 +
  49 + /**
38 * @remark :保存数据 50 * @remark :保存数据
39 * @name :save 51 * @name :save
40 * @author :lyh 52 * @author :lyh
@@ -400,7 +400,6 @@ class AdsController extends BaseController @@ -400,7 +400,6 @@ class AdsController extends BaseController
400 }else{ 400 }else{
401 $item['project_id'] = 0; 401 $item['project_id'] = 0;
402 } 402 }
403 -  
404 } 403 }
405 404
406 return $this->response('success', Code::SUCCESS, $result); 405 return $this->response('success', Code::SUCCESS, $result);
@@ -62,8 +62,8 @@ class ProductController extends BaseController @@ -62,8 +62,8 @@ class ProductController extends BaseController
62 $userModel = new User(); 62 $userModel = new User();
63 foreach ($lists['list'] as $k=>$v){ 63 foreach ($lists['list'] as $k=>$v){
64 $route = getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id'], 0, true); 64 $route = getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id'], 0, true);
65 - $v['url'] = $this->user['domain'] . $route['route'];  
66 - $v['pv'] = $route['pv']; 65 + $v['url'] = $this->user['domain'] . ($route['route'] ?? '');
  66 + $v['pv'] = $route['pv'] ?? '';
67 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data); 67 $v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
68 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); 68 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
69 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 69 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
@@ -29,11 +29,32 @@ class DomainApplicantLogLogic extends BaseLogic @@ -29,11 +29,32 @@ class DomainApplicantLogLogic extends BaseLogic
29 * @time :2025/5/29 14:34 29 * @time :2025/5/29 14:34
30 */ 30 */
31 public function lists($map,$page,$row){ 31 public function lists($map,$page,$row){
  32 + if(isset($map['domain']) && !empty($map['domain'])){
  33 + $map['domain'] = ['like','%'.$map['domain'].'%'];
  34 + }
  35 + if(isset($map['applicant_name']) && !empty($map['applicant_name'])){
  36 + $map['applicant_name'] = ['like','%'.$map['applicant_name'].'%'];
  37 + }
  38 + if(isset($map['operator_name']) && !empty($map['operator_name'])){
  39 + $map['operator_name'] = ['like','%'.$map['operator_name'].'%'];
  40 + }
32 $lists = $this->model->lists($map,$page,$row,'id',['*']); 41 $lists = $this->model->lists($map,$page,$row,'id',['*']);
33 return $this->success($lists); 42 return $this->success($lists);
34 } 43 }
35 44
36 /** 45 /**
  46 + * @remark :获取详情
  47 + * @name :info
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2025/5/30 14:35
  51 + */
  52 + public function info(){
  53 + $lists = $this->model->read($this->param);
  54 + return $this->success($lists);
  55 + }
  56 +
  57 + /**
37 * @remark :保存域名申请记录 58 * @remark :保存域名申请记录
38 * @name :saveDomainLog 59 * @name :saveDomainLog
39 * @author :lyh 60 * @author :lyh
@@ -24,7 +24,8 @@ class WebSettingLogic extends BaseLogic @@ -24,7 +24,8 @@ class WebSettingLogic extends BaseLogic
24 public function setting_read(){ 24 public function setting_read(){
25 $info = $this->model->read(['project_id'=>$this->user['project_id']]); 25 $info = $this->model->read(['project_id'=>$this->user['project_id']]);
26 if($info === false){ 26 if($info === false){
27 - $info = []; 27 + $this->model->addReturnId(['project_id'=>$this->user['project_id']]);
  28 + $info =$this->model->read(['project_id'=>$this->user['project_id']]);
28 } 29 }
29 return $this->success($info); 30 return $this->success($info);
30 } 31 }
@@ -103,4 +103,22 @@ class ReInquiryCount extends Base @@ -103,4 +103,22 @@ class ReInquiryCount extends Base
103 } 103 }
104 return $res; 104 return $res;
105 } 105 }
  106 +
  107 + public static function getRemainingDays($domain, $type, $project_id)
  108 + {
  109 + $cache_key = 're_inquiry_count_' . $domain . '_' . date('Ymd');
  110 + $data = Cache::get($cache_key);
  111 + if($data === null){
  112 + if($project_id){
  113 + $data = Project::where('id', $project_id)->value('remain_day');
  114 + }else if($type == 3){
  115 + $data = '-';
  116 + }else{
  117 + $res = (new QuanqiusouApi())->getV5RemainDay($domain);
  118 + $data = $res['data']['remain_day'] ??'-';
  119 + }
  120 + Cache::put($cache_key, $data, 24 * 3600);
  121 + }
  122 + return $data;
  123 + }
106 } 124 }
1 <?php 1 <?php
2 -/**  
3 - * @remark :  
4 - * @name :AiCommandService.php  
5 - * @author :lyh  
6 - * @method :post  
7 - * @time :2025/5/26 17:01  
8 - */  
9 -  
10 namespace App\Services; 2 namespace App\Services;
11 3
12 /** 4 /**
13 - * @remark :AI指令返回数据  
14 - * @name :AiCommandService  
15 - * @author :lyh  
16 - * @method :post  
17 - * @time :2025/5/26 17:01 5 + * Class AiCommandService
  6 + * @package App\Services
18 */ 7 */
19 class AiCommandService 8 class AiCommandService
20 { 9 {
@@ -22,16 +11,22 @@ class AiCommandService @@ -22,16 +11,22 @@ class AiCommandService
22 11
23 public $api_key = 'nnLsyr3IhPNsJt5OvTtD9SVCLEixMntg'; 12 public $api_key = 'nnLsyr3IhPNsJt5OvTtD9SVCLEixMntg';
24 13
  14 + /**
  15 + * @var string gemini 模型
  16 + * https://gemini.google.com/app
  17 + * gemini-2.0-flash-lite
  18 + * gemini-2.5-pro-preview-05-06
  19 + * gemini-2.5-flash-preview-05-20
  20 + * gemini-2.5-flash-preview-04-17
  21 + */
25 public $model = 'gemini-2.0-flash-lite'; 22 public $model = 'gemini-2.0-flash-lite';
26 23
27 public $supplier = 'google'; 24 public $supplier = 'google';
28 25
29 /** 26 /**
30 - * @remark :Ai一键排版  
31 - * @name :ai_click_layout  
32 - * @author :lyh  
33 - * @method :post  
34 - * @time :2025/5/26 17:03 27 + * AI排版
  28 + * @param $content
  29 + * @return array
35 */ 30 */
36 public function send_layout_design($content){ 31 public function send_layout_design($content){
37 $param = [ 32 $param = [
@@ -278,6 +278,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -278,6 +278,7 @@ Route::middleware(['aloginauth'])->group(function () {
278 }); 278 });
279 Route::prefix('domain_log')->group(function () { 279 Route::prefix('domain_log')->group(function () {
280 Route::any('/', [Aside\Domain\DomainApplicantLogController::class, 'lists'])->name('admin.domain_log_lists'); 280 Route::any('/', [Aside\Domain\DomainApplicantLogController::class, 'lists'])->name('admin.domain_log_lists');
  281 + Route::any('/info', [Aside\Domain\DomainApplicantLogController::class, 'info'])->name('admin.domain_log_info');
281 Route::any('/save', [Aside\Domain\DomainApplicantLogController::class, 'save'])->name('admin.domain_log_save'); 282 Route::any('/save', [Aside\Domain\DomainApplicantLogController::class, 'save'])->name('admin.domain_log_save');
282 Route::any('/del', [Aside\Domain\DomainApplicantLogController::class, 'del'])->name('admin.domain_log_del'); 283 Route::any('/del', [Aside\Domain\DomainApplicantLogController::class, 'del'])->name('admin.domain_log_del');
283 }); 284 });