|
@@ -717,6 +717,7 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
@@ -717,6 +717,7 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
717
|
isSaveLog bool = false
|
717
|
isSaveLog bool = false
|
718
|
chanceReviseLog *models.ChanceReviseLog
|
718
|
chanceReviseLog *models.ChanceReviseLog
|
719
|
message string
|
719
|
message string
|
|
|
720
|
+ changeCount int
|
720
|
)
|
721
|
)
|
721
|
defer func() {
|
722
|
defer func() {
|
722
|
if p := recover(); p != nil {
|
723
|
if p := recover(); p != nil {
|
|
@@ -799,18 +800,25 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
@@ -799,18 +800,25 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
799
|
diffFormList(chance.SourceContent, request.FormList)
|
800
|
diffFormList(chance.SourceContent, request.FormList)
|
800
|
diffChanceData()
|
801
|
diffChanceData()
|
801
|
checkModifyLog := func() {
|
802
|
checkModifyLog := func() {
|
|
|
803
|
+ changeCount += len(modifyLog.Speechs)
|
802
|
if len(modifyLog.Speechs) == 0 {
|
804
|
if len(modifyLog.Speechs) == 0 {
|
803
|
modifyLog.Speechs = make([]protocol.Speech, 0)
|
805
|
modifyLog.Speechs = make([]protocol.Speech, 0)
|
804
|
}
|
806
|
}
|
|
|
807
|
+ changeCount += len(modifyLog.Pictures)
|
805
|
if len(modifyLog.Pictures) == 0 {
|
808
|
if len(modifyLog.Pictures) == 0 {
|
806
|
modifyLog.Pictures = make([]protocol.Picture, 0)
|
809
|
modifyLog.Pictures = make([]protocol.Picture, 0)
|
807
|
}
|
810
|
}
|
|
|
811
|
+ changeCount += len(modifyLog.Videos)
|
808
|
if len(modifyLog.Videos) == 0 {
|
812
|
if len(modifyLog.Videos) == 0 {
|
809
|
modifyLog.Videos = make([]protocol.Video, 0)
|
813
|
modifyLog.Videos = make([]protocol.Video, 0)
|
810
|
}
|
814
|
}
|
|
|
815
|
+ changeCount += len(modifyLog.DiffContents)
|
|
|
816
|
+ if len(modifyLog.DiffContents) == 0 {
|
|
|
817
|
+ modifyLog.DiffContents = make([]protocol.ReviseContent, 0)
|
|
|
818
|
+ }
|
811
|
}
|
819
|
}
|
812
|
checkModifyLog()
|
820
|
checkModifyLog()
|
813
|
- if isSaveLog {
|
821
|
+ if isSaveLog && changeCount > 0 {
|
814
|
orm := orm.NewOrm()
|
822
|
orm := orm.NewOrm()
|
815
|
orm.Begin()
|
823
|
orm.Begin()
|
816
|
var logId int64
|
824
|
var logId int64
|
|
@@ -850,7 +858,6 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
@@ -850,7 +858,6 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
850
|
return
|
858
|
return
|
851
|
}
|
859
|
}
|
852
|
|
860
|
|
853
|
- //TODO:保存变更日志
|
|
|
854
|
orm.Commit()
|
861
|
orm.Commit()
|
855
|
}
|
862
|
}
|
856
|
}
|
863
|
}
|