作者 赵彬吉
... ... @@ -50,10 +50,41 @@ class TicketUploadDataController extends BaseController
'project_id.required' => 'project_id不能为空',
]);
$data = $this->model->lists($this->map, $this->page, $this->row, $this->order);
if(!empty($data) && !empty($data['list'])){
foreach ($data['list'] as &$item) {
$item['text']['cate_name'] = $this->cateText($item['type'],$item['text']['category_id'] ?? []);
}
}
$this->response('success', Code::SUCCESS, $data);
}
/**
* @remark :获取分类名称
* @name :cateText
* @author :lyh
* @method :post
* @time :2025/9/29 17:18
*/
public function cateText($type,$category_id)
{
if(!empty($category_id)){
return '';
}else{
$filed = 'name';
if($type == 1){
$cateModel = new Category();
$filed = 'title';
}elseif ($type == 2){
$cateModel = new BlogCategory();
}else{
$cateModel = new NewsCategory();
}
$cateArr = $cateModel->selectField(['id'=>['in',$category_id]],$filed);
return implode(',',$cateArr);
}
}
/**
* @remark :获取数据详情
* @name :info
* @author :lyh
... ... @@ -91,7 +122,17 @@ class TicketUploadDataController extends BaseController
]);
//验证当前数据是否已提交
$this->param['text'] = json_encode($this->param['text'], true);
$info = $this->model->read(['project_id' => $this->$this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]);
if(isset($this->param['id']) && !empty($this->param['id'])){
//执行编辑
$info = $this->model->read(['id'=>$this->param['id']]);
if($info['status'] == 0){
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->response('当前状态不允许编辑', Code::SYSTEM_ERROR);
}
$this->response('success');
}else{
$info = $this->model->read(['project_id' => $this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]);
if ($info === false) {
$id = $this->model->addReturnId($this->param);
} else {
... ... @@ -100,6 +141,7 @@ class TicketUploadDataController extends BaseController
$data = ['id' => $id];
$this->response('success', Code::SUCCESS, $data);
}
}
/**
* @remark :根据项目获取分类
... ... @@ -123,10 +165,10 @@ class TicketUploadDataController extends BaseController
if ($this->param['type'] == 1) {
//todo::搜索获取分类
$productCateModel = new Category();
$data = $productCateModel->lists(['title' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
$data = $productCateModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
} else {
$keywordModel = new Keyword();
$data = $keywordModel->lists(['title' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
$data = $keywordModel->lists(['title' => ['like','%' . $this->param['search'] . '%']], 1, 20,'id',['id','title as name']);
}
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
... ... @@ -150,7 +192,7 @@ class TicketUploadDataController extends BaseController
]);
ProjectServer::useProject($this->param['project_id']);
$blogCateModel = new BlogCategory();
$data = $blogCateModel->lists(['name' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
$data = $blogCateModel->lists(['name' => ['like' ,'%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']);
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
}
... ... @@ -173,7 +215,7 @@ class TicketUploadDataController extends BaseController
]);
ProjectServer::useProject($this->param['project_id']);
$newsCateModel = new NewsCategory();
$data = $newsCateModel->lists(['name' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
$data = $newsCateModel->lists(['name' => ['like' , '%' . $this->param['search'] . '%']], 1, 20,'id',['id','name']);
DB::disconnect('custom_mysql');
$this->response('success', Code::SUCCESS, $data);
}
... ...
... ... @@ -37,6 +37,11 @@ class TicketUploadDataController extends BaseController
* @time :2025/9/25 14:02
*/
public function lists(){
$this->request->validate([
'project_id'=>'required'
],[
'project_id.required' => 'project_id不能为空',
]);
if(isset($this->map['text']) && !empty($this->map['text'])){
$this->map['text'] = ['like','%'.$this->map['text'].'%'];
}
... ...
... ... @@ -82,8 +82,8 @@ class AiBlogController extends BaseController
* @method :post
* @time :2023/7/5 14:33
*/
public function save(AiBlogLogic $aiBlogLogic){
// $aiBlogRequest->validated();
public function save(AiBlogRequest $aiBlogRequest,AiBlogLogic $aiBlogLogic){
$aiBlogRequest->validated();
$aiBlogLogic->blogSave();
$this->response('success');
}
... ...
... ... @@ -218,14 +218,15 @@ class BlogController extends BaseController
public function edit_seo(BlogLogic $blogLogic){
$this->request->validate([
'id'=>['required'],
'seo_title'=>['required'],
'seo_description'=>['required'],
'seo_keywords'=>['required'],
'seo_title'=>['required','max:70'],
'seo_description'=>['required','max:200'],
'seo_keywords'=>['required','max:200'],
],[
'id.required' => 'ID不能为空',
'seo_title.required' => 'seo_title不能为空',
'seo_description.required' => 'seo_description不能为空',
'seo_keywords.required' => 'seo_description不能为空',
'seo_title.max' => 'seo_title不能超过70个字符',
]);
$blogLogic->edit_seo();
$this->response('success');
... ...
... ... @@ -200,11 +200,17 @@ class CustomModuleContentController extends BaseController
$this->request->validate([
'name'=>['required'],
'route'=>['required'],
'module_id'=>['required']
'module_id'=>['required'],
'seo_title'=>['max:70'],
'seo_keywords'=>['max:200'],
'seo_description'=>['max:200'],
],[
'name.required' => '分类名称不能为空',
'route.required' => '分类路由不能为空',
'module_id.required' => '所选模块id不能为空'
'module_id.required' => '所选模块id不能为空',
'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
]);
$data = $logic->contentSave();
$this->response('success',Code::SUCCESS,$data);
... ...
... ... @@ -211,14 +211,8 @@ class NewsController extends BaseController
public function edit_seo(NewsLogic $newsLogic){
$this->request->validate([
'id'=>['required'],
'seo_title'=>['required'],
'seo_description'=>['required'],
'seo_keywords'=>['required'],
],[
'id.required' => 'ID不能为空',
'seo_title.required' => 'seo_title不能为空',
'seo_description.required' => 'seo_description不能为空',
'seo_keywords.required' => 'seo_description不能为空',
]);
$newsLogic->edit_seo();
$this->response('success');
... ...
... ... @@ -12,7 +12,10 @@ namespace App\Http\Logic\Aside\Ticket;
use App\Helper\Arr;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Blog\Blog;
use App\Models\Blog\BlogCategory;
use App\Models\News\News;
use App\Models\News\NewsCategory;
use App\Models\Product\Category;
use App\Models\Product\CategoryRelated;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
... ... @@ -41,10 +44,15 @@ class TicketUploadDataLogic extends BaseLogic
if(isset($this->map['text']) && !empty($this->map['text'])){
$this->map['text'] = ['like','%'.$this->map['text'].'%'];
}
ProjectServer::useProject($map['project_id']);
$data = $this->model->lists($map,$page,$row,$order);
foreach ($data as &$v){
if(!empty($data) && !empty($data['list'])){
foreach ($data['list'] as &$v){
$v = $this->getHandleFileImage($v);
$v['text']['cate_text'] = $this->cateText($v['type'],$v['text']['category_id'] ?? []);
}
}
DB::disconnect('custom_mysql');
return $this->success($data);
}
... ... @@ -59,17 +67,43 @@ class TicketUploadDataLogic extends BaseLogic
if($v['type'] == 1){
if(!empty($v['text']['image'])){
foreach ($v['text']['image'] as $gallery_k => $gallery_v){
$gallery_v['url'] = getImageUrl($gallery_v['url'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
$gallery_v['url'] = getImageUrl($gallery_v['url']);
$info['text']['image'][$gallery_k] = $gallery_v;
}
}
}else{
$v['text']['image'] = getImageUrl($v['text']['image'],$this->user['storage_type'],$this->user['project_location']);
$v['text']['image'] = getImageUrl($v['text']['image']);
}
return $this->success($v);
}
/**
* @remark :获取分类名称
* @name :cateText
* @author :lyh
* @method :post
* @time :2025/9/29 17:18
*/
public function cateText($type,$category_id)
{
if(!empty($category_id)){
return '';
}else{
$filed = 'name';
if($type == 1){
$cateModel = new Category();
$filed = 'title';
}elseif ($type == 2){
$cateModel = new BlogCategory();
}else{
$cateModel = new NewsCategory();
}
$cateArr = $cateModel->selectField(['id'=>['in',$category_id]],$filed);
return implode(',',$cateArr);
}
}
/**
* @remark :获取当前数据详情
* @name :getDetail
* @author :lyh
... ...
... ... @@ -49,6 +49,7 @@ class GeoQuestionResLogic extends BaseLogic
public function getResultList($map = [],$page = 1,$row = 20,$order = 'created_at',$sort = 'desc'){
unset($map['sort']);
$map['project_id'] = $this->user['project_id'];
$map['hit'] = ['!=',0];
$filed = ['id','project_id','question_id','platform','is_match','question','en_question','keywords','url','label','cosine','created_at','updated_at'];
if(!empty($map['created_at'])){
$map['created_at'] = ['between',[$map['created_at'].' 00:00:00',$map['created_at'].' 23:59:59']];
... ...
... ... @@ -25,6 +25,9 @@ class AiBlogRequest extends FormRequest
{
return [
'new_title'=>'required',
'seo_title'=>'max:70',
'seo_keywords'=>'max:200',
'seo_description'=>'max:200',
];
}
... ... @@ -32,6 +35,9 @@ class AiBlogRequest extends FormRequest
{
return [
'new_title.required' => '新标题不能为空',
'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
];
}
}
... ...
... ... @@ -24,7 +24,10 @@ class BlogCategoryRequest extends FormRequest
public function rules()
{
return [
'name'=>'required|max:100',
'name'=>'required|max:200',
'seo_title'=>'max:70',
'seo_keywords'=>'max:200',
'seo_description'=>'max:200',
];
}
... ... @@ -32,7 +35,10 @@ class BlogCategoryRequest extends FormRequest
{
return [
'name.required'=>'请填写名称',
'name.max'=>'名称最大100字',
'name.max'=>'名称最大200字',
'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
];
}
}
... ...
... ... @@ -25,9 +25,11 @@ class BlogRequest extends FormRequest
{
return [
'name'=>'required|max:200',
'seo_keywords'=>'max:500',
'remark'=>'max:1000',
'url'=>'required',
'seo_title'=>'max:70',
'seo_keywords'=>'max:200',
'seo_description'=>'max:200',
// 'text'=>'max:5000',
];
}
... ... @@ -38,7 +40,9 @@ class BlogRequest extends FormRequest
'name.required'=>'请填写名称',
'name.max'=>'名称超过最长长度200',
'url.required'=>'链接不能为空',
'seo_keywords.max'=>'seo_keywords太长,请重新编辑',
'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
'remark.max'=>'描述超过最长长度1000',
// 'text.max'=>'详情内容超过最大长度',
];
... ...
... ... @@ -24,7 +24,10 @@ class NewsCategoryRequest extends FormRequest
public function rules()
{
return [
'name'=>'required|max:100',
'name'=>'required|max:200',
'seo_title'=>'max:70',
'seo_keywords'=>'max:200',
'seo_description'=>'max:200',
];
}
... ... @@ -33,6 +36,9 @@ class NewsCategoryRequest extends FormRequest
return [
'name.required'=>'请填写名称',
'name.max'=>'名称最大100字',
'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
];
}
}
... ...
... ... @@ -27,6 +27,9 @@ class NewsRequest extends FormRequest
'name'=>'required|max:200',
// 'remark'=>'max:2000',
'url'=>'required',
'seo_title' => 'max:70',
'seo_keywords' => 'max:200',
'seo_description' => 'max:200',
];
}
... ... @@ -37,6 +40,9 @@ class NewsRequest extends FormRequest
'name.max'=>'名称超过最长长度200',
'url.required'=>'链接不能为空',
// 'remark.max'=>'描述超过最长长度2000'
'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过300个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
];
}
}
... ...
... ... @@ -31,9 +31,9 @@ class KeywordRequest extends FormRequest
{
return [
'title'=>'required|max:200',
'seo_title'=>'max:255',
'seo_keywords'=>'max:500',
'seo_description'=>'max:500',
'seo_title'=>'max:70',
'seo_keywords'=>'max:200',
'seo_description'=>'max:200',
'related_news_ids'=>'array|max:2',
'related_blog_ids'=>'array|max:2',
];
... ... @@ -44,9 +44,9 @@ class KeywordRequest extends FormRequest
return [
'title.required' => '请输入关键词',
'title.max' => '关键词不能超过200个字符',
'seo_title.max' => 'SEO标题不能超过255个字符',
'seo_keywords.max' => 'SEO关键词不能超过500个字符',
'seo_description.max' => 'SEO描述不能超过500个字符',
'seo_title.max' => 'SEO标题不能超过70个字符',
'seo_keywords.max' => 'SEO关键词不能超过200个字符',
'seo_description.max' => 'SEO描述不能超过200个字符',
'related_news_ids.max' => '关联新闻不能超过两条',
'related_blog_ids.max' => '关联博客不能超过两条',
];
... ...
... ... @@ -38,6 +38,9 @@ class ProductRequest extends FormRequest
return [
'title' => 'required|max:200',
'route' => 'required|max:200',
'seo_mate.title' => 'max:70',
'seo_mate.keyword' => 'max:200',
'seo_mate.description' => 'max:200',
'status' => ['required', Rule::in(array_keys(Product::statusMap()))],
];
}
... ... @@ -51,6 +54,10 @@ class ProductRequest extends FormRequest
'route.max' => '产品链接不能超过200个字符',
'status.required' => '请选择产品状态',
'status.in' => '产品状态值异常',
// 可选的 seo_mate 子字段的提示
'seo_mate.title.max' => 'SEO 标题不能超过70个字符',
'seo_mate.keyword.max' => 'SEO 关键字不能超过200个字符',
'seo_mate.description.max' => 'SEO 描述不能超过200个字符',
];
}
... ...