OaNoticeLogic.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
85
86
87
88
89
<?php
/**
* @remark :
* @name :OaNoticeLogic.php
* @author :lyh
* @method :post
* @time :2024/6/20 10:48
*/
namespace App\Http\Logic\Aside\Com;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Manage\Manage;
use App\Models\OaNotice\OaNotice;
use App\Models\Project\Project;
class OaNoticeLogic extends BaseLogic
{
/**
* 初始数据
*/
public function __construct()
{
parent::__construct();
$this->model = new OaNotice();
$this->param = $this->requestAll;
}
/**
* @remark :保存数据
* @name :saveOaNotice
* @author :lyh
* @method :post
* @time :2024/6/20 15:03
*/
public function saveOaNotice(){
$this->param['operator_id'] = $this->manager['id'];
$project_str = trim($this->param['project_str'],',');
if($project_str == 0){
$this->param['project_str'] = 'all';
}
if($project_str != 'all'){
$this->param['project_str'] = ','.$project_str.',';
}
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 :statusOaNotice
* @author :lyh
* @method :post
* @time :2024/6/20 15:44
*/
public function statusOaNotice(){
$id = $this->param['id'];
$this->model->edit(['status'=>$this->param['status']],['id'=>$id]);
return $this->success(['id'=>$id]);
}
/**
* @remark :获取详情
* @name :infoOaNotice
* @author :lyh
* @method :post
* @time :2024/6/20 16:04
*/
public function infoOaNotice(){
$info = $this->model->read($this->param);
if($info == false){
$this->fail('当前数据不存在或已被删除');
}
$info['project_str'] = trim($info['project_str'],',');
if(strtolower($info['project_str']) != 'all'){
$projectModel = new Project();
$info['project_title'] = $projectModel->formatQuery(['id'=>['in',explode(',',$info['project_str'])]])->pluck('title')->toArray();
}else{
$info['project_title'] = '所有';
}
$info['operator_name'] = (new Manage())->getName($info['operator_id']);
return $this->success($info);
}
}