TicketUploadDataLogic.php
2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* @remark :
* @name :TicketUploadDataLogic.php
* @author :lyh
* @method :post
* @time :2025/9/25 14:03
*/
namespace App\Http\Logic\Aside\Ticket;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Blog\Blog;
use App\Models\News\News;
use App\Models\Product\Product;
use App\Models\RouteMap\RouteMap;
use App\Models\Ticket\TicketUploadData;
use App\Services\ProjectServer;
use Illuminate\Support\Facades\DB;
class TicketUploadDataLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new TicketUploadData();
}
/**
* @remark :获取审核列表
* @name :getDataList
* @author :lyh
* @method :post
* @time :2025/9/25 14:17
*/
public function getDataList($map = [],$page = 1,$row = 20,$order = 'id'){
if(isset($this->map['text']) && !empty($this->map['text'])){
$this->map['text'] = ['like','%'.$this->map['text'].'%'];
}
$data = $this->model->lists($map,$page,$row,$order);
return $this->success($data);
}
/**
* @remark :保存数据详情
* @name :saveData
* @author :lyh
* @method :post
* @time :2025/9/25 14:17
*/
public function saveData(){
//获取当前数据详情
$info = $this->model->read(['id'=>$this->param['id']]);
if($info === false){
$this->fail('当前数据不存在或已被删除');
}
ProjectServer::useProject($info['project_id']);
if($info['type'] == 1){
//产品
$productModel = new Product();
$data = [
'project_id' => $info['project_id'],
'title' => $info['text']['title'],
'thumb'=>json_encode($info['text']['gallery'][0] ?? [],true),
'gallery'=>json_encode($info['text']['gallery'] ?? [],true),
'intro'=>$info['text']['remark'],
'category_id'=>$info['text']['category_id'],
'keyword_id'=>$info['text']['keyword_id'],
'status'=>0,
];
$id = $productModel->addReturnId($data);
RouteMap::setRoute($data['title'],RouteMap::SOURCE_PRODUCT,$id,$info['project_id']);
}elseif ($info['type'] == 2){
//博客
$blogModel = new Blog();
}else{
//新闻
$newsModel = new News();
}
DB::disconnect('custom_mysql');
}
}