作者 ZhengBing He

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

正在显示 52 个修改的文件 包含 1338 行增加149 行删除
... ... @@ -13,6 +13,7 @@ use App\Helper\Arr;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Ai\AiBlogList;
use App\Models\Com\NoticeLog;
use App\Models\Com\Notify;
use App\Models\Devops\ServerConfig;
use App\Models\Devops\ServersIp;
... ... @@ -337,6 +338,9 @@ class AiBlogTask extends Command
'is_sitemap' => 0
];
$res = http_post($c_url, json_encode($param,true));
if(empty($res)){
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url'=>$c_url,'c_params'=>$param]),date('Y-m-d H:i:s',time()+300));
}
$this->output('notify: project id: ' . $project_id . ', result: ' . json_encode($res,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
}
}
... ...
<?php
/**
* @remark :
* @name :AiDomainTask.php
* @author :lyh
* @method :post
* @time :2025/6/19 10:53
*/
namespace App\Console\Commands\Ai;
use App\Models\Domain\DomainInfo;
use Illuminate\Console\Command;
/**
* @remark :拉取项目Ai域名
* @name :AiDomainTask
* @author :lyh
* @method :post
* @time :2025/6/19 10:54
*/
class AiDomainTask extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ai_domain';
/**
* The console command description.
*
* @var string
*/
protected $description = '获取对应域名的ai复制站域名';
public $url = 'https://www.cmer.site/api/globalso_site';
/**
* @remark :执行方法
* @name :handle
* @author :lyh
* @method :post
* @time :2025/6/19 11:32
*/
public function handle(){
$pageSize = 300;
$page = 1;
$res = http_get($this->url.'?pagesize='.$pageSize.'&page='.$page);
if($res['status'] != 200){
echo date('Y-m-d H:i:s').'请求失败,状态码错误'.PHP_EOL;
return false;
}
if(empty($res['data']['data'])){
echo date('Y-m-d H:i:s').'请求失败,未拉取到数据'.PHP_EOL;
return false;
}
$data = $res['data']['data'];
while($page <= $res['data']['last_page']){
$res = http_get($this->url.'?pagesize='.$pageSize.'&page='.$page);
if($res['status'] != 200){
echo date('Y-m-d H:i:s').'第'.$page.'请求失败,未拉取到数据'.PHP_EOL;
return false;
}
$data = array_values(array_merge($data,$res['data']['data']));
$page++;
}
//处理数据
$this->handleData($data);
echo 'end'.PHP_EOL;
return true;
}
/**
* @remark :处理数据
* @name :handleData
* @author :lyh
* @method :post
* @time :2025/6/19 11:21
*/
public function handleData($data){
$domainInfoModel = new DomainInfo();
foreach ($data as $item){
$info = $domainInfoModel->read(['domain'=>$item['domain']],'id');
if($info === false){
$info = $domainInfoModel->read(['domain'=>$item['globalso_domain']],'id');
if($info !== false){
$domainInfoModel->edit(['ai_domain'=>$item['domain']],['id'=>$info['id']]);
}
}else{
$domainInfoModel->edit(['ai_domain'=>$item['globalso_domain']],['id'=>$info['id']]);
}
}
return true;
}
}
... ...
... ... @@ -43,7 +43,9 @@ class RemainDay extends Command
1893,
2066,
2250,
2193
2193,
2399,
1685
];//需要单独处理的项目
/**
* The console command description.
... ...
... ... @@ -736,7 +736,12 @@ class RelayInquiry extends Command
// 所有可用url
$urls = $inquiry_urls = [];
//入口url 首页30%,单页10%,聚合页60%
$type = getRandByRatio([40,20,40]);
if ($re_website == 'https://www.hikelok.com/') {
$type = getRandByRatio([50,49,1]);
} else {
$type = getRandByRatio([40,20,40]);
}
$inlet = $re_website;
$type == 1 && $inlet = $page_url ? Arr::random($page_url) : $re_website;
$type == 2 && $inlet = $keywords_url ? Arr::random($keywords_url) : $re_website;
... ...
... ... @@ -10,12 +10,15 @@
namespace App\Console\Commands\LyhTest;
use App\Helper\Common;
use App\Models\Blog\Blog;
use App\Models\Com\V6WeeklyReport;
use App\Models\News\News;
use App\Models\Product\Category;
use App\Models\Product\CategoryRelated;
use App\Models\Product\Product;
use App\Models\ProjectAssociation\ProjectAssociation;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Models\Visit\Visit;
use App\Models\Visit\VisitItem;
use App\Models\Workchat\MessagePush;
... ... @@ -43,16 +46,51 @@ class DownloadProject extends Command
public function handle(){
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
ProjectServer::useProject(535);
$this->model = new Visit();
$data = $this->importVisit();
dd($data);
ProjectServer::useProject(671);
$this->newsImportBlog();
DB::disconnect('custom_mysql');
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
return true;
}
/**
* @remark :新闻导入到博客
* @name :newsImportBlog
* @author :lyh
* @method :post
* @time :2025/6/7 11:12
*/
public function newsImportBlog(){
$newsModel = new News();
$newsLists = $newsModel->list(['status'=>1]);
$blogModel = new Blog();
foreach ($newsLists as $item){
$data = [
'name'=>$item['name'],
'status'=>1,
'remark'=>$item['remark'],
'text'=>$item['text'],
'image'=>$item['image'],
'url'=>$item['url'],
'seo_title'=>$item['seo_title'],
'seo_description'=>$item['seo_title'],
'seo_keywords'=>$item['seo_title'],
'project_id'=>671,
'release_at'=>$item['release_at'],
'og_image'=>$item['og_image']
];
$id = $blogModel->addReturnId($data);
RouteMap::delRoute(RouteMap::SOURCE_NEWS,$item['id'],671);
$route = RouteMap::setRoute($item['url'],RouteMap::SOURCE_BLOG,$id,671);
$blogModel->edit(['url'=>$route],['id'=>$id]);
//更新当前的可视化归宿
$templateModel = new BTemplate();
$templateModel->edit(['source'=>3,'source_id'=>$id],['source'=>4,'source_id'=>$item['id'],'is_custom'=>0,'is_list'=>0]);
}
return true;
}
/**
* @remark :导出明细
* @name :importVisit
* @author :lyh
... ...
... ... @@ -52,9 +52,9 @@ class LyhImportTest extends Command
* @time :2023/11/20 15:13
*/
public function handle(){
ProjectServer::useProject(3951);
ProjectServer::useProject(3654);
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
$this->import2140CustomModule('https://ecdn6.globalso.com/upload/p/2140/file/2025-05/daoru.csv',3951);
$this->importProductCategory('https://ecdn6-nc.globalso.com/upload/p/3654/file/2025-06/products-1.csv',3654);
DB::disconnect('custom_mysql');
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
}
... ... @@ -129,23 +129,43 @@ class LyhImportTest extends Command
if($k < 1){
continue;
}
if(empty($val[1])){
echo '跳过的名称:'.$val[1];
if(empty($val[0])){
echo '跳过的名称:'.$val[0];
continue;
}
try {
$categoryModel->edit(['sort'=>$val[1]],['title'=>$val[0]]);
// $id = $categoryModel->addReturnId(['project_id'=>$project_id,'title'=>$val[1],'seo_title'=>$val[0],'seo_des'=>$val[2]]);
// $pid = 0;
// if($val[2] != 0){
// //查询上级id
// $pidCate = $categoryModel->read(['seo_title'=>$val[2]]);
// if($pidCate !== false){
// $pid = $pidCate['id'];
// }
// }
// $route = RouteMap::setRoute($val[1],RouteMap::SOURCE_PRODUCT_CATE,$id,$project_id);
// $categoryModel->edit(['route'=>$route,'pid'=>$pid],['id'=>$id]);
$cateArr = explode('/',$val[0]);
$pid = 0;
$two_pid = 0;
foreach ($cateArr as $key => $item){
if($key == 0){
//查看一级分类是否存在
$info = $categoryModel->read(['title'=>$item,'pid'=>0],['id']);
if($info === false){
$pid = $categoryModel->addReturnId(['project_id'=>$project_id,'title'=>$item]);
//设置路由
$route = RouteMap::setRoute($item,RouteMap::SOURCE_PRODUCT_CATE,$pid,$project_id);
$categoryModel->edit(['route'=>$route],['id'=>$pid]);
}else{
$pid = $info['id'];
}
}elseif ($key == 1){
//查看当前下面的子级别是否存在
$two_info = $categoryModel->read(['title'=>$item,'pid'=>$pid],['id']);
if($two_info === false){
$two_pid = $categoryModel->addReturnId(['project_id'=>$project_id,'title'=>$item,'pid'=>$pid]);
//设置路由
$route = RouteMap::setRoute($item,RouteMap::SOURCE_PRODUCT_CATE,$two_pid,$project_id);
$categoryModel->edit(['route'=>$route],['id'=>$two_pid]);
}else{
$two_pid = $two_info['id'];
}
}else{
$id = $categoryModel->addReturnId(['project_id'=>$project_id,'title'=>$item,'pid'=>$two_pid]);
$route = RouteMap::setRoute($item,RouteMap::SOURCE_PRODUCT_CATE,$id,$project_id);
$categoryModel->edit(['route'=>$route],['id'=>$id]);
}
}
echo date('Y-m-d H:i:s') . '产品分类id:'.PHP_EOL;
}catch (\Exception $e){
echo date('Y-m-d H:i:s') . '跳过的名称:'. $val[1];
... ...
... ... @@ -68,7 +68,9 @@ class UpdateRoute extends Command
*/
public function handle()
{
return $this->getAiBlog();
ProjectServer::useProject(1181);
return $this->setProductKeyword();
DB::disconnect('custom_mysql');
}
/**
... ... @@ -299,18 +301,18 @@ class UpdateRoute extends Command
if(!empty($lists)){
foreach ($lists as $v){
if(!empty($v['route'])){
// echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL;
// $route = $this->setRoute($v['route'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
// $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL;
$route = $this->setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
$keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
continue;
}else{
echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL;
$route = Translate::tran($v['title'], 'en');
if(!empty($route)){
echo date('Y-m-d H:i:s') . $route . PHP_EOL;
$route = $this->setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
$keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
}
// echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL;
// $route = Translate::tran($v['title'], 'en');
// if(!empty($route)){
// echo date('Y-m-d H:i:s') . $route . PHP_EOL;
// $route = $this->setRoute($route, RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']);
// $keywordModel->edit(['route'=>$route],['id'=>$v['id']]);
// }
}
}
}
... ... @@ -372,7 +374,7 @@ class UpdateRoute extends Command
}
}
$route = $sign.$suffix;
while(RouteMap::isExist($route, $source_id, $project_id)){
while(RouteMap::isExist($route, $source_id, $project_id,$source)){
$route = $sign .'-'.$i.$suffix;
$i++;
}
... ...
... ... @@ -10,6 +10,7 @@
namespace App\Console\Commands\LyhTest;
use App\Console\Commands\Domain\DomainInfo;
use App\Helper\OaGlobalsoApi;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
... ... @@ -28,6 +29,7 @@ use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplateMain;
use App\Models\Template\TemplateTypeMain;
use App\Models\Visit\Visit;
use App\Models\WebSetting\TranslateBigProject;
use App\Models\WebSetting\WebLanguage;
use App\Models\WebSetting\WebSetting;
use App\Models\Workchat\MessagePush;
... ... @@ -56,19 +58,7 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
$projectModel = new Project();
$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;
ProjectServer::useProject($item['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');
}
}
public function _actionTemplateMain(){
... ...
... ... @@ -188,6 +188,7 @@ class Supervisory extends Command
->where('gl_project.type', Project::TYPE_TWO)
->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制
->where('gl_project.delete_status', Project::IS_DEL_FALSE)
->where('gl_project.project_type', '!=', Project::PROJECT_TYPE_SEO)//排除白帽项目
->where(function ($subQuery) {
$subQuery->orwhere('c.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)->orwhere('gl_project.is_upgrade', Project::IS_UPGRADE_TRUE);
})
... ...
... ... @@ -75,6 +75,7 @@ class CopyProject extends Command
}catch (\Exception $e){
echo $e->getMessage().PHP_EOL;
echo '复制数据库失败:'.$old_project_id . '<->'.$project_id;
continue;
}
//修改项目状态
$projectModel->edit(['delete_status'=>0],['id'=>$project_id]);
... ...
... ... @@ -183,6 +183,7 @@ class CountAllProject extends Command
}
}
$channel = Channel::getChannelText($v['channel']['user_id'] ?? 0);
$plan = Project::planMap();
$data[] = [
'project_id'=>$v['id'],
'version'=>1,//代表6.0
... ... @@ -196,7 +197,7 @@ class CountAllProject extends Command
'keywords_num'=>$v['key'],
'service_num'=>$v['day'],
'production_num'=>intval(abs((empty($v['uptime']) ? time() : strtotime($v['uptime'])) - strtotime($v['created_at'])) / 86400),
'plan'=>Project::planMap()[$v['plan']],
'plan'=>$plan[$v['plan']] ?? '无版本信息',
'status'=>$type,
'category'=>$category,
'is_admin5' => 6,
... ...
... ... @@ -51,11 +51,12 @@ class GeneratePage extends Command
{
$noticeModel = new NoticeLog();
while (true){
$noticeInfo = $noticeModel->read(['status'=>0,'type'=>$noticeModel::GENERATE_PAGE,'start_at'=>['<=',date('Y-m-d H:i:s')]]);
$task_id = $this->getTaskId();
if (empty($noticeInfo)) {
sleep(10);
continue;
}
$noticeInfo = $noticeModel->read(['id'=>$task_id]);
try {
$this->output(' taskID: ' . $noticeInfo['id'] . ' start');
$notice_data = json_decode($noticeInfo['data'],true);
... ... @@ -80,6 +81,28 @@ class GeneratePage extends Command
return true;
}
/**
* @remark :获取任务id
* @name :getTaskId
* @author :lyh
* @method :post
* @time :2025/6/19 10:02
*/
public function getTaskId()
{
$task_id = Redis::rpop('generate_page_id');
if (empty($task_id)) {
$noticeModel = new NoticeLog();
$ids = $noticeModel->selectField(['status'=>0],'id');
if(!empty($ids)){
foreach ($ids as $id) {
Redis::lpush('generate_page_id', $id);
}
}
$task_id = Redis::rpop('generate_page_id');
}
return $task_id;
}
/**
* 输出message
... ...
<?php
/**
* @remark :
* @name :InitKeywordComment.php
* @author :lyh
* @method :post
* @time :2025/6/3 15:38
*/
namespace App\Console\Commands\Project;
use App\Helper\Common;
use App\Helper\Gpt;
use App\Models\Ai\AiCommand;
use App\Models\Com\NoticeLog;
use App\Models\Project\AggregateKeywordComment;
use App\Models\Project\Project;
use Illuminate\Console\Command;
class InitKeywordComment extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'init_keyword_comment';
/**
* The console command description.
*
* @var string
*/
protected $description = '初始化关键字评论';
public $number = 100;
public function handle(){
return $this->_action(467);
while (true){
$list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMON)->where('status', NoticeLog::STATUS_PENDING)->get();
if(empty($list)){
sleep(200);
continue;
}
foreach ($list as $item){
echo date('Y-m-d H:i:s').'start:' . $item['id'] . PHP_EOL;
$project_id = $item['data']['project_id'];
echo date('Y-m-d H:i:s').'执行的项目id:' . $project_id . PHP_EOL;
try {
$this->_action($project_id);
$count = $keywordCommonModel->counts(['project_id'=>$project_id]);
if($count > 100){
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
}
}catch (\Exception $e){
echo date('Y-m-d H:i:s').'错误信息:'.$e->getMessage().PHP_EOL;
continue;
}
echo date('Y-m-d H:i:s').'end:' . $item['id'] . PHP_EOL;
}
}
return true;
}
/**
* @remark :执行的方法
* @name :_action
* @author :lyh
* @method :post
* @time :2025/6/3 15:42
*/
public function _action($project_id){
$aiCommonModel = new AiCommand();
$info = $aiCommonModel->read(['key'=>'tag_comment']);
$text = Gpt::instance()->openai_chat_qqs($info['ai']);
$text = Common::deal_keywords($text);
preg_match_all('/\{[^{}]*\}/', $text, $matches);
if(!empty($text)){
$data = [];
foreach ($matches[0] as $item){
$item = str_replace("'", '"', $item);
// 解码成 PHP 关联数组
$item = json_decode($item, true);
if(!isset($item['name']) || !isset($item['comment'])){
continue;
}
$data[] = [
'nickname'=>$item['name'],
'text'=>$item['comment'],
'project_id'=>$project_id,
'type'=>1,
'uid'=>0,
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
}
$keywordCommonModel = new AggregateKeywordComment();
$keywordCommonModel->insertAll($data);
}
return true;
}
}
... ...
... ... @@ -227,7 +227,8 @@ class SyncProject extends Command
'version'=>$version
],
'deploy_build' => [
'login_mobile'=>$param['principal_mobile']
'login_mobile'=>$param['principal_mobile'],
'ads_price'=>$param['ads_price'] ?? 0
],
'deploy_optimize' => [
// 'api_no' => 0
... ...
<?php
namespace App\Console\Commands\Tdk;
use App\Exceptions\ValidateException;
use App\Helper\Arr;
use App\Helper\Gpt;
use App\Models\Ai\AiCommand;
use App\Models\Com\NoticeLog;
use App\Models\Domain\DomainInfo;
use App\Models\Product\Keyword;
use App\Models\Project\AggregateKeywordAffix;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\ProjectKeywordAiTask;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
/**
* 关键词聚合页AI生成内容
* Class InitProject
* @package App\Console\Commands
* @author zbj
* @date 2025/06/06
*/
class KeywordPageAiContent extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'keyword_page_ai_content';
/**
* The console command description.
*
* @var string
*/
protected $description = '关键词聚合页AI生成内容';
/**
* 统计图表类型 随机一个
* @var string[]
*/
protected $chart_types = [
'柱状图',
'折线图',
];
/**
* @return bool
*/
public function handle()
{
while (true) {
$task = ProjectKeywordAiTask::getPendingTask();
if (!$task) {
sleep(10);
continue;
}
$project_id = $task->project_id;
echo getmypid() . ' ' . date('Y-m-d H:i:s') . ' start project_id: ' . $project_id . PHP_EOL;
try {
ProjectServer::useProject($project_id);
$update_rows = $this->ai_content($task);
DB::disconnect('custom_mysql');
ProjectKeywordAiTask::finish($task->id, $update_rows);
$update_rows && $this->sendNotify($project_id);
} catch (ValidateException $e) {
echo getmypid() . ' ' . date('Y-m-d H:i:s') . 'line: ' . $e->getLine() . ' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL;
$task->status = ProjectKeywordAiTask::STATUS_FAIL;
$task->remark = mb_substr($e->getMessage(), 0, 250);
$task->save();
} catch (\Exception $e) {
echo getmypid() . ' ' . date('Y-m-d H:i:s') . 'line: ' . $e->getLine() . ' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL;
ProjectKeywordAiTask::retry($task->id, $e->getMessage());
}
echo getmypid() . ' ' . date('Y-m-d H:i:s') . ' end project_id: ' . $project_id . PHP_EOL;
}
}
/**
* @param ProjectKeywordAiTask $task
* @author zbj
* @date 2025/6/6
*/
public function ai_content(ProjectKeywordAiTask $task)
{
//前后缀
$affix = AggregateKeywordAffix::where('project_id', $task->project_id)->first();
$prefix = empty($affix['prefix']) ? [] : explode("\r\n", $affix['prefix']);
$suffix = empty($affix['suffix']) ? [] : explode("\r\n", $affix['suffix']);
if (!$prefix || !$suffix) {
throw new ValidateException('扩展标题前后缀不存在');
}
//公司英文描述
$company_en_description = DeployOptimize::where('project_id', $task->project_id)->value('company_en_description');
if (!$company_en_description) {
throw new ValidateException('公司英文描述不存在');
}
//指令
$ai_commands = AiCommand::whereIn('key', ['tag_sale_content', 'tag_count_content', 'tag_data_table'])->where('project_id', 0)->select('key', 'scene', 'ai')->get()->toArray();
$project_ai_commands = AiCommand::whereIn('key', ['tag_sale_content', 'tag_count_content', 'tag_data_table'])->where('project_id', $task->project_id)->select('key', 'scene', 'ai')->get()->toArray();
$ai_commands = Arr::setValueToKey($ai_commands, 'key');
$project_ai_commands = Arr::setValueToKey($project_ai_commands, 'key');
foreach ($ai_commands as $k => $ai_command) {
if (!empty($project_ai_commands[$k])) {
$ai_commands[$k] = $project_ai_commands[$k];
}
}
//没有标题、文案、图表的关键词
$keyword_ids = Keyword::whereNull('sale_title')->orWhereNull('sale_content')->orWhereNull('table_html')
->orWhereNull('count_title')->orWhereNull('count_html')
->pluck('id')
->toArray();
$update_rows = 0;
foreach ($keyword_ids as $id) {
//缓存 在处理的项目数据 id
$cache_key = "keyword_page_ai_content_task_lock_{$task->project_id}_{$id}";
if (!Redis::setnx($cache_key, 1)) {
continue;
}
Redis::expire($cache_key, 120);
$keyword = Keyword::where('id', $id)->select(['id', 'title', 'sale_title', 'sale_content', 'table_html', 'count_title', 'count_html'])->first();
echo getmypid() . ' ' . date('Y-m-d H:i:s') . ' id:' . $keyword['id'] . ' project_id:' . $task->project_id . PHP_EOL;
$update = false;
if (empty($keyword['sale_title'])) {
$sale_title = $this->new_title($keyword['title'], $prefix, $suffix);
$keyword->sale_title = $sale_title;
$update = true;
}
if (empty($keyword['sale_content']) && $keyword->sale_title) {
$content = $this->ai_send($keyword->sale_title, $company_en_description, $ai_commands['tag_sale_content']['ai']);
if ($content) {
$keyword->sale_content = $content;
$update = true;
}
}
if (empty($keyword['table_html']) && $keyword->sale_title) {
$content = $this->ai_send($keyword->sale_title, $company_en_description, $ai_commands['tag_data_table']['ai']);
if ($content) {
$keyword->table_html = str_replace(['```html', '``html', '```'], '', $content);
$update = true;
}
}
if (empty($keyword['count_title'])) {
$count_title = $this->new_title($keyword['title'], $prefix, $suffix);
$count_title && $keyword->count_title = $count_title;
$update = true;
}
if (empty($keyword['count_html']) && $keyword->sale_title) {
$content = $this->ai_send($keyword->sale_title, $company_en_description, $ai_commands['tag_count_content']['ai']);
if ($content) {
$keyword->count_html = $this->fixChart(str_replace(['```html', '``html', '```'], '', $content));
$update = true;
}
}
if ($update) {
$keyword->save();
$update_rows++;
}
}
return $update_rows;
}
public function new_title($title, $prefix, $suffix)
{
//打乱顺序
shuffle($prefix);
shuffle($suffix);
//标题(title):{聚合页扩展标题前缀} keywords {聚合页扩展标题后缀} {聚合页扩展标题后缀}
return sprintf('%s %s %s %s', $prefix[0], $title, $suffix[0], $suffix[1]);
}
public function ai_send($title, $company_description, $prompt)
{
if (strpos($prompt, '{title}') !== false) {
$prompt = str_replace('{title}', $title, $prompt);
}
if (strpos($prompt, '{company introduction}') !== false) {
$prompt = str_replace('{company introduction}', $company_description, $prompt);
}
if (strpos($prompt, '{chart_type}') !== false) {
shuffle($this->chart_types);
$prompt = str_replace('{chart_type}', $this->chart_types[0], $prompt);
}
$text = Gpt::instance()->openai_chat_qqs($prompt);
if (!$text) {
echo getmypid() . ' ' . '生成失败' . PHP_EOL;
}
return $text;
}
function fixChart($html)
{
$html = '<body>' . $html . '</body>';
$dom = new \DOMDocument();
@$dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
$canvas_count = $dom->getElementsByTagName('canvas')->count();
//没有canvas
if (!$canvas_count) {
$div = $dom->getElementsByTagName('div');
foreach ($div as $element) {
if ($element->hasAttribute('id')) {
$canvas = $dom->createElement('canvas');
$canvas->setAttribute('id', $element->getAttribute('id'));
$element->removeAttribute('id');
$element->appendChild($canvas);
break;
}
}
}
$body = $dom->getElementsByTagName('body')->item(0);
$modifiedHtml = '';
foreach ($body->childNodes as $child) {
$modifiedHtml .= $dom->saveHTML($child);
}
return $modifiedHtml;
}
public function sendNotify($project_id)
{
//获取当前项目的域名
$domainModel = new DomainInfo();
$domainInfo = $domainModel->read(['project_id' => $project_id]);
if ($domainInfo === false) {
//获取测试域名
$deployBuildModel = new DeployBuild();
$buildInfo = $deployBuildModel->read(['project_id' => $project_id]);
$domain = $buildInfo['test_domain'];
} else {
$domain = 'https://' . $domainInfo['domain'] . '/';
}
$url = $domain . 'api/update_page/';
$param = [
'project_id' => $project_id,
'type' => 1,
'route' => 2,
'url' => [],
'language' => [],
];
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url' => $url, 'c_params' => $param]), date('Y-m-d H:i:s', time() + 300));
echo getmypid() . ' ' . '更新中请稍后, 更新完成将会发送站内信通知更新结果!' . PHP_EOL;
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Console\Commands\Tdk;
use App\Models\Project\Project;
use App\Models\Project\ProjectKeywordAiTask;
use App\Models\Project\ProjectUpdateTdk;
use Illuminate\Console\Command;
... ... @@ -42,6 +43,16 @@ class UpdateSeoTdkCrontab extends Command
dump($e->getMessage());
}
}
$project_ids = Project::where('type', Project::TYPE_TWO)->where('tag_page_version', '>' ,1)->where('uptime', '<=', date('Y-m-d H:i:s'))->pluck('id')->toArray();
foreach ($project_ids as $project_id){
try {
ProjectKeywordAiTask::add_task($project_id);
}catch (\Exception $e){
dump($e->getMessage());
}
}
}
}
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Console\Commands\Test;
use App\Helper\Arr;
use App\Http\Logic\Bside\Product\CategoryLogic;
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;
... ... @@ -16,6 +17,7 @@ use App\Models\Product\Product;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BCustomTemplate;
use App\Models\WebSetting\WebLanguage;
use App\Services\BatchExportService;
... ... @@ -41,7 +43,197 @@ class Temp extends Command
public function handle()
{
$this->check_no_cname_projects();
}
/**
* 3531项目导入扩展模块内容
* @return bool
* @author Akun
* @date 2025/06/05 10:47
*/
public function specialImport()
{
$file_url = 'https://ecdn6.globalso.com/upload/p/3531/file/2025-06/news.csv';
$domain = 'www.hybio.com.cn';
$project_id = 3531;
$is_gbk = 0;
$file_code_type = $this->get_code_type($file_url);
if ($file_code_type === false) {
echo 'date:' . date('Y-m-d H:i:s') . ', import fail, error: 文件编码格式错误' . PHP_EOL;
return true;
} elseif ($file_code_type === 'GBK') {
$is_gbk = 1;
setlocale(LC_ALL, 'zh_CN');
}
//读取csv文件
$line_of_text = [];
try {
$opts = [
'http' => [
'method' => 'GET',
'header' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'
],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]
];
$file_handle = fopen($file_url, 'r', null, stream_context_create($opts));
while (!feof($file_handle)) {
$line_of_text[] = fgetcsv($file_handle, 0, ',');
}
fclose($file_handle);
} catch (\Exception $e) {
$this->output('import fail, error: ' . $e->getMessage());
return true;
}
$total_count = 0; //总条数
$success_count = 0; //成功导入条数
$repeat_count = 0; //过滤已存在条数
$fail_count = 0;//导入失败条数
$fail_line = [];//失败行数
if (count($line_of_text) > 1) {
//设置数据库
$project = ProjectServer::useProject($project_id);
if ($project) {
foreach ($line_of_text as $k => $v) {
if ($k > 0 && isset($v[0]) && $v[0]) {
if ($is_gbk) {
foreach ($v as $kk => $vv) {
$v[$kk] = mb_convert_encoding($vv, 'utf-8', 'gbk');
}
}
$v[0] = $this->special2str($v[0]);
$total_count += 1;
try {
if ($this->importModule($project_id, $domain, $v)) {
$success_count += 1;
} else {
$repeat_count += 1;
}
} catch (\Exception $e) {
$fail_count += 1;
$fail_line[] = $k + 1;
$this->output('title: ' . $v[0] . ', import fail, error: ' . $e->getMessage());
}
}
}
}
//关闭数据库
DB::disconnect('custom_mysql');
}
$this->output('import end, total count: ' . $total_count . ', success count: ' . $success_count . ', repeat_count count: ' . $repeat_count . ', fail_count count: ' . $fail_count);
return true;
}
protected function importModule($project_id, $domain, $data)
{
$model = new CustomModuleContent();
$module = $model->read(['name' => $data[0]]);
if (!$module) {
$content = '';
if ($data[4] ?? '') {
//处理内容中的图片
preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result);
if ($result[2] ?? []) {
foreach ($result[2] as $img) {
$new_img = check_remote_url_down($img, $project_id, $domain, 1);
$new_img && $data[4] = str_replace($img, $new_img, $data[4]);
}
}
//处理内容中的视频
preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[4], $result_video);
if ($result_video[2] ?? []) {
foreach ($result_video[2] as $video) {
$new_video = check_remote_url_down($video, $project_id, $domain, 1);
$new_video && $data[4] = str_replace($video, $new_video, $data[4]);
}
}
$content = $data[4];
}
$seo_title = '';
if ($data[6] ?? '') {
$seo_title = substr(strip_tags($data[6]), 0, 70);
}
$seo_keywords = '';
if ($data[7] ?? '') {
$seo_keywords = substr(strip_tags(str_replace('^v6sp$', ',', $data[7])), 0, 255);
}
$seo_description = '';
if ($data[8] ?? '') {
$seo_description = substr(strip_tags($data[8]), 0, 200);
}
$release_at = date('Y-m-d H:i:s');
if ($data[9] ?? '') {
$release_at = date('Y-m-d H:i:s', strtotime($data[9]));
}
$id = $model->addReturnId(
[
'name' => $data[0],
'category_id' => ',1,',
'module_id' => 2,
'content' => $content,
'seo_title' => $seo_title,
'seo_keywords' => $seo_keywords,
'seo_description' => $seo_description,
'project_id' => $project_id,
'operator_id' => 8143,
'status' => 0,
'route' => '',
'release_at' => $release_at
]
);
$route = RouteMap::setRoute($data[0], RouteMap::SOURCE_MODULE, $id, $project_id);
$model->edit(['route' => $route], ['id' => $id]);
return true;
}
return false;
}
//特殊字符转换
protected function special2str($str)
{
if (strpos($str, ';') === false) {
return $str;
}
$list = [
'&lt;' => '<',
'&gt;' => '>',
'&amp;' => '&',
'&acute;' => "'",
'&quot;' => '"',
'&nbsp;' => ' ',
'&#x27;' => "'"
];
foreach ($list as $k => $v) {
$str = str_replace($k, $v, $str);
}
return $str;
}
/**
... ... @@ -820,8 +1012,8 @@ class Temp extends Command
*/
public function check_no_cname_projects()
{
$server_id = 1;
$server_name = '硅谷云服务器';
$server_id = 20;
$server_name = '建站服务器01';
$server_ip_model = new ServersIp();
... ... @@ -839,7 +1031,13 @@ class Temp extends Command
}
$domain = $domain_info['domain'];
$check = dns_get_record($domain, DNS_A);
$check = [];
try {
$check = dns_get_record($domain, DNS_A);
} catch (\Exception $e) {
$this->output($domain . ' | ' . $e->getMessage());
}
$ip = $check[0]['ip'] ?? '';
$host = $check[0]['host'] ?? '';
if (strpos($host, 'globalso.com') === false) {
... ...
... ... @@ -35,7 +35,6 @@ class UpdateKeyword extends Command
public function handle(){
dd(1111);
while (true){
$keywordPageModel = new KeywordPage();
$lists = $keywordPageModel->list(['status'=>0]);
... ...
<?php
namespace App\Exceptions;
use Exception;
/**
* @notes: 验证
* Class ValidateException
* @package App\Exceptions
*/
class ValidateException extends Exception
{
}
... ...
... ... @@ -61,7 +61,7 @@ if (!function_exists('http_post')) {
* @param type $url
* @param type $post_data
*/
function http_post($url, $post_data, $header = [],$is_json = true)
function http_post($url, $post_data, $header = [],$is_json = true,$timeout = 60)
{
if (empty($header)) {
$header = array(
... ... @@ -73,6 +73,7 @@ if (!function_exists('http_post')) {
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
... ... @@ -1189,7 +1190,7 @@ function getDeployOptimize($project_id){
$info = Cache::get($cache_key);
if(!$info){
$projectOptimizeModel = new DeployOptimize();
$info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description', 'keyword_prefix', 'keyword_suffix']);
$info = $projectOptimizeModel->read(['project_id' => $project_id], ['id', 'company_en_name', 'company_en_description', 'keyword_prefix', 'keyword_suffix', 'special']);
$projectKeywordModel = new ProjectKeyword();
$keywordInfo = $projectKeywordModel->read(['project_id'=>$project_id]);
$info['main_keyword'] = '';
... ...
... ... @@ -52,6 +52,7 @@ class PrivateController extends BaseController
->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id')
->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id')
->where('gl_project.type', Project::TYPE_TWO)
->where('gl_project.project_type',Project::TYPE_ZERO)
->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制
->where('gl_project.delete_status', Project::IS_DEL_FALSE)
->where(function ($subQuery) {
... ...
... ... @@ -142,7 +142,7 @@ class IndexController extends BaseController
Cache::add($token,$info,12 * 3600);
$languageModel = new WebLanguage();
$languageInfo = $languageModel->read(['id'=>$info['main_lang_id']],['short','english','chinese']);
$data = ['token'=>$token,'main_lang_id'=>$info['main_lang_id'],'language_info'=>$languageInfo];
$data = ['token'=>$token,'main_lang_id'=>$info['main_lang_id'],'language_info'=>$languageInfo,'project_seo_type'=>$info['project_seo_type']];
$this->response('success',Code::SUCCESS,$data);
}
... ...
... ... @@ -51,10 +51,10 @@ class UpdateController extends BaseController
if (empty($info['company_en_description'])) {
$this->fail('公司英文描述未设置');
}
if (empty($info['keyword_prefix'])) {
if (empty($info['keyword_prefix']) && !in_array(8, explode(',', $info['special']))) {
$this->fail('前缀关键词未设置');
}
if (empty($info['keyword_suffix'])) {
if (empty($info['keyword_suffix']) && !in_array(8, explode(',', $info['special']))) {
$this->fail('后缀关键词未设置');
}
try {
... ...
... ... @@ -31,6 +31,19 @@ class HrController extends BaseController
}
/**
* @remark :获取列表数据
* @name :getManagerList
* @author :lyh
* @method :post
* @time :2025/6/7 9:22
*/
public function getManagerList(){
$manageHrModel = new ManageHr();
$lists = $manageHrModel->lists($this->map,$this->page,$this->row);
$this->response('success', Code::SUCCESS, $lists);
}
/**
* @remark :获取详情
* @name :info
* @author :lyh
... ...
... ... @@ -234,6 +234,7 @@ class OptimizeController extends BaseController
'gl_project_deploy_optimize.first_compliance_time AS first_compliance_time',
'gl_domain_info.amp_status AS amp_status',
'gl_domain_info.domain AS domain',
'gl_domain_info.ai_domain AS ai_domain',
];
return $select;
}
... ... @@ -262,6 +263,9 @@ class OptimizeController extends BaseController
if(isset($this->map['ai_video']) && !empty($this->map['ai_video'])){
$query = $query->where('gl_project_deploy_optimize.ai_video',$this->map['ai_video']);
}
if(isset($this->map['ai_domain']) && !empty($this->map['ai_domain'])){
$query = $query->whereNotNull('gl_domain_info.ai_domain');
}
if(isset($this->map['amp_status'])){
$query = $query->where('gl_domain_info.amp_status',$this->map['amp_status']);
}
... ...
... ... @@ -15,6 +15,7 @@ use App\Models\Channel\Channel;
use App\Models\Channel\User;
use App\Models\Channel\Zone;
use App\Models\Com\City;
use App\Models\Com\NoticeLog;
use App\Models\Com\UpdateLog;
use App\Models\Devops\ServerConfig;
use App\Models\Devops\ServersIp;
... ... @@ -60,6 +61,7 @@ class ProjectController extends BaseController
->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
->leftJoin('gl_project_online_check', 'gl_project.id', '=', 'gl_project_online_check.project_id')
->leftJoin('gl_web_setting_template', 'gl_project.id', '=', 'gl_web_setting_template.project_id')
->leftJoin('gl_project_association', 'gl_project.id', '=', 'gl_project_association.project_id')
->where('gl_project.delete_status',Project::TYPE_ZERO);
$query = $this->searchParam($query);
$query = $this->orderByList($query);
... ... @@ -121,6 +123,7 @@ class ProjectController extends BaseController
'gl_project_deploy_optimize.design_mid AS design_mid',
'gl_project_deploy_optimize.api_no AS api_no',
'gl_web_setting_template.template_id AS template_id',
'gl_project_association.friend_id as friend_id',
];
return $select;
}
... ... @@ -171,7 +174,7 @@ class ProjectController extends BaseController
*/
public function searchType(&$query){
if(isset($this->map['type'])){
$query->where('gl_project.extend_type', '!=' ,5);
$query->where('gl_project.extend_type', '!=' ,5)->where('gl_project.extend_type', '!=' ,8);
if (in_array($this->map['type'], [Project::TYPE_ZERO, Project::TYPE_ONE, Project::TYPE_TWO, Project::TYPE_THREE])){
$query->where('gl_project.type', $this->map['type']);
} elseif ($this->map['type'] == 8){
... ... @@ -294,6 +297,16 @@ class ProjectController extends BaseController
if(isset($this->map['plan'])){
$query = $query->where('gl_project_deploy_build.plan',$this->map['plan']);
}
if(isset($this->map['friend_id'])){
if($this->map['friend_id'] == 1){
$query = $query->where('gl_project_association.friend_id', '!=', 0);
}else{
$query = $query->where(function ($subQuery) {
$subQuery->where('gl_project_association.friend_id', 0)
->orWhereNull('gl_project_association.friend_id');
});
}
}
if(isset($this->map['seo_plan'])){
$query = $query->where('gl_project_deploy_build.seo_plan',$this->map['seo_plan']);
}
... ... @@ -960,14 +973,10 @@ class ProjectController extends BaseController
'id'=>'required',
'aicc'=>'required',
'hagro'=>'required',
// 'exclusive_aicc_day'=>'required',
// 'exclusive_hagro_day'=>'required',
],[
'id.required' => 'id不能为空',
'aicc.required' => 'aicc是否开启不能为空',
'hagro.required' => 'hagro是否开启不能为空',
// 'exclusive_aicc_day.required' => '服务天数不能为空',
// 'exclusive_hagro_day.required' => '服务天数不能为空',
]);
$logic->saveOtherProject();
$this->response('success');
... ... @@ -1136,7 +1145,7 @@ class ProjectController extends BaseController
//获取项目数据
$projectModel = new Project();
$projectInfo = $projectModel->read(['id'=>$this->param['id']],['project_type','serve_id','site_status']);
$projectInfo = $projectModel->read(['id'=>$this->param['id']],['project_type','serve_id','site_status','site_token']);
if(!$projectInfo){
$this->fail('获取项目数据失败');
}
... ... @@ -1144,61 +1153,75 @@ class ProjectController extends BaseController
$this->response('success');
}
//获取域名数据
$domainModel = new DomainInfoModel();
$domainInfo = $domainModel->read(['project_id'=>$this->param['id']],['id','domain','amp_status']);
if(!$domainInfo){
$this->fail('获取域名数据失败');
}
if($this->param['site_status'] == 1){
//关闭站点:通知C端
$re = curl_get('https://'.$domainInfo['domain'].'/api/stop_or_start_website');
if(isset($re['status']) && $re['status'] !== 200){
$this->fail($re['message']);
if($projectInfo['serve_id'] == 8){
//自建站项目
if($this->param['site_status'] == 1){
//关闭站点
$site_token = $projectInfo['site_token'] ? $projectInfo['site_token'].'_expired' : '';
}else{
//开启站点
$site_token = str_replace('_expired','',$projectInfo['site_token']);
}
$projectModel->edit(['site_status'=>$this->param['site_status'],'site_token'=>$site_token],['id'=>$this->param['id']]);
}else{
//开启站点:创建建站任务
$serverIpModel = new ServersIp();
$serversIpInfo = $serverIpModel->read(['id' => $projectInfo['serve_id']], ['servers_id']);
if(!$serversIpInfo){
$this->fail('获取项目所属服务器失败');
//普通项目
//获取域名数据
$domainModel = new DomainInfoModel();
$domainInfo = $domainModel->read(['project_id'=>$this->param['id']],['id','domain','amp_status']);
if(!$domainInfo){
$this->fail('获取域名数据失败');
}
if ($projectInfo['project_type'] == Project::PROJECT_TYPE_SEO) {
$type = DomainCreateTask::TYPE_BLOG;
} else {
$type = DomainCreateTask::TYPE_MAIN;
}
if($this->param['site_status'] == 1){
//关闭站点:通知C端
$re = curl_get('https://'.$domainInfo['domain'].'/api/stop_or_start_website');
if(isset($re['status']) && $re['status'] !== 200){
$this->fail($re['message']);
}
}else{
//开启站点:创建建站任务
$serverIpModel = new ServersIp();
$serversIpInfo = $serverIpModel->read(['id' => $projectInfo['serve_id']], ['servers_id']);
if(!$serversIpInfo){
$this->fail('获取项目所属服务器失败');
}
//创建更新站点证书任务
$domainCreateTaskModel = new DomainCreateTask();
$task_info = $domainCreateTaskModel->read(['type' => $type, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
if (!$task_info) {
$domainCreateTaskModel->add([
'server_id' => $serversIpInfo['servers_id'],
'project_id' => $this->param['id'],
'domain_id' => $domainInfo['id'],
'type' => $type,
'is_open' => DomainCreateTask::IS_OPEN
]);
}
if ($projectInfo['project_type'] == Project::PROJECT_TYPE_SEO) {
$type = DomainCreateTask::TYPE_BLOG;
} else {
$type = DomainCreateTask::TYPE_MAIN;
}
if($domainInfo['amp_status']){
$task_info_amp = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_AMP, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
if (!$task_info_amp) {
//创建更新站点证书任务
$domainCreateTaskModel = new DomainCreateTask();
$task_info = $domainCreateTaskModel->read(['type' => $type, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
if (!$task_info) {
$domainCreateTaskModel->add([
'server_id' => $serversIpInfo['servers_id'],
'project_id' => $this->param['id'],
'domain_id' => $domainInfo['id'],
'type' => DomainCreateTask::TYPE_AMP,
'type' => $type,
'is_open' => DomainCreateTask::IS_OPEN
]);
}
if($domainInfo['amp_status']){
$task_info_amp = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_AMP, 'domain_id' => $domainInfo['id'], 'is_open' => DomainCreateTask::IS_OPEN, 'status' => ['<', DomainCreateTask::STATUS_SUC]], ['id']);
if (!$task_info_amp) {
$domainCreateTaskModel->add([
'server_id' => $serversIpInfo['servers_id'],
'project_id' => $this->param['id'],
'domain_id' => $domainInfo['id'],
'type' => DomainCreateTask::TYPE_AMP,
'is_open' => DomainCreateTask::IS_OPEN
]);
}
}
}
}
$projectModel->edit(['site_status'=>$this->param['site_status']],['id'=>$this->param['id']]);
$projectModel->edit(['site_status'=>$this->param['site_status']],['id'=>$this->param['id']]);
}
$this->response('success');
}
... ... @@ -1215,4 +1238,25 @@ class ProjectController extends BaseController
$this->response('success', Code::SUCCESS, $lists);
}
/**
* @remark :生成关键词图表数据
* @name :generateCountCharts
* @author :lyh
* @method :post
* @time :2025/6/10 10:51
*/
public function generateCountCharts(){
$this->request->validate([
'project_id'=>'required',
],[
'project_id.required' => '项目id不能为空',
]);
$noticeModel = new NoticeLog();
$info = $noticeModel->read(['type'=>NoticeLog::TYPE_GENERATE_COUNT_CHARTS,'status'=>0,'data'=>['like','%"'.$this->param['project_id'].'"%']]);
if($info !== false){
$this->fail('当前数据在生成中');
}
NoticeLog::createLog(NoticeLog::TYPE_GENERATE_COUNT_CHARTS, ['project_id' => $this->param['project_id']]);
$this->response('success');
}
}
... ...
... ... @@ -143,9 +143,15 @@ class AyrShareController extends BaseController
$data = [
'profileKey'=>$info['profile_key']
];
$res = $ayrShareHelper->post_generate_jwt($data);
if($res['status'] == 'fail'){
$this->response($res['message'],Code::USER_ERROR);
try {
$res = $ayrShareHelper->post_generate_jwt($data);
if($res['status'] == 'fail'){
$ayrShareLogic->ayr_share_edit(['profile_key'=>null,'bind_platforms'=>null,'ref_id'=>null],$info['id']);
$this->response('当前key值已过期,请刷新重新绑定',Code::USER_ERROR);
}
}catch (\Exception $e){
$ayrShareLogic->ayr_share_edit(['profile_key'=>null,'bind_platforms'=>null,'ref_id'=>null],$info['id']);
$this->response('当前key值已过期,请刷新重新绑定',Code::USER_ERROR);
}
$this->response('success',Code::SUCCESS,$res);
}
... ...
... ... @@ -34,6 +34,7 @@ use App\Models\Project\Country as CountryModel;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Models\WebSetting\SettingNum;
use App\Models\WebSetting\TranslateBigProject;
use App\Models\WebSetting\WebLanguage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
... ... @@ -61,7 +62,8 @@ class CNoticeController extends BaseController
],[
'language.required' => 'language不能为空',
]);
$project_id_arr = explode(',',env('PROJECT_ID')) ?? [];
$bigProjectModel = new TranslateBigProject();
$project_id_arr = $bigProjectModel->selectField(['status'=>1],'project_id') ?? [];
if(in_array($this->user['project_id'],$project_id_arr)){
$this->response('success');
}
... ... @@ -208,7 +210,7 @@ class CNoticeController extends BaseController
* 更新通知C端
* @param Request $request
* @return \Illuminate\Http\JsonResponse
* @param : type : 1->主站更新 4->聚合页更新
* @param : type : 1->主站更新 4->聚合页更新 7->ai博客
*/
public function sendNotify(Request $request)
{
... ... @@ -299,8 +301,11 @@ class CNoticeController extends BaseController
'language'=> $language,
'is_sitemap' => $is_sitemap
];
// http_post($c_url, json_encode($c_param));
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url'=>$c_url,'c_params'=>$c_param]));
try {
http_post($c_url, json_encode($c_param));
}catch (\Exception $e){
NoticeLog::createLog(NoticeLog::GENERATE_PAGE, json_encode(['c_url'=>$c_url,'c_params'=>$c_param]));
}
}
$this->response('更新中请稍后, 更新完成将会发送站内信通知更新结果!');
}
... ...
... ... @@ -93,7 +93,7 @@ class OperationHeartbeatController extends BaseController
if($info === false){
$info = [];
}else{
$date_time = strtotime($info['updated_at']) + 120;
$date_time = strtotime($info['updated_at']) + 60;
if($date_time < time()){
$operationHeartbeatModel->edit(['status'=>0,'ip'=>'127.0.0.1'],$condition);
$info['status'] = 0;
... ...
... ... @@ -3,13 +3,17 @@
namespace App\Http\Controllers\Bside\Product;
use App\Enums\Common\Code;
use App\Helper\Common;
use App\Helper\Gpt;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Product\KeywordLogic;
use App\Http\Requests\Bside\Product\KeywordRequest;
use App\Models\Ai\AiCommand;
use App\Models\Product\Keyword;
use App\Models\Product\KeywordPage;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Models\Project\AggregateKeywordComment;
use App\Rules\Ids;
use Illuminate\Http\Request;
... ... @@ -312,4 +316,73 @@ class KeywordController extends BaseController
$logic->delAllRelated($this->param['keyword_id']);
$this->response('success');
}
/**
* @remark :添加评论
* @name :saveComment
* @author :lyh
* @method :post
* @time :2025/6/9 14:27
*/
public function saveComment(KeywordLogic $logic){
$this->request->validate([
'text'=>'required',
'nickname'=>'required',
'start_time'=>'required',
],[
'text.required' => '评论内容不能为空',
'nickname.required'=>'昵称不能为空',
'start_time.required'=>'发布时间不能为空',
]);
$data = $logic->saveComment();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :生成评论
* @name :sendComment
* @author :lyh
* @method :post
* @time :2025/6/9 11:10
*/
public function sendComment(KeywordLogic $logic){
$this->request->validate([
'count' => 'required|integer|max:100',
], [
'count.required' => '生成条数不能为空',
'count.integer' => '生成条数必须是整数',
'count.max' => '生成条数最大不能超过100',
]);
$data = $logic->sendComment();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :获取评论
* @name :getComment
* @author :lyh
* @method :post
* @time :2025/6/9 11:45
*/
public function getComment(KeywordLogic $logic){
$data = $logic->getComment($this->map,$this->page,$this->row);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :删除评论
* @name :getComment
* @author :lyh
* @method :post
* @time :2025/6/9 11:45
*/
public function delComment(KeywordLogic $logic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => '主键不能为空',
]);
$data = $logic->delComment();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -359,7 +359,7 @@ class ProductController extends BaseController
}
if (!empty($new_content)){
$detailModel = new Detail();
$detailInfo = $detailModel->read(['column_id'=>1]);
$detailInfo = $detailModel->read(['column_id'=>1,'product_id'=>$this->param['product_id']]);
if($detailInfo !== false && !empty($detailInfo['content'])){
$productInfo['content'] = $new_content . $detailInfo['content']['content'];
}
... ...
... ... @@ -23,7 +23,7 @@ class WebSettingImageController extends BaseController
* @time :2023/9/21 15:12
*/
public function lists(WebSettingImage $webSettingImage){
$list = $webSettingImage->list($this->map,'id',['id','image','type']);
$list = $webSettingImage->list($this->map,'id',['id','image','type','is_call']);
foreach ($list as $k=>$v){
$v['image'] = getImageUrl($v['image'],$this->user['storage_type'],$this->user['project_location']);
$list[$k] = $v;
... ... @@ -40,11 +40,15 @@ class WebSettingImageController extends BaseController
*/
public function save(WebSettingImage $webSettingImage){
try {
$webSettingImage->del(['project_id'=>$this->user['project_id']]);
foreach ($this->param['data'] as $v){
$v['project_id'] = $this->user['project_id'];
$v['image'] = str_replace_url($v['image']);
$webSettingImage->add($v);
if(isset($v['id']) && !empty($v['id'])){
$v['image'] = str_replace_url($v['image']);
$webSettingImage->edit($v,['id'=>$v['id']]);
}else{
$v['project_id'] = $this->user['project_id'];
$v['image'] = str_replace_url($v['image']);
$webSettingImage->add($v);
}
}
}catch (\Exception $e){
$this->response('系统错误请联系管理员');
... ...
... ... @@ -514,22 +514,22 @@ class ImageController extends Controller
foreach ($files as $file){
if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){
if ($file->getSize() > $this->cache['image_max'] * 1024) {
$this->response('图片最大为'.$this->cache['image_max'],Code::SYSTEM_ERROR);
$this->response('图片最大为'.$this->cache['image_max'].'k',Code::SYSTEM_ERROR);
}
}else{
if ($file->getSize() > $max) {
$this->response('图片最大为1024K',Code::SYSTEM_ERROR);
$this->response('图片最大为2m',Code::SYSTEM_ERROR);
}
}
}
}else{
if(isset($this->cache['image_max']) && ($this->cache['image_max'] != 0)){
if ($files->getSize() > $this->cache['image_max'] * 1024) {
$this->response('图片最大为'.$this->cache['image_max'],Code::SYSTEM_ERROR);
$this->response('图片最大为'.$this->cache['image_max'].'k',Code::SYSTEM_ERROR);
}
}else{
if ($files->getSize() > $max) {
$this->response('图片最大为1024K',Code::SYSTEM_ERROR);
$this->response('图片最大为2m',Code::SYSTEM_ERROR);
}
}
}
... ...
... ... @@ -70,7 +70,7 @@ class LoginLogic extends BaseLogic
// Cache::pull(Common::MANAGE_TOKEN . $manage['token']);
// }
//生成新token
$token = md5(uniqid().$manage['id']);
$token = $manage['id'].'_a'.md5(uniqid().$manage['id']);
unset($manage['password']);
//更新用户信息
$manage->token = $token;
... ...
... ... @@ -81,12 +81,14 @@ class RenewLogic extends BaseLogic
}
DB::beginTransaction();
try {
$this->model->edit(['project_id'=>$this->param['id'],'operator_id'=>$this->manager['id']],['id'=>$this->param['renew_id']]);
if($this->param['renew_id'] != 0){
$this->model->edit(['project_id'=>$this->param['id'],'operator_id'=>$this->manager['id']],['id'=>$this->param['renew_id']]);
}
$param = $this->param;
$param['api_no'] = $info['api_no'] ?? 0;
$this->saveLog($param);
$this->updateProject($this->param['id'],$this->param['type']);
$this->updateProjectBuild($this->param['id'],$this->param['service_duration'],$this->param['plan']);
$this->updateProjectBuild($this->param['id'],$this->param['service_duration'] ?? 0,$this->param['plan']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
... ... @@ -120,12 +122,12 @@ class RenewLogic extends BaseLogic
public function saveLog($param){
$data = [
'renew_id'=>$param['renew_id'],
'service_duration'=>$param['service_duration'],
'service_duration'=>$param['service_duration'] ?? 0,
'plan'=>$param['plan'],
'old_plan'=>$param['old_plan'],
'type'=>$param['type'],
'old_type'=>$param['old_type'],
'amount'=>$param['amount'],
'amount'=>$param['amount'] ?? 0,
'api_no'=>$param['api_no'],
'project_id'=>$param['id'],
'operator_id'=>$this->manager['id'],
... ...
... ... @@ -68,6 +68,7 @@ class AiBlogLogic extends BaseLogic
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
$this->sendHttpC([$this->param['route'],'top-blog']);
shell_exec("php artisan save_ai_blog_list {$this->user['project_id']} > /dev/null 2>&1 &");
return $this->success();
}
... ...
... ... @@ -9,7 +9,6 @@
namespace App\Http\Logic\Bside\Gpt;
use App\Helper\Stream;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Gpt\Chat;
use App\Models\Gpt\ChatItem;
... ...
... ... @@ -81,7 +81,7 @@ class NewsLogic extends BaseLogic
$this->edit(['url' => $route], ['id' => $id]);
$this->curlDelRoute(['new_route'=>$route]);
}
$this->model->saveExtendInfo($id,$this->param['extend'] ?? []);
$this->model->saveExtendInfo($id,$this->param['extend'] ?? [],$this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
return $this->success(['id'=>$id]);
}
... ... @@ -175,6 +175,9 @@ class NewsLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
$this->delRoute($id);
$this->model->del(['id' => $id]);
//删除扩展字段
$extendInfoModel = new NewsExtendInfo();
$extendInfoModel->del(['news_id'=>$id]);
}
}
DB::commit();
... ...
... ... @@ -5,12 +5,15 @@ namespace App\Http\Logic\Bside\Product;
use App\Exceptions\BsideGlobalException;
use App\Helper\Arr;
use App\Helper\Common;
use App\Helper\Gpt;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ai\AiCommand;
use App\Models\Com\NoticeLog;
use App\Models\News\News;
use App\Models\Product\Keyword;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Models\Project\AggregateKeywordComment;
use App\Models\RouteMap\RouteMap;
use App\Models\User\User;
use Illuminate\Support\Facades\DB;
... ... @@ -345,4 +348,110 @@ class KeywordLogic extends BaseLogic
return $this->success();
}
/**
* @remark :手动添加评论
* @name :saveComment
* @author :lyh
* @method :post
* @time :2025/6/9 14:29
*/
public function saveComment(){
$keywordCommonModel = new AggregateKeywordComment();
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$keywordCommonModel->edit($this->param,['id'=>$this->param['id']]);
}else{
$param = [
'nickname' => $this->param['nickname'],
'text' => $this->param['text'],
'project_id' => $this->user['project_id'],
'type' => 1,
'uid' => 0,
'start_time'=>$this->param['start_time'],
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
];
$id = $keywordCommonModel->addReturnId($param);
}
return $this->success(['id'=>$id]);
}
/**
* @remark :保存数据
* @name :sendComment
* @author :lyh
* @method :post
* @time :2025/6/9 11:19
*/
public function sendComment()
{
$aiCommonModel = new AiCommand();
$info = $aiCommonModel->read(['key' => 'tag_comment','project_id'=>$this->user['project_id']]);
if($info === false){
$info = $aiCommonModel->read(['key' => 'tag_comment']);
$info['ai'] = str_replace('50', $this->param['count'], $info['ai']);
}
$text = Gpt::instance()->openai_chat_qqs($info['ai']);
$text = Common::deal_keywords($text);
preg_match_all('/\{[^{}]*\}/', $text, $matches);
$data = [];
$twoMonthsAgo = strtotime('-2 months');
if (!empty($text)) {
foreach ($matches[0] as $item) {
$item = str_replace("'", '"', $item);
// 解码成 PHP 关联数组
$item = json_decode($item, true);
if (!isset($item['name']) || !isset($item['comment'])) {
continue;
}
$randomTimestamp = rand($twoMonthsAgo, time());
$randomDateTime = date('Y-m-d H:i:s', $randomTimestamp);
$data[] = [
'nickname' => $item['name'],
'text' => $item['comment'],
'project_id' => $this->user['project_id'],
'type' => 1,
'uid' => 0,
'start_time'=>$randomDateTime,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s')
];
}
}
$keywordCommonModel = new AggregateKeywordComment();
$keywordCommonModel->insertAll($data);
return $this->success($data);
}
/**
* @remark :获取评论
* @name :getComment
* @author :lyh
* @method :post
* @time :2025/6/9 11:46
*/
public function getComment($map,$page,$row){
$keywordCommonModel = new AggregateKeywordComment();
$map['project_id'] = $this->user['project_id'];
$lists = $keywordCommonModel->lists($map,$page,$row);
return $this->success($lists);
}
/**
* @remark :删除评论
* @name :delComment
* @author :lyh
* @method :post
* @time :2025/6/9 11:48
*/
public function delComment(){
$keywordCommonModel = new AggregateKeywordComment();
if($this->param['id'] == 0){
$keywordCommonModel->del(['project_id'=>$this->user['project_id']]);
}else{
$keywordCommonModel->del(['id'=>$this->param['id']]);
}
return $this->success();
}
}
... ...
... ... @@ -101,6 +101,7 @@ class RankDataLogic extends BaseLogic
'keyword_num' => $project['deploy_build']['keyword_num'],
'compliance_day' => $project['finish_remain_day'] ?? 0,
'remain_day' => $project['remain_day'],
'seo_remain_day' => $project['seo_remain_day'],
'g_top_plan' => $g_top_plan ?? [],
];
//小语种列表
... ... @@ -553,7 +554,7 @@ class RankDataLogic extends BaseLogic
$without_extension_project_ids = [658]; //是否达标只统计主词的
$extension_project_ids = [354]; //扩展词也到达标的
$compliance_project_ids = [2163,257,823,1750,497]; //直接达标处理的
$ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193];//暂停的项目
$ceaseProjectId = [354, 378, 649, 1226, 1283, 1703, 1893, 2066, 2250,2193,2399,1685];//暂停的项目
$uptimeProjectId = [1434,1812,276,2414,2974];//按上线时间统计的项目
//一个项目多个api_no
$multiple_api_no_project_ids = [
... ...
... ... @@ -74,6 +74,7 @@ class TranslateLogic extends BaseLogic
}
$arr2 = [];
foreach ($text_array as $val) {
$val = str_replace(['%22', '%', '+'], ['"', '%', '+'], $val);
$val = rawurldecode($val);
$val = str_replace(' ','',$val);//处理特殊字符
$val = trim(str_replace(' ','',$val));
... ... @@ -272,14 +273,10 @@ class TranslateLogic extends BaseLogic
$data = [];
if(!empty($this->param['data'])){
//处理传递的data
foreach ($this->param['data'] as $k => $v){
if(!empty($v) && is_array($v)){
foreach ($v as $text => $translate){
$text = str_replace(['%22', '%', '+'], ['"', '%', '+'], $text);
$translate = str_replace(['%22', '%', '+'], ['"', '%', '+'], $translate);
$data[$text] = $translate;
}
}
foreach ($this->param['data'] as $k => $translate){
$text = str_replace(['%22', '%', '+'], ['"', '%', '+'], $translate[0]);
$translate = str_replace(['%22', '%', '+'], ['"', '%', '+'], $translate[1]);
$data[$text] = $translate;
}
$this->param['data'] = $data;
}
... ...
... ... @@ -7,6 +7,7 @@ use App\Exceptions\AsideGlobalException;
use App\Exceptions\BsideGlobalException;
use App\Helper\Common;
use App\Models\Domain\DomainInfo;
use App\Models\Manage\ManageHr;
use App\Models\Project\Project;
use App\Models\Scoring\ScoringSystem;
use App\Models\Sms\SmsLog;
... ... @@ -89,7 +90,7 @@ class UserLoginLogic
Cache::pull($info['token']);
}
//生成新token
$token = md5(uniqid().$info['id']);
$token = $info['id'].'_b'.md5(uniqid().$info['id']);
//存储缓存
$info['token'] = $token;
Cache::add($token,$info,3600 * 12);
... ... @@ -292,6 +293,9 @@ class UserLoginLogic
$info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0;
$info['is_comment'] = $project['deploy_build']['is_comment'] ?? 0;
$info['is_ai_blog_send'] = $project['deploy_optimize']['is_ai_blog_send'] ?? 0;
$info['tech_leader'] = $project['deploy_optimize']['tech_leader'] ?? 0;
$manageModel = new ManageHr();
$info['tech_leader_name'] = $manageModel->getName($project['deploy_optimize']['tech_leader'] ?? 0);
$info['remain_day'] = $project['remain_day'] ?? 0;
$info['project_created_at'] = $project['created_at'];
$info['type'] = $project['type'] ?? 1;
... ...
... ... @@ -26,6 +26,8 @@ class AutoPullNotify extends Base
22 => '白帽专属服务器01',
24 => '白帽专属服务器02',
23 => '西班牙服务器',
6 => '自建站服务器群',
27 => '硅谷建站服务器03',
];
}
... ...
... ... @@ -13,6 +13,8 @@ class NoticeLog extends Base
const TYPE_PROJECT = 'project';
const TYPE_RANK_DATA = 'rank_data';
const TYPE_INIT_PROJECT = 'init_project';
const TYPE_INIT_KEYWORD_COMMON = 'init_keyword_common';//聚合页关键词评论
const TYPE_GENERATE_COUNT_CHARTS = 'generate_count_charts';//聚合页关键字图表生成
const TYPE_COPY_PROJECT = 'copy_project';
const TYPE_INIT_KEYWORD = 'init_keyword';
const DELETE_PRODUCT_CATEGORY = 'delete_product_category';
... ...
... ... @@ -80,7 +80,7 @@ class News extends Base
$arr = json_decode($info['values']);
foreach ($arr as $k1=>$v1){
$v1 = (array)$v1;
$v1['url'] = getImageUrl($v1['url'],$this->user['storage_type'],$this->user['project_location']);
$v1['url'] = getImageUrl($v1['url']);
$arr[$k1] = $v1;
}
$v['values'] = $arr;
... ... @@ -89,9 +89,9 @@ class News extends Base
foreach ($arr1 as $k1=>$v1){
$v1 = (array)$v1;
if(isset($v1['url'])){
$v1['url'] = getFileUrl($v1['url'],$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn'] ?? 0);
$v1['url'] = getFileUrl($v1['url']);
}else{
$v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn'] ?? 0);
$v1 = getFileUrl($v1);
}
$arr1[$k1] = $v1;
}
... ... @@ -109,7 +109,7 @@ class News extends Base
* @method :post
* @time :2023/11/9 15:02
*/
public function saveExtendInfo($news_id,$extend){
public function saveExtendInfo($news_id,$extend,$project_id){
//先删除以前的数据
$extendInfoModel = new NewsExtendInfo();
$extendInfoModel->del(['news_id'=>$news_id]);
... ... @@ -120,7 +120,7 @@ class News extends Base
if(empty($v['values'])){
continue;
}
$v = $this->saveHandleExtend($v,$news_id);
$v = $this->saveHandleExtend($v,$news_id,$project_id);
$extendInfoModel->add($v);
}
return true;
... ... @@ -133,7 +133,7 @@ class News extends Base
* @method :post
* @time :2023/12/6 15:11
*/
public function saveHandleExtend(&$v,$news_id){
public function saveHandleExtend(&$v,$news_id,$project_id){
unset($v['title']);
if($v['type'] == 3){
foreach ($v['values'] as $k1=>$v1){
... ... @@ -148,7 +148,7 @@ class News extends Base
}
$v['values'] = json_encode($v['values']);
}
$v['project_id'] = $this->user['project_id'];
$v['project_id'] = $project_id;
$v['news_id'] = $news_id;
return $v;
}
... ...
<?php
/**
* @remark :
* @name :AggregateKeywordComment.php
* @author :lyh
* @method :post
* @time :2025/6/3 17:42
*/
namespace App\Models\Project;
use App\Models\Base;
class AggregateKeywordComment extends Base
{
protected $table = 'gl_aggregate_keyword_comment';
}
... ...
... ... @@ -60,6 +60,8 @@ class Project extends Base
5 => 'Q告知书二',
6 => 'KA',
7 => 'CKA',
18 => '白帽V1(AI视频)',
19 => '白帽V2(保证排名)',
];
}
... ...
<?php
namespace App\Models\Project;
use App\Helper\Arr;
use App\Models\Base;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis;
class ProjectKeywordAiTask extends Base
{
//设置关联表名
protected $table = 'gl_project_keyword_ai_task';
const STATUS_PENDING = 0;
const STATUS_SUCCESS = 1;
const STATUS_FAIL = 2;
public static function add_task($project_id){
$task = self::where('project_id', $project_id)->where('status', self::STATUS_PENDING)->first();
if($task){
throw new \Exception('该项目有未执行的任务,请勿重复添加');
}
$model = new self();
$model->project_id = $project_id;
$model->save();
Redis::lpush('projectKeywordAiTask', $project_id);
}
public static function getPendingTask(){
//有其他任务 就取其他任务 没有其他任务运行未结束的任务
$project_id = Redis::rpop('projectKeywordAiTask');
$data = [];
if($project_id){
$data = self::where('status', self::STATUS_PENDING)->where('project_id', $project_id)->orderBy('id', 'asc')->first();
}
if($data){
return $data;
}
return self::where('status', self::STATUS_PENDING)->orderBy('id', 'asc')->first();
}
/**
* 重试任务
* @param $id
* @param $remark
* @author zbj
* @date 2023/11/9
*/
public static function retry($id, $remark)
{
DB::beginTransaction();
try {
//行锁 避免脏读写
$data = self::where('id', $id)->lockForUpdate()->first();
$data->retry = $data->retry + 1;
if ($data->retry > 3) {
$data->status = self::STATUS_FAIL;
}else{
$data->status = self::STATUS_PENDING;
}
$data->remark = mb_substr($remark, 0, 250);
$data->save();
DB::commit();
} catch (\Exception $e) {
DB::rollback();
Log::error('project_keyword_ai_task retry error:' . $e->getMessage());
}
}
/**
* 完成
* @param $id
* @param $update_rows
* @author zbj
* @date 2023/11/9
*/
public static function finish($id, $update_rows){
DB::beginTransaction();
try {
//行锁 避免脏读写
$data = self::where('id', $id)->lockForUpdate()->first();
$data->status = self::STATUS_SUCCESS;
$data->update_rows = $update_rows;
$data->save();
DB::commit();
} catch (\Exception $e) {
DB::rollback();
Log::error('project_keyword_ai_task finish error:' . $e->getMessage());
}
}
}
... ...
<?php
/**
* @remark :
* @name :TranslateBigProject.php
* @author :lyh
* @method :post
* @time :2025/6/4 14:40
*/
namespace App\Models\WebSetting;
use App\Models\Base;
/**
* @remark :需要翻译的大网站
* @name :TranslateBigProject
* @author :lyh
* @method :post
* @time :2025/6/4 14:41
*/
class TranslateBigProject extends Base
{
protected $table = 'gl_translate_big_project';
}
... ...
... ... @@ -25,7 +25,7 @@ class ProjectServer
<section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404"
id="sectionIdyxqu938">
<div class="layout" data-unable="demo01-error404">
<img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" />
<img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" alt=""/>
</div>
<p style="text-align: center">SORRY. THE PAGE HAS EITHER MOVED OR CANNOT BE FOUND.</p>
<style>
... ... @@ -38,7 +38,7 @@ class ProjectServer
.section-block-error404 img {
width: 400px;
}
@media only screen and (max-width:500) {
@media only screen and (max-width:500px) {
.section-block-error404 img {
max-width: 100%;
}
... ...
... ... @@ -149,6 +149,7 @@ Route::middleware(['aloginauth'])->group(function () {
//人事管理
Route::prefix('hr')->group(function () {
Route::any('/', [Aside\Manage\HrController::class, 'list'])->name('admin.hr');
Route::any('/getManagerList', [Aside\Manage\HrController::class, 'getManagerList'])->name('admin.hr_getManagerList');
Route::any('/info', [Aside\Manage\HrController::class, 'info'])->name('admin.hr_info');
Route::post('/save', [Aside\Manage\HrController::class, 'save'])->name('admin.hr_save');
Route::post('/sort', [Aside\Manage\HrController::class, 'sort'])->name('admin.hr_sort');
... ... @@ -208,6 +209,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix');
Route::any('/save', [Aside\Project\KeywordPrefixController::class, 'save'])->name('admin.keyword_save');
Route::any('/del', [Aside\Project\KeywordPrefixController::class, 'del'])->name('admin.keyword_del');
Route::any('/generateCountCharts', [Aside\Project\ProjectController::class, 'generateCountCharts'])->name('admin.keyword_generateCountCharts');
});
//企业资料库
Route::prefix('enterprise_product')->group(function () {
... ...
... ... @@ -327,6 +327,10 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('keyword/batchKeywordIsVideo', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordIsVideo'])->name('product_keyword_batchKeywordIsVideo');
Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled');
Route::any('keyword/delRelatedProductId', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delRelatedProductId'])->name('product_keyword_delRelatedProductId');
Route::any('keyword/sendComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'sendComment'])->name('product_keyword_sendComment');
Route::any('keyword/getComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'getComment'])->name('product_keyword_getComment');
Route::any('keyword/delComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delComment'])->name('product_keyword_delComment');
Route::any('keyword/saveComment', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'saveComment'])->name('product_keyword_saveComment');
//产品参数
Route::get('attr', [\App\Http\Controllers\Bside\Product\AttrController::class, 'index'])->name('product_attr');
Route::get('attr/info', [\App\Http\Controllers\Bside\Product\AttrController::class, 'info'])->name('product_attr_info');
... ...