作者 ZhengBing He

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

<?php
namespace App\Console\Commands\Inquiry;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\ReInquiryCount;
use Illuminate\Console\Command;
/**
* Class FBInquiryRemainDay
* @package App\Console\Commands\Inquiry
*/
class FBInquiryRemainDay extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'fb_inquiry_remain_day';
/**
* The console command description.
*
* @var string
*/
protected $description = '执行询盘请求';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
public function handle()
{
$list = ReInquiryCount::all();
foreach ($list as $item){
$this->output('start:' . $item['id']);
$tasks = $item->tasks; //调用访问器
$is_v6 = 0;
foreach ($tasks as $task){
if($task['is_v6']){
$is_v6 = 1;
}
}
if($is_v6){
$project_id = DomainInfo::where('domain', $item['domain'])->value('project_id') ?: 0;
}else{
$project_id = 0;
}
//获取剩余天数
$remaining_days = ReInquiryCount::getRemainingDays($item['domain'], $item['type'], $project_id);
$item->remaining_days = $remaining_days;
$item->save();
}
}
public function output($message)
{
echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL;
}
}
... ...
... ... @@ -57,36 +57,15 @@ class lyhDemo extends Command
public function handle(){
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[2,3,4,6]]], 'id', ['id']);
$lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']);
foreach ($lists as $item){
echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
// echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
ProjectServer::useProject($item['id']);
$authorModel = new AiBlogAuthor();
$author_list = $authorModel->list(['id'=>['>',0]]);
if(empty($author_list)){
echo '跳过的项目id:'.$item['id'].PHP_EOL;
DB::disconnect('custom_mysql');
continue;
}
$projectAiSettingModel = new ProjectAiSetting();
$aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$item['id']]);
if($aiSettingInfo === false){
echo '跳过的项目id:'.$item['id'].PHP_EOL;
DB::disconnect('custom_mysql');
continue;
}
$aiBlogService = new AiBlogService($item['id']);
foreach ($author_list as $val){
$aiBlogService->author_id = $val['author_id'];
$result = $aiBlogService->getAuthorDetail();
if(isset($result['status']) && $result['status'] == 200){
//当前作者的页面
$aiBlogAuthorModel = new AiBlogAuthor();
$authorInfo = $aiBlogAuthorModel->read(['author_id'=>$val['author_id']],['id','route']);
if($authorInfo !== false && !empty($result['data']['section'])){
$aiBlogAuthorModel->edit(['text'=>$result['data']['section']],['author_id'=>$val['author_id']]);
}
}
$webSettingModel = new WebSetting();
$info = $webSettingModel->read(['project_id'=>$item['id']]);
if($info === false){
$webSettingModel->addReturnId(['project_id'=>$item['id']]);
echo '当前数据为空:'.$item['id'].PHP_EOL;
}
DB::disconnect('custom_mysql');
}
... ...
... ... @@ -51,14 +51,14 @@ class Temp extends Command
*/
public function setDomain301()
{
$domain = 'www.lvtopsun.com';
$domain = 'www.cisfoshan.com';
$domain_extend_config = DomainInfo::where('domain', $domain)->value('extend_config');
$domain_origin_list = $domain_extend_config ? array_column($domain_extend_config, 'origin') : [];
//读取csv文件
$file = 'C:\Users\Akun\Desktop\广东绿达新能源有限公司设置301页面.csv';
$file = 'C:\Users\Akun\Desktop\加至527聚合页301.csv';
$line_of_text = [];
try {
$file_handle = fopen($file, 'r');
... ... @@ -71,10 +71,12 @@ class Temp extends Command
}
if (count($line_of_text) > 1) {
// $language = ['fr', 'de', 'pt', 'es', 'ru', 'ja', 'ko', 'ar', 'tr', 'it', 'id', 'pl', 'hi', 'nl', 'ms', 'fa', 'th', 'vi'];
$language = [];
foreach ($line_of_text as $k => $v) {
if ($k > 0 && $v) {
$origin = str_replace('https://'.$domain, '', $v[0]);
$target = str_replace('https://'.$domain, '', $v[1]);
$origin = str_replace('https://' . $domain, '', $v[0]);
$target = str_replace('https://' . $domain, '', $v[1]);
if (!in_array($origin, $domain_origin_list)) {
$domain_extend_config[] = [
... ... @@ -82,6 +84,15 @@ class Temp extends Command
'target' => $target
];
}
foreach ($language as $vl) {
$origin_minor = '/' . $vl . $origin;
if (!in_array($origin_minor, $domain_origin_list)) {
$domain_extend_config[] = [
'origin' => $origin_minor,
'target' => $target
];
}
}
}
}
}
... ...
... ... @@ -39,6 +39,8 @@ class Kernel extends ConsoleKernel
$schedule->command('sync_ad_cost')->everyThirtyMinutes()->withoutOverlapping(1);
// 优化预设关键词 同步 20点会开始TDK生成
$schedule->command('optimize_set_keyword_sync')->dailyAt('20:00')->withoutOverlapping(1);
//FB询盘剩余时间
$schedule->command('fb_inquiry_remain_day')->dailyAt('02:00')->withoutOverlapping(1);
}
/**
... ...
... ... @@ -310,4 +310,25 @@ class QuanqiusouApi
}
}
/**
* 获取代理信息
* @param $domain
* @return array|mixed
* @author zbj
* @date 2024/10/26
*/
public function getV5RemainDay($domain){
$token = md5($domain.'qqs');
try {
$client = new \GuzzleHttp\Client();
$res = $client->request('GET', 'https://quanqiusou.cn/extend_api/api/get_remain_day_by_domain.php?'.http_build_query(['token' => $token, 'domain' => $domain]), [
'proxy' => env('CURL_PROXY'), // 代理服务器地址和端口号
])->getBody()->getContents();
return Arr::s2a($res);
} catch (\Exception | GuzzleException $e) {
errorLog('获取代理失败', [$domain], $e);
return [];
}
}
}
... ...
... ... @@ -879,7 +879,7 @@ function getRouteMap($source,$source_id,$is_upgrade = 0, $returnModel = false){
$route = $info['route'];
}
}
if($returnModel){
if($returnModel && ($info !== false)){
return $info;
}
return $route;
... ...
... ... @@ -35,6 +35,18 @@ class DomainApplicantLogController extends BaseController
}
/**
* @remark :获取详情
* @name :info
* @author :lyh
* @method :post
* @time :2025/5/30 14:35
*/
public function info(){
$lists = $this->logic->info();
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
... ...
... ... @@ -400,7 +400,6 @@ class AdsController extends BaseController
}else{
$item['project_id'] = 0;
}
}
return $this->response('success', Code::SUCCESS, $result);
... ...
... ... @@ -62,8 +62,8 @@ class ProductController extends BaseController
$userModel = new User();
foreach ($lists['list'] as $k=>$v){
$route = getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id'], 0, true);
$v['url'] = $this->user['domain'] . $route['route'];
$v['pv'] = $route['pv'];
$v['url'] = $this->user['domain'] . ($route['route'] ?? '');
$v['pv'] = $route['pv'] ?? '';
$v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
$v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
$v['created_uid_text'] = $userModel->getName($v['created_uid']);
... ...
... ... @@ -29,11 +29,32 @@ class DomainApplicantLogLogic extends BaseLogic
* @time :2025/5/29 14:34
*/
public function lists($map,$page,$row){
if(isset($map['domain']) && !empty($map['domain'])){
$map['domain'] = ['like','%'.$map['domain'].'%'];
}
if(isset($map['applicant_name']) && !empty($map['applicant_name'])){
$map['applicant_name'] = ['like','%'.$map['applicant_name'].'%'];
}
if(isset($map['operator_name']) && !empty($map['operator_name'])){
$map['operator_name'] = ['like','%'.$map['operator_name'].'%'];
}
$lists = $this->model->lists($map,$page,$row,'id',['*']);
return $this->success($lists);
}
/**
* @remark :获取详情
* @name :info
* @author :lyh
* @method :post
* @time :2025/5/30 14:35
*/
public function info(){
$lists = $this->model->read($this->param);
return $this->success($lists);
}
/**
* @remark :保存域名申请记录
* @name :saveDomainLog
* @author :lyh
... ...
... ... @@ -24,7 +24,8 @@ class WebSettingLogic extends BaseLogic
public function setting_read(){
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$info = [];
$this->model->addReturnId(['project_id'=>$this->user['project_id']]);
$info =$this->model->read(['project_id'=>$this->user['project_id']]);
}
return $this->success($info);
}
... ...
... ... @@ -103,4 +103,22 @@ class ReInquiryCount extends Base
}
return $res;
}
public static function getRemainingDays($domain, $type, $project_id)
{
$cache_key = 're_inquiry_count_' . $domain . '_' . date('Ymd');
$data = Cache::get($cache_key);
if($data === null){
if($project_id){
$data = Project::where('id', $project_id)->value('remain_day');
}else if($type == 3){
$data = '-';
}else{
$res = (new QuanqiusouApi())->getV5RemainDay($domain);
$data = $res['data']['remain_day'] ??'-';
}
Cache::put($cache_key, $data, 24 * 3600);
}
return $data;
}
}
... ...
<?php
/**
* @remark :
* @name :AiCommandService.php
* @author :lyh
* @method :post
* @time :2025/5/26 17:01
*/
namespace App\Services;
/**
* @remark :AI指令返回数据
* @name :AiCommandService
* @author :lyh
* @method :post
* @time :2025/5/26 17:01
* Class AiCommandService
* @package App\Services
*/
class AiCommandService
{
... ... @@ -22,16 +11,22 @@ class AiCommandService
public $api_key = 'nnLsyr3IhPNsJt5OvTtD9SVCLEixMntg';
/**
* @var string gemini 模型
* https://gemini.google.com/app
* gemini-2.0-flash-lite
* gemini-2.5-pro-preview-05-06
* gemini-2.5-flash-preview-05-20
* gemini-2.5-flash-preview-04-17
*/
public $model = 'gemini-2.0-flash-lite';
public $supplier = 'google';
/**
* @remark :Ai一键排版
* @name :ai_click_layout
* @author :lyh
* @method :post
* @time :2025/5/26 17:03
* AI排版
* @param $content
* @return array
*/
public function send_layout_design($content){
$param = [
... ...
... ... @@ -278,6 +278,7 @@ Route::middleware(['aloginauth'])->group(function () {
});
Route::prefix('domain_log')->group(function () {
Route::any('/', [Aside\Domain\DomainApplicantLogController::class, 'lists'])->name('admin.domain_log_lists');
Route::any('/info', [Aside\Domain\DomainApplicantLogController::class, 'info'])->name('admin.domain_log_info');
Route::any('/save', [Aside\Domain\DomainApplicantLogController::class, 'save'])->name('admin.domain_log_save');
Route::any('/del', [Aside\Domain\DomainApplicantLogController::class, 'del'])->name('admin.domain_log_del');
});
... ...