|
@@ -586,11 +586,11 @@ func (mae *MarketAnalysisEntity) GetPartResult(flag int) (map[string]interface{}
|
|
|
log.Printf("report %s[%d] speed %d ms\n", mae.MgoRecordId, flag, time.Now().Sub(start).Milliseconds())
|
|
|
}()
|
|
|
//校验报告是否合法
|
|
|
- if flag != marketScaleMain {
|
|
|
- if exists, _ := redis.Exists(ReportCacheDB, fmt.Sprintf(ReportCacheKey, mae.MgoRecordId, 1)); !exists {
|
|
|
- return nil, fmt.Errorf("报告异常请求,请刷新重试")
|
|
|
- }
|
|
|
- }
|
|
|
+ //if flag != marketScaleMain {
|
|
|
+ // if exists, _ := redis.Exists(ReportCacheDB, fmt.Sprintf(ReportCacheKey, mae.MgoRecordId, 1)); !exists {
|
|
|
+ // return nil, fmt.Errorf("报告异常请求,请刷新重试")
|
|
|
+ // }
|
|
|
+ //}
|
|
|
// 1. 查mongo
|
|
|
var rData map[string]interface{}
|
|
|
var err error
|
|
@@ -684,8 +684,19 @@ func GetMongoColl(flag int) (string, error) {
|
|
|
func (mae *MarketAnalysisEntity) SaveMongoReport(rData map[string]interface{}, flag int) {
|
|
|
collName, _ := GetMongoColl(flag)
|
|
|
rData["s_m_id"] = mae.MgoRecordId
|
|
|
- db.Mgo.Save(collName, rData)
|
|
|
-
|
|
|
+ b, err := json.Marshal(rData)
|
|
|
+ if err != nil {
|
|
|
+ log.Println("JSON marshal error:", err)
|
|
|
+ } else {
|
|
|
+ var saveMap map[string]interface{}
|
|
|
+ err = json.Unmarshal(b, &saveMap)
|
|
|
+ if err != nil {
|
|
|
+ log.Println("JSON Unmarshal error:", err)
|
|
|
+ db.Mgo.Save(collName, rData)
|
|
|
+ } else {
|
|
|
+ db.Mgo.Save(collName, saveMap)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// GetAnalyzingReport 是否有正在分析的离线报告
|