作者 刘锟

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

... ... @@ -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]);
... ...
... ... @@ -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) {
... ...
... ... @@ -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;
... ... @@ -960,14 +961,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');
... ... @@ -1229,4 +1226,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');
}
}
... ...
... ... @@ -328,9 +328,11 @@ class KeywordController extends BaseController
$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);
... ...
... ... @@ -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('系统错误请联系管理员');
... ...
... ... @@ -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]);
}
... ...
... ... @@ -367,6 +367,7 @@ class KeywordLogic extends BaseLogic
'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')
];
... ... @@ -394,6 +395,8 @@ class KeywordLogic extends BaseLogic
$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);
... ... @@ -402,12 +405,15 @@ class KeywordLogic extends BaseLogic
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')
];
... ... @@ -441,11 +447,11 @@ class KeywordLogic extends BaseLogic
*/
public function delComment(){
$keywordCommonModel = new AggregateKeywordComment();
if($this->param['id'] = 0){
$keywordCommonModel->del(['project_id'=>$this->param['project_id']]);
if($this->param['id'] == 0){
$keywordCommonModel->del(['project_id'=>$this->user['project_id']]);
}else{
$rs = $keywordCommonModel->del(['id'=>$this->param['id']]);
$keywordCommonModel->del(['id'=>$this->param['id']]);
}
return $this->success($rs);
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 ?? [],
];
//小语种列表
... ...
... ... @@ -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 () {
... ...