修复路径分析 用户分群筛选bug(多谢广州好友相助)
This commit is contained in:
		
							parent
							
								
									4b2c97d563
								
							
						
					
					
						commit
						4179e50a26
					
				@ -58,7 +58,7 @@ func (this RealDataController) List(ctx *fiber.Ctx) error {
 | 
				
			|||||||
	if strings.TrimSpace(reqData.SearchKw)!="" {
 | 
						if strings.TrimSpace(reqData.SearchKw)!="" {
 | 
				
			||||||
		filterSql =  filterSql+ ` and event_name like '%`+reqData.SearchKw+`%' `
 | 
							filterSql =  filterSql+ ` and event_name like '%`+reqData.SearchKw+`%' `
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sql := `select report_data,event_name,create_time as create_time from xwl_real_time_warehousing where   table_id = ?    `+filterSql+` order by create_time desc limit 0,1000;`
 | 
						sql := `select report_data,event_name,create_time as create_time from xwl_real_time_warehousing prewhere   table_id = ?    `+filterSql+` order by create_time desc limit 0,1000;`
 | 
				
			||||||
	logs.Logger.Sugar().Infof("sql",sql,args)
 | 
						logs.Logger.Sugar().Infof("sql",sql,args)
 | 
				
			||||||
	var res []Res
 | 
						var res []Res
 | 
				
			||||||
	err := db.ClickHouseSqlx.Select(&res,sql,
 | 
						err := db.ClickHouseSqlx.Select(&res,sql,
 | 
				
			||||||
 | 
				
			|||||||
@ -9,6 +9,7 @@ import (
 | 
				
			|||||||
	"go.uber.org/zap"
 | 
						"go.uber.org/zap"
 | 
				
			||||||
	"runtime"
 | 
						"runtime"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
						"time"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func Cors(handle fasthttp.RequestHandler) fasthttp.RequestHandler {
 | 
					func Cors(handle fasthttp.RequestHandler) fasthttp.RequestHandler {
 | 
				
			||||||
@ -30,6 +31,14 @@ func Cors(handle fasthttp.RequestHandler) fasthttp.RequestHandler {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func FTimer(handle fasthttp.RequestHandler) fasthttp.RequestHandler {
 | 
				
			||||||
 | 
						return func(ctx *fasthttp.RequestCtx) {
 | 
				
			||||||
 | 
							startT := time.Now()
 | 
				
			||||||
 | 
							handle(ctx)
 | 
				
			||||||
 | 
							logs.Logger.Info("handle lost time",zap.String("time",time.Now().Sub(startT).String()))
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func WechatSpider(handle fasthttp.RequestHandler) fasthttp.RequestHandler {
 | 
					func WechatSpider(handle fasthttp.RequestHandler) fasthttp.RequestHandler {
 | 
				
			||||||
	return func(ctx *fasthttp.RequestCtx) {
 | 
						return func(ctx *fasthttp.RequestCtx) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -114,6 +114,8 @@ func (this *Trace) GetTableSql() (SQL string, allArgs []interface{}, err error)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	allArgs = append(allArgs, whereFilterArgs...)
 | 
						allArgs = append(allArgs, whereFilterArgs...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						allArgs = append(allArgs, this.args...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	allArgs = append(allArgs, userFilterArgs...)
 | 
						allArgs = append(allArgs, userFilterArgs...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SQL = `
 | 
						SQL = `
 | 
				
			||||||
@ -288,6 +290,8 @@ func NewTrace(reqData []byte) (Ianalysis, error) {
 | 
				
			|||||||
	obj.eventNameMapStr = mapStr
 | 
						obj.eventNameMapStr = mapStr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	obj.sql, obj.args, err = utils.GetUserGroupSqlAndArgs(obj.req.UserGroup, obj.req.Appid)
 | 
						obj.sql, obj.args, err = utils.GetUserGroupSqlAndArgs(obj.req.UserGroup, obj.req.Appid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
@ -20,7 +20,7 @@ func (this RealDataService) FailDataList(minutes int,appid int) (failDataResList
 | 
				
			|||||||
			toStartOfInterval(a.part_date, INTERVAL `+strconv.Itoa(minutes)+`  minute) as interval_date,
 | 
								toStartOfInterval(a.part_date, INTERVAL `+strconv.Itoa(minutes)+`  minute) as interval_date,
 | 
				
			||||||
			formatDateTime(interval_date,'%Y-%m-%d') as year ,formatDateTime(interval_date,'%H:%M') as start_minute, formatDateTime(addMinutes(interval_date, ?),'%H:%M') as end_minute,
 | 
								formatDateTime(interval_date,'%Y-%m-%d') as year ,formatDateTime(interval_date,'%H:%M') as start_minute, formatDateTime(addMinutes(interval_date, ?),'%H:%M') as end_minute,
 | 
				
			||||||
			count(report_data) as count,a.error_reason,a.error_handling,report_type 
 | 
								count(report_data) as count,a.error_reason,a.error_handling,report_type 
 | 
				
			||||||
			from (select * from xwl_acceptance_status where table_id = ? and status = ? order by part_date desc limit 1000 ) a
 | 
								from (select * from xwl_acceptance_status prewhere table_id = ? and status = ? order by part_date desc limit 1000 ) a
 | 
				
			||||||
			group by interval_date,a.error_reason,a.error_handling,report_type
 | 
								group by interval_date,a.error_reason,a.error_handling,report_type
 | 
				
			||||||
			order by interval_date desc;
 | 
								order by interval_date desc;
 | 
				
			||||||
	`,minutes,appid,consumer_data.FailStatus)
 | 
						`,minutes,appid,consumer_data.FailStatus)
 | 
				
			||||||
@ -30,7 +30,7 @@ func (this RealDataService) FailDataList(minutes int,appid int) (failDataResList
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func(this RealDataService) FailDataDesc(appid ,startTime ,endTime ,errorReason ,errorHandling ,reportType string )(data string ,err error){
 | 
					func(this RealDataService) FailDataDesc(appid ,startTime ,endTime ,errorReason ,errorHandling ,reportType string )(data string ,err error){
 | 
				
			||||||
	err = db.ClickHouseSqlx.Get(&data, `
 | 
						err = db.ClickHouseSqlx.Get(&data, `
 | 
				
			||||||
			select report_data from xwl_acceptance_status where
 | 
								select report_data from xwl_acceptance_status prewhere
 | 
				
			||||||
			table_id = `+appid+`
 | 
								table_id = `+appid+`
 | 
				
			||||||
			and part_date >= '`+startTime+`'
 | 
								and part_date >= '`+startTime+`'
 | 
				
			||||||
			and part_date <= '`+endTime+`'
 | 
								and part_date <= '`+endTime+`'
 | 
				
			||||||
@ -61,16 +61,16 @@ func(this RealDataService)ReportCount(appid string,startTime string,endTime stri
 | 
				
			|||||||
	if util.FilterMysqlNilErr(mysqlErr) {
 | 
						if util.FilterMysqlNilErr(mysqlErr) {
 | 
				
			||||||
		return nil,mysqlErr
 | 
							return nil,mysqlErr
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	err = db.ClickHouseSqlx.Select(&allCountArr, `select data_name,count() as count from xwl_acceptance_status xas where table_id = `+appid+` and  part_date >= '`+startTime+`'  and part_date <= '`+endTime+`' group by data_name`)
 | 
						err = db.ClickHouseSqlx.Select(&allCountArr, `select data_name,count() as count from xwl_acceptance_status xas prewhere table_id = `+appid+` and  part_date >= '`+startTime+`'  and part_date <= '`+endTime+`' group by data_name`)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil,err
 | 
							return nil,err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = db.ClickHouseSqlx.Select(&failCountArr, `select data_name,count() as count from xwl_acceptance_status xas where   status = 0 and	table_id = `+appid+` and  part_date >= '`+startTime+`'  and part_date <= '`+endTime+`' group by data_name`)
 | 
						err = db.ClickHouseSqlx.Select(&failCountArr, `select data_name,count() as count from xwl_acceptance_status xas prewhere   status = 0 and	table_id = `+appid+` and  part_date >= '`+startTime+`'  and part_date <= '`+endTime+`' group by data_name`)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil,err
 | 
							return nil,err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	err = db.ClickHouseSqlx.Select(&succCountArr, `select data_name,count() as count from xwl_acceptance_status xas where  status = 1 and table_id = `+appid+` and  part_date >= '`+startTime+`'  and part_date <= '`+endTime+`' group by data_name`)
 | 
						err = db.ClickHouseSqlx.Select(&succCountArr, `select data_name,count() as count from xwl_acceptance_status xas prewhere  status = 1 and table_id = `+appid+` and  part_date >= '`+startTime+`'  and part_date <= '`+endTime+`' group by data_name`)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil,err
 | 
							return nil,err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -115,7 +115,7 @@ func(this RealDataService)ReportCount(appid string,startTime string,endTime stri
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func(this RealDataService)EventFailDesc(appid ,startTime ,endTime,dataName string)(res []response.EventFailDescRes,err error){
 | 
					func(this RealDataService)EventFailDesc(appid ,startTime ,endTime,dataName string)(res []response.EventFailDescRes,err error){
 | 
				
			||||||
	err = db.ClickHouseSqlx.Select(&res, `select error_reason,count() as count,any(report_data) as report_data from xwl_acceptance_status where 
 | 
						err = db.ClickHouseSqlx.Select(&res, `select error_reason,count() as count,any(report_data) as report_data from xwl_acceptance_status prewhere 
 | 
				
			||||||
			table_id = `+appid+`
 | 
								table_id = `+appid+`
 | 
				
			||||||
			and part_date >= '`+startTime+`'
 | 
								and part_date >= '`+startTime+`'
 | 
				
			||||||
			and part_date <= '`+endTime+`'
 | 
								and part_date <= '`+endTime+`'
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user