|
...
|
...
|
@@ -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);
|
|
|
|
}
|
...
|
...
|
|