作者 tangxvhui

bug 修复

@@ -38,17 +38,14 @@ type RequestAddAchievement struct { @@ -38,17 +38,14 @@ type RequestAddAchievement struct {
38 38
39 //RequestAddAchievement 添加成果 39 //RequestAddAchievement 添加成果
40 type RequestEditAchievement struct { 40 type RequestEditAchievement struct {
41 - AchievementId int64 `json:"achievement_id"`  
42 - ChanceData []AchievementChance `json:"chance_data"`  
43 - ChanceTypeId int64 `json:"chance_type_id"` //机会一级分类 chance_type  
44 - AuditTemplateId int64 `json:"audit_template_id"` //机会二级分类  
45 - DepartmentId int64 `json:"department_id"` //把握人的部门  
46 - UserCompanyId int64 `json:"user_company_id"` //把握人的id  
47 - GraspScore float64 `json:"grasp_score"` //把握分  
48 - UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分  
49 - Provider []AchievementProvider `json:"provider"` //机会提供者  
50 - SourceContent string `json:"source_content"` //成果描述文本  
51 - Images []AchievementImage `json:"image"` //图片 41 + AchievementId int64 `json:"achievement_id"`
  42 + ChanceData []AchievementChance `json:"chance_data"`
  43 + ChanceTypeId int64 `json:"chance_type_id"` //机会一级分类 chance_type
  44 + AuditTemplateId int64 `json:"audit_template_id"` //机会二级分类
  45 + GraspScore float64 `json:"grasp_score"` //把握分
  46 + // UserGraspScore float64 `json:"user_grasp_score"` //把握人总得分
  47 + SourceContent string `json:"source_content"` //成果描述文本
  48 + Images []AchievementImage `json:"image"` //图片
52 } 49 }
53 50
54 // ResponseRankSeasonList 赛季列表 51 // ResponseRankSeasonList 赛季列表
@@ -120,16 +120,13 @@ func EditAchievement(editData *protocol.RequestEditAchievement, companyid int64) @@ -120,16 +120,13 @@ func EditAchievement(editData *protocol.RequestEditAchievement, companyid int64)
120 } 120 }
121 nowTime := time.Now() 121 nowTime := time.Now()
122 achievementData.UpdateAt = nowTime 122 achievementData.UpdateAt = nowTime
123 - achievementData.DepartmentId = editData.DepartmentId  
124 - achievementData.UserCompanyId = editData.UserCompanyId  
125 achievementData.ChanceTypeId = editData.ChanceTypeId 123 achievementData.ChanceTypeId = editData.ChanceTypeId
126 achievementData.AuditTemplateId = editData.AuditTemplateId 124 achievementData.AuditTemplateId = editData.AuditTemplateId
127 achievementData.SourceContent = editData.SourceContent 125 achievementData.SourceContent = editData.SourceContent
128 achievementData.GraspScore = editData.GraspScore 126 achievementData.GraspScore = editData.GraspScore
129 - achievementData.UserGraspScore = editData.UserGraspScore  
130 achievementData.UpdateAt = nowTime 127 achievementData.UpdateAt = nowTime
131 cols := []string{ 128 cols := []string{
132 - "UpdateAt", "DepartmentId", "UserCompanyId", "ChanceTypeId", "AuditTemplateId", "SourceContent", "GraspScore", 129 + "UpdateAt", "ChanceTypeId", "AuditTemplateId", "SourceContent", "GraspScore",
133 } 130 }
134 o := orm.NewOrm() 131 o := orm.NewOrm()
135 o.Begin() 132 o.Begin()
@@ -149,30 +146,13 @@ func EditAchievement(editData *protocol.RequestEditAchievement, companyid int64) @@ -149,30 +146,13 @@ func EditAchievement(editData *protocol.RequestEditAchievement, companyid int64)
149 log.Info("删除achievement_chance数据失败:%s", err) 146 log.Info("删除achievement_chance数据失败:%s", err)
150 return protocol.NewErrWithMessage("1") 147 return protocol.NewErrWithMessage("1")
151 } 148 }
152 - //删除achievement_prover旧数据  
153 - _, err = o.QueryTable(&models.AchievementProvider{}).  
154 - Filter("achievement_id", editData.AchievementId).  
155 - Delete()  
156 - if err != nil {  
157 - o.Rollback()  
158 - log.Info("删除achievement_chance数据失败:%s", err)  
159 - return protocol.NewErrWithMessage("1")  
160 - } 149 +
161 err = addAchievementChance(editData.ChanceData, achievementData.Id, o) 150 err = addAchievementChance(editData.ChanceData, achievementData.Id, o)
162 if err != nil { 151 if err != nil {
163 log.Error("添加achievement_chance失败:%s", err) 152 log.Error("添加achievement_chance失败:%s", err)
164 o.Rollback() 153 o.Rollback()
165 return protocol.NewErrWithMessage("1") 154 return protocol.NewErrWithMessage("1")
166 } 155 }
167 - //操作achievement_provider 成果提供人表  
168 - if len(editData.Provider) > 0 {  
169 - err = addAchievementProvider(editData.Provider, achievementData.Id, o)  
170 - if err != nil {  
171 - log.Error("添加achievement_provider失败:%s", err)  
172 - o.Rollback()  
173 - return protocol.NewErrWithMessage("1")  
174 - }  
175 - }  
176 o.Commit() 156 o.Commit()
177 return nil 157 return nil
178 } 158 }