作者 lyh

GX生成白帽报表脚本

... ... @@ -19,14 +19,12 @@ use App\Models\News\NewsCategory;
use App\Models\Product\Category;
use App\Models\Product\Keyword;
use App\Models\Product\Product;
use App\Models\Project\Project;
use App\Models\RouteMap\RouteMap;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
use PhpOffice\PhpSpreadsheet\IOFactory;
use function Aws\default_http_handler;
class UpdateProjectTdk extends Command
{
... ...
<?php
/**
* @remark :
* @name :GeoController.php
* @author :lyh
* @method :post
* @time :2025/7/2 17:42
*/
namespace App\Http\Controllers\Aside\Geo;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Geo\GeoLogic;
use Illuminate\Http\Request;
/**
* @remark :项目geo设置
* @name :GeoController
* @author :lyh
* @method :post
* @time :2025/7/2 17:42
*/
class GeoController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new GeoLogic();
}
/**
* @remark :开启或关闭geo设置
* @name :setGeoStatus
* @author :lyh
* @method :post
* @time :2025/7/2 17:50
*/
public function setGeoStatus(){
$this->request->validate([
'project_id'=>'required',
'geo_status'=>'required',
'geo_frequency'=>'required',
],[
'project_id.required' => '项目ID不能为空',
'geo_status.required' => '项目开启与关闭不能为空',
'geo_frequency.required' => '项目发送频率不能为空',
]);
$data = $this->logic->setGeoStatus();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :问题列表
* @name :getGeoQuestion
* @author :lyh
* @method :post
* @time :2025/7/3 9:09
*/
public function getGeoQuestionList(){
$this->request->validate([
'project_id'=>'required',
],[
'project_id.required' => '项目ID不能为空',
]);
$data = $this->logic->getGeoQuestionList($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存问题数据
* @name :saveGeoQuestion
* @author :lyh
* @method :post
* @time :2025/7/3 9:31
*/
public function saveGeoQuestion(){
$this->request->validate([
'project_id'=>'required',
'question'=>'required',
'keywords'=>'required',
'url'=>'required',
'status'=>'required',
],[
'project_id.required' => '项目ID不能为空',
'question.required' => '项目ID不能为空',
'keywords.required' => '项目ID不能为空',
'url.required' => '项目ID不能为空',
'status.required' => '项目ID不能为空',
]);
$data = $this->logic->saveGeoQuestion();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -58,8 +58,20 @@ class ComController extends BaseController
public function seo_get_menu(){
$seoMenuModel = new ProjectMenuSeo();
$this->map['status'] = 0;
$data = [];
$is_ai_blog = $this->getIsAiBlog();
if($is_ai_blog != 1){
$data[] = 57;
}
$is_ai_video = $this->getIsAiVideo();
if($is_ai_video != 1){
$data[] = 74;
}
if($this->user['login_source'] == User::LOGIN_PASSWORD_SOURCE){
$this->map['id'] = ['not in',[19]];
$data[] = 19;
}
if(!empty($data)){
$this->map['id'] = ['not in',$data];
}
$lists = $seoMenuModel->list($this->map,'sort');
$menu = array();
... ...
<?php
/**
* @remark :
* @name :GeoLogic.php
* @author :lyh
* @method :post
* @time :2025/7/2 17:51
*/
namespace App\Http\Logic\Aside\Geo;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\GeoQuestion;
use App\Models\Project\Project;
class GeoLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new GeoQuestion();
}
/**
* @remark :设置geo状态
* @name :setGeoStatus
* @author :lyh
* @method :post
* @time :2025/7/2 17:51
*/
public function setGeoStatus(){
$projectModel = new Project();
$data = $projectModel->edit(['geo_status'=>$this->param['geo_status'],'geo_frequency'=>$this->param['geo_frequency']],['id'=>$this->param['project_id']]);
return $this->success($data);
}
/**
* @remark :获取问题列表
* @name :getGeoQuestionList
* @author :lyh
* @method :post
* @time :2025/7/3 9:12
*/
public function getGeoQuestionList($map,$page,$row,$order,$field = ['*']){
$data = $this->model->lists($map,$page,$row,$order,$field);
return $this->success($data);
}
/**
* @remark :保存数据
* @name :saveGeoQuestion
* @author :lyh
* @method :post
* @time :2025/7/3 9:47
* @param : question->提交的问题
* @param : url->提交的网址
* @param : keywords->提交的关键字
*/
public function saveGeoQuestion(){
//处理数据
$this->param['question'] = json_encode($this->param['question'] ?? [],true);
$this->param['url'] = json_encode($this->param['url'] ?? [],true);
$this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true);
//执行时间设置为今天
$this->param['current_time'] = date('Y-m-d');
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$id]);
}else{
$id = $this->model->addReturnId($this->param);
}
return $this->success(['id'=>$id]);
}
}
... ...
... ... @@ -484,7 +484,7 @@ class ProjectLogic extends BaseLogic
}
$param['upload_config'] = json_encode($param['upload_config'] ?? []);
$param['web_traffic_config'] = json_encode($param['web_traffic_config'] ?? []);
unset($param['robots'],$param['is_analysis']);//项目不保存robots
unset($param['robots'],$param['is_analysis'],$param['geo_status'],$param['geo_frequency']);//项目单独保存的数据
$this->model->edit($param,['id'=>$param['id']]);
Common::del_user_cache($this->model->getTable(),$param['id']);
return $this->success();
... ...
<?php
/**
* @remark :
* @name :GeoQuestion.php
* @author :lyh
* @method :post
* @time :2025/7/3 9:05
*/
namespace App\Models\Geo;
use App\Helper\Arr;
use App\Models\Base;
/**
* @remark :geo设置问题表
* @name :GeoQuestion
* @author :lyh
* @method :post
* @time :2025/7/3 9:05
*/
class GeoQuestion extends Base
{
protected $table = 'gl_geo_question';
/**
* @remark :geo提交网址获取器
* @name :getUrlAttribute
* @author :lyh
* @method :post
* @time :2025/7/3 9:52
*/
public function getUrlAttribute($value)
{
if($value){
$value = Arr::s2a($value);
}
return $value;
}
/**
* @remark :geo提交问题获取器
* @name :getUrlAttribute
* @author :lyh
* @method :post
* @time :2025/7/3 9:53
*/
public function getQuestionAttribute($value)
{
if($value){
$value = Arr::s2a($value);
}
return $value;
}
/**
* @remark :geo提交关键字获取器
* @name :getUrlAttribute
* @author :lyh
* @method :post
* @time :2025/7/3 9:53
*/
public function getKeywordsAttribute($value)
{
if($value){
$value = Arr::s2a($value);
}
return $value;
}
/**
* @remark :品牌类型
* @name :brandType
* @author :lyh
* @method :post
* @time :2025/7/3 9:43
*/
public function brandType(){
return [
1=>'品牌数据',
2=>'营销数据'
];
}
}
... ...