正在显示
7 个修改的文件
包含
56 行增加
和
55 行删除
@@ -14,15 +14,17 @@ RUN go mod download | @@ -14,15 +14,17 @@ RUN go mod download | ||
14 | 14 | ||
15 | COPY . . | 15 | COPY . . |
16 | RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w" -installsuffix cgo -o opp main.go | 16 | RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w" -installsuffix cgo -o opp main.go |
17 | - | ||
18 | -FROM alpine:latest | ||
19 | - | ||
20 | -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories | ||
21 | -RUN apk add --no-cache tzdata \ | ||
22 | - && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ | ||
23 | - && echo "Asia/Shanghai" > /etc/timezone \ | ||
24 | -# && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* $HOME/.cache ## 清除缓存 | ||
25 | -WORKDIR /root/ | ||
26 | -COPY --from=builder /go/src/opp . | ||
27 | EXPOSE 8080 | 17 | EXPOSE 8080 |
28 | CMD ["./opp"] | 18 | CMD ["./opp"] |
19 | + | ||
20 | +#FROM alpine:latest | ||
21 | + | ||
22 | +#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories | ||
23 | +#RUN apk add --no-cache tzdata \ | ||
24 | +# && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ | ||
25 | +# && echo "Asia/Shanghai" > /etc/timezone \ | ||
26 | +## && rm -rf /var/cache/apk/* /tmp/* /var/tmp/* $HOME/.cache ## 清除缓存 | ||
27 | +#WORKDIR /root/ | ||
28 | +#COPY --from=builder /go/src/opp . | ||
29 | +#EXPOSE 8080 | ||
30 | +#CMD ["./opp"] |
@@ -72,7 +72,7 @@ func (this *ChanceController) Comments() { | @@ -72,7 +72,7 @@ func (this *ChanceController) Comments() { | ||
72 | return | 72 | return |
73 | } | 73 | } |
74 | header := controllers.GetRequestHeader(this.Ctx) | 74 | header := controllers.GetRequestHeader(this.Ctx) |
75 | - request.SourceType = protocol.SourceType_Chance | 75 | + request.SourceType = protocol.SourceTypeChance |
76 | msg = protocol.NewReturnResponse(chance.Comments(header, request)) | 76 | msg = protocol.NewReturnResponse(chance.Comments(header, request)) |
77 | } | 77 | } |
78 | 78 | ||
@@ -156,7 +156,7 @@ func (this *ChanceController) SympathyAction() { | @@ -156,7 +156,7 @@ func (this *ChanceController) SympathyAction() { | ||
156 | msg = m | 156 | msg = m |
157 | return | 157 | return |
158 | } | 158 | } |
159 | - if !(request.SourceType == protocol.SourceType_Chance || request.SourceType == protocol.SourceType_Comment) { | 159 | + if !(request.SourceType == protocol.SourceTypeChance || request.SourceType == protocol.SourceTypeComment) { |
160 | msg = protocol.BadRequestParam(2) | 160 | msg = protocol.BadRequestParam(2) |
161 | return | 161 | return |
162 | } | 162 | } |
@@ -224,7 +224,7 @@ func (this *ChanceController) ChanceSubmit() { | @@ -224,7 +224,7 @@ func (this *ChanceController) ChanceSubmit() { | ||
224 | return | 224 | return |
225 | } | 225 | } |
226 | header := controllers.GetRequestHeader(this.Ctx) | 226 | header := controllers.GetRequestHeader(this.Ctx) |
227 | - if request.Id>0{ | 227 | + if request.Id > 0 { |
228 | msg = protocol.NewReturnResponse(chance.ChanceUpdate(header, request)) | 228 | msg = protocol.NewReturnResponse(chance.ChanceUpdate(header, request)) |
229 | return | 229 | return |
230 | } | 230 | } |
@@ -31,7 +31,6 @@ else | @@ -31,7 +31,6 @@ else | ||
31 | kubectl -n mmm-suplus-prd get svc | grep -q opp | 31 | kubectl -n mmm-suplus-prd get svc | grep -q opp |
32 | if [ "$?" == "0" ];then | 32 | if [ "$?" == "0" ];then |
33 | echo "opp service update success!" | 33 | echo "opp service update success!" |
34 | - cat /tmp/prd/opp/opp.yaml | ||
35 | else | 34 | else |
36 | echo "opp service update fail!" | 35 | echo "opp service update fail!" |
37 | fi | 36 | fi |
@@ -40,7 +40,7 @@ func Favorite(header *protocol.RequestHeader, request *protocol.FavoriteRequest) | @@ -40,7 +40,7 @@ func Favorite(header *protocol.RequestHeader, request *protocol.FavoriteRequest) | ||
40 | Id: f.Id, | 40 | Id: f.Id, |
41 | } | 41 | } |
42 | switch f.SourceType { | 42 | switch f.SourceType { |
43 | - case protocol.SourceType_Chance: | 43 | + case protocol.SourceTypeChance: |
44 | chance, err = agg.GetChance(f.SourceId, f.CompanyId) | 44 | chance, err = agg.GetChance(f.SourceId, f.CompanyId) |
45 | if err != nil { | 45 | if err != nil { |
46 | log.Error(err) | 46 | log.Error(err) |
@@ -49,7 +49,7 @@ func Favorite(header *protocol.RequestHeader, request *protocol.FavoriteRequest) | @@ -49,7 +49,7 @@ func Favorite(header *protocol.RequestHeader, request *protocol.FavoriteRequest) | ||
49 | chance.IsZan = (f.MarkFlag & protocol.MarkFlag_Zan) == protocol.MarkFlag_Zan | 49 | chance.IsZan = (f.MarkFlag & protocol.MarkFlag_Zan) == protocol.MarkFlag_Zan |
50 | chance.IsCollect = (f.MarkFlag & protocol.MarkFlag_Collect) == protocol.MarkFlag_Collect | 50 | chance.IsCollect = (f.MarkFlag & protocol.MarkFlag_Collect) == protocol.MarkFlag_Collect |
51 | item.Favorite = chance | 51 | item.Favorite = chance |
52 | - case protocol.SourceType_Comment: | 52 | + case protocol.SourceTypeComment: |
53 | } | 53 | } |
54 | rsp.Lists[i] = item | 54 | rsp.Lists[i] = item |
55 | } | 55 | } |
@@ -71,7 +71,7 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc | @@ -71,7 +71,7 @@ func SympathyAction(header *protocol.RequestHeader, request *protocol.SympathyAc | ||
71 | log.Error(err) | 71 | log.Error(err) |
72 | return | 72 | return |
73 | } | 73 | } |
74 | - if request.SourceType == protocol.SourceType_Chance { | 74 | + if request.SourceType == protocol.SourceTypeChance { |
75 | if chance, err = repository.Chance.GetChanceById(request.Id); err != nil { | 75 | if chance, err = repository.Chance.GetChanceById(request.Id); err != nil { |
76 | log.Error("机会不存在", err) | 76 | log.Error("机会不存在", err) |
77 | return | 77 | return |
@@ -258,14 +258,14 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit | @@ -258,14 +258,14 @@ func ChanceSubmit(header *protocol.RequestHeader, request *protocol.ChanceSubmit | ||
258 | } | 258 | } |
259 | //6.文件 | 259 | //6.文件 |
260 | { | 260 | { |
261 | - data :=&models.ChanceData{ | ||
262 | - Id:idgen.Next(), | ||
263 | - ChanceId:chance.Id, | ||
264 | - Speechs:common.AssertJson(request.Speechs), | ||
265 | - Images:common.AssertJson(request.Pictures), | ||
266 | - Videos:common.AssertJson(request.Videos), | ||
267 | - CreateAt:time.Now(), | ||
268 | - UpdateAt:time.Now(), | 261 | + data := &models.ChanceData{ |
262 | + Id: idgen.Next(), | ||
263 | + ChanceId: chance.Id, | ||
264 | + Speechs: common.AssertJson(request.Speechs), | ||
265 | + Images: common.AssertJson(request.Pictures), | ||
266 | + Videos: common.AssertJson(request.Videos), | ||
267 | + CreateAt: time.Now(), | ||
268 | + UpdateAt: time.Now(), | ||
269 | } | 269 | } |
270 | if _, err = orm.Insert(data); err != nil { | 270 | if _, err = orm.Insert(data); err != nil { |
271 | log.Error(err) | 271 | log.Error(err) |
@@ -288,16 +288,16 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceSubmit | @@ -288,16 +288,16 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceSubmit | ||
288 | auditConfig *protocol.AuditConfig | 288 | auditConfig *protocol.AuditConfig |
289 | chanceData *models.ChanceData | 289 | chanceData *models.ChanceData |
290 | //auditFlows []*models.AuditFlowProcess | 290 | //auditFlows []*models.AuditFlowProcess |
291 | - updateMap =make(map[string]interface{}) | 291 | + updateMap = make(map[string]interface{}) |
292 | ) | 292 | ) |
293 | - if chance,err =models.GetChanceById(request.Id);err!=nil{ | 293 | + if chance, err = models.GetChanceById(request.Id); err != nil { |
294 | log.Error(err) | 294 | log.Error(err) |
295 | return | 295 | return |
296 | } | 296 | } |
297 | //TODO:非本人 1.需要验证角色权限,是否是审核人 | 297 | //TODO:非本人 1.需要验证角色权限,是否是审核人 |
298 | - if chance.UserId!=header.Uid{ | 298 | + if chance.UserId != header.Uid { |
299 | err = protocol.NewErrWithMessage(1) | 299 | err = protocol.NewErrWithMessage(1) |
300 | - log.Error(fmt.Sprintf("user:%v 无权限操作机会 chance:%v",header.Uid,chance.Id)) | 300 | + log.Error(fmt.Sprintf("user:%v 无权限操作机会 chance:%v", header.Uid, chance.Id)) |
301 | return | 301 | return |
302 | } | 302 | } |
303 | //TODO:验证机会当前是否在审核中 | 303 | //TODO:验证机会当前是否在审核中 |
@@ -315,14 +315,13 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceSubmit | @@ -315,14 +315,13 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceSubmit | ||
315 | updateMap["SourceContent"] = common.AssertJson(request.FormList) | 315 | updateMap["SourceContent"] = common.AssertJson(request.FormList) |
316 | updateMap["DepartmentId"] = request.RelatedDepartment | 316 | updateMap["DepartmentId"] = request.RelatedDepartment |
317 | 317 | ||
318 | - if err = utils.UpdateTableByMapWithOrmer(orm,&models.Chance{Id:chance.Id},updateMap); err != nil { | 318 | + if err = utils.UpdateTableByMapWithOrmer(orm, &models.Chance{Id: chance.Id}, updateMap); err != nil { |
319 | log.Error(err) | 319 | log.Error(err) |
320 | orm.Rollback() | 320 | orm.Rollback() |
321 | return | 321 | return |
322 | } | 322 | } |
323 | } | 323 | } |
324 | 324 | ||
325 | - | ||
326 | //4.查询审核配置 | 325 | //4.查询审核配置 |
327 | //5.生成审核流 删除旧的 生成新的 | 326 | //5.生成审核流 删除旧的 生成新的 |
328 | //if auditFlows, err = GenAuditFlowProcess(header, chance.Id, template.Id, auditConfig); err != nil { | 327 | //if auditFlows, err = GenAuditFlowProcess(header, chance.Id, template.Id, auditConfig); err != nil { |
@@ -340,26 +339,26 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceSubmit | @@ -340,26 +339,26 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceSubmit | ||
340 | 339 | ||
341 | //6.更新文件 | 340 | //6.更新文件 |
342 | { | 341 | { |
343 | - if chanceData,err = models.GetChanceDataByChanceId(chance.Id);err==nil{ | ||
344 | - if err = utils.UpdateTableByMapWithOrmer(orm,chanceData,map[string]interface{}{ | ||
345 | - "Speechs":common.AssertJson(request.Speechs), | ||
346 | - "Images":common.AssertJson(request.Pictures), | ||
347 | - "Videos":common.AssertJson(request.Videos), | ||
348 | - "UpdateAt":time.Now(), | ||
349 | - });err!=nil{ | 342 | + if chanceData, err = models.GetChanceDataByChanceId(chance.Id); err == nil { |
343 | + if err = utils.UpdateTableByMapWithOrmer(orm, chanceData, map[string]interface{}{ | ||
344 | + "Speechs": common.AssertJson(request.Speechs), | ||
345 | + "Images": common.AssertJson(request.Pictures), | ||
346 | + "Videos": common.AssertJson(request.Videos), | ||
347 | + "UpdateAt": time.Now(), | ||
348 | + }); err != nil { | ||
350 | log.Error(err) | 349 | log.Error(err) |
351 | orm.Rollback() | 350 | orm.Rollback() |
352 | return | 351 | return |
353 | } | 352 | } |
354 | - }else{ | ||
355 | - data :=&models.ChanceData{ | ||
356 | - Id:idgen.Next(), | ||
357 | - ChanceId:chance.Id, | ||
358 | - Speechs:common.AssertJson(request.Speechs), | ||
359 | - Images:common.AssertJson(request.Pictures), | ||
360 | - Videos:common.AssertJson(request.Videos), | ||
361 | - CreateAt:time.Now(), | ||
362 | - UpdateAt:time.Now(), | 353 | + } else { |
354 | + data := &models.ChanceData{ | ||
355 | + Id: idgen.Next(), | ||
356 | + ChanceId: chance.Id, | ||
357 | + Speechs: common.AssertJson(request.Speechs), | ||
358 | + Images: common.AssertJson(request.Pictures), | ||
359 | + Videos: common.AssertJson(request.Videos), | ||
360 | + CreateAt: time.Now(), | ||
361 | + UpdateAt: time.Now(), | ||
363 | } | 362 | } |
364 | if _, err = orm.Insert(data); err != nil { | 363 | if _, err = orm.Insert(data); err != nil { |
365 | log.Error(err) | 364 | log.Error(err) |
@@ -22,14 +22,14 @@ func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) | @@ -22,14 +22,14 @@ func IComment(header *protocol.RequestHeader, request *protocol.ICommentRequest) | ||
22 | updateMap = make(map[string]interface{}) | 22 | updateMap = make(map[string]interface{}) |
23 | ) | 23 | ) |
24 | switch request.SourceType { | 24 | switch request.SourceType { |
25 | - case protocol.SourceType_Chance: | 25 | + case protocol.SourceTypeChance: |
26 | if chance, err = repository.Chance.GetChanceById(request.Id); err != nil { | 26 | if chance, err = repository.Chance.GetChanceById(request.Id); err != nil { |
27 | log.Error(err) | 27 | log.Error(err) |
28 | return | 28 | return |
29 | } | 29 | } |
30 | updateTable = chance | 30 | updateTable = chance |
31 | updateMap["CommentTotal"] = chance.CommentTotal + 1 | 31 | updateMap["CommentTotal"] = chance.CommentTotal + 1 |
32 | - case protocol.SourceType_Comment: | 32 | + case protocol.SourceTypeComment: |
33 | if comment, err = repository.Comment.GetCommentById(request.Id); err != nil { | 33 | if comment, err = repository.Comment.GetCommentById(request.Id); err != nil { |
34 | log.Error(err) | 34 | log.Error(err) |
35 | return | 35 | return |
@@ -74,7 +74,7 @@ func IComments(header *protocol.RequestHeader, request *protocol.ICommentsReques | @@ -74,7 +74,7 @@ func IComments(header *protocol.RequestHeader, request *protocol.ICommentsReques | ||
74 | baseUserInfo *protocol.BaseUserInfo | 74 | baseUserInfo *protocol.BaseUserInfo |
75 | total int | 75 | total int |
76 | ) | 76 | ) |
77 | - if comments, total, err = repository.Comment.GetComments(header.Uid, protocol.SourceType_Chance, 0, request.LastId, request.PageSize); err != nil { | 77 | + if comments, total, err = repository.Comment.GetComments(header.Uid, protocol.SourceTypeChance, 0, request.LastId, request.PageSize); err != nil { |
78 | log.Error(err) | 78 | log.Error(err) |
79 | return | 79 | return |
80 | } | 80 | } |
@@ -187,7 +187,7 @@ func CommentDetailsMulti(header *protocol.RequestHeader, request *protocol.Comme | @@ -187,7 +187,7 @@ func CommentDetailsMulti(header *protocol.RequestHeader, request *protocol.Comme | ||
187 | } | 187 | } |
188 | rsp.Comment = commentDetailSingle.Comment | 188 | rsp.Comment = commentDetailSingle.Comment |
189 | } | 189 | } |
190 | - if commentDetailMulti, err = Comments(header, &protocol.CommentsRequest{LastId: request.LastId, SourceId: request.SourceId, PageSize: request.PageSize, SourceType: protocol.SourceType_Comment}); err != nil { | 190 | + if commentDetailMulti, err = Comments(header, &protocol.CommentsRequest{LastId: request.LastId, SourceId: request.SourceId, PageSize: request.PageSize, SourceType: protocol.SourceTypeComment}); err != nil { |
191 | log.Error(err) | 191 | log.Error(err) |
192 | return | 192 | return |
193 | } | 193 | } |
@@ -60,8 +60,8 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac | @@ -60,8 +60,8 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac | ||
60 | SourceType: msg.SourceType, | 60 | SourceType: msg.SourceType, |
61 | } | 61 | } |
62 | switch msg.SourceType { | 62 | switch msg.SourceType { |
63 | - case protocol.SourceType_Chance: | ||
64 | - case protocol.SourceType_Comment: | 63 | + case protocol.SourceTypeChance: |
64 | + case protocol.SourceTypeComment: | ||
65 | } | 65 | } |
66 | rsp.Lists[i] = userMsg | 66 | rsp.Lists[i] = userMsg |
67 | } | 67 | } |
-
请 注册 或 登录 后发表评论