SettingFaqLogic.php
2.0 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
<?php
/**
* @remark :
* @name :SettingFaqLogic.php
* @author :lyh
* @method :post
* @time :2025/10/29 16:34
*/
namespace App\Http\Logic\Bside\Setting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\RouteMap\RouteMap;
use App\Models\WebSetting\SettingFaq;
class SettingFaqLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new SettingFaq();
$this->param = $this->requestAll;
}
/**
* @remark :获取列表页数据
* @name :getFaqLists
* @author :lyh
* @method :post
* @time :2025/10/29 16:50
*/
public function getFaqLists($map = [],$page = 1, $row = 10,$order = 'id')
{
$lists = $this->model->lists($map,$page,$row,$order);
return $this->success($lists);
}
/**
* @remark :保存数据
* @name :saveFaq
* @author :lyh
* @method :post
* @time :2025/10/29 16:50
*/
public function saveFaq()
{
//todo::根据路由获取对应数据详情
$routeModel = new RouteMap();
$routeInfo = $routeModel->read(['route'=>$this->param['route']],['source','source_id']);
if($routeInfo === false){
$this->fail('路由不存在');
}
$this->param['qa'] = json_encode($this->param['qa'],true);
$this->param['source'] = $routeInfo['source'];
$this->param['source_id'] = $routeInfo['source_id'];
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$id]);
}else{
$id = $this->model->addReturnId($this->param);
}
return $this->success(['id' => $id]);
}
/**
* @remark :删除数据
* @name :deleteFaq
* @author :lyh
* @method :post
* @time :2025/10/29 17:27
*/
public function deleteFaq(){
$this->model->del(['id'=>['in',$this->param['id']]]);
return $this->success();
}
}