GeoQuestionController.php
3.7 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
/**
* @remark :
* @name :GeoQuestionController.php
* @author :lyh
* @method :post
* @time :2025/7/2 17:42
*/
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 Illuminate\Http\Request;
/**
* @remark :项目geo设置
* @name :GeoQuestionController
* @author :lyh
* @method :post
* @time :2025/7/2 17:42
*/
class GeoQuestionController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new GeoLogic();
}
/**
* @remark :开启或关闭geo设置
* @name :setGeoStatus
* @author :lyh
* @method :post
* @time :2025/7/2 17:50
*/
public function setGeoStatus(){
$this->request->validate([
'project_id'=>'required',
'geo_status'=>'required',
'geo_frequency'=>'required',
],[
'project_id.required' => '项目ID不能为空',
'geo_status.required' => '项目开启与关闭不能为空',
'geo_frequency.required' => '项目发送频率不能为空',
]);
$data = $this->logic->setGeoStatus();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :获取类型
* @name :getType
* @author :lyh
* @method :post
* @time :2025/7/3 10:46
*/
public function getType(){
$data = $this->logic->getType();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :问题列表
* @name :getGeoQuestion
* @author :lyh
* @method :post
* @time :2025/7/3 9:09
*/
public function getGeoQuestionList(){
$this->request->validate([
'project_id'=>'required',
],[
'project_id.required' => '项目ID不能为空',
]);
$data = $this->logic->getGeoQuestionList($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存问题数据
* @name :saveGeoQuestion
* @author :lyh
* @method :post
* @time :2025/7/3 9:31
* @param : question->提交的问题
* @param : url->提交的网址
* @param : keywords->提交的关键字
* @param : status->状态(0:可执行 1:禁止执行)
* @param : project_id->项目id
* @param : type->类型()
*/
public function saveGeoQuestion(){
$this->request->validate([
'project_id'=>'required',
'question'=>'required',
'keywords'=>'required',
'url'=>'required',
'status'=>'required',
'type'=>'required',
],[
'project_id.required' => '项目ID不能为空',
'question.required' => '项目ID不能为空',
'keywords.required' => '项目ID不能为空',
'url.required' => '项目ID不能为空',
'status.required' => '项目ID不能为空',
'type.required' => '类型不能为空',
]);
$data = $this->logic->saveGeoQuestion();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :删除问题
* @name :del
* @author :lyh
* @method :post
* @time :2025/7/3 10:11
* @param :id->主键
*/
public function delGeoQuestion(){
$this->request->validate([
'ids'=>'required|array',
],[
'ids.required' => 'ID集合不能为空',
'ids.array' => 'ID集合为数组',
]);
$data = $this->logic->delGeoQuestion();
$this->response('success',Code::SUCCESS,$data);
}
}