正在显示
7 个修改的文件
包含
28 行增加
和
5 行删除
@@ -2,6 +2,8 @@ package aliyun | @@ -2,6 +2,8 @@ package aliyun | ||
2 | 2 | ||
3 | const ( | 3 | const ( |
4 | RegionID = "cn-shanghai" | 4 | RegionID = "cn-shanghai" |
5 | + //AccessKeyID = "LTAI4Fv7TX3UP9nYuofpLHRy" | ||
6 | + //AccessKeySecret = "Yx6lSe7JE9KjtWyOV2LSBnjalrGUk6" | ||
5 | AccessKeyID = "LTAI4FhiZ3UktC6N1u3H5GFC" | 7 | AccessKeyID = "LTAI4FhiZ3UktC6N1u3H5GFC" |
6 | AccessKeySecret = "UyspWwdni55CYQ02hUCint4qY2jNYO" | 8 | AccessKeySecret = "UyspWwdni55CYQ02hUCint4qY2jNYO" |
7 | ) | 9 | ) |
@@ -66,7 +66,7 @@ func CreateUploadImage(client *vod.Client, r *CreateUploadImageRequest) (respons | @@ -66,7 +66,7 @@ func CreateUploadImage(client *vod.Client, r *CreateUploadImageRequest) (respons | ||
66 | if err != nil { | 66 | if err != nil { |
67 | return | 67 | return |
68 | } | 68 | } |
69 | - err = utils.DeepCopy(&response, &rsp) | 69 | + err = utils.JsonDeepCopy(&response, &rsp) |
70 | return | 70 | return |
71 | } | 71 | } |
72 | 72 |
@@ -99,6 +99,15 @@ func DeepCopy(dst, src interface{}) error { | @@ -99,6 +99,15 @@ func DeepCopy(dst, src interface{}) error { | ||
99 | return gob.NewDecoder(&buf).Decode(dst) | 99 | return gob.NewDecoder(&buf).Decode(dst) |
100 | } | 100 | } |
101 | 101 | ||
102 | +//深度拷贝 | ||
103 | +func JsonDeepCopy(dst, src interface{}) error { | ||
104 | + var buf bytes.Buffer | ||
105 | + if err := json.NewEncoder(&buf).Encode(src); err != nil { | ||
106 | + return err | ||
107 | + } | ||
108 | + return json.NewDecoder(&buf).Decode(dst) | ||
109 | +} | ||
110 | + | ||
102 | //检查版本信息 | 111 | //检查版本信息 |
103 | func ValidVersion(current, compare string) bool { | 112 | func ValidVersion(current, compare string) bool { |
104 | curVersions := strings.Split(current, ".") | 113 | curVersions := strings.Split(current, ".") |
@@ -44,7 +44,7 @@ const ( | @@ -44,7 +44,7 @@ const ( | ||
44 | ) | 44 | ) |
45 | 45 | ||
46 | var ( | 46 | var ( |
47 | - SqlGetChanceSelfChecks = `select self_checks from chance where id =?` //机会自查数据 | 47 | + SqlGetChanceSelfChecks = `select user_id,review_status,self_checks from chance where id =?` //机会自查数据 |
48 | ) | 48 | ) |
49 | 49 | ||
50 | func (t *Chance) TableName() string { | 50 | func (t *Chance) TableName() string { |
@@ -153,6 +153,7 @@ type CheckQuestion struct { | @@ -153,6 +153,7 @@ type CheckQuestion struct { | ||
153 | CheckItem string `json:"checkItem"` | 153 | CheckItem string `json:"checkItem"` |
154 | Title string `json:"title"` | 154 | Title string `json:"title"` |
155 | GroupId int64 `json:"groupId"` | 155 | GroupId int64 `json:"groupId"` |
156 | + Answer string `json:"answer,omitempty"` | ||
156 | CheckOptions []CheckOption `json:"options"` | 157 | CheckOptions []CheckOption `json:"options"` |
157 | } | 158 | } |
158 | type CheckOption struct { | 159 | type CheckOption struct { |
@@ -269,7 +269,7 @@ func GetCheckQuestionsByTemplateId(id int64) (rsp []*protocol.CheckQuestion, err | @@ -269,7 +269,7 @@ func GetCheckQuestionsByTemplateId(id int64) (rsp []*protocol.CheckQuestion, err | ||
269 | } | 269 | } |
270 | 270 | ||
271 | //获取自查问题列表 通过机会(历史模板) | 271 | //获取自查问题列表 通过机会(历史模板) |
272 | -func GetCheckQuestionsByChanceId(id int64) (rsp []*protocol.CheckQuestion, err error) { | 272 | +func GetCheckQuestionsByChanceId(header *protocol.RequestHeader, id int64) (rsp []*protocol.CheckQuestion, err error) { |
273 | var ( | 273 | var ( |
274 | chance *models.Chance | 274 | chance *models.Chance |
275 | selfChecks protocol.SelfChecks | 275 | selfChecks protocol.SelfChecks |
@@ -286,6 +286,10 @@ func GetCheckQuestionsByChanceId(id int64) (rsp []*protocol.CheckQuestion, err e | @@ -286,6 +286,10 @@ func GetCheckQuestionsByChanceId(id int64) (rsp []*protocol.CheckQuestion, err e | ||
286 | if len(chance.SelfChecks) == 0 { | 286 | if len(chance.SelfChecks) == 0 { |
287 | return | 287 | return |
288 | } | 288 | } |
289 | + //if chance.ReviewStatus==protocol.ReviewStatusPass{ | ||
290 | + // log.Warn("机会已审核通过不可编辑自查数据:",chance.Id) | ||
291 | + // return | ||
292 | + //} | ||
289 | if e := json.Unmarshal([]byte(chance.SelfChecks), &selfChecks); e != nil { | 293 | if e := json.Unmarshal([]byte(chance.SelfChecks), &selfChecks); e != nil { |
290 | log.Error(e) | 294 | log.Error(e) |
291 | return | 295 | return |
@@ -300,6 +304,9 @@ func GetCheckQuestionsByChanceId(id int64) (rsp []*protocol.CheckQuestion, err e | @@ -300,6 +304,9 @@ func GetCheckQuestionsByChanceId(id int64) (rsp []*protocol.CheckQuestion, err e | ||
300 | idx = 0 | 304 | idx = 0 |
301 | } | 305 | } |
302 | item := protocol.NewCheckQuestion(c.CheckItem, getQuestionTitle(groupIdx, idx, c.CheckItem), c.GroupId, protocol.CheckOptionsCommit) | 306 | item := protocol.NewCheckQuestion(c.CheckItem, getQuestionTitle(groupIdx, idx, c.CheckItem), c.GroupId, protocol.CheckOptionsCommit) |
307 | + if header.UserId == chance.UserId && chance.ReviewStatus != protocol.ReviewStatusPass { | ||
308 | + item.Answer = c.Answer | ||
309 | + } | ||
303 | rsp = append(rsp, item) | 310 | rsp = append(rsp, item) |
304 | idx++ | 311 | idx++ |
305 | } | 312 | } |
@@ -704,7 +704,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | @@ -704,7 +704,6 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | ||
704 | updateMap["DiscoveryScore"] = chance.DiscoveryScore | 704 | updateMap["DiscoveryScore"] = chance.DiscoveryScore |
705 | } | 705 | } |
706 | } | 706 | } |
707 | - go agg.BulkInsertSelfChecks(header, chance.Id, chance.Id, request.SelfChecks, true, protocol.TypeSubmit) | ||
708 | } | 707 | } |
709 | } | 708 | } |
710 | 709 | ||
@@ -712,7 +711,12 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | @@ -712,7 +711,12 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate | ||
712 | //机会发布 并且当前机会不是已经通过的,机会状态审核中(存在更新时自动通过) | 711 | //机会发布 并且当前机会不是已经通过的,机会状态审核中(存在更新时自动通过) |
713 | if request.IsPublish && chance.ReviewStatus != protocol.ReviewStatusPass { | 712 | if request.IsPublish && chance.ReviewStatus != protocol.ReviewStatusPass { |
714 | updateMap["ReviewStatus"] = int8(protocol.ReviewStatusAuditging) | 713 | updateMap["ReviewStatus"] = int8(protocol.ReviewStatusAuditging) |
714 | + | ||
715 | + } | ||
716 | + //本人可以重新编辑 | ||
717 | + if len(request.SelfChecks) > 0 && header.UserId == chance.UserId && chance.ReviewStatus != protocol.ReviewStatusPass { | ||
715 | updateMap["SelfChecks"] = common.AssertJson(request.SelfChecks) | 718 | updateMap["SelfChecks"] = common.AssertJson(request.SelfChecks) |
719 | + go agg.BulkInsertSelfChecks(header, chance.Id, chance.Id, request.SelfChecks, true, protocol.TypeSubmit) | ||
716 | } | 720 | } |
717 | updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig) | 721 | updateMap["AuditTemplateConfig"] = common.AssertJson(auditConfig) |
718 | updateMap["Content"] = request.Content | 722 | updateMap["Content"] = request.Content |
@@ -2340,7 +2344,7 @@ func ChanceReviseDetail(header *protocol.RequestHeader, request *protocol.Chance | @@ -2340,7 +2344,7 @@ func ChanceReviseDetail(header *protocol.RequestHeader, request *protocol.Chance | ||
2340 | func CheckQuestions(header *protocol.RequestHeader, request *protocol.CheckQuestionsRequest) (rsp *protocol.CheckQuestionsResponse, err error) { | 2344 | func CheckQuestions(header *protocol.RequestHeader, request *protocol.CheckQuestionsRequest) (rsp *protocol.CheckQuestionsResponse, err error) { |
2341 | var () | 2345 | var () |
2342 | rsp = &protocol.CheckQuestionsResponse{} | 2346 | rsp = &protocol.CheckQuestionsResponse{} |
2343 | - rsp.Questions, err = agg.GetCheckQuestionsByChanceId(request.ChanceId) | 2347 | + rsp.Questions, err = agg.GetCheckQuestionsByChanceId(header, request.ChanceId) |
2344 | if err != nil { | 2348 | if err != nil { |
2345 | log.Error(err) | 2349 | log.Error(err) |
2346 | } | 2350 | } |
-
请 注册 或 登录 后发表评论