作者 陈志颖

fix:修复排行榜时间更新错误

@@ -156,24 +156,27 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt @@ -156,24 +156,27 @@ func (listIntervalService *ListIntervalService) UpdateListInterval(updateListInt
156 listIntervalRepository = value 156 listIntervalRepository = value
157 } 157 }
158 158
159 - listInterval, err := listIntervalRepository.FindOne(map[string]interface{}{"listId": updateListIntervalCommand.ListIntervalId}) 159 + listIntervalFound, err := listIntervalRepository.FindOne(map[string]interface{}{"listId": updateListIntervalCommand.ListIntervalId})
160 if err != nil { 160 if err != nil {
161 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 161 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
162 } 162 }
163 - if listInterval == nil { 163 + if listIntervalFound == nil {
164 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateListIntervalCommand.ListIntervalId))) 164 return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateListIntervalCommand.ListIntervalId)))
165 } 165 }
166 - if err := listInterval.Update(tool_funs.SimpleStructToMap(updateListIntervalCommand)); err != nil { 166 +
  167 + fmt.Printf("Command: %+v\n", updateListIntervalCommand)
  168 +
  169 + if err := listIntervalFound.Update(tool_funs.SimpleStructToMap(updateListIntervalCommand)); err != nil {
167 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 170 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
168 } 171 }
169 172
170 - if listInterval, err := listIntervalRepository.Save(listInterval); err != nil { 173 + if listIntervalUpdated, err := listIntervalRepository.Save(listIntervalFound); err != nil {
171 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 174 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
172 } else { 175 } else {
173 if err := transactionContext.CommitTransaction(); err != nil { 176 if err := transactionContext.CommitTransaction(); err != nil {
174 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 177 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
175 } 178 }
176 - return listInterval, nil 179 + return listIntervalUpdated, nil
177 } 180 }
178 } 181 }
179 182
1 package domain 1 package domain
2 2
3 -import "time" 3 +import (
  4 + "time"
  5 +)
4 6
5 // 排行榜时间 7 // 排行榜时间
6 type ListInterval struct { 8 type ListInterval struct {
@@ -25,11 +27,11 @@ func (listInterval *ListInterval) Identify() interface{} { @@ -25,11 +27,11 @@ func (listInterval *ListInterval) Identify() interface{} {
25 } 27 }
26 28
27 func (listInterval *ListInterval) Update(data map[string]interface{}) error { 29 func (listInterval *ListInterval) Update(data map[string]interface{}) error {
28 - if intervalStartTime, ok := data["intervalStartTime"]; ok {  
29 - listInterval.IntervalStartTime = intervalStartTime.(time.Time) 30 + if listIntervalStartTime, ok := data["listIntervalStartTime"]; ok {
  31 + listInterval.IntervalStartTime = listIntervalStartTime.(time.Time)
30 } 32 }
31 - if intervalEndTime, ok := data["intervalEndTime"]; ok {  
32 - listInterval.IntervalStartTime = intervalEndTime.(time.Time) 33 + if listIntervalEndTime, ok := data["listIntervalEndTime"]; ok {
  34 + listInterval.IntervalEndTime = listIntervalEndTime.(time.Time)
33 } 35 }
34 return nil 36 return nil
35 } 37 }