|
...
|
...
|
@@ -11,8 +11,14 @@ namespace App\Http\Controllers\Api\WorkOrder; |
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Http\Controllers\Api\BaseController;
|
|
|
|
use App\Models\Blog\BlogCategory;
|
|
|
|
use App\Models\News\NewsCategory;
|
|
|
|
use App\Models\Product\Category;
|
|
|
|
use App\Models\Product\Keyword;
|
|
|
|
use App\Models\Ticket\TicketUploadData;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :上传产品/博客/新闻模块
|
|
...
|
...
|
@@ -39,12 +45,12 @@ class TicketUploadDataController extends BaseController |
|
|
|
public function lists()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'project_id'=>'required',
|
|
|
|
],[
|
|
|
|
'project_id' => 'required',
|
|
|
|
], [
|
|
|
|
'project_id.required' => 'project_id不能为空',
|
|
|
|
]);
|
|
|
|
$data = $this->model->lists($this->map,$this->page,$this->row,$this->order);
|
|
|
|
$this->response('success',Code::SUCCESS,$data);
|
|
|
|
$data = $this->model->lists($this->map, $this->page, $this->row, $this->order);
|
|
|
|
$this->response('success', Code::SUCCESS, $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -54,14 +60,15 @@ class TicketUploadDataController extends BaseController |
|
|
|
* @method :post
|
|
|
|
* @time :2025/9/25 10:35
|
|
|
|
*/
|
|
|
|
public function info(){
|
|
|
|
public function info()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'id'=>'required',
|
|
|
|
],[
|
|
|
|
'id' => 'required',
|
|
|
|
], [
|
|
|
|
'id.required' => 'id不能为空',
|
|
|
|
]);
|
|
|
|
$data = $this->model->read($this->param);
|
|
|
|
$this->response('success',Code::SUCCESS,$data);
|
|
|
|
$this->response('success', Code::SUCCESS, $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -74,23 +81,100 @@ class TicketUploadDataController extends BaseController |
|
|
|
public function save()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'project_id'=>'required',
|
|
|
|
'type'=>'required',
|
|
|
|
'text'=>'required'
|
|
|
|
],[
|
|
|
|
'project_id' => 'required',
|
|
|
|
'type' => 'required',
|
|
|
|
'text' => 'required'
|
|
|
|
], [
|
|
|
|
'project_id.required' => 'project_id不能为空',
|
|
|
|
'type.required' => '上传类型不能为空',
|
|
|
|
'text'=>'数据详情不为空'
|
|
|
|
'text' => '数据详情不为空'
|
|
|
|
]);
|
|
|
|
//验证当前数据是否已提交
|
|
|
|
$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($info === false){
|
|
|
|
$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 ($info === false) {
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
$id = $info['id'];
|
|
|
|
}
|
|
|
|
$data = ['id'=>$id];
|
|
|
|
$this->response('success',Code::SUCCESS,$data);
|
|
|
|
$data = ['id' => $id];
|
|
|
|
$this->response('success', Code::SUCCESS, $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :根据项目获取分类
|
|
|
|
* @name :getProductCate
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/9/25 15:41
|
|
|
|
*/
|
|
|
|
public function getProductCate()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'project_id' => 'required',
|
|
|
|
'type' => 'required',
|
|
|
|
'search' => 'required'
|
|
|
|
], [
|
|
|
|
'project_id.required' => 'project_id不能为空',
|
|
|
|
'type.required' => 'type不能为空',
|
|
|
|
'search.required' => '搜索参数不能为空',
|
|
|
|
]);
|
|
|
|
ProjectServer::useProject($this->param['project_id']);
|
|
|
|
if ($this->param['type'] == 1) {
|
|
|
|
//todo::搜索获取分类
|
|
|
|
$productCateModel = new Category();
|
|
|
|
$data = $productCateModel->lists(['title' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
|
|
|
|
} else {
|
|
|
|
$keywordModel = new Keyword();
|
|
|
|
$data = $keywordModel->lists(['title' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
|
|
|
|
}
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
$this->response('success', Code::SUCCESS, $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取博客分类
|
|
|
|
* @name :getBlogCate
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/9/25 15:42
|
|
|
|
*/
|
|
|
|
public function getBlogCate()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'project_id' => 'required',
|
|
|
|
'search' => 'required'
|
|
|
|
], [
|
|
|
|
'project_id.required' => 'project_id不能为空',
|
|
|
|
'search.required' => '搜索参数不能为空',
|
|
|
|
]);
|
|
|
|
ProjectServer::useProject($this->param['project_id']);
|
|
|
|
$blogCateModel = new BlogCategory();
|
|
|
|
$data = $blogCateModel->lists(['name' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
$this->response('success', Code::SUCCESS, $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取新闻分类
|
|
|
|
* @name :getNewsCate
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/9/25 15:43
|
|
|
|
*/
|
|
|
|
public function getNewsCate()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'project_id' => 'required',
|
|
|
|
'search' => 'required'
|
|
|
|
], [
|
|
|
|
'project_id.required' => 'project_id不能为空',
|
|
|
|
'search.required' => '搜索参数不能为空',
|
|
|
|
]);
|
|
|
|
ProjectServer::useProject($this->param['project_id']);
|
|
|
|
$newsCateModel = new NewsCategory();
|
|
|
|
$data = $newsCateModel->lists(['name' => ['like' => '%' . $this->param['search'] . '%']], 1, 20);
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
$this->response('success', Code::SUCCESS, $data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|