Exemple #1
0
//处理单元入口
func GetData(dp *common.DataParam, t time.Time) *common.OutputParam {
	if dp.TimeRange == 1 && len(dp.LimitId) == 1 { //单网元,单时间点,用于指标详细
		log.Infoln("开始处理过程,单网元,单时间点,用于指标详细")
		return GetColumnsData(dp, t)
	} else if dp.TimeRange > 1 && len(dp.LimitId) == 1 { //单网元,多时间点,用于走势图
		log.Infoln("开始处理过程,单网元,多时间点,用于走势图")
		return GetTimeLineData(dp, t)
	} else if dp.TimeRange == 1 && (len(dp.LimitId) > 1 || len(dp.LimitNodeId) > 0) { //单时间点,多网元,用于排行榜
		log.Infoln("开始处理过程,单时间点,多网元,用于排行榜")
		return GetOrderData(dp, t)
	} else { //多时间点,多网元,暂不支持
		log.Error("开始处理过程,不被支持的过程", dp.ToString())
		return nil
	}
}
Exemple #2
0
//注册推送数据的请求
func pid2(cmd *common.RequestData, c *online.Client) {
	if checkParamError(cmd, c, "DataKey", "DataRange", "Id", "LimitId", "OrderBy", "OrderKey", "OutputKey", "TimeRange") {
		return
	}
	dp := new(common.DataParam)
	dp.DataKey = cmd.GetString("DataKey")
	dp.DataRange = cmd.GetInt("DataRange")
	dp.Id = cmd.GetString("Id")
	dp.LimitId = cmd.GetStringArray("LimitId")
	dp.OrderBy = cmd.GetInt("OrderBy")
	dp.OrderKey = cmd.GetString("OrderKey")
	dp.OutputKey = cmd.GetStringArray("OutputKey")
	dp.FillKey = cmd.GetString("FillKey")
	dp.TimeRange = cmd.GetInt("TimeRange")
	c.AddRequest(dp)
	//同时直接返回一次数据,否则界面会有空白期
	tm := &common.TimeMessage{Time: online.GetCurrentTime()}
	c.Processing(tm)
}