作者 tangxvhui

bug 修复

... ... @@ -62,14 +62,14 @@ func AdminChance(companyid int64, phone string) error {
}
newCharge.AdminType = models.USERCOMPANY_ADMIN_MAIN
oldCharge.AdminType = models.USERCOMPANY_ADMIN_SUBSET
err = models.UpdateUserCompanyById(newCharge, []string{"ChargeStatus"}, o)
err = models.UpdateUserCompanyById(newCharge, []string{"AdminType"}, o)
if err != nil {
o.Rollback()
e := fmt.Errorf("更新原公司主管理员数据失败,user_company_id=%d,err:%s", oldCharge.Id, err)
log.Error(e.Error())
return e
}
err = models.UpdateUserCompanyById(oldCharge, []string{"ChargeStatus"}, o)
err = models.UpdateUserCompanyById(oldCharge, []string{"AdminType"}, o)
if err != nil {
o.Rollback()
e := fmt.Errorf("更新新公司主管理员数据失败,user_company_id=%d , err:%s", newCharge.Id, err)
... ...
... ... @@ -154,7 +154,7 @@ func UpdateCompanyData(data ModuleCompanytData) error {
if data.User.Id != oldAdminData.Id {
//更新公司主管理员
oldAdminData.AdminType = models.USERCOMPANY_ADMIN_SUBSET
err = models.UpdateUserCompanyById(oldAdminData, []string{"ChargeStatus"}, o)
err = models.UpdateUserCompanyById(oldAdminData, []string{"AdminType"}, o)
if err != nil {
o.Rollback()
log.Error("去除旧的主管理员失败:user_company_id=%d,err:%s", oldAdminData.Id, err)
... ... @@ -168,7 +168,7 @@ func UpdateCompanyData(data ModuleCompanytData) error {
return errors.New("获取新的主管理员")
}
newAdminData.AdminType = models.USERCOMPANY_ADMIN_MAIN
err = models.UpdateUserCompanyById(newAdminData, []string{"ChargeStatus"}, o)
err = models.UpdateUserCompanyById(newAdminData, []string{"AdminType"}, o)
if err != nil {
o.Rollback()
log.Error("变更更主管理员失败:user_company_id=%d,err:%s", newAdminData.Id, err)
... ...