...
|
...
|
@@ -59,15 +59,15 @@ type ModuleEmployee struct { |
|
|
|
|
|
//DeleteUserData 删除用户
|
|
|
type DeleteUserData struct {
|
|
|
CompanyId int64 `json:"companyId"`
|
|
|
Ids []int64 `json:"ids"`
|
|
|
// CompanyId int64 `json:"companyId"`
|
|
|
Ids []int64 `json:"ids"`
|
|
|
}
|
|
|
|
|
|
//ForbidAllowUserData 启用禁用用户
|
|
|
type ForbidAllowUserData struct {
|
|
|
CompanyId int64 `json:"companyId"`
|
|
|
Ids []int64 `json:"ids"`
|
|
|
Status int8 `json:"status"`
|
|
|
// CompanyId int64 `json:"companyId"`
|
|
|
Ids []int64 `json:"ids"`
|
|
|
Status int8 `json:"status"`
|
|
|
}
|
|
|
|
|
|
//RemoveUserDepartmentData 移动通讯录用户部门
|
...
|
...
|
@@ -559,12 +559,13 @@ func editUserPosition(usercompanyid int64, companyid int64, userPosition []UserP |
|
|
|
|
|
// DeleteEmployeeData ...
|
|
|
func DeleteEmployeeData(data DeleteUserData) error {
|
|
|
companyData, err := models.GetCompanyByUCenter(data.CompanyId)
|
|
|
if err != nil {
|
|
|
log.Error("h获取公司数据失败,user_center_id=%d,err:%s", data.CompanyId, err)
|
|
|
return errors.New("获取公司数据失败")
|
|
|
}
|
|
|
// companyData, err := models.GetCompanyByUCenter(data.CompanyId)
|
|
|
// if err != nil {
|
|
|
// log.Error("h获取公司数据失败,user_center_id=%d,err:%s", data.CompanyId, err)
|
|
|
// return errors.New("获取公司数据失败")
|
|
|
// }
|
|
|
var (
|
|
|
err error
|
|
|
userCompanyDatas []models.UserCompany
|
|
|
userIdMap = make(map[int64]int64)
|
|
|
)
|
...
|
...
|
@@ -572,7 +573,6 @@ func DeleteEmployeeData(data DeleteUserData) error { |
|
|
o.Begin()
|
|
|
_, err = o.QueryTable(&models.UserCompany{}).
|
|
|
Filter("id__in", data.Ids).
|
|
|
Filter("company_id", companyData.Id).
|
|
|
Filter("delete_at", 0).
|
|
|
All(&userCompanyDatas)
|
|
|
if err != nil {
|
...
|
...
|
@@ -586,7 +586,6 @@ func DeleteEmployeeData(data DeleteUserData) error { |
|
|
}
|
|
|
_, err = o.QueryTable(&models.UserCompany{}).
|
|
|
Filter("id__in", data.Ids).
|
|
|
Filter("company_id", companyData.Id).
|
|
|
Update(orm.Params{
|
|
|
"delete_at": time.Now().Format("2006-01-02 15:04:05"),
|
|
|
"enable": models.USERCOMPANY_ENABLE_NO,
|
...
|
...
|
@@ -626,12 +625,15 @@ func DeleteEmployeeData(data DeleteUserData) error { |
|
|
}
|
|
|
|
|
|
func ForbidAllowEmployeeData(data ForbidAllowUserData) error {
|
|
|
companyData, err := models.GetCompanyByUCenter(data.CompanyId)
|
|
|
if err != nil {
|
|
|
log.Error("h获取公司数据失败,user_center_id=%d,err:%s", data.CompanyId, err)
|
|
|
return errors.New("获取公司数据失败")
|
|
|
}
|
|
|
var status int8
|
|
|
// companyData, err := models.GetCompanyByUCenter(data.CompanyId)
|
|
|
// if err != nil {
|
|
|
// log.Error("h获取公司数据失败,user_center_id=%d,err:%s", data.CompanyId, err)
|
|
|
// return errors.New("获取公司数据失败")
|
|
|
// }
|
|
|
var (
|
|
|
status int8
|
|
|
err error
|
|
|
)
|
|
|
switch data.Status {
|
|
|
case 1:
|
|
|
status = models.USERCOMPANY_ENABLE_YES
|
...
|
...
|
@@ -641,7 +643,6 @@ func ForbidAllowEmployeeData(data ForbidAllowUserData) error { |
|
|
o := orm.NewOrm()
|
|
|
_, err = o.QueryTable(&models.UserCompany{}).
|
|
|
Filter("id__in", data.Ids).
|
|
|
Filter("company_id", companyData.Id).
|
|
|
Update(orm.Params{
|
|
|
"enable": status,
|
|
|
"update_at": time.Now().Format("2006-01-02 15:04:05"),
|
...
|
...
|
|