作者 tangxvhui

bug 修复

... ... @@ -52,6 +52,14 @@ const (
USERCOMPANY_CHARGE_NO int8 = 2
)
//
// 1普通用户 2主管理员
const (
USERCOMPANY_ADMIN_SUBSET int8 = 1
USERCOMPANY_ADMIN_MAIN int8 = 2
)
func (t *UserCompany) IsEnable() bool {
switch t.Enable {
case USERCOMPANY_ENABLE_YES:
... ...
... ... @@ -344,7 +344,7 @@ func AddUserCompanyData(centerCompany *ModuleCompanytData, newcompany *models.Co
uc = &models.UserCompany{
UserId: newuser.Id,
CompanyId: newcompany.Id,
Enable: adminUserData.Status,
Enable: models.USERCOMPANY_ENABLE_YES,
ChargeStatus: adminUserData.ChargeStatus,
Id: adminUserData.Id,
NickName: adminUserData.Name,
... ...
... ... @@ -206,6 +206,11 @@ func departmentRelationUpdate(departmentUpdate models.Department, newparent mode
return nil
}
func setDepartmentLevel(relation string) int {
s := strings.Split(relation, ",")
return len(s) - 3
}
//AddDepartmentData ...
func AddDepartmentData(data []ModuleDeparmentData) error {
if len(data) == 0 {
... ... @@ -238,6 +243,7 @@ func AddDepartmentData(data []ModuleDeparmentData) error {
BusinessDepartmentId: v.Id,
DeleteAt: time.Unix(0, 0),
CreateAt: time.Now(),
Level: v.Level,
}
if v.ParentId > 0 {
parentDepart := &models.Department{}
... ... @@ -257,7 +263,7 @@ func AddDepartmentData(data []ModuleDeparmentData) error {
departmentData.SetRelation(topDepartment)
}
departmentData.Level = setDepartmentLevel(departmentData.Relation)
// departmentData.Level = setDepartmentLevel(departmentData.Relation)
_, err = models.AddDepartment(departmentData, o)
if err != nil {
e := fmt.Errorf("存储部门数据失败,err:%s", err)
... ... @@ -270,11 +276,6 @@ func AddDepartmentData(data []ModuleDeparmentData) error {
return nil
}
func setDepartmentLevel(relation string) int {
s := strings.Split(relation, ",")
return len(s) - 3
}
//DeleteDepartmentData ...
func DeleteDepartmentData(ids []int64) error {
o := orm.NewOrm()
... ...