diff --git a/service/publishedGi.go b/service/publishedGi.go index ef08656..389a63a 100644 --- a/service/publishedGi.go +++ b/service/publishedGi.go @@ -2,6 +2,7 @@ package service import ( "fmt" + "sync" "time" "joylink.club/bj-rtsts-server/ats/verify/simulation/wayside/memory" @@ -11,6 +12,8 @@ import ( "joylink.club/bj-rtsts-server/dto/publishedGi" ) +var publishMapMutex sync.Mutex + func PageQueryPublishedGi(req *publishedGi.PublishedGiReqDto) *dto.PageDto { dp := dbquery.PublishedGi where := dp.Where(dp.Status.Eq(1)) @@ -55,6 +58,8 @@ func GetPublishedGiById(id int) (*model.PublishedGi, error) { } func PublishFormDraft(req *publishedGi.PublishReqDto, user *model.User) { + publishMapMutex.Lock() + defer publishMapMutex.Unlock() draft := QueryDrafting(req.DraftId) if draft.Proto == nil || len(draft.Proto) == 0 { panic(fmt.Sprintf("草稿[%v]绘图数据信息为空", req.DraftId))