TutorialLogic.php
1.8 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
<?php
/**
* @remark :
* @name :TutorialLogic.php
* @author :lyh
* @method :post
* @time :2024/5/13 17:38
*/
namespace App\Http\Logic\Aside\Tutorial;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Tutorial\Tutorial;
class TutorialLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new Tutorial();
$this->param = $this->requestAll;
}
/**
* @remark :保存数据
* @name :saveTutorial
* @author :lyh
* @method :post
* @time :2024/5/13 17:39
*/
public function saveTutorial(){
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 :statusTutorial
* @author :lyh
* @method :post
* @time :2024/5/13 17:42
*/
public function statusTutorial(){
$rs = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]);
return $this->success($rs);
}
/**
* @remark :修改状排序
* @name :statusTutorial
* @author :lyh
* @method :post
* @time :2024/5/13 17:42
*/
public function sortTutorial(){
$rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]);
return $this->success($rs);
}
/**
* @remark :删除数据
* @name :delTutorial
* @author :lyh
* @method :post
* @time :2024/5/13 17:41
*/
public function delTutorial(){
$rs = $this->model->del(['id'=>$this->param['id']]);
return $this->success($rs);
}
}