|
@@ -63,34 +63,39 @@ func NewSaveBidding(tmp map[string]interface{}) (b bool, res int, mgoid, mgocoll
|
|
//publishtime校验、修正
|
|
//publishtime校验、修正
|
|
nowTime := time.Now().Unix()
|
|
nowTime := time.Now().Unix()
|
|
if tmp["publishtime"] != nil {
|
|
if tmp["publishtime"] != nil {
|
|
- if publishtime_str, ok := tmp["publishtime"].(string); ok { //字段类型异常
|
|
|
|
- errorData(LEVEL_ERROR, true, "publishtime", "Field Type Error", href, title, &warn, tmp)
|
|
|
|
- //修正
|
|
|
|
- pTmp, err := time.ParseInLocation(qutil.Date_Full_Layout, publishtime_str, time.Local)
|
|
|
|
- if err != nil {
|
|
|
|
- pTmp, err = time.ParseInLocation(qutil.Date_Short_Layout, publishtime_str, time.Local)
|
|
|
|
- if err != nil {
|
|
|
|
- tmp["publishtime"] = nowTime
|
|
|
|
|
|
+ publishtime := nowTime
|
|
|
|
+ if publishtime_str, ok := tmp["publishtime"].(string); ok { //字段类型异常的发布时间
|
|
|
|
+ if publishtime_str == "-1" {
|
|
|
|
+ publishtime = -1
|
|
|
|
+ } else {
|
|
|
|
+ pTmp, err := time.ParseInLocation(qutil.Date_Full_Layout, publishtime_str, time.Local)
|
|
|
|
+ if err == nil {
|
|
|
|
+ publishtime = pTmp.Unix()
|
|
} else {
|
|
} else {
|
|
- tmp["publishtime"] = pTmp.Unix()
|
|
|
|
|
|
+ pTmp, err = time.ParseInLocation(qutil.Date_Short_Layout, publishtime_str, time.Local)
|
|
|
|
+ if err == nil {
|
|
|
|
+ publishtime = pTmp.Unix()
|
|
|
|
+ } else {
|
|
|
|
+ errorData(LEVEL_ERROR, true, "publishtime", "Field Type Error", href, title, &warn, tmp)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- tmp["publishtime"] = pTmp.Unix()
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- publishtime := qutil.Int64All(tmp["publishtime"])
|
|
|
|
- if publishtime != -1 { //publishtime=-1的放行,结构化数据处理提取
|
|
|
|
- if publishtime < 0 || (publishtime > 0 && publishtime < 1000000000) || publishtime > nowTime {
|
|
|
|
- errorData(LEVEL_ERROR, true, "publishtime", "Publishtime Is Error", href, title, &warn, tmp)
|
|
|
|
- tmp["publishtime"] = nowTime
|
|
|
|
- } else if publishtime == 0 {
|
|
|
|
- errorData(LEVEL_WARN, true, "publishtime", "Publishtime Is Zero", href, title, &warn, tmp)
|
|
|
|
- tmp["publishtime"] = nowTime
|
|
|
|
- } /*else if publishtime > nowTime {
|
|
|
|
- errorData(LEVEL_ERROR, true, "publishtime", "Publishtime Is Error", href, title, &warn, tmp)
|
|
|
|
- tmp["publishtime"] = nowTime
|
|
|
|
- }*/
|
|
|
|
}
|
|
}
|
|
|
|
+ } else { //时间戳类型的发布时间
|
|
|
|
+ publishtime = qutil.Int64All(tmp["publishtime"])
|
|
|
|
+ }
|
|
|
|
+ tmp["publishtime"] = publishtime
|
|
|
|
+ //检测
|
|
|
|
+ if publishtime != -1 { //publishtime=-1的放行,结构化数据处理提取
|
|
|
|
+ if publishtime < 0 || (publishtime > 0 && publishtime < 1000000000) || publishtime > nowTime {
|
|
|
|
+ errorData(LEVEL_ERROR, true, "publishtime", "Publishtime Is Error", href, title, &warn, tmp)
|
|
|
|
+ tmp["publishtime"] = nowTime
|
|
|
|
+ } else if publishtime == 0 {
|
|
|
|
+ errorData(LEVEL_WARN, true, "publishtime", "Publishtime Is Zero", href, title, &warn, tmp)
|
|
|
|
+ tmp["publishtime"] = nowTime
|
|
|
|
+ } /*else if publishtime > nowTime {
|
|
|
|
+ errorData(LEVEL_ERROR, true, "publishtime", "Publishtime Is Error", href, title, &warn, tmp)
|
|
|
|
+ tmp["publishtime"] = nowTime
|
|
|
|
+ }*/
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
errorData(LEVEL_ERROR, true, "publishtime", "Field Value Is Null", href, title, &warn, tmp)
|
|
errorData(LEVEL_ERROR, true, "publishtime", "Field Value Is Null", href, title, &warn, tmp)
|