|
@@ -1023,6 +1023,7 @@ func (a *AnalysisEntity) MarketTime() (map[string]interface{}, error) {
|
|
sql []string
|
|
sql []string
|
|
monthB, yearB bool
|
|
monthB, yearB bool
|
|
MonthRange, YearRange string
|
|
MonthRange, YearRange string
|
|
|
|
+ isOffline = a.Offline == 1
|
|
)
|
|
)
|
|
sql = append(sql, fmt.Sprintf(aggsMarketAnalysis, "thismarket", fmt.Sprintf(`{"key":"%s","from":%d,"to":%d}`, "market", a.FormatParam.STime, a.FormatParam.ETime)))
|
|
sql = append(sql, fmt.Sprintf(aggsMarketAnalysis, "thismarket", fmt.Sprintf(`{"key":"%s","from":%d,"to":%d}`, "market", a.FormatParam.STime, a.FormatParam.ETime)))
|
|
n_stime := a.FormatParam.STime
|
|
n_stime := a.FormatParam.STime
|
|
@@ -1036,10 +1037,10 @@ func (a *AnalysisEntity) MarketTime() (map[string]interface{}, error) {
|
|
sql = append(sql, fmt.Sprintf(aggsMarketAnalysis, "oldmarket", fmt.Sprintf(`{"key":"%s","from":%d,"to":%d}`, "market", n_stime, a.FormatParam.STime)))
|
|
sql = append(sql, fmt.Sprintf(aggsMarketAnalysis, "oldmarket", fmt.Sprintf(`{"key":"%s","from":%d,"to":%d}`, "market", n_stime, a.FormatParam.STime)))
|
|
}
|
|
}
|
|
|
|
|
|
- if time.Unix(a.FormatParam.STime, 0).AddDate(0, 1, 0).Unix() < time.Unix(a.FormatParam.ETime, 0).Unix() {
|
|
|
|
|
|
+ if isOffline || time.Unix(a.FormatParam.STime, 0).AddDate(0, 1, 0).Unix() < time.Unix(a.FormatParam.ETime, 0).Unix() {
|
|
var mon_time, year_time int64
|
|
var mon_time, year_time int64
|
|
stime, etime := time.Unix(a.FormatParam.STime, 0), time.Unix(a.FormatParam.ETime, 0)
|
|
stime, etime := time.Unix(a.FormatParam.STime, 0), time.Unix(a.FormatParam.ETime, 0)
|
|
- monthB, MonthRange = GetMonthData(stime, etime)
|
|
|
|
|
|
+ monthB, MonthRange = GetMonthData(isOffline, stime, etime)
|
|
sql = append(sql, fmt.Sprintf(projectTimeDistribution, "monthtime", MonthRange))
|
|
sql = append(sql, fmt.Sprintf(projectTimeDistribution, "monthtime", MonthRange))
|
|
if monthB {
|
|
if monthB {
|
|
mon_time = stime.AddDate(0, -1, 0).Unix()
|
|
mon_time = stime.AddDate(0, -1, 0).Unix()
|
|
@@ -1047,7 +1048,7 @@ func (a *AnalysisEntity) MarketTime() (map[string]interface{}, error) {
|
|
mon_time = a.FormatParam.STime
|
|
mon_time = a.FormatParam.STime
|
|
}
|
|
}
|
|
//年度数据
|
|
//年度数据
|
|
- yearB, YearRange = GetYearData(stime, etime)
|
|
|
|
|
|
+ yearB, YearRange = GetYearData(isOffline, stime, etime)
|
|
sql = append(sql, fmt.Sprintf(projectTimeDistribution, "yeartime", YearRange))
|
|
sql = append(sql, fmt.Sprintf(projectTimeDistribution, "yeartime", YearRange))
|
|
if yearB {
|
|
if yearB {
|
|
year_time = stime.AddDate(-1, 0, 0).Unix()
|
|
year_time = stime.AddDate(-1, 0, 0).Unix()
|
|
@@ -1062,8 +1063,10 @@ func (a *AnalysisEntity) MarketTime() (map[string]interface{}, error) {
|
|
n_stime = year_time
|
|
n_stime = year_time
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- n_mae.FormatParam.STime = n_stime
|
|
|
|
|
|
+ //非离线
|
|
|
|
+ if !isOffline {
|
|
|
|
+ n_mae.FormatParam.STime = n_stime
|
|
|
|
+ }
|
|
finalSql := fmt.Sprintf(n_mae.GetCommonQuerySqlWithAggs(), strings.Join(sql, ","))
|
|
finalSql := fmt.Sprintf(n_mae.GetCommonQuerySqlWithAggs(), strings.Join(sql, ","))
|
|
log.Printf("final MarketScaleRefineQuery sql: %s", finalSql)
|
|
log.Printf("final MarketScaleRefineQuery sql: %s", finalSql)
|
|
rMap := make(map[string]interface{})
|
|
rMap := make(map[string]interface{})
|