|
@@ -578,7 +578,7 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate |
|
@@ -578,7 +578,7 @@ func ChanceUpdate(header *protocol.RequestHeader, request *protocol.ChanceUpdate |
|
578
|
}
|
578
|
}
|
|
579
|
auditConfig = &protocol.AuditConfig{NoApprover: template.NoApprover}
|
579
|
auditConfig = &protocol.AuditConfig{NoApprover: template.NoApprover}
|
|
580
|
|
580
|
|
|
581
|
- go CheckChanceDifferent(header, chance, request)
|
581
|
+ CheckChanceDifferent(header, chance, request)
|
|
582
|
|
582
|
|
|
583
|
orm := orm.NewOrm()
|
583
|
orm := orm.NewOrm()
|
|
584
|
orm.Begin()
|
584
|
orm.Begin()
|
|
@@ -717,21 +717,22 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
@@ -717,21 +717,22 @@ 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
|
|
|
|
721
|
)
|
720
|
)
|
|
722
|
defer func() {
|
721
|
defer func() {
|
|
723
|
if p := recover(); p != nil {
|
722
|
if p := recover(); p != nil {
|
|
724
|
log.Error(p)
|
723
|
log.Error(p)
|
|
725
|
}
|
724
|
}
|
|
726
|
}()
|
725
|
}()
|
|
727
|
- //TODO:测试
|
|
|
|
728
|
if header.UserId == chance.UserId {
|
726
|
if header.UserId == chance.UserId {
|
|
729
|
return
|
727
|
return
|
|
730
|
}
|
728
|
}
|
|
731
|
if chance.ReviewStatus != protocol.ReviewStatusPass {
|
729
|
if chance.ReviewStatus != protocol.ReviewStatusPass {
|
|
732
|
return
|
730
|
return
|
|
733
|
}
|
731
|
}
|
|
734
|
- var modifyLog = protocol.ChanceReviseLog{}
|
732
|
+ var modifyLog = protocol.ChanceReviseLog{
|
|
|
|
733
|
+ RemoveAllPhotoVideo: false,
|
|
|
|
734
|
+ RemoveAllSpeech: false,
|
|
|
|
735
|
+ }
|
|
735
|
checkIsSaveLog := func() {
|
736
|
checkIsSaveLog := func() {
|
|
736
|
if !isSaveLog {
|
737
|
if !isSaveLog {
|
|
737
|
isSaveLog = true
|
738
|
isSaveLog = true
|
|
@@ -777,7 +778,7 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
@@ -777,7 +778,7 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
777
|
jsonUnmarshal(chanceData.Speechs, &speechs)
|
778
|
jsonUnmarshal(chanceData.Speechs, &speechs)
|
|
778
|
jsonUnmarshal(chanceData.Images, &pictures)
|
779
|
jsonUnmarshal(chanceData.Images, &pictures)
|
|
779
|
jsonUnmarshal(chanceData.Videos, &videos)
|
780
|
jsonUnmarshal(chanceData.Videos, &videos)
|
|
780
|
- if !reflect.DeepEqual(request.Videos, videos) || !reflect.DeepEqual(request.Pictures, pictures) {
|
781
|
+ if !reflect.DeepEqual(request.Videos, videos) {
|
|
781
|
checkIsSaveLog()
|
782
|
checkIsSaveLog()
|
|
782
|
modifyLog.Videos = request.Videos
|
783
|
modifyLog.Videos = request.Videos
|
|
783
|
}
|
784
|
}
|
|
@@ -789,6 +790,20 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
@@ -789,6 +790,20 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
789
|
checkIsSaveLog()
|
790
|
checkIsSaveLog()
|
|
790
|
modifyLog.Speechs = request.Speechs
|
791
|
modifyLog.Speechs = request.Speechs
|
|
791
|
}
|
792
|
}
|
|
|
|
793
|
+
|
|
|
|
794
|
+ if (len(videos) > 0 && len(request.Videos) == 0) && len(pictures) > 0 && len(request.Pictures) == 0 {
|
|
|
|
795
|
+ modifyLog.RemoveAllPhotoVideo = true
|
|
|
|
796
|
+ }
|
|
|
|
797
|
+ if (len(videos) > 0 && len(request.Videos) == 0) && len(pictures) == 0 && len(request.Pictures) == 0 {
|
|
|
|
798
|
+ modifyLog.RemoveAllPhotoVideo = true
|
|
|
|
799
|
+ }
|
|
|
|
800
|
+ if (len(videos) == 0 && len(request.Videos) == 0) && len(pictures) > 0 && len(request.Pictures) == 0 {
|
|
|
|
801
|
+ modifyLog.RemoveAllPhotoVideo = true
|
|
|
|
802
|
+ }
|
|
|
|
803
|
+
|
|
|
|
804
|
+ if len(speechs) > 0 && len(request.Speechs) == 0 {
|
|
|
|
805
|
+ modifyLog.RemoveAllSpeech = true
|
|
|
|
806
|
+ }
|
|
792
|
} else {
|
807
|
} else {
|
|
793
|
checkIsSaveLog()
|
808
|
checkIsSaveLog()
|
|
794
|
modifyLog.Speechs = request.Speechs
|
809
|
modifyLog.Speechs = request.Speechs
|
|
@@ -800,25 +815,21 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
@@ -800,25 +815,21 @@ func CheckChanceDifferent(header *protocol.RequestHeader, chance *models.Chance, |
|
800
|
diffFormList(chance.SourceContent, request.FormList)
|
815
|
diffFormList(chance.SourceContent, request.FormList)
|
|
801
|
diffChanceData()
|
816
|
diffChanceData()
|
|
802
|
checkModifyLog := func() {
|
817
|
checkModifyLog := func() {
|
|
803
|
- changeCount += len(modifyLog.Speechs)
|
|
|
|
804
|
if len(modifyLog.Speechs) == 0 {
|
818
|
if len(modifyLog.Speechs) == 0 {
|
|
805
|
modifyLog.Speechs = make([]protocol.Speech, 0)
|
819
|
modifyLog.Speechs = make([]protocol.Speech, 0)
|
|
806
|
}
|
820
|
}
|
|
807
|
- changeCount += len(modifyLog.Pictures)
|
|
|
|
808
|
if len(modifyLog.Pictures) == 0 {
|
821
|
if len(modifyLog.Pictures) == 0 {
|
|
809
|
modifyLog.Pictures = make([]protocol.Picture, 0)
|
822
|
modifyLog.Pictures = make([]protocol.Picture, 0)
|
|
810
|
}
|
823
|
}
|
|
811
|
- changeCount += len(modifyLog.Videos)
|
|
|
|
812
|
if len(modifyLog.Videos) == 0 {
|
824
|
if len(modifyLog.Videos) == 0 {
|
|
813
|
modifyLog.Videos = make([]protocol.Video, 0)
|
825
|
modifyLog.Videos = make([]protocol.Video, 0)
|
|
814
|
}
|
826
|
}
|
|
815
|
- changeCount += len(modifyLog.DiffContents)
|
|
|
|
816
|
if len(modifyLog.DiffContents) == 0 {
|
827
|
if len(modifyLog.DiffContents) == 0 {
|
|
817
|
modifyLog.DiffContents = make([]protocol.ReviseContent, 0)
|
828
|
modifyLog.DiffContents = make([]protocol.ReviseContent, 0)
|
|
818
|
}
|
829
|
}
|
|
819
|
}
|
830
|
}
|
|
820
|
checkModifyLog()
|
831
|
checkModifyLog()
|
|
821
|
- if isSaveLog && changeCount > 0 {
|
832
|
+ if isSaveLog { //&& changeCount > 0
|
|
822
|
orm := orm.NewOrm()
|
833
|
orm := orm.NewOrm()
|
|
823
|
orm.Begin()
|
834
|
orm.Begin()
|
|
824
|
var logId int64
|
835
|
var logId int64
|