作者 tangxvhui

bug 修复

... ... @@ -42,11 +42,8 @@ type RequestEditAchievement struct {
ChanceData []AchievementChance `json:"chance_data"`
ChanceTypeId int64 `json:"chance_type_id"` //机会一级分类 chance_type
AuditTemplateId int64 `json:"audit_template_id"` //机会二级分类
DepartmentId int64 `json:"department_id"` //把握人的部门
UserCompanyId int64 `json:"user_company_id"` //把握人的id
GraspScore float64 `json:"grasp_score"` //把握分
UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分
Provider []AchievementProvider `json:"provider"` //机会提供者
// UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分
SourceContent string `json:"source_content"` //成果描述文本
Images []AchievementImage `json:"image"` //图片
}
... ...
... ... @@ -120,16 +120,13 @@ func EditAchievement(editData *protocol.RequestEditAchievement, companyid int64)
}
nowTime := time.Now()
achievementData.UpdateAt = nowTime
achievementData.DepartmentId = editData.DepartmentId
achievementData.UserCompanyId = editData.UserCompanyId
achievementData.ChanceTypeId = editData.ChanceTypeId
achievementData.AuditTemplateId = editData.AuditTemplateId
achievementData.SourceContent = editData.SourceContent
achievementData.GraspScore = editData.GraspScore
achievementData.UserGraspScore = editData.UserGraspScore
achievementData.UpdateAt = nowTime
cols := []string{
"UpdateAt", "DepartmentId", "UserCompanyId", "ChanceTypeId", "AuditTemplateId", "SourceContent", "GraspScore",
"UpdateAt", "ChanceTypeId", "AuditTemplateId", "SourceContent", "GraspScore",
}
o := orm.NewOrm()
o.Begin()
... ... @@ -149,30 +146,13 @@ func EditAchievement(editData *protocol.RequestEditAchievement, companyid int64)
log.Info("删除achievement_chance数据失败:%s", err)
return protocol.NewErrWithMessage("1")
}
//删除achievement_prover旧数据
_, err = o.QueryTable(&models.AchievementProvider{}).
Filter("achievement_id", editData.AchievementId).
Delete()
if err != nil {
o.Rollback()
log.Info("删除achievement_chance数据失败:%s", err)
return protocol.NewErrWithMessage("1")
}
err = addAchievementChance(editData.ChanceData, achievementData.Id, o)
if err != nil {
log.Error("添加achievement_chance失败:%s", err)
o.Rollback()
return protocol.NewErrWithMessage("1")
}
//操作achievement_provider 成果提供人表
if len(editData.Provider) > 0 {
err = addAchievementProvider(editData.Provider, achievementData.Id, o)
if err != nil {
log.Error("添加achievement_provider失败:%s", err)
o.Rollback()
return protocol.NewErrWithMessage("1")
}
}
o.Commit()
return nil
}
... ...