|
...
|
...
|
@@ -7,8 +7,10 @@ use App\Http\Logic\Aside\BaseLogic; |
|
|
|
use App\Models\Manage\Manage;
|
|
|
|
use App\Models\Manage\MenuSpecial;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\User\ProjectRole;
|
|
|
|
use App\Models\User\User;
|
|
|
|
use App\Models\User\User as UserModel;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
class UserLogic extends BaseLogic
|
|
|
|
{
|
|
...
|
...
|
@@ -40,10 +42,11 @@ class UserLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @name :添加会员
|
|
|
|
* @return void
|
|
|
|
* @author :liyuhang
|
|
|
|
* @method
|
|
|
|
* @remark :保存用户
|
|
|
|
* @name :projectUserSave
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/22 14:35
|
|
|
|
*/
|
|
|
|
public function projectUserSave()
|
|
|
|
{
|
|
...
|
...
|
@@ -150,13 +153,18 @@ class UserLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function user_del()
|
|
|
|
{
|
|
|
|
$ids = $this->param['id'];
|
|
|
|
$this->param['id'] = ['in', $this->param['id']];
|
|
|
|
$rs = $this->model->del($this->param);
|
|
|
|
if ($rs === false) {
|
|
|
|
$this->fail('删除失败');
|
|
|
|
foreach ($this->param['id'] as $id){
|
|
|
|
$info = $this->model->read(['id'=>$id],['id','role_id']);
|
|
|
|
if($info['role_id'] != 0){
|
|
|
|
$rs = $this->model->del(['id'=>$id]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('系统错误,请联系管理员');
|
|
|
|
}
|
|
|
|
Common::del_user_cache($this->model, $id, 'A');
|
|
|
|
}else{
|
|
|
|
$this->fail('超级管理员不允许删除');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Common::del_user_cache($this->model, $ids, 'A');
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -174,4 +182,27 @@ class UserLogic extends BaseLogic |
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :设置超级管理员
|
|
|
|
* @name :setRole
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/9/22 14:38
|
|
|
|
*/
|
|
|
|
public function setRole(){
|
|
|
|
DB::beginTransaction();
|
|
|
|
//获取当前用户的觉得
|
|
|
|
$roleModel = new ProjectRole();
|
|
|
|
$roleInfo = $roleModel->orderBy('id','asc')->first();
|
|
|
|
try {
|
|
|
|
$this->model->edit(['role_id'=>$roleInfo['id']],['role_id'=>0]);
|
|
|
|
$this->model->edit(['role_id'=>0],['id'=>$this->param['id']]);
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
|
|
$this->fail('系统错误,请联系管理员');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|