|
@@ -7,8 +7,10 @@ use App\Http\Logic\Aside\BaseLogic; |
|
@@ -7,8 +7,10 @@ use App\Http\Logic\Aside\BaseLogic; |
|
7
|
use App\Models\Manage\Manage;
|
7
|
use App\Models\Manage\Manage;
|
|
8
|
use App\Models\Manage\MenuSpecial;
|
8
|
use App\Models\Manage\MenuSpecial;
|
|
9
|
use App\Models\Project\Project;
|
9
|
use App\Models\Project\Project;
|
|
|
|
10
|
+use App\Models\User\ProjectRole;
|
|
10
|
use App\Models\User\User;
|
11
|
use App\Models\User\User;
|
|
11
|
use App\Models\User\User as UserModel;
|
12
|
use App\Models\User\User as UserModel;
|
|
|
|
13
|
+use Illuminate\Support\Facades\DB;
|
|
12
|
|
14
|
|
|
13
|
class UserLogic extends BaseLogic
|
15
|
class UserLogic extends BaseLogic
|
|
14
|
{
|
16
|
{
|
|
@@ -40,10 +42,11 @@ class UserLogic extends BaseLogic |
|
@@ -40,10 +42,11 @@ class UserLogic extends BaseLogic |
|
40
|
}
|
42
|
}
|
|
41
|
|
43
|
|
|
42
|
/**
|
44
|
/**
|
|
43
|
- * @name :添加会员
|
|
|
|
44
|
- * @return void
|
|
|
|
45
|
- * @author :liyuhang
|
|
|
|
46
|
- * @method
|
45
|
+ * @remark :保存用户
|
|
|
|
46
|
+ * @name :projectUserSave
|
|
|
|
47
|
+ * @author :lyh
|
|
|
|
48
|
+ * @method :post
|
|
|
|
49
|
+ * @time :2023/9/22 14:35
|
|
47
|
*/
|
50
|
*/
|
|
48
|
public function projectUserSave()
|
51
|
public function projectUserSave()
|
|
49
|
{
|
52
|
{
|
|
@@ -150,13 +153,18 @@ class UserLogic extends BaseLogic |
|
@@ -150,13 +153,18 @@ class UserLogic extends BaseLogic |
|
150
|
*/
|
153
|
*/
|
|
151
|
public function user_del()
|
154
|
public function user_del()
|
|
152
|
{
|
155
|
{
|
|
153
|
- $ids = $this->param['id'];
|
|
|
|
154
|
- $this->param['id'] = ['in', $this->param['id']];
|
|
|
|
155
|
- $rs = $this->model->del($this->param);
|
|
|
|
156
|
- if ($rs === false) {
|
|
|
|
157
|
- $this->fail('删除失败');
|
156
|
+ foreach ($this->param['id'] as $id){
|
|
|
|
157
|
+ $info = $this->model->read(['id'=>$id],['id','role_id']);
|
|
|
|
158
|
+ if($info['role_id'] != 0){
|
|
|
|
159
|
+ $rs = $this->model->del(['id'=>$id]);
|
|
|
|
160
|
+ if($rs === false){
|
|
|
|
161
|
+ $this->fail('系统错误,请联系管理员');
|
|
|
|
162
|
+ }
|
|
|
|
163
|
+ Common::del_user_cache($this->model, $id, 'A');
|
|
|
|
164
|
+ }else{
|
|
|
|
165
|
+ $this->fail('超级管理员不允许删除');
|
|
|
|
166
|
+ }
|
|
158
|
}
|
167
|
}
|
|
159
|
- Common::del_user_cache($this->model, $ids, 'A');
|
|
|
|
160
|
return $this->success();
|
168
|
return $this->success();
|
|
161
|
}
|
169
|
}
|
|
162
|
|
170
|
|
|
@@ -174,4 +182,27 @@ class UserLogic extends BaseLogic |
|
@@ -174,4 +182,27 @@ class UserLogic extends BaseLogic |
|
174
|
}
|
182
|
}
|
|
175
|
return $this->success();
|
183
|
return $this->success();
|
|
176
|
}
|
184
|
}
|
|
|
|
185
|
+
|
|
|
|
186
|
+ /**
|
|
|
|
187
|
+ * @remark :设置超级管理员
|
|
|
|
188
|
+ * @name :setRole
|
|
|
|
189
|
+ * @author :lyh
|
|
|
|
190
|
+ * @method :post
|
|
|
|
191
|
+ * @time :2023/9/22 14:38
|
|
|
|
192
|
+ */
|
|
|
|
193
|
+ public function setRole(){
|
|
|
|
194
|
+ DB::beginTransaction();
|
|
|
|
195
|
+ //获取当前用户的觉得
|
|
|
|
196
|
+ $roleModel = new ProjectRole();
|
|
|
|
197
|
+ $roleInfo = $roleModel->orderBy('id','asc')->first();
|
|
|
|
198
|
+ try {
|
|
|
|
199
|
+ $this->model->edit(['role_id'=>$roleInfo['id']],['role_id'=>0]);
|
|
|
|
200
|
+ $this->model->edit(['role_id'=>0],['id'=>$this->param['id']]);
|
|
|
|
201
|
+ DB::commit();
|
|
|
|
202
|
+ }catch (\Exception $e){
|
|
|
|
203
|
+ DB::rollBack();
|
|
|
|
204
|
+ $this->fail('系统错误,请联系管理员');
|
|
|
|
205
|
+ }
|
|
|
|
206
|
+ return $this->success();
|
|
|
|
207
|
+ }
|
|
177
|
} |
208
|
} |