|
...
|
...
|
@@ -4,6 +4,8 @@ namespace App\Http\Logic\Aside\User; |
|
|
|
|
|
|
|
use App\Helper\Common;
|
|
|
|
use App\Http\Logic\Aside\BaseLogic;
|
|
|
|
use App\Models\Manage\Manage;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\User\ProjectMenu as ProjectMenuModel;
|
|
|
|
use App\Models\User\ProjectRole;
|
|
|
|
use App\Models\User\User as UserModel;
|
|
...
|
...
|
@@ -28,10 +30,10 @@ class ProjectRoleLogic extends BaseLogic |
|
|
|
public function role_get_menu(){
|
|
|
|
$menuModel = new ProjectMenuModel();
|
|
|
|
$this->param['status'] = $this::STATUS_ONE;
|
|
|
|
$lists = $menuModel->list($this->param,'id');
|
|
|
|
$lists = $menuModel->list($this->param,'created_at');
|
|
|
|
$menu = array();
|
|
|
|
if(!empty($lists)){
|
|
|
|
foreach ($lists as $k => $v){
|
|
|
|
foreach ($lists as $v){
|
|
|
|
$v = (array)$v;
|
|
|
|
if ($v['pid'] == 0) {
|
|
|
|
$v['sub'] = _get_child($v['id'], $lists);
|
|
...
|
...
|
@@ -55,6 +57,14 @@ class ProjectRoleLogic extends BaseLogic |
|
|
|
if($info === false){
|
|
|
|
$this->fail('当前数据不存在');
|
|
|
|
}
|
|
|
|
if($info['type'] == 1){
|
|
|
|
$userModel = new UserModel();
|
|
|
|
$info['operator_name'] = $userModel->read(['id'=>$info['operator_id']],['name'])['name'];
|
|
|
|
}else{
|
|
|
|
$managerModel = new Manage();
|
|
|
|
$info['operator_name'] = $managerModel->read(['id'=>$info['operator_id']],['name'])['name'];
|
|
|
|
}
|
|
|
|
$info['project_name'] = (new Project())->read(['id'=>$info['project_id']],['title'])['title'];
|
|
|
|
Common::set_user_cache($info,$this->model,$this->param['id'],'A');
|
|
|
|
}
|
|
|
|
return $this->success($info);
|
|
...
|
...
|
@@ -68,10 +78,17 @@ class ProjectRoleLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function role_add(){
|
|
|
|
//查询当前名称是否存在
|
|
|
|
$info = $this->model->read(['name'=>$this->param['name']]);
|
|
|
|
$info = $this->model->read([
|
|
|
|
'name'=>$this->param['name'],
|
|
|
|
'project_id'=>$this->param['project_id']]);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前菜单名称已存在');
|
|
|
|
$this->fail('当前角色名称已存在');
|
|
|
|
}
|
|
|
|
//类型
|
|
|
|
$this->param['type'] = $this->model::TYPE_ONE;
|
|
|
|
//A端操作人
|
|
|
|
$this->param['create_id'] = $this->manager['id'];
|
|
|
|
$this->param['operator_id'] = $this->manager['id'];
|
|
|
|
$rs = $this->model->add($this->param);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('添加失败');
|
|
...
|
...
|
@@ -87,10 +104,14 @@ class ProjectRoleLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function role_edit(){
|
|
|
|
//查询当前名称是否存在
|
|
|
|
$info = $this->model->read(['name'=>$this->param['name'],'id'=>['!=',$this->param['id']]]);
|
|
|
|
$info = $this->model->read([
|
|
|
|
'name'=>$this->param['name'],
|
|
|
|
'id'=>['!=',$this->param['id']],
|
|
|
|
'project_id'=>$this->param['project_id']]);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前菜单名称已存在');
|
|
|
|
}
|
|
|
|
$this->param['operator_id'] = $this->manager['id'];
|
|
|
|
$rs = $this->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
...
|
...
|
|