>[warning] 使用前必须引入**Organization**模型
use app\common\model\sys\Organization as OrgModel;
#### bindToOrg()-将指定的用户绑定到指定的组织机构下,并绑定对应的组织机构角色和岗位
>[info] bindToOrg(array $data,$sync=true){}
### 参数
* data:用户参数
* UserId:用户编号
* OrgId:组织机构编号
* OrgRoleId:组织机构管理角色
* PostId:岗位编号
* sync:是否需要同步到远端
* true:同步到远端
* false:不同步到远端
>[success]返回值
### error
```php
array(
'code' => 0,
'msg' => '提示信息'
)
```
### success
```php
array(
'code' => 1,
'msg' => 'success'
)
```
>[success]示例代码
```php
$this->model = new OrgModel;
$data =array(
'OrgId' =>$orgId,
'UserId' =>$userInfo['UserId'],
'PostId' =>$PostId,
'OrgRoleId' =>(isset($params['OrgRoleId']))?trim($params['OrgRoleId']):'',
'entry_date' =>(empty($PostId))?'':trim($params['entry_date']),
'IsMaster' =>(isset($params['IsMaster']))?intval($params['IsMaster']):0
);
$res = $this->model->bindToOrg($data,true);
if($res['code']==1){
$this->success();
}else{
$this->error('绑定用户到组织机构失败:'.$res['msg']);
}
```
- 空白目录
- 简介
- 前端
- 组件
- 文件上传
- 用户选择
- 组织机构选择
- 角色岗位选择
- 岗位选择
- 用户组选择
- 高拍仪上传
- 公共类库
- 组织机构
- bindToOrg
- bindusertoremote
- getAncestors
- getAllChildIds
- getByOrgId
- getByThirdAppPkId
- getChilds
- getChildsCount
- getMasterOrg
- getOrgUserById
- getOrgUser
- getOrgRoleData
- getOrgRoleQuota
- getOrgRoleUserCount
- getParents
- getPosteritys
- getTreeArray
- getUserOrgs
- getUserOrgCount
- getUserOrgRoleInfo
- hasChild
- hasMasterOrg
- hasBind
- isOrgUser
- updateOrg
- 用户管理
- getAuthorInfo
- getByDuty
- getByGroup
- getByMobile
- getByOrg
- getByUserId
- getByUserName
- getByRole
- getByToken
- getByThirdUserId
- getUserOrgs
- getUserRoles
- getUserList
- 统一待办
- createTodo
- createHandle
- createRead
- removeTodo
- getTodoList
- setReaded