修复bug
This commit is contained in:
		
							parent
							
								
									22ed7ab185
								
							
						
					
					
						commit
						09016138a5
					
				@ -149,7 +149,6 @@ func(this *App) RunManager() {
 | 
				
			|||||||
	}()
 | 
						}()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
func(this *App) WaitForExitSign(exitFunc ...func()) {
 | 
					func(this *App) WaitForExitSign(exitFunc ...func()) {
 | 
				
			||||||
	c := make(chan os.Signal, 1)
 | 
						c := make(chan os.Signal, 1)
 | 
				
			||||||
	signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
 | 
						signal.Notify(c, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
 | 
				
			||||||
 | 
				
			|||||||
@ -48,6 +48,8 @@ func main() {
 | 
				
			|||||||
		panic(err)
 | 
							panic(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						defer app.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kafka.Init()
 | 
						kafka.Init()
 | 
				
			||||||
	ck.Init()
 | 
						ck.Init()
 | 
				
			||||||
	mysql.Init()
 | 
						mysql.Init()
 | 
				
			||||||
 | 
				
			|||||||
@ -51,6 +51,8 @@ func main() {
 | 
				
			|||||||
		panic(err)
 | 
							panic(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						defer app.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	app.RunManager()
 | 
						app.RunManager()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	app.WaitForExitSign(func() {
 | 
						app.WaitForExitSign(func() {
 | 
				
			||||||
 | 
				
			|||||||
@ -76,13 +76,13 @@ func (this *Geoip2) GetAreaFromIP(rawIP string) (province, city string, err erro
 | 
				
			|||||||
	ip := net.ParseIP(rawIP)
 | 
						ip := net.ParseIP(rawIP)
 | 
				
			||||||
	if ip == nil {
 | 
						if ip == nil {
 | 
				
			||||||
		logs.Logger.Error("net.ParseIP", zap.String("can't parse ip", rawIP))
 | 
							logs.Logger.Error("net.ParseIP", zap.String("can't parse ip", rawIP))
 | 
				
			||||||
		return "", "", nil
 | 
							return "未知", "未知", nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = this.mmdb.Lookup(ip, &res)
 | 
						err = this.mmdb.Lookup(ip, &res)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		logs.Logger.Error("this.mmdb.Lookup", zap.String("err", err.Error()))
 | 
							logs.Logger.Error("this.mmdb.Lookup", zap.String("err", err.Error()))
 | 
				
			||||||
		return "", "", nil
 | 
							return "未知", "未知", nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(res.Subdivisions) > 0 {
 | 
						if len(res.Subdivisions) > 0 {
 | 
				
			||||||
 | 
				
			|||||||
@ -82,6 +82,8 @@ func main() {
 | 
				
			|||||||
		panic(err)
 | 
							panic(err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						defer app.Close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	geoip2, err := geoip.NewGeoip(geoip.GeoipMmdbByte)
 | 
						geoip2, err := geoip.NewGeoip(geoip.GeoipMmdbByte)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 | 
				
			|||||||
@ -27,8 +27,10 @@ type ReportAcceptStatus struct {
 | 
				
			|||||||
	flushInterval int
 | 
						flushInterval int
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const FailStatus = 0
 | 
					const (
 | 
				
			||||||
const SuccessStatus = 1
 | 
						FailStatus    = 0
 | 
				
			||||||
 | 
						SuccessStatus = 1
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func NewReportAcceptStatus(batchSize int, flushInterval int) *ReportAcceptStatus {
 | 
					func NewReportAcceptStatus(batchSize int, flushInterval int) *ReportAcceptStatus {
 | 
				
			||||||
	logs.Logger.Info("NewReportAcceptStatus", zap.Int("batchSize", batchSize), zap.Int("flushInterval", flushInterval))
 | 
						logs.Logger.Info("NewReportAcceptStatus", zap.Int("batchSize", batchSize), zap.Int("flushInterval", flushInterval))
 | 
				
			||||||
@ -49,7 +51,7 @@ func NewReportAcceptStatus(batchSize int, flushInterval int) *ReportAcceptStatus
 | 
				
			|||||||
func (this *ReportAcceptStatus) Flush() (err error) {
 | 
					func (this *ReportAcceptStatus) Flush() (err error) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this.bufferMutex.Lock()
 | 
						this.bufferMutex.Lock()
 | 
				
			||||||
	if len(this.buffer)==0{
 | 
						if len(this.buffer) == 0 {
 | 
				
			||||||
		this.bufferMutex.Unlock()
 | 
							this.bufferMutex.Unlock()
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -88,7 +90,7 @@ func (this *ReportAcceptStatus) Flush() (err error) {
 | 
				
			|||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		len := len(this.buffer)
 | 
							len := len(this.buffer)
 | 
				
			||||||
		if len > 0 {
 | 
							if len > 0 {
 | 
				
			||||||
			logs.Logger.Info("入库数据状态成功", zap.String("所花时间",  time.Now().Sub(startNow).String()), zap.Int("数据长度为", len))
 | 
								logs.Logger.Info("入库数据状态成功", zap.String("所花时间", time.Now().Sub(startNow).String()), zap.Int("数据长度为", len))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	stmt.Close()
 | 
						stmt.Close()
 | 
				
			||||||
 | 
				
			|||||||
@ -275,14 +275,6 @@ FROM
 | 
				
			|||||||
	(select * from meta_attr_relation where app_id = ?) mu
 | 
						(select * from meta_attr_relation where app_id = ?) mu
 | 
				
			||||||
	INNER JOIN (select * from meta_event where appid = ?  )  e ON e.event_name = mu.event_name
 | 
						INNER JOIN (select * from meta_event where appid = ?  )  e ON e.event_name = mu.event_name
 | 
				
			||||||
	INNER JOIN (select * from attribute where app_id = ? and (status = 1 or attribute_type = 1) and attribute_source = 2 and attribute_name not in ('xwl_part_event','xwl_part_date','xwl_kafka_offset') ) a ON a.attribute_name = mu.event_attr `
 | 
						INNER JOIN (select * from attribute where app_id = ? and (status = 1 or attribute_type = 1) and attribute_source = 2 and attribute_name not in ('xwl_part_event','xwl_part_date','xwl_kafka_offset') ) a ON a.attribute_name = mu.event_attr `
 | 
				
			||||||
	type eventNameAndTheAttr struct {
 | 
					 | 
				
			||||||
		EventNameDesc string `json:"event_name_desc" db:"event_name_desc"`
 | 
					 | 
				
			||||||
		EventName     string `json:"event_name" db:"event_name"`
 | 
					 | 
				
			||||||
		AttributeName string `json:"attribute_name" db:"attribute_name"`
 | 
					 | 
				
			||||||
		AttributeDesc string `json:"attribute_desc" db:"attribute_desc"`
 | 
					 | 
				
			||||||
		DataType      string `json:"data_type" db:"data_type"`
 | 
					 | 
				
			||||||
		AttributeType string `json:"attribute_type" db:"attribute_type"`
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = db.Sqlx.Select(&eventNameAndTheAttrList, getEventNameAndTheAttrSql, appid, appid, appid)
 | 
						err = db.Sqlx.Select(&eventNameAndTheAttrList, getEventNameAndTheAttrSql, appid, appid, appid)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
 | 
				
			|||||||
@ -145,13 +145,13 @@ func (this *PannelService) GetPannelList(managerUid int32, appid int) (res []Pan
 | 
				
			|||||||
	p1.id AS folder_id,
 | 
						p1.id AS folder_id,
 | 
				
			||||||
	ifnull(p2.report_tables,'') as report_tables ,
 | 
						ifnull(p2.report_tables,'') as report_tables ,
 | 
				
			||||||
	 ifnull(p2.id,0)as pannel_id,
 | 
						 ifnull(p2.id,0)as pannel_id,
 | 
				
			||||||
	ifnull(p2.pannel_name,'') as pannel_name,ifnull(p2.create_by,0) as create_by,ifnull(FIND_IN_SET(?,p2.managers),0) as folder_type,ifnull(p2.managers,'') as managers
 | 
						ifnull(p2.pannel_name,'') as pannel_name,ifnull(p1.create_by,0) as create_by,ifnull(FIND_IN_SET(?,p2.managers),0) as folder_type,ifnull(p2.managers,'') as managers
 | 
				
			||||||
FROM
 | 
					FROM
 | 
				
			||||||
	pannel_folder p1
 | 
						pannel_folder p1
 | 
				
			||||||
	LEFT JOIN pannel p2 ON p1.id = p2.folder_id 
 | 
						LEFT JOIN pannel p2 ON p1.id = p2.folder_id 
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
			WHERE
 | 
								WHERE
 | 
				
			||||||
				(p2.create_by = ? OR FIND_IN_SET(?,p2.managers)  or isnull(p2.create_by))   and appid= ?`
 | 
									(p1.create_by = ? OR FIND_IN_SET(?,p2.managers)  )   and appid= ?`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = db.Sqlx.Select(&res, sql, managerUid, managerUid, managerUid, appid)
 | 
						err = db.Sqlx.Select(&res, sql, managerUid, managerUid, managerUid, appid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -453,7 +453,7 @@ export default {
 | 
				
			|||||||
    async init() {
 | 
					    async init() {
 | 
				
			||||||
      const userListRes = await userList()
 | 
					      const userListRes = await userList()
 | 
				
			||||||
      if (userListRes) {
 | 
					      if (userListRes) {
 | 
				
			||||||
        for (var v of userListRes.data) {
 | 
					        for (let v of userListRes.data) {
 | 
				
			||||||
          this.userConfig[v.id] = v.realname
 | 
					          this.userConfig[v.id] = v.realname
 | 
				
			||||||
          this.allUserConfig.push(
 | 
					          this.allUserConfig.push(
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user