DeptUserLogic.php
2.2 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
<?php
namespace App\Http\Logic\Bside\User;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\User\DeptUser;
use App\Models\User\User as UserModel;
class DeptUserLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new DeptUser();
$this->param = $this->requestAll;
}
/**
* @name :(部门用户)dept_user_add
* @author :lyh
* @method :post
* @time :2023/5/18 10:21
*/
public function dept_user_save(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$rs = $this->dept_user_edit($this->param);
}else{
$rs = $this->dept_user_add();
}
if ($rs === false) {
$this->fail('部门添加成员失败');
}
return $this->success();
}
/**
* @name :(部门添加用户)dept_user_add
* @author :lyh
* @method :post
* @time :2023/5/18 10:21
*/
public function dept_user_add(){
$param = [
'dept_id'=> $this->param['dept_id'],
'project_id'=>$this->user['project_id'],
'user_id'=>$this->param['user_id'],
'operator_id'=>$this->user['id'],
'create_id'=>$this->user['id']
];
$rs = $this->model->add($param);
if($rs === false){
$this->fail('部门添加成员失败');
}
return $this->success();
}
/**
* @name :(用户更改部门)dept_user_edit
* @author :lyh
* @method :post
* @time :2023/5/17 17:54
*/
public function dept_user_edit($param){
$rs = $this->model->edit($param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
/**
* @name :(用户设置角色)user_edit_role
* @author :lyh
* @method :post
* @time :2023/5/19 9:35
*/
public function user_edit_role(){
$userModel = new UserModel();
$rs = $userModel->edit(['role_id'=>$this->param['role_id']],['id'=>$this->param['id']]);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
}