作者 赵彬吉
... ... @@ -100,9 +100,11 @@ class UpdateKeyword extends Command
}else{
$randomNumber = $text[$key] ?? rand(0, $number - 1);
}
if(isset($text[$randomNumber])){
$keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]);
}
}
}
//按给定的数量更新
if(!empty($updateObject['number']) && ($updateObject['number'] != 0)){
$keywordIdArr = $keywordModel->where("status",1)->inRandomOrder()->take($updateObject['number'])->pluck('id')->toArray();
... ... @@ -112,10 +114,12 @@ class UpdateKeyword extends Command
}else{
$randomNumber = $text[$key] ?? rand(0, $number - 1);
}
if(isset($text[$randomNumber])){
$keywordModel->edit(['keyword_content'=>$text[$randomNumber]],['title'=>$item]);
}
}
}
}
return true;
}
... ...
... ... @@ -7,6 +7,7 @@
*/
namespace App\Http\Controllers\Api;
use App\Enums\Common\Code;
use App\Models\Geo\GeoConfirm;
use App\Models\Geo\GeoWritings;
use App\Models\Project\Project;
... ... @@ -35,13 +36,15 @@ class GeoController extends BaseController
} catch (\Exception $e) {
return $this->error('非法请求');
}
$project = Project::select('title', 'version')->where(['project_id' => $this->param['project_id']])->first();
$list = GeoWritings::select(['title', 'status', 'uniqid', 'confirm_at'])->where(['project_id' => $project_id, 'is_del' => GeoWritings::IS_DEL_FALSE])->get();
$projectModel = new Project();
$projectInfo = $projectModel->read(['project_id' => $project_id],['title','version']);
$geoWritingsModel = new GeoWritings();
$lists = $geoWritingsModel->list(['project_id' => $project_id, 'is_del' => GeoWritings::IS_DEL_FALSE],'id',['title', 'status', 'uniqid', 'confirm_at']);
$result = [
'project' => $project,
'list' => $list
'project' => $projectInfo,
'list' => $lists
];
return $this->success($result);
$this->response('success',Code::SUCCESS,$result);
}
/**
... ... @@ -49,11 +52,12 @@ class GeoController extends BaseController
* @param Request $request
* @return false|string
*/
public function getWritingsDetail(Request $request)
public function getWritingsDetail()
{
$token = trim($request->input('token'));
$detail = GeoWritings::select(['title', 'content', 'status'])->where(['uniqid' => $token])->first();
return $this->success($detail);
$geoWritingsModel = new GeoWritings();
$token = trim($this->param['token']);
$detail = $geoWritingsModel->read(['uniqid' => $token],['title', 'content', 'status']);
$this->response('success',Code::SUCCESS,$detail);
}
... ... @@ -95,9 +99,9 @@ class GeoController extends BaseController
* @param Request $request
* @return false|string
*/
public function getConfirm(Request $request)
public function getConfirm()
{
$token = trim($request->input('token'));
$token = trim($this->param['token']);
$data = GeoConfirm::where(['uniqid' => $token])->first();
if (empty($data)){
return $this->error('当前授权已失效');
... ... @@ -107,7 +111,7 @@ class GeoController extends BaseController
$type = $data->type;
$status = $data->status;
$result = compact('content', 'confirm', 'type', 'status');
return $this->success($result);
$this->response('success',Code::SUCCESS,$result);
}
/**
... ... @@ -115,6 +119,20 @@ class GeoController extends BaseController
* 验证当前确认数据状态, 不可重复确认
* @param Request $request
*/
public function saveConfirm(Request $request)
{}
public function saveConfirm()
{
$this->request->validate([
'uniqid' => 'required',
'confirm' => 'required',
'confirm_num' => 'required',
], [
'uniqid.required' => '非法请求',
'confirm.required' => '客户确认内容不能为空',
'confirm_num.max' => '客户确认数量不能为空',
]);
$geoConfirmModel = new GeoConfirm();
$this->param['status'] = $geoConfirmModel::STATUS_FINISH;
$result = $geoConfirmModel->edit($this->param,['uniqid'=>$this->param['uniqid']]);
$this->response('success',Code::SUCCESS,$result);
}
}
... ...
<?php
/**
* @remark :
* @name :GeoConfirmController.php
* @author :lyh
* @method :post
* @time :2025/10/25 11:35
*/
namespace App\Http\Controllers\Aside\Geo;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Geo\GeoConfirmLogic;
use Illuminate\Http\Request;
/**
* @remark :用户确认信息表
* @name :GeoConfirmController
* @author :lyh
* @method :post
* @time :2025/10/25 11:37
*/
class GeoConfirmController extends BaseController
{
public function __construct(Request $request){
parent::__construct($request);
$this->logic = new GeoConfirmLogic();
}
/**
* 保存确认数据, 并推送微信群
* @param Request $request
* @throws \App\Exceptions\AsideGlobalException
*/
public function saveConfirmContent()
{
$this->request->validate([
'project_id' => 'required',
'type' => 'required|integer',
'content' => 'required',
'max_num' => 'required',
], [
'project_id.required' => '项目ID不能为空',
'type.required' => '确定数据类型不能为空',
'type.integer' => '确定数据类型不正确',
'content.required' => '确定数据不能为空',
'max_num.required' => '最大确认数量不能为空',
]);
$data = $this->logic->saveConfirmContent($this->param);
$this->response('success', Code::SUCCESS, $data);
}
}
... ...
... ... @@ -9,6 +9,7 @@ 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 App\Models\Geo\GeoConf;
use App\Models\Geo\GeoConfirm;
use App\Models\Manage\ManageHr;
... ... @@ -23,6 +24,11 @@ use Illuminate\Http\Request;
*/
class GeoController extends BaseController
{
public function __construct(Request $request){
parent::__construct($request);
$this->logic = new GeoLogic();
}
/**
* 获取GEO相关配置
* @param Request $request
... ... @@ -34,36 +40,8 @@ class GeoController extends BaseController
], [
'project_id.required' => '项目ID不能为空',
]);
$projectModel = new Project();
$project_geo_conf = $projectModel->read(['id' => $this->param['project_id']],['title', 'version', 'geo_status', 'geo_qualify_num']);
$geoConfModel = new GeoConf();
$geo_conf = $geoConfModel->read(['project_id' => $this->param['project_id']]);
if($geo_conf === false){//数据未初始化
$geo_conf = [
'project_id' => $this->param['project_id'],
'manager_id'=>0,
'company'=>$project_geo_conf['title'],
'brand'=>'',
'description'=>''
];
}
//负责人集合
$geo_manage_list = $geoConfModel->geoManage();
// geo配置管理员,已经移除管理员列表,补充管理员信息
if ($geo_conf && $geo_conf['manager_id'] && empty($geo_manage_list[$geo_conf['manager_id']])) {
$manage = ManageHr::where(['id' => $geo_conf['manager_id']])->pluck('name', 'id')->toArray();
$geo_manage_list = array_merge($geo_manage_list, $manage);
}
$result = [
'project_geo_conf' => $project_geo_conf,
'geo_conf' => $geo_conf,
'geo_manage_list' => $geo_manage_list,
'geo_keyword' => [
'prefix' => KeywordPrefix::getKeyword($this->param['project_id'], KeywordPrefix::TYPE_GEO_PREFIX),
'suffix' => KeywordPrefix::getKeyword($this->param['project_id'], KeywordPrefix::TYPE_GEO_SUFFIX),
],
];
$this->response('success', Code::SUCCESS, $result);
$data = $this->logic->getCongInfo($this->param['project_id']);
$this->response('success', Code::SUCCESS, $data);
}
/**
... ... @@ -87,47 +65,11 @@ class GeoController extends BaseController
'brand.max' => '品牌名不能超过200个字符',
'description.max' => '描述不能超过500个字符',
]);
try {
$data = GeoConf::saveConf($this->param['project_id'], $this->param['manager_id'], $this->param['company'], $this->param['brand'], $this->param['description'], $this->param['prefix'], $this->param['suffix']);
# FIXME 保存GEO状态 达标数量
$data = $this->logic->saveConfig($this->param);
$this->response('success', Code::SUCCESS, $data);
} catch (\Exception $e) {
$this->fail('配置保存失败, error:' . $e->getMessage());
}
}
/**
* 保存确认数据, 并推送微信群
* @param Request $request
* @throws \App\Exceptions\AsideGlobalException
*/
public function saveConfirmContent()
{
$this->request->validate([
'project_id' => 'required',
'type' => 'required|integer',
'content' => 'required',
'max_num' => 'required',
], [
'project_id.required' => '项目ID不能为空',
'type.required' => '确定数据类型不能为空',
'type.integer' => '确定数据类型不正确',
'content.required' => '确定数据不能为空',
'max_num.required' => '最大确认数量不能为空',
]);
try {
$data = GeoConfirm::saveContent($this->param['project_id'], $this->param['type'], $this->param['content'], $this->param['max_num']);
$friend = ProjectAssociation::where(['project_id' => $this->param['project_id']])->first();
if (empty($friend)){
$this->fail('项目未绑定微信群, 推送消息失败!');
}
$data = GeoConfirm::sendConfirmMessage($data->id, $friend->friend_id);
$this->response('success', Code::SUCCESS, $data);
} catch (\Exception $e) {
$this->fail('操作失败, error:' . $e->getMessage());
}
}
/**
* OA后台管理员,保存确认数据
... ...
... ... @@ -11,7 +11,7 @@ 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 App\Http\Logic\Aside\Geo\GeoQuestionLogic;
use Illuminate\Http\Request;
/**
... ... @@ -26,7 +26,7 @@ class GeoQuestionController extends BaseController
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new GeoLogic();
$this->logic = new GeoQuestionLogic();
}
/**
... ...
... ... @@ -9,7 +9,11 @@
namespace App\Http\Controllers\Aside\Geo;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Geo\GeoWritingsTaskLogic;
use App\Http\Requests\Aside\Geo\GeoWritingsTaskRequest;
use Illuminate\Http\Request;
/**
* @remark :文章任务(收集数据)
... ... @@ -20,14 +24,53 @@ use App\Http\Controllers\Aside\BaseController;
*/
class GeoWritingTaskController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new GeoWritingsTaskLogic();
}
/**
* @remark :文章任务列表
* @remark :ai文章列表页
* @name :lists
* @author :lyh
* @method :post
* @time :2025/10/25 10:41
* @time :2025/10/25 15:12
*/
public function lists(){
$data = $this->logic->listWritingTask($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存geoAi文章生成数据
* @name :lists
* @author :lyh
* @method :post
* @time :2025/10/25 10:41
*/
public function saveWritingTask(){
$request = new GeoWritingsTaskRequest();
$request->validated();
$data = $this->logic->saveWritingTask();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :批量删除文章任务
* @name :delWritingTask
* @author :lyh
* @method :post
* @time :2025/10/25 15:03
*/
public function delWritingTask(){
$this->request->validate([
'id'=>'required|array',
],[
'id.required' => 'ID不能为空',
'id.array' => 'ID为数组',
]);
$data = $this->logic->delWritingTask();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -9,7 +9,11 @@
namespace App\Http\Controllers\Aside\Geo;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Geo\GeoWritingsLogic;
use App\Http\Requests\Aside\Geo\GeoWritingsRequest;
use Illuminate\Http\Request;
/**
* @remark :geo文章
... ... @@ -20,5 +24,54 @@ use App\Http\Controllers\Aside\BaseController;
*/
class GeoWritingsController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new GeoWritingsLogic();
}
/**
* @remark :文章列表数据
* @name :lists
* @author :lyh
* @method :post
* @time :2025/10/25 15:53
*/
public function lists(){
$data = $this->logic->listWriting($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存geoAi文章生成数据
* @name :lists
* @author :lyh
* @method :post
* @time :2025/10/25 10:41
*/
public function saveWriting(){
$request = new GeoWritingsRequest();
$request->validated();
$data = $this->logic->saveWriting();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :批量删除文章任务
* @name :delWritingTask
* @author :lyh
* @method :post
* @time :2025/10/25 15:03
*/
public function delWriting(){
$this->request->validate([
'id'=>'required|array',
],[
'id.required' => 'ID不能为空',
'id.array' => 'ID为数组',
]);
$data = $this->logic->delWriting();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -160,7 +160,7 @@ class OptimizeController extends BaseController
$manageModel = new ManageHr();
$plan = Project::planMap();
$seo_plan = Project::seoMap();
$item['plan'] = $plan[$item['plan']] ?? $seo_plan[1];
$item['plan'] = $plan[$item['plan']] ?? ($seo_plan[$item['seo_plan']] ?? '');
$item['channel'] = Channel::getChannelText($item['channel']['user_id'] ?? 0);
$item['build_leader'] = $manageModel->getName($item['leader_mid']);
$item['build_manager'] = $manageModel->getName($item['manager_mid']);
... ...
<?php
/**
* @remark :
* @name :GeoConfirmLogic.php
* @author :lyh
* @method :post
* @time :2025/10/25 11:36
*/
namespace App\Http\Logic\Aside\Geo;
use App\Enums\Common\Code;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\GeoConfirm;
use App\Models\ProjectAssociation\ProjectAssociation;
/**
* @remark :用户确认信息
* @name :GeoConfirmLogic
* @author :lyh
* @method :post
* @time :2025/10/25 11:37
*/
class GeoConfirmLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new GeoConfirm();
}
/**
* @remark :保存数据->并推送微信群客户确认
* @name :saveConfirmContent
* @author :lyh
* @method :post
* @time :2025/10/25 11:41
*/
public function saveConfirmContent($param)
{
try {
$info = $this->model->read(['project_id' => $param['project_id']]);
if($info === false){
$id = $this->model->addReturnId($param);
}else{
$id = $param['id'];
$this->model->edit($param,['id'=>$info['id']]);
}
$friend = ProjectAssociation::where(['project_id' => $param['project_id']])->first();
if (empty($friend)){
$this->fail('项目未绑定微信群, 推送消息失败!');
}
GeoConfirm::sendConfirmMessage($id, $friend->friend_id);
} catch (\Exception $e) {
$this->fail('操作失败, error:' . $e->getMessage());
}
return $this->success(['id'=>$id]);
}
}
... ...
... ... @@ -4,109 +4,99 @@
* @name :GeoLogic.php
* @author :lyh
* @method :post
* @time :2025/7/2 17:51
* @time :2025/10/25 11:08
*/
namespace App\Http\Logic\Aside\Geo;
use App\Enums\Common\Code;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Geo\GeoPlatform;
use App\Models\Geo\GeoConf;
use App\Models\Geo\GeoQuestion;
use App\Models\Manage\ManageHr;
use App\Models\Project\KeywordPrefix;
use App\Models\Project\Project;
/**
* @remark :geo设置
* @name :GeoLogic
* @author :lyh
* @method :post
* @time :2025/10/25 11:08
*/
class GeoLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new GeoQuestion();
$this->model = new GeoConf();
}
/**
* @remark :设置geo状态
* @name :setGeoStatus
* @remark :获取geo设置数据详情
* @name :getCongInfo
* @author :lyh
* @method :post
* @time :2025/7/2 17:51
* @time :2025/10/25 11:10
*/
public function setGeoStatus(){
public function getCongInfo($project_id)
{
$projectModel = new Project();
$data = $projectModel->edit(['geo_status'=>$this->param['geo_status'],'geo_frequency'=>$this->param['geo_frequency']],['id'=>$this->param['project_id']]);
$questionModel = new GeoQuestion();
$questionModel->edit(['status'=>$this->param['geo_status']],['project_id'=>$this->param['project_id']]);
return $this->success($data);
$project_geo_conf = $projectModel->read(['id' => $project_id],['title', 'version', 'geo_status', 'geo_qualify_num']);
$geoConfModel = new GeoConf();
$geo_conf = $geoConfModel->read(['project_id' => $project_id]);
if($geo_conf === false){//数据未初始化
$geo_conf = [
'project_id' => $project_id, 'manager_id'=>0, 'company'=>$project_geo_conf['title'], 'brand'=>'', 'description'=>''
];
}
/**
* @remark :获取类型
* @name :getType
* @author :lyh
* @method :post
* @time :2025/7/3 10:47
*/
public function getType(){
$data['type'] = $this->model->brandType();
$data['frequency'] = $this->model->frequency;
$geoPlatformModel = new GeoPlatform();
$data['platform'] = $geoPlatformModel->getList();
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);
if(!empty($data) && !empty($data['list'])){
foreach ($data['list'] as $key => $item){
$item['type_name'] = $this->model->brandType()[$item['type']];
$data['list'][$key] = $item;
//负责人集合
$geo_manage_list = $geoConfModel->geoManage();
// geo配置管理员,已经移除管理员列表,补充管理员信息
if ($geo_conf && $geo_conf['manager_id'] && empty($geo_manage_list[$geo_conf['manager_id']])) {
$manage = ManageHr::where(['id' => $geo_conf['manager_id']])->pluck('name', 'id')->toArray();
$geo_manage_list = array_merge($geo_manage_list, $manage);
}
}
return $this->success($data);
$result = [
'project_geo_conf' => $project_geo_conf,
'geo_conf' => $geo_conf,
'geo_manage_list' => $geo_manage_list,
'geo_keyword' => [
'prefix' => KeywordPrefix::getKeyword($project_id, KeywordPrefix::TYPE_GEO_PREFIX),
'suffix' => KeywordPrefix::getKeyword($project_id, KeywordPrefix::TYPE_GEO_SUFFIX),
],
];
return $this->success($result);
}
/**
* @remark :保存数据
* @name :saveGeoQuestion
* @remark :保存数据详情
* @name :saveCongInfo
* @author :lyh
* @method :post
* @time :2025/7/3 9:47
* @param : question->提交的问题
* @param : url->提交的网址
* @param : keywords->提交的关键字
* @param : project_id->项目id
* @time :2025/10/25 11:14
* @param->gl_geo_conf : project_id->项目id;manager_id->管理员id;company->公司名称;brand->品牌名;description->描述(必传)
* @param :prefix->前缀;suffix->后缀(非必传)
* @param->gl_project : geo_status->开启/关闭状态 geo_qualify_num->达标数量
*/
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);
//执行时间设置为今天
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$id]);
public function saveConfig($param)
{
$projectModel = new Project();
$projectModel->edit(['geo_status'=>$param['geo_status'],'geo_qualify_num'=>$param['geo_qualify_num']],['id'=>$param['project_id']]);
try {
unset($param['geo_status'],$param['geo_qualify_num']);//无需保存
$info = $this->model->read(['project_id' => $param['project_id']]);
if($info === false){
$id = $this->model->addReturnId($param);
}else{
$this->param['next_time'] = date('Y-m-d');
$id = $this->model->addReturnId($this->param);
$id = $param['id'];
$this->model->edit($param,['id'=>$info['id']]);
}
} catch (\Exception $e) {
$this->fail('配置保存失败, error:' . $e->getMessage());
}
return $this->success(['id'=>$id]);
}
/**
* @remark :删除数据
* @name :delGeoQuestion
* @author :lyh
* @method :post
* @time :2025/7/3 10:13
*/
public function delGeoQuestion(){
$data = $this->model->del(['id'=>['in',$this->param['ids']]]);
return $this->success($data);
}
}
... ...
<?php
/**
* @remark :
* @name :GeoQuestionLogic.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\GeoPlatform;
use App\Models\Geo\GeoQuestion;
use App\Models\Project\Project;
class GeoQuestionLogic 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']]);
$questionModel = new GeoQuestion();
$questionModel->edit(['status'=>$this->param['geo_status']],['project_id'=>$this->param['project_id']]);
return $this->success($data);
}
/**
* @remark :获取类型
* @name :getType
* @author :lyh
* @method :post
* @time :2025/7/3 10:47
*/
public function getType(){
$data['type'] = $this->model->brandType();
$data['frequency'] = $this->model->frequency;
$geoPlatformModel = new GeoPlatform();
$data['platform'] = $geoPlatformModel->getList();
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);
if(!empty($data) && !empty($data['list'])){
foreach ($data['list'] as $key => $item){
$item['type_name'] = $this->model->brandType()[$item['type']];
$data['list'][$key] = $item;
}
}
return $this->success($data);
}
/**
* @remark :保存数据
* @name :saveGeoQuestion
* @author :lyh
* @method :post
* @time :2025/7/3 9:47
* @param : question->提交的问题
* @param : url->提交的网址
* @param : keywords->提交的关键字
* @param : project_id->项目id
*/
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);
//执行时间设置为今天
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$id]);
}else{
$this->param['next_time'] = date('Y-m-d');
$id = $this->model->addReturnId($this->param);
}
return $this->success(['id'=>$id]);
}
/**
* @remark :删除数据
* @name :delGeoQuestion
* @author :lyh
* @method :post
* @time :2025/7/3 10:13
*/
public function delGeoQuestion(){
$data = $this->model->del(['id'=>['in',$this->param['ids']]]);
return $this->success($data);
}
}
... ...
... ... @@ -27,4 +27,57 @@ class GeoWritingsLogic extends BaseLogic
$this->param = $this->requestAll;
$this->model = new GeoWritings();
}
/**
* @remark :列表数据
* @name :listWriting
* @author :lyh
* @method :post
* @time :2025/10/25 15:57
*/
public function listWriting($map,$page,$row,$order){
$data = $this->model->lists($map,$page,$row,$order);
return $this->success($data);
}
/**
* @remark :手动上传数据
* @name :saveWriting
* @author :lyh
* @method :post
* @time :2025/10/25 16:07
*/
public function saveWriting(){
try {
$this->param['content_length'] = strlen($this->param['content']);
$this->param['confirm_ip'] = $this->request->ip();
$this->param['confirm_at'] = date('Y-m-d H:i:s');
if(isset($this->param['id']) &&!empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$id]);
}else{
$this->param['uniqid'] = uniqid().$this->param['project_id'];
$id = $this->model->addReturnId($this->param);
}
}catch (\Exception $e){
$this->fail('保存数据失败,请联系管理员'.$e->getMessage());
}
return $this->success(['id'=>$id]);
}
/**
* @remark :删除数据
* @name :delWritingTask
* @author :lyh
* @method :post
* @time :2025/10/25 15:05
*/
public function delWriting()
{
$res = $this->model->del(['id'=>['in',$this->param['id']]]);
if($res === false){
$this->fail('删除失败,请联系管理员');
}
return $this->success();
}
}
... ...
... ... @@ -21,4 +21,55 @@ class GeoWritingsTaskLogic extends BaseLogic
$this->param = $this->requestAll;
$this->model = new GeoWritingsTask();
}
/**
* @remark :
* @name :listWritingTask
* @author :lyh
* @method :post
* @time :2025/10/25 15:13
*/
public function listWritingTask($map,$page,$row,$order){
$data = $this->model->lists($map,$page,$row,$order);
return $this->success($data);
}
/**
* @remark :保存AI文章数据
* @name :saveWritingTask
* @author :lyh
* @method :post
* @time :2025/10/25 14:41
* @param :project_id->项目ID;company->公司名称;brand->品牌词;keyword->关键词;prefix->前缀;suffix->后缀;event_title->事件标题;
* event_content->事件内容;title->标题;description->描述;footer->结尾引用;img->图片;ai_model->ai_model
*/
public function saveWritingTask(){
try {
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);
}
}catch (\Exception $e){
$this->fail('保存数据失败,请联系管理员'.$e->getMessage());
}
return $this->success(['id'=>$id]);
}
/**
* @remark :删除数据
* @name :delWritingTask
* @author :lyh
* @method :post
* @time :2025/10/25 15:05
*/
public function delWritingTask()
{
$res = $this->model->del(['id'=>['in',$this->param['id']]]);
if($res === false){
$this->fail('删除失败,请联系管理员');
}
return $this->success();
}
}
... ...
... ... @@ -401,7 +401,7 @@ class InquiryForwardLogic extends BaseLogic
$text = Translate::tran($text, $lang);
}
return $this->success(['ai_message' => Common::deal_str($text)]);
return $this->success(['ai_message' => str_replace('<br/>', PHP_EOL, Common::deal_str($text))]);
}
/**
... ...
... ... @@ -35,6 +35,9 @@ class WebSettingReceivingLogic extends BaseLogic
*/
public function setting_receiving_save(){
$data = [];
if(!isset($this->param['data']) || empty($this->param['data'])){
$this->fail('参数错误,请联系管理员');
}
foreach ($this->param['data'] as $v){
if($v['type'] == 1){
// 使用正则表达式匹配中国大陆手机号
... ...
<?php
/**
* @remark :
* @name :GeoWritingsTaskRequest.php
* @author :lyh
* @method :post
* @time :2025/10/25 14:21
*/
namespace App\Http\Requests\Aside\Geo;
use Illuminate\Foundation\Http\FormRequest;
class GeoWritingsRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'project_id' => 'required',
'title' => 'required|string',
'content' => 'required|string',
];
}
}
... ...
<?php
/**
* @remark :
* @name :GeoWritingsTaskRequest.php
* @author :lyh
* @method :post
* @time :2025/10/25 14:21
*/
namespace App\Http\Requests\Aside\Geo;
use Illuminate\Foundation\Http\FormRequest;
class GeoWritingsTaskRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'project_id' => 'required',
'company' => 'required|string',
'brand' => 'required|string',
'keyword' => 'required|string',
'prefix' => 'required|string',
'suffix' => 'required|string',
'event_title' => 'required|string',
'event_content' => 'required|string',
'title' => 'required|string|max:120',
'description' => 'required|string',
'footer' => 'required|string',
'img' => 'required|string',
'ai_model' => 'required|string',
];
}
}
... ...
... ... @@ -26,7 +26,7 @@ class NewsRequest extends FormRequest
return [
'name'=>'required|max:200',
'url'=>'required',
// 'seo_title' => 'max:70',
'seo_title' => 'max:70',
'seo_keywords' => 'max:300',
'seo_description' => 'max:200',
];
... ... @@ -38,7 +38,7 @@ class NewsRequest extends FormRequest
'name.required'=>'请填写名称',
'name.max'=>'名称超过最长长度200',
'url.required'=>'链接不能为空',
// 'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过300个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
];
... ...
... ... @@ -23,33 +23,6 @@ class GeoConf extends Base
*/
protected $table = 'gl_project_geo_conf';
/**
* 保存GEO相关配置
* @param $project_id
* @param $manager_id
* @param $company
* @param $brand
* @param $description
* @param $prefix
* @param $suffix
* @return GeoConf
*/
public static function saveConf($project_id, $manager_id, $company, $brand, $description, $prefix, $suffix)
{
$data = self::where(compact('project_id'))->first();
if (empty($data)) {
$data = new self();
$data->project_id = $project_id;
}
$data->manager_id = $manager_id;
$data->company = $company;
$data->brand = $brand;
$data->description = $description;
$data->prefix = $prefix;
$data->suffix = $suffix;
$data->save();
return $data;
}
/**
* GEO 负责人集合
... ...
... ... @@ -60,26 +60,6 @@ class GeoConfirm extends Base
];
}
/**
* @param $project_id
* @param $type
* @param $content
* @param $max_num
* @return GeoConfirm
*/
public static function saveContent($project_id, $type, $content, $max_num)
{
$data = self::where(compact('project_id', 'type'))->first();
if (empty($data)) {
$data = new self();
$data->project_id = $project_id;
$data->type = $type;
}
$data->content = $content;
$data->max_num = $max_num;
$data->save();
return $data;
}
/**
* 保存确认数据
... ...
... ... @@ -110,5 +110,8 @@ Route::prefix('ticket_upload')->group(function () {
//geo设置
Route::prefix('geo')->group(function () {
Route::any('/getConfirm', [\App\Http\Controllers\Api\GeoController::class, 'getConfirm'])->name('geo.getConfirm');
Route::any('/getWritingsList', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsList'])->name('geo.getWritingsList');//确认文章数据
Route::any('/getWritingsDetail', [\App\Http\Controllers\Api\GeoController::class, 'getWritingsDetail'])->name('geo.getWritingsDetail');//文章数据详情
Route::any('/saveConfirm', [\App\Http\Controllers\Api\GeoController::class, 'saveConfirm'])->name('geo.saveConfirm');//保存用户确认信息
});
... ...
... ... @@ -586,11 +586,26 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/downloadGeoLink', [Aside\Geo\GeoLinkController::class, 'downloadGeoLink'])->name('admin.geo_link_downloadGeoLink');
Route::any('/daResultData', [Aside\Geo\GeoLinkController::class, 'daResultData'])->name('admin.geo_link_daResultData');
});
//geo设置
//geo信息详情设置
Route::prefix('conf')->group(function () {
Route::any('/getConfig', [Aside\Geo\GeoController::class, 'getConfig'])->name('admin.geo_conf_getConfig');
Route::any('/saveConfig', [Aside\Geo\GeoController::class, 'saveConfig'])->name('admin.geo_conf_saveConfig');
Route::any('/saveConfirmContent', [Aside\Geo\GeoController::class, 'saveConfirmContent'])->name('admin.geo_conf_saveConfirmContent');
});
//geo客户确认信息
Route::prefix('confirm')->group(function () {
Route::any('/saveConfirmContent', [Aside\Geo\GeoConfirmController::class, 'saveConfirmContent'])->name('admin.geo_confirm_saveConfirmContent');
});
//geoai文章任务管理
Route::prefix('writing_task')->group(function () {
Route::any('/', [Aside\Geo\GeoWritingTaskController::class, 'lists'])->name('admin.geo_writing_task_lists');
Route::any('/saveWritingTask', [Aside\Geo\GeoWritingTaskController::class, 'saveWritingTask'])->name('admin.geo_writing_task_saveWritingTask');
Route::any('/delWritingTask', [Aside\Geo\GeoWritingTaskController::class, 'delWritingTask'])->name('admin.geo_writing_task_delWritingTask');
});
//geo文章管理
Route::prefix('writing')->group(function () {
Route::any('/', [Aside\Geo\GeoWritingsController::class, 'lists'])->name('admin.geo_writing_task');
Route::any('/saveWriting', [Aside\Geo\GeoWritingsController::class, 'saveWriting'])->name('admin.geo_writing_saveWriting');
Route::any('/delWriting', [Aside\Geo\GeoWritingsController::class, 'delWriting'])->name('admin.geo_writing_delWriting');
});
});
// 任务相关
... ...