// Copyright 2019 getensh.com. All rights reserved. // Use of this source code is governed by getensh.com. // package impl implement all interfaces of micro service in gd_access_log package impl import ( "context" "gd_access_log/apis" "gd_access_log/impl/access_log" "gd_access_log/impl/h5_access_log" "gd_access_log/rpc_apis/gd_management" "time" "gd_access_log/common.in/task" "github.com/astaxie/beego/orm" ) // 具体实现 type Rcvr struct { } func (c *Rcvr) LogAddAccessLog(ctx context.Context, req *apis.LogAddAccessLogReq, reply *apis.LogAddAccessLogReply) error { t1 := func() error { return access_log.LogAddAccessLog(ctx, req, reply) } return task.Do(ctx, t1) } // 添加无效日志 func (c *Rcvr) LogAddInvalidAccessLog(ctx context.Context, req *apis.LogAddInvalidAccessLogReq, reply *apis.LogAddInvalidAccessLogReply) error { t1 := func() error { return access_log.LogAddInvalidAccessLog(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) H5LogAddAccessLog(ctx context.Context, req *apis.H5LogAddAccessLogReq, reply *apis.H5LogAddAccessLogReply) error { t1 := func() error { return h5_access_log.H5LogAddAccessLog(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) TryApiAccessLogAdd(ctx context.Context, req *apis.TryApiAccessLogReq, reply *apis.TryApiAccessLogReply) error { t1 := func() error { return access_log.TryApiAccessLogAdd(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) LogUpdateApiName(ctx context.Context, req *apis.LogUpdateApiNameReq, reply *apis.LogUpdateApiNameReply) error { t1 := func() error { return access_log.LogUpdateApiName(ctx, req, reply) } return task.Do(ctx, t1) } func (c *Rcvr) LogCallbackIn(ctx context.Context, req *apis.LogCallbackInReq, reply *apis.LogCallbackInReply) error { task1 := func() error { return access_log.LogCallbackIn(ctx, req, reply) } return task.Do(ctx, task1) } func (c *Rcvr) LogCallbackOut(ctx context.Context, req *apis.LogCallbackOutReq, reply *apis.LogCallbackOutReply) error { task1 := func() error { return access_log.LogCallbackOut(ctx, req, reply) } return task.Do(ctx, task1) } func RegisterOrmModel() { //orm.RegisterModel(new(apis.AccessLog)) //orm.RegisterModel(new(apis.TGdAccessLogHistory)) //orm.RegisterModel(new(apis.ThirdpartLog)) //orm.RegisterModel(new(apis.TGdThirdpartAccessLogHistory)) orm.RegisterModel(new(apis.TGdAccessLogCountExport)) orm.RegisterModel(new(apis.InvalidAccessLog)) orm.RegisterModel(new(apis.H5AccessLog)) orm.RegisterModel(new(apis.H5ThirdpartLog)) orm.RegisterModel(new(apis.TryApiAccessLog)) orm.RegisterModel(new(apis.AccessLogDay)) orm.RegisterModel(new(apis.ThirdpartLogDay)) orm.RegisterModel(new(apis.TGdAccessLogMonth1)) orm.RegisterModel(new(apis.TGdAccessLogMonth2)) orm.RegisterModel(new(apis.TGdAccessLogMonth3)) orm.RegisterModel(new(apis.TGdAccessLogMonth4)) orm.RegisterModel(new(apis.TGdAccessLogMonth5)) orm.RegisterModel(new(apis.TGdAccessLogMonth6)) orm.RegisterModel(new(apis.TGdAccessLogMonth7)) orm.RegisterModel(new(apis.TGdAccessLogMonth8)) orm.RegisterModel(new(apis.TGdAccessLogMonth9)) orm.RegisterModel(new(apis.TGdAccessLogMonth10)) orm.RegisterModel(new(apis.TGdAccessLogMonth11)) orm.RegisterModel(new(apis.TGdAccessLogMonth12)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth1)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth2)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth3)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth4)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth5)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth6)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth7)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth8)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth9)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth10)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth11)) orm.RegisterModel(new(apis.TGdThirdpartLogMonth12)) } func CleanLocalCache() { t := time.NewTicker(5 * time.Minute) for { select { case <-t.C: gd_management.CleanNameMap() } } }