作者 刘锟

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

... ... @@ -13,6 +13,7 @@ use App\Console\Commands\Domain\DomainInfo;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Models\Ai\AiBlog;
use App\Models\Ai\AiBlogAuthor;
use App\Models\Ai\AiCommand;
use App\Models\Com\NoticeLog;
use App\Models\Com\V6WeeklyReport;
use App\Models\Product\Category;
... ... @@ -31,6 +32,7 @@ use App\Models\WebSetting\WebLanguage;
use App\Models\WebSetting\WebSetting;
use App\Models\Workchat\MessagePush;
use App\Services\AiBlogService;
use App\Services\AiCommandService;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Schema;
... ... @@ -54,7 +56,40 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
return true;
$projectModel = new Project();
$lists = $projectModel->list(['delete_status' => 0,'project_type'=>0,'extend_type'=>0,'type'=>['in',[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']);
$authorModel = new AiBlogAuthor();
$author_list = $authorModel->list(['id'=>['>',0]]);
if(empty($author_list)){
echo '跳过的项目id:'.$item['id'].PHP_EOL;
DB::disconnect('custom_mysql');
continue;
}
$projectAiSettingModel = new ProjectAiSetting();
$aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$item['id']]);
if($aiSettingInfo === false){
echo '跳过的项目id:'.$item['id'].PHP_EOL;
DB::disconnect('custom_mysql');
continue;
}
$aiBlogService = new AiBlogService($item['id']);
foreach ($author_list as $val){
$aiBlogService->author_id = $val['author_id'];
$result = $aiBlogService->getAuthorDetail();
if(isset($result['status']) && $result['status'] == 200){
//当前作者的页面
$aiBlogAuthorModel = new AiBlogAuthor();
$authorInfo = $aiBlogAuthorModel->read(['author_id'=>$val['author_id']],['id','route']);
if($authorInfo !== false && !empty($result['data']['section'])){
$aiBlogAuthorModel->edit(['text'=>$result['data']['section']],['author_id'=>$val['author_id']]);
}
}
}
DB::disconnect('custom_mysql');
}
}
public function _actionTemplateMain(){
... ...
... ... @@ -10,6 +10,7 @@ use App\Models\Subscribe\Smtp;
use App\Models\Workchat\MessagePush;
use App\Services\Aside\ProjectAssociation\ProjectAssociationServices;
use Illuminate\Console\Command;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Mail;
... ... @@ -44,6 +45,10 @@ class WorkchatMessageSend extends Command
ProjectAssociationServices::getInstance()->sendMessage($task->friend_id, $task->content, $task->content_type);
$this->output('推送消息' . $task->id . '成功');
$task->status = MessagePush::STATUS_SUCCESS;
}catch (ConnectionException $e){
$this->output('推送消息' . $task->id . '超时');
$task->status = MessagePush::STATUS_ERROR;
$task->remark = '请求超时';
}catch (\Exception $e){
$this->output('推送消息' . $task->id . '失败:' . $e->getMessage());
$task->status = MessagePush::STATUS_ERROR;
... ...
... ... @@ -6,6 +6,7 @@ namespace App\Console\Commands\Test;
use App\Helper\Common;
use App\Helper\FormGlobalsoApi;
use App\Models\Ai\AiCommand;
use App\Models\Domain\DomainInfo;
use App\Models\HomeCount\Count;
use App\Models\Inquiry\InquiryFormData;
... ... @@ -17,6 +18,7 @@ use App\Models\Project\ProjectUpdateTdk;
use App\Models\SyncSubmitTask\SyncSubmitTask as SyncSubmitTaskModel;
use App\Models\WebSetting\Translate as TranslateModel;
use App\Models\WebSetting\WebLanguage;
use App\Services\AiCommandService;
use App\Services\ProjectServer;
use Carbon\Carbon;
use Illuminate\Console\Command;
... ... @@ -60,6 +62,13 @@ class Test extends Command
*/
public function handle()
{
$string = '';
$promote = AiCommand::where(['key' => 'ai_layout_design'])->frist();
$promote = str_replace("{html}", $string, $promote->ai);
$aiCommandService = new AiCommandService();
$result = $aiCommandService->send_layout_design($promote);
dd($result);
$string = 'eyJpdiI6ImxDWW96VUdGVk5QcEZ5dnRyd2lzVkE9PSIsInZhbHVlIjoiRGJSRXdQZDdtMFp1Tjh5c21jTWRKbjh4SWNMeWpRR1hWdE1HdVR3cEI5MjNYdjA0d2hKemV5ZjFoNUd4enNKaklaNXZwUUFtbDhIUkxyckVwYTJ6YnE3V2pMdmUyeU5lblNPQXNsbHl2U0hFOTZ1NERTTStUb2dnQmhMTzZMMXVCV0REeiszQ3NcL0l1ZGhTSkI5a3J3TkRoVFhteHpFcXpcL3FwRkVGVG1sN2xBTlFJemZiZ3N1Sk1PT3Z2T1Jld2MiLCJtYWMiOiIzZmU5OTRiZTMyNWZhNzczMzUzZTc1YjFlODg0MGFhNDJlM2Q2MDhhMDY4YWQxNWFlNjNlYjczYmJmZThkOWJlIn0%3D';
$string_aicc = 'eyJpdiI6ImE0UDhxK25EY3RXLzI3bGZYM3BRVUE9PSIsInZhbHVlIjoiZ01IN0JBMmpNQ0EwWjJ5VmhMVFNrS2ZlRjY3ZmVpRExtdjh3MTQ4enkyK2gzMjJCajV1QXNKYjA4YlV6Z0dVMU0xMWdOTmJXZ0NWTDdRS3lSUWNhNmJsUW5qc0pIYjE4cm40ZkVXNkdibWVnSVR2dG4wUVp5Y1MyU3RrUnJZd3RCa1IzZ05nRC9FVUt5Q2xuZmVYNDFnPT0iLCJtYWMiOiIyZjZiYmRjNWY5N2E0MGUxNjAzNWYxZjVlMGUyNWE2OTk0MzhiY2UyYWNkYzY5MzA0YmJmYmYzNjM1YjIyY2QwIn0=';
$string_fob = 'eyJpdiI6IlBwOXRPL1ZUV1F1SHZpVnpaQkUwSWc9PSIsInZhbHVlIjoiVGFxcTFmSDBvL0hkSldEWkh0elRlaXpkOHJTQW1OeWlDZmMvMndaeXF0SE5YYXd1YjE3MWpPTTZuVEdlSEYzY3VmeXdSbmI5T0d0ZkxXZTRxb3laNWpCdFJxQ2dlQlExemZrRVFFeStxQm40a2VuNWxpUmFpdFoyZjJxMzRLYXBOK0hKa0JvcFlVQklDWE9yR3hEdEVBPT0iLCJtYWMiOiI3NDg5ZDViMjJiNzM3ZjAyZDUxZTAxODVlYjdhYWVmZWFjZDM2ZTE0M2NkNjEwODdjNTJjNmM1NmNlOTUxYjdiIn0=';
... ...
... ... @@ -29,7 +29,8 @@ class AiCommandController extends BaseController
$this->map['name|key|ai'] = ['like','%'.$this->map['scene'].'%'];
unset($this->map['scene']);
}
$lists = $aiCommandModel->lists($this->map,$this->page,$this->row,$this->order);
$this->order = 'project_id';
$lists = $aiCommandModel->lists($this->map,$this->page,$this->row,$this->order,['*'],'asc');
$projectModel = new Project();
if(!empty($lists) && !empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
... ...
... ... @@ -177,6 +177,13 @@ class IndexController extends BaseController
'text.required' => '文本text不能为空',
'lang.required' => '语种不能为空',
]);
if($this->param['lang'] == 0){
$lang = Translate::translateSl($this->param['text']);
$this->param['lang'] = $lang['texts']['sl'] ?? '';
}
if(empty($this->param['lang'])){
$this->fail('未获取到语种');
}
$service = new HumanizeAiTextService();
$data = $service->humanizer($this->param['text'],$this->param['lang']);
$this->response('success', Code::SUCCESS, $data);
... ...
<?php
/**
* @remark :
* @name :DomainApplicantLogController.php
* @author :lyh
* @method :post
* @time :2025/5/29 13:52
*/
namespace App\Http\Controllers\Aside\Domain;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Domain\DomainApplicantLogLogic;
use Illuminate\Http\Request;
class DomainApplicantLogController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new DomainApplicantLogLogic();
}
/**
* @remark :获取列表
* @name :lists
* @author :lyh
* @method :post
* @time :2025/5/29 13:54
*/
public function lists(){
$lists = $this->logic->lists($this->map,$this->page,$this->row);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2025/5/29 14:19
*/
public function save(){
$this->request->validate([
'domain'=>'required',
'applicant_name'=>'required',
],[
'domain.required' => 'domain不能为空',
'applicant_name.required' => '申请人不能为空',
]);
$data = $this->logic->saveDomainLog();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :删除记录
* @name :del
* @author :lyh
* @method :post
* @time :2025/5/29 14:25
*/
public function del(){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'domain不能为空',
]);
$data = $this->logic->delDomainLog();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
<?php
/**
* @remark :
* @name :AggregateKeywordAffixController.php
* @author :lyh
* @method :post
* @time :2025/5/27 14:20
*/
namespace App\Http\Controllers\Aside\Project;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Project\AggregateKeywordAffixLogic;
use Illuminate\Http\Request;
class AggregateKeywordAffixController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new AggregateKeywordAffixLogic();
}
/**
* @remark :获取当前项目关键字前后缀
* @name :getAffix
* @author :lyh
* @method :post
* @time :2025/5/27 14:23
*/
public function getAffix(){
$this->request->validate([
'project_id'=>'required',
],[
'project_id.required' => 'project_id不能为空',
]);
$data = $this->logic->getAffix();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存关键字前后缀
* @name :save
* @author :lyh
* @method :post
* @time :2025/5/27 14:23
*/
public function saveAffix(){
$this->request->validate([
'project_id'=>'required',
'prefix'=>'required',
'suffix'=>'required',
],[
'project_id.required' => 'project_id不能为空',
'prefix.required' => '前缀不能为空',
'suffix.required' => '后缀不能为空',
]);
$data = $this->logic->saveAffix();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -9,9 +9,9 @@
namespace App\Http\Controllers\Bside\News;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\News\NewsExtendLogic;
use App\Models\News\NewsExtend;
use Illuminate\Http\Request;
class NewsExtendController extends BaseController
... ... @@ -56,6 +56,25 @@ class NewsExtendController extends BaseController
}
/**
* @remark :修改状态
* @name :status
* @author :lyh
* @method :post
* @time :2025/5/27 9:22
*/
public function status(){
$this->request->validate([
'id' => 'required',
'status' => 'required',
], [
'id.required' => '字段名称不能为空',
'status.required' => '字段类型不能为空',
]);
$data = $this->logic->extendStatus();
$this->response('success', Code::SUCCESS, $data);
}
/**
* @remark :删除扩展字段
* @name :del
* @author :lyh
... ...
<?php
/**
* @remark :
* @name :BTemplateModuleRandomController.php
* @author :lyh
* @method :post
* @time :2025/5/27 15:33
*/
namespace App\Http\Controllers\Bside\Template;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\BTemplate\BTemplateModuleRandomLogic;
use Illuminate\Http\Request;
class BTemplateModuleRandomController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new BTemplateModuleRandomLogic();
}
/**
* @remark :获取当前项目所有随机模块
* @name :getRandomList
* @author :lyh
* @method :post
* @time :2025/5/27 16:00
*/
public function getRandomList(){
$data = $this->logic->getRandomList();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :设置为随机模块
* @name :saveRandomModule
* @author :lyh
* @method :post
* @time :2025/5/27 15:34
*/
public function saveRandomModule(){
$this->request->validate([
'module_id'=>'required',
'uuid'=>'required',
'html'=>'required',
],[
'module_id.required' => '左侧模块id不能为空',
'uuid.required' => 'uuid唯一不能为空',
'html.required' => 'html不能为空',
]);
$data = $this->logic->saveRandomModule();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :获取当前随机模块详情
* @name :getRandomInfo
* @author :lyh
* @method :post
* @time :2025/5/27 15:47
*/
public function getRandomInfo(){
$this->request->validate([
'uuid'=>'required',
],[
'uuid.required' => 'uuid唯一不能为空',
]);
$data = $this->logic->getRandomInfo();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :删除随机模块
* @name :delRandom
* @author :lyh
* @method :post
* @time :2025/5/27 17:59
*/
public function delRandom(){
$this->request->validate([
'uuid'=>'required',
],[
'uuid.required' => 'uuid唯一不能为空',
]);
$data = $this->logic->delRandom();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
<?php
/**
* @remark :
* @name :DomainApplicantLogLogic.php
* @author :lyh
* @method :post
* @time :2025/5/29 13:53
*/
namespace App\Http\Logic\Aside\Domain;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Domain\DomainApplicantLog;
class DomainApplicantLogLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new DomainApplicantLog();
$this->param = $this->requestAll;
}
/**
* @remark :列表
* @name :lists
* @author :lyh
* @method :post
* @time :2025/5/29 14:34
*/
public function lists($map,$page,$row){
$lists = $this->model->lists($map,$page,$row,'id',['*']);
return $this->success($lists);
}
/**
* @remark :保存域名申请记录
* @name :saveDomainLog
* @author :lyh
* @method :post
* @time :2025/5/29 14:34
*/
public function saveDomainLog(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$id = $this->model->addReturnId($this->param);
}
return $this->success(['id'=>$id]);
}
/**
* @remark :删除当前记录
* @name :delDomainLog
* @author :lyh
* @method :post
* @time :2025/5/29 14:40
*/
public function delDomainLog(){
$rs = $this->model->del($this->param);
return $this->success($rs);
}
}
... ...
... ... @@ -20,7 +20,6 @@ class DomainInfoLogic extends BaseLogic
parent::__construct();
$this->model = new DomainInfo();
$this->param = $this->requestAll;
}
/**
... ...
<?php
/**
* @remark :
* @name :AggregateKeywordAffixLogic.php
* @author :lyh
* @method :post
* @time :2025/5/27 14:21
*/
namespace App\Http\Logic\Aside\Project;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Project\AggregateKeywordAffix;
class AggregateKeywordAffixLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new AggregateKeywordAffix();
}
/**
* @remark :保存数据
* @name :getAffix
* @author :lyh
* @method :post
* @time :2025/5/27 14:25
*/
public function getAffix(){
$data = $this->model->read(['project_id'=>$this->param['project_id']]);
if($data === false){
$data = [];
}
return $this->success($data);
}
/**
* @remark :保存数据
* @name :saveAffix
* @author :lyh
* @method :post
* @time :2025/5/27 14:28
*/
public function saveAffix(){
$info = $this->model->read(['project_id'=>$this->param['project_id']]);
try {
if($info === false){
$this->model->addReturnId(['project_id'=>$this->param['project_id'],'prefix'=>$this->param['prefix'] ?? '','suffix'=>$this->param['suffix'] ?? '']);
}else{
$this->model->edit(['prefix'=>$this->param['prefix'] ?? '','suffix'=>$this->param['suffix'] ?? ''],['project_id'=>$this->param['project_id']]);
}
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
return $this->success();
}
}
... ...
... ... @@ -139,11 +139,14 @@ class AiBlogLogic extends BaseLogic
try {
$aiSettingInfo = $this->getProjectAiSetting();
$aiBlogService = new AiBlogService();
$aiBlogTask = new AiBlogTask();
foreach ($this->param['ids'] as $id) {
$info = $this->model->read(['id'=>$id],['task_id','route']);
$info = $this->model->read(['id'=>$id],['task_id','route','author_id']);
$aiBlogService->mch_id = $aiSettingInfo['mch_id'];
$aiBlogService->key = $aiSettingInfo['key'];
$aiBlogService->delDetail($info['task_id']);
//重新生成作者页面
$aiBlogTask->addReturnId(['type'=>$aiBlogTask::TYPE_AUTHOR_ID,'task_id'=>$info['author_id'],'status'=>1,'project_id'=>$this->user['project_id']]);
//删除路由映射
RouteMap::delRoute(RouteMap::SOURCE_AI_BLOG, $id, $this->user['project_id']);
$this->model->del(['id'=>$id]);
... ...
<?php
/**
* @remark :
* @name :BTemplateModuleRandomLogic.php
* @author :lyh
* @method :post
* @time :2025/5/27 15:36
*/
namespace App\Http\Logic\Bside\BTemplate;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Template\TemplateModuleRandom;
class BTemplateModuleRandomLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new TemplateModuleRandom();
$this->param = $this->requestAll;
}
/**
* @remark :保存为随机模块
* @name :saveRandomModule
* @author :lyh
* @method :post
* @time :2025/5/27 15:38
*/
public function saveRandomModule(){
//查询当前uuid是否已存在
$info = $this->model->read(['project_id'=>$this->user['project_id'],'uuid'=>$this->param['uuid'],'module_id'=>$this->param['module_id']]);
try {
if($info === false){
$this->param['project_id'] = $this->user['project_id'];
//执行新增数据
$this->model->add($this->param);
}else{
//执行编辑
$this->model->edit(['html'=>$this->param['html']],['id'=>$this->param['id']]);
}
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员');
}
return $this->success();
}
/**
* @remark :获取当前项目的所有随机模块
* @name :getRandomList
* @author :lyh
* @method :post
* @time :2025/5/27 15:59
*/
public function getRandomList(){
$data = $this->model->list(['project_id'=>$this->user['project_id']],'id',['id','uuid','project_id','module_id']);
return $this->success($data);
}
/**
* @remark :获取当前模块是否为随机模块
* @name :getIsRandomModule
* @author :lyh
* @method :post
* @time :2025/5/27 15:47
*/
public function getRandomInfo(){
$info = $this->model->read(['uuid'=>$this->param['uuid']]);
if($info === false){
$info = [];
}
return $this->success($info);
}
/**
* @remark :删除数据
* @name :delRandom
* @author :lyh
* @method :post
* @time :2025/5/27 18:04
*/
public function delRandom(){
$res = $this->model->del(['uuid'=>$this->param['uuid']]);
return $this->success($res);
}
}
... ...
... ... @@ -49,10 +49,16 @@ class CustomTemplateLogic extends BaseLogic
if($info === false){
$this->fail('当前数据不存在');
}
if(!empty($info['html'])){
$info['is_renovation'] = 1;
}else{
$info['html'] = $info['text'];
$info['is_renovation'] = 0;
}
$info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']);
if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
$template_id = $this->getTemplateId();
$html = $this->getTemplateComHtml(empty($info['html']) ? $info['text'] : $info['html'],$info['html_style'],$template_id);
$html = $this->getTemplateComHtml($info['html'],$info['html_style'],$template_id);
$info['html'] = $this->getHeadFooter($html);
}
return $this->success($info);
... ...
... ... @@ -25,7 +25,7 @@ class MonthCountLogic extends BaseLogic
*/
public function getCountLists($map,$order = 'created_at',$filed = ['*']){
$map['project_id'] = $this->user['project_id'];
$lists = $this->model->list($map,$order,$filed,'desc',12);
$lists = $this->model->list($map,$order,$filed,'desc');
if(isset($this->project['is_record_china_visit']) && ($this->project['is_record_china_visit'] == 0)){
foreach ($lists as $k => $v){
if(empty($v['source_country'])){
... ... @@ -55,9 +55,9 @@ class MonthCountLogic extends BaseLogic
*/
public function getIpPvCount(){
$count = new Count();
$startTime = date("Y-m-d", strtotime("-11 months", mktime(0, 0, 0)));
$startTime = date("Y-m-d", strtotime("-35 months", mktime(0, 0, 0)));
$ensTime = date('Y-m-d',time());
$lists = $count->list(['date'=>['between',[$startTime,$ensTime]],'project_id'=>$this->user['project_id']],'id',['*'],'asc');
$lists = $count->list(['date'=>['<=',$ensTime],'project_id'=>$this->user['project_id']],'id',['*'],'asc');
$groupedData = [];
foreach ($lists as $v){
$month = date('Y-m', strtotime($v['date']));
... ...
... ... @@ -30,6 +30,7 @@ class NewsExtendLogic extends BaseLogic
* @time :2025/5/26 15:17
*/
public function list($map){
$map['status'] = 1;
$data = $this->model->list($map);
return $this->success($data);
}
... ... @@ -61,6 +62,18 @@ class NewsExtendLogic extends BaseLogic
}
/**
* @remark :修改状态
* @name :extendStatus
* @author :lyh
* @method :post
* @time :2025/5/27 9:20
*/
public function extendStatus(){
$result = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
return $this->success(['result'=>$result]);
}
/**
* @remark :删除字段
* @name :extendDel
* @author :lyh
... ...
... ... @@ -8,6 +8,8 @@ use App\Http\Logic\Bside\BaseLogic;
use App\Models\News\News;
use App\Models\News\NewsCategory;
use App\Models\News\NewsCategory as NewsCategoryModel;
use App\Models\News\NewsExtend;
use App\Models\News\NewsExtendInfo;
use App\Models\RouteMap\RouteMap;
use App\Models\Template\BTemplate;
use App\Services\CosService;
... ... @@ -79,6 +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->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
return $this->success(['id'=>$id]);
}
... ... @@ -143,11 +146,12 @@ class NewsLogic extends BaseLogic
{
$info = $this->model->read($this->param);
if($info === false){
$this->fail('error');
$this->fail('当前数据不存在');
}
$info['category_id'] = explode(',',trim($info['category_id'],','));
$info['image_link'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']);
$info['og_image'] = getImageUrl(empty($info['og_image']) ? $info['image'] : $info['og_image'],$this->user['storage_type'],$this->user['project_location']);
$info['extend'] = $this->model->getExtendInfo($info['id']);
return $this->success($info);
}
... ...
... ... @@ -215,6 +215,10 @@ class RankDataLogic extends BaseLogic
$page = intval($this->request['page'] ?: 1);
$lang = $this->request['lang'] ?: '';
$project_id = $this->user['project_id'];
# fixme 白帽演示项目或者演示项目排名信息数据
if ($project_id == 3989) {
$project_id = 1;
}
$project = (new ProjectLogic())->getProjectInfo($project_id);
if(request('api_no')){
$api_no = request('api_no');
... ... @@ -286,8 +290,8 @@ class RankDataLogic extends BaseLogic
$v = [
'keyword' => $key,
'domain_type' => $domain_arr[0],
'domain' => $domain_arr[1],
'domain_text' => $domain_text,
'domain' => $this->user['project_id'] == 3989 ? 'google.com' : $domain_arr[1], # fixme 白帽演示项目或者演示项目排名信息数据
'domain_text' => $this->user['project_id'] == 3989 ? 'google.com' : $domain_text, # fixme 白帽演示项目或者演示项目排名信息数据
'g' => $last['g'], //1核心关键词
'position' => $data,
];
... ...
<?php
/**
* @remark :
* @name :DomainApplicantLog.php
* @author :lyh
* @method :post
* @time :2025/5/29 13:47
*/
namespace App\Models\Domain;
use App\Models\Base;
class DomainApplicantLog extends Base
{
protected $table = 'gl_domain_applicant_log';
}
... ...
... ... @@ -32,4 +32,124 @@ class News extends Base
public function getRelatedProductIdAttribute($value){
return Arr::setToArr($value);
}
/**
* @remark :扩展字段根据type返回类型
* @name :setTypValues
* @author :lyh
* @method :post
* @time :2023/12/6 14:43
*/
public function getExtendInfo($news_id){
$extendModel = new NewsExtend();
$list = $extendModel->list(['status'=>1],'id',['id','type','key','title']);
if(empty($list)){
return [];
}
$extendInfoModel = new NewsExtendInfo();
$infoList = $extendInfoModel->list(['news_id'=>$news_id],'created_at');
foreach ($list as $k=>$v){
if($v['type'] == 3 || $v['type'] == 4){
$v['values'] = [];
}else{
$v['values'] = '';
}
if(!empty($infoList)){
foreach ($infoList as $values){
if($v['key'] == $values['key']){
$v = $this->setTypValues($v,$values);
break;
}
}
}
$list[$k] = $v;
}
return $list;
}
/**
* @remark :扩展字段根据type返回类型
* @name :setTypValues
* @author :lyh
* @method :post
* @time :2023/12/6 14:43
*/
public function setTypValues($v,$info){
if($v['type'] == 3){
$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']);
$arr[$k1] = $v1;
}
$v['values'] = $arr;
}elseif($v['type'] == 4){
$arr1 = json_decode($info['values']);
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);
}else{
$v1 = getFileUrl($v1,$this->user['storage_type'],$this->user['project_location'],$this->user['file_cdn'] ?? 0);
}
$arr1[$k1] = $v1;
}
$v['values'] = $arr1;
}else{
$v['values'] = $info['values'];
}
return $v;
}
/**
* @remark :保存扩展字段
* @name :saveExtend
* @author :lyh
* @method :post
* @time :2023/11/9 15:02
*/
public function saveExtendInfo($news_id,$extend){
//先删除以前的数据
$extendInfoModel = new NewsExtendInfo();
$extendInfoModel->del(['news_id'=>$news_id]);
if(empty($extend)) {
return true;
}
foreach ($extend as $k => $v){
if(empty($v['values'])){
continue;
}
$v = $this->saveHandleExtend($v,$news_id);
$extendInfoModel->add($v);
}
return true;
}
/**
* @remark :保存扩展字段时处理数据
* @name :saveHandleExtend
* @author :lyh
* @method :post
* @time :2023/12/6 15:11
*/
public function saveHandleExtend(&$v,$news_id){
unset($v['title']);
if($v['type'] == 3){
foreach ($v['values'] as $k1=>$v1){
$v1['url'] = str_replace_url($v1['url']);
$v['values'][$k1] = $v1;
}
$v['values'] = json_encode($v['values']);
}elseif ($v['type'] == 4){
foreach ($v['values'] as $k1=>$v1){
$v1['url'] = str_replace_url($v1['url']);
$v['values'][$k1] = $v1;
}
$v['values'] = json_encode($v['values']);
}
$v['project_id'] = $this->user['project_id'];
$v['news_id'] = $news_id;
return $v;
}
}
... ...
... ... @@ -26,7 +26,7 @@ class NewsExtend extends Base
* @time :2025/5/26 15:39
*/
public function getKey($key = self::EXTEND_KEY,$i = 1){
$info = $this->model->read(['key'=>$key.$i]);
$info = $this->read(['key'=>$key.$i]);
if($info !== false){
return $this->getKey($key,$i+1);
}else{
... ...
<?php
/**
* @remark :
* @name :AggregateKeywordAffix.php
* @author :lyh
* @method :post
* @time :2025/5/27 14:16
*/
namespace App\Models\Project;
use App\Models\Base;
/**
* @remark :聚合页关键字前后缀
* @name :AggregateKeywordAffix
* @author :lyh
* @method :post
* @time :2025/5/27 14:16
*/
class AggregateKeywordAffix extends Base
{
protected $table = 'gl_aggregate_keyword_affix';
}
... ...
... ... @@ -58,7 +58,8 @@ class Project extends Base
3 => '告知书一',
4 => '告知书二',
5 => 'Q告知书二',
6 => 'CKA',
6 => 'KA',
7 => 'CKA',
];
}
... ... @@ -105,6 +106,10 @@ class Project extends Base
];
}
/**
* 项目版本
* @return array
*/
public static function planMap()
{
return [
... ... @@ -122,6 +127,9 @@ class Project extends Base
12 => '俄语商务版',
14 => '俄语旗舰版',
13 => '体验版',
15 => 'CKA方案半托管',
16 => 'CKA方案全托管',
17 => '多语言版',
];
}
... ...
<?php
/**
* @remark :
* @name :TemplateModuleRandom.php
* @author :lyh
* @method :post
* @time :2025/5/27 15:31
*/
namespace App\Models\Template;
use App\Models\Base;
/**
* @remark :随机模块
* @name :TemplateModuleRandom
* @author :lyh
* @method :post
* @time :2025/5/27 15:32
*/
class TemplateModuleRandom extends Base
{
protected $table = 'gl_public_template_module_random';
}
... ...
... ... @@ -49,7 +49,13 @@ class AiCommandService
"Content-Type:application/json;charset=utf-8",
);
$result = http_post($this->url,json_encode($param,true),$header);
return $result;
$data = $result['content'][0]['data'] ?? '';
$data = trim($data, "\"\n");
$data = preg_replace('/^```html\s*/', '', $data); // 去除开头
$data = preg_replace('/\s*```$/', '', $data); // 去除结尾
$data = str_replace("\\n", "\n", $data);
$data = str_replace('\"', '"', $data);
return ['data'=>$data];
}
}
... ...
... ... @@ -189,7 +189,7 @@ class ProjectAssociationServices extends BaseService
];
$param['sign'] = $this->getSign($param);
$url = 'https://hub.ai.cc/api/globalso_ai_customer_service/send_msg';
$result = Http::withoutVerifying()->post($url, $param)->json();
$result = Http::withoutVerifying()->timeout(30)->post($url, $param)->json();
if(empty($result) || $result['status'] != 200){
throw new \Exception($result['message'] ?? '');
}
... ...
... ... @@ -220,6 +220,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/', [Aside\Project\MinorLanguagesController::class, 'getMinorLanguageList'])->name('admin.getMinorLanguageList');
Route::any('/getLanguages', [Aside\Project\MinorLanguagesController::class, 'getLanguages'])->name('admin.getLanguages');
});
//更新项目tdk
Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk');
//项目内容采集
... ... @@ -268,6 +269,11 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/getCountryCode', [Aside\Domain\DomainInfoController::class, 'getCountryCode'])->name('admin.get_country_code');
});
Route::prefix('domain_log')->group(function () {
Route::any('/', [Aside\Domain\DomainApplicantLogController::class, 'lists'])->name('admin.domain_log_lists');
Route::any('/save', [Aside\Domain\DomainApplicantLogController::class, 'save'])->name('admin.domain_log_save');
Route::any('/del', [Aside\Domain\DomainApplicantLogController::class, 'del'])->name('admin.domain_log_del');
});
//图片操作
Route::prefix('images')->group(function () {
Route::post('/upload', [\App\Http\Controllers\File\ImageController::class, 'upload'])->name('images_upload');
... ... @@ -562,6 +568,11 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/info', [Aside\Project\AggregateKeywordController::class, 'info'])->name('admin.aggregateKeyword_info');
Route::any('/save', [Aside\Project\AggregateKeywordController::class, 'save'])->name('admin.aggregateKeyword_save');
Route::any('/del', [Aside\Project\AggregateKeywordController::class, 'del'])->name('admin.aggregateKeyword_del');
//聚合页关键词前后缀
Route::prefix('affix')->group(function () {
Route::any('/getAffix', [Aside\Project\AggregateKeywordAffixController::class, 'getAffix'])->name('admin.affix_getAffix');
Route::any('/saveAffix', [Aside\Project\AggregateKeywordAffixController::class, 'saveAffix'])->name('admin.affix_saveAffix');
});
});
});
... ...
... ... @@ -104,6 +104,11 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/category/status', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'status'])->name('news_category_status');
Route::any('/category/sort', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'sort'])->name('news_category_sort');
Route::any('/category/categoryTopList', [\App\Http\Controllers\Bside\News\NewsCategoryController::class, 'categoryTopList'])->name('news_category_categoryTopList');
//新闻扩展模块
Route::any('/extend/', [\App\Http\Controllers\Bside\News\NewsExtendController::class, 'lists'])->name('news_extend_lists');
Route::any('/extend/save', [\App\Http\Controllers\Bside\News\NewsExtendController::class, 'save'])->name('news_extend_save');
Route::any('/extend/status', [\App\Http\Controllers\Bside\News\NewsExtendController::class, 'status'])->name('news_extend_status');
Route::any('/extend/del', [\App\Http\Controllers\Bside\News\NewsExtendController::class, 'del'])->name('news_extend_del');
});
//博客相关路由
... ... @@ -438,7 +443,14 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'save'])->name('template_module_project_save');
Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateModuleProjectController::class, 'del'])->name('template_module_project_del');
});
//随机模块
Route::prefix('random')->group(function () {
//获取所有左侧模版
Route::any('/getRandomList', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'getRandomList'])->name('template_random_getRandomList');
Route::any('/getRandomInfo', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'getRandomInfo'])->name('template_random_getRandomInfo');
Route::any('/saveRandomModule', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'saveRandomModule'])->name('template_random_saveRandomModule');
Route::any('/delRandom', [\App\Http\Controllers\Bside\Template\BTemplateModuleRandomController::class, 'delRandom'])->name('template_random_delRandom');
});
//编辑记录
Route::prefix('log')->group(function () {
//获取所有左侧模版
... ...