>[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