|
@@ -132,15 +132,17 @@ type FutureGoodEdbInfoMaxAndMinInfo struct {
|
|
|
// AfterFind 在该模型上设置钩子函数,把日期转成正确的string,所以查询函数只能用Find函数,First或者Scan是不会触发该函数的来获取数据
|
|
|
func (m *FutureGoodEdbInfoMaxAndMinInfo) AfterFind(db *gorm.DB) (err error) {
|
|
|
if m.MinDate != "" {
|
|
|
- minDateTmp, err := time.ParseInLocation(utils.FormatDateWallWithLoc, m.MinDate, time.Local)
|
|
|
- if err != nil {
|
|
|
+ minDateTmp, e := time.ParseInLocation(utils.FormatDateWallWithLoc, m.MinDate, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ err = e
|
|
|
return
|
|
|
}
|
|
|
m.MinDate = minDateTmp.Format(utils.FormatDate)
|
|
|
}
|
|
|
if m.MaxDate != "" {
|
|
|
- maxDateTmp, err := time.ParseInLocation(utils.FormatDateWallWithLoc, m.MaxDate, time.Local)
|
|
|
- if err != nil {
|
|
|
+ maxDateTmp, e := time.ParseInLocation(utils.FormatDateWallWithLoc, m.MaxDate, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ err = e
|
|
|
return
|
|
|
}
|
|
|
m.MaxDate = maxDateTmp.Format(utils.FormatDate)
|