作者 赵彬吉
... ... @@ -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;
... ...
... ... @@ -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;
... ... @@ -57,26 +58,28 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
$str = '3671,955,752,1270,439,2674,3588,2388,1271,1543,738,624,552,1417,1237,651,1143,817,1556,1234,1350,650,538,491,631,2059,1845,866,1194,1699,546,684,905,1805,1728,2811,952,2972,2827,983,812,3081,554,741,1349,980';
$arr = explode(',',$str);
$model = new TranslateBigProject();
foreach ($arr as $val){
$model->addReturnId(['project_id'=>$val]);
$projectModel = new Project();
$buildModel = new DeployBuild();
$lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'is_upgrade'=>0,'id'=>['<',1659],'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id','notice_order_id']);
foreach ($lists as $item){
echo date('Y-m-d H:i:s') . '开始--项目的id:'. $item['id'] . PHP_EOL;
try {
if(!empty($item['notice_order_id'])){
$api = new OaGlobalsoApi();
$data = $api->order_info($item['notice_order_id']);
if(!empty($data)){
if(isset($data['data']['ads_price'])){
echo '奖励金额:'.$data['data']['ads_price'].PHP_EOL;
$buildModel->edit(['ads_price'=>$data['data']['ads_price'] ?? 0],['project_id'=>$item['id']]);
}
}
}
}catch (\Exception $e){
continue;
}
DB::disconnect('custom_mysql');
}
return true;
// $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');
// }
echo date('Y-m-d H:i:s') . '结束。。。' . PHP_EOL;
}
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]);
... ...
... ... @@ -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
... ...
... ... @@ -35,7 +35,6 @@ class UpdateKeyword extends Command
public function handle(){
dd(1111);
while (true){
$keywordPageModel = new KeywordPage();
$lists = $keywordPageModel->list(['status'=>0]);
... ...
... ... @@ -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);
}
... ...
... ... @@ -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;
}
... ... @@ -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');
}
}
... ...
... ... @@ -210,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)
{
... ...
... ... @@ -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('系统错误请联系管理员');
... ...
... ... @@ -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 ?? [],
];
//小语种列表
... ...
... ... @@ -26,6 +26,7 @@ class AutoPullNotify extends Base
22 => '白帽专属服务器01',
24 => '白帽专属服务器02',
23 => '西班牙服务器',
6 => '自建站服务器群',
];
}
... ...
... ... @@ -14,6 +14,7 @@ class NoticeLog extends Base
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;
}
... ...
... ... @@ -209,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');
... ...