This commit is contained in:
parent
cd6b6de15b
commit
b4418e23bb
|
@ -17,6 +17,9 @@ func (s *Service) CreateUpdateAccountImageAudit(ctx *gin.Context, oldAccount *db
|
||||||
if newAccount.Avatar == nil {
|
if newAccount.Avatar == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if util.IsInt64SliceEqualAsSet(oldAccount.Avatar.GetImageIds(), newAccount.Avatar.GetImageIds()) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
tasks = make([]*dbstruct.ImageAuditTask, 0)
|
tasks = make([]*dbstruct.ImageAuditTask, 0)
|
||||||
|
|
||||||
|
@ -38,7 +41,7 @@ func (s *Service) CreateUpdateAccountImageAudit(ctx *gin.Context, oldAccount *db
|
||||||
func (s *Service) CreateUpdateStreamerImageAudit(ctx *gin.Context, oldStreamer *dbstruct.Streamer, newStreamer *dbstruct.Streamer) (tasks []*dbstruct.ImageAuditTask) {
|
func (s *Service) CreateUpdateStreamerImageAudit(ctx *gin.Context, oldStreamer *dbstruct.Streamer, newStreamer *dbstruct.Streamer) (tasks []*dbstruct.ImageAuditTask) {
|
||||||
tasks = make([]*dbstruct.ImageAuditTask, 0)
|
tasks = make([]*dbstruct.ImageAuditTask, 0)
|
||||||
|
|
||||||
if newStreamer.Cover != nil {
|
if newStreamer.Cover != nil && util.IsInt64SliceEqualAsSet(oldStreamer.Cover.GetImageIds(), newStreamer.Cover.GetImageIds()) {
|
||||||
tasks = append(tasks, &dbstruct.ImageAuditTask{
|
tasks = append(tasks, &dbstruct.ImageAuditTask{
|
||||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||||
AssociativeDatabase: goproto.String("streamer"),
|
AssociativeDatabase: goproto.String("streamer"),
|
||||||
|
@ -50,7 +53,7 @@ func (s *Service) CreateUpdateStreamerImageAudit(ctx *gin.Context, oldStreamer *
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if newStreamer.Album != nil {
|
if newStreamer.Album != nil && oldStreamer.Cover != nil && util.IsInt64SliceEqualAsSet(oldStreamer.Album.GetImageIds(), newStreamer.Album.GetImageIds()) {
|
||||||
tasks = append(tasks, &dbstruct.ImageAuditTask{
|
tasks = append(tasks, &dbstruct.ImageAuditTask{
|
||||||
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
RouteUrl: goproto.String(ctx.Request.URL.Path),
|
||||||
AssociativeDatabase: goproto.String("streamer"),
|
AssociativeDatabase: goproto.String("streamer"),
|
||||||
|
|
|
@ -217,3 +217,25 @@ func SortParam(argList []*message.JsonParamEntry) string {
|
||||||
}
|
}
|
||||||
return strings.Join(args, "&")
|
return strings.Join(args, "&")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TransferInt64SliceIntoValueCountMap(s []int64) map[int64]int {
|
||||||
|
mp := make(map[int64]int)
|
||||||
|
for _, integer := range s {
|
||||||
|
mp[integer] = mp[integer] + 1
|
||||||
|
}
|
||||||
|
return mp
|
||||||
|
}
|
||||||
|
|
||||||
|
func IsInt64SliceEqualAsSet(s1 []int64, s2 []int64) bool {
|
||||||
|
if len(s1) != len(s2) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
mp1 := TransferInt64SliceIntoValueCountMap(s1)
|
||||||
|
mp2 := TransferInt64SliceIntoValueCountMap(s2)
|
||||||
|
for _, integer := range s1 {
|
||||||
|
if mp1[integer] != mp2[integer] {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue