This commit is contained in:
1340691923@qq.com 2022-02-17 17:22:02 +08:00
parent b2b393054f
commit 68341adf80
10 changed files with 25 additions and 30 deletions

View File

@ -162,7 +162,7 @@ func InitRbac() (fn func(), err error) {
func InitOpenWinBrowser() (fn func(), err error) { func InitOpenWinBrowser() (fn func(), err error) {
config := model.GlobConfig config := model.GlobConfig
if !config.Manager.DeBug { if !config.Manager.DeBug {
port := ":" + strconv.Itoa(config.Manager.Port) port := ":" + strconv.Itoa(int(config.Manager.Port))
uri := fmt.Sprintf("%s%s", "http://127.0.0.1", port) uri := fmt.Sprintf("%s%s", "http://127.0.0.1", port)
util.OpenWinBrowser(uri) util.OpenWinBrowser(uri)
log.Println(fmt.Sprintf("将打开浏览器!地址为:%v", log.Println(fmt.Sprintf("将打开浏览器!地址为:%v",

View File

@ -38,7 +38,6 @@ func init() {
// By 肖文龙 // By 肖文龙
func main() { func main() {
log.Println("configFileDir", configFileDir)
app := application.NewApp( app := application.NewApp(
"report_server", "report_server",
application.WithConfigFileDir(configFileDir), application.WithConfigFileDir(configFileDir),

View File

@ -36,7 +36,7 @@
"mysql": { "mysql": {
"username":"root", "username":"root",
"pwd":"123456", "pwd":"123456",
"ip":"127.0.0.1", "ip":"192.168.1.236",
"port":"3306", "port":"3306",
"dbName":"lyn_bi", "dbName":"lyn_bi",
"maxOpenConns":10, "maxOpenConns":10,
@ -45,7 +45,7 @@
"clickhouse": { "clickhouse": {
"username":"default", "username":"default",
"pwd":"EtHnvllx", "pwd":"EtHnvllx",
"ip":"127.0.0.1", "ip":"192.168.1.236",
"port":"9000", "port":"9000",
"dbName":"default", "dbName":"default",
"clusterName":"perftest_3shards_1replicas", "clusterName":"perftest_3shards_1replicas",
@ -55,7 +55,7 @@
"maxIdleConns":1000 "maxIdleConns":1000
}, },
"kafka": { "kafka": {
"addresses":["127.0.0.1:9092"], "addresses":["192.168.1.236:9092"],
"username":"", "username":"",
"password":"", "password":"",
"numPartitions":300, "numPartitions":300,
@ -66,12 +66,12 @@
"realTimeDataGroup": "realTimeDataGroup2" "realTimeDataGroup": "realTimeDataGroup2"
}, },
"elasticSearch": { "elasticSearch": {
"Addresses":["http://127.0.0.1:9200"], "Addresses":["http://192.168.1.236:9200"],
"Username":"", "Username":"",
"Password":"" "Password":""
}, },
"redis": { "redis": {
"addr":"127.0.0.1:6379", "addr":"192.168.1.236:6379",
"passwd":"", "passwd":"",
"db": 7, "db": 7,
"maxIdle": 300, "maxIdle": 300,

View File

@ -17,7 +17,7 @@ type BehaviorAnalysisController struct {
func (this BehaviorAnalysisController) GetConfigs(ctx *fiber.Ctx) error { func (this BehaviorAnalysisController) GetConfigs(ctx *fiber.Ctx) error {
type ReqData struct { type ReqData struct {
Appid int `json:"appid"` Appid int32 `json:"appid"`
} }
var reqData ReqData var reqData ReqData
err := ctx.BodyParser(&reqData) err := ctx.BodyParser(&reqData)
@ -27,7 +27,7 @@ func (this BehaviorAnalysisController) GetConfigs(ctx *fiber.Ctx) error {
behaviorAnalysisService := analysis.BehaviorAnalysisService{} behaviorAnalysisService := analysis.BehaviorAnalysisService{}
eventNameList, attributeMap, err := behaviorAnalysisService.GetConfigs(reqData.Appid) eventNameList, attributeMap, err := behaviorAnalysisService.GetConfigs(int(reqData.Appid))
if err != nil { if err != nil {
return this.Error(ctx, err) return this.Error(ctx, err)
@ -72,7 +72,7 @@ func (this BehaviorAnalysisController) LoadPropQuotas(ctx *fiber.Ctx) error {
func (this BehaviorAnalysisController) GetValues(ctx *fiber.Ctx) error { func (this BehaviorAnalysisController) GetValues(ctx *fiber.Ctx) error {
type ReqData struct { type ReqData struct {
Appid int `json:"appid"` Appid int32 `json:"appid"`
Table string `json:"table"` Table string `json:"table"`
Col string `json:"col"` Col string `json:"col"`
} }
@ -82,7 +82,7 @@ func (this BehaviorAnalysisController) GetValues(ctx *fiber.Ctx) error {
return this.Error(ctx, err) return this.Error(ctx, err)
} }
appid := strconv.Itoa(reqData.Appid) appid := strconv.Itoa(int(reqData.Appid))
table := reqData.Table table := reqData.Table
col := reqData.Col col := reqData.Col

View File

@ -13,7 +13,7 @@ func NewEsClient(address []string, username, password string) (esClient *elastic
optList = append(optList, elastic.SetBasicAuth(username, password)) optList = append(optList, elastic.SetBasicAuth(username, password))
} }
esClient, err = elastic.NewClient(optList...) esClient, err = elastic.NewSimpleClient(optList...)
return return
} }

View File

@ -1,18 +1,18 @@
package model package model
type App struct { type App struct {
Page uint64 `json:"page" db:"-"`
Limit uint64 `json:"limit" db:"-"`
IsClose *int `db:"is_close" json:"is_close"`
Id int `db:"id" json:"id"` Id int `db:"id" json:"id"`
CreateBy int `db:"create_by" json:"create_by"`
UpdateBy int `db:"update_by" json:"update_by"`
SaveMonth int `db:"save_mouth" json:"save_mouth"`
AppName string `db:"app_name" json:"app_name"` AppName string `db:"app_name" json:"app_name"`
Descibe string `db:"descibe" json:"descibe"` Descibe string `db:"descibe" json:"descibe"`
AppId string `db:"app_id" json:"app_id"` AppId string `db:"app_id" json:"app_id"`
AppKey string `db:"app_key" json:"app_key"` AppKey string `db:"app_key" json:"app_key"`
CreateBy int `db:"create_by" json:"create_by"`
UpdateBy int `db:"update_by" json:"update_by"`
CreateTime string `db:"create_time" json:"create_time"` CreateTime string `db:"create_time" json:"create_time"`
UpdateTime string `db:"update_time" json:"update_time"` UpdateTime string `db:"update_time" json:"update_time"`
AppManager string `db:"app_manager" json:"app_manager"` AppManager string `db:"app_manager" json:"app_manager"`
SaveMonth int `db:"save_mouth" json:"save_mouth"`
IsClose *int `db:"is_close" json:"is_close"`
Page uint64 `json:"page" db:"-"`
Limit uint64 `json:"limit" db:"-"`
} }

View File

@ -28,7 +28,7 @@ type Config struct {
} }
type ManagerConfig struct{ type ManagerConfig struct{
Port int `json:"port"` //铸龙分析系统http启动端口 Port uint16 `json:"port"` //铸龙分析系统http启动端口
CkQueryLimit int `json:"ckQueryLimit"` //clickhouse 查询限流器阈值 CkQueryLimit int `json:"ckQueryLimit"` //clickhouse 查询限流器阈值
CkQueryExpiration int `json:"ckQueryExpiration"` //clickhouse 查询限流器阈值 CkQueryExpiration int `json:"ckQueryExpiration"` //clickhouse 查询限流器阈值
JwtSecret string `json:"jwtSecret"` JwtSecret string `json:"jwtSecret"`
@ -39,7 +39,7 @@ type SinkerConfig struct {
ReportAcceptStatus BatchConfig `json:"reportAcceptStatus"` ReportAcceptStatus BatchConfig `json:"reportAcceptStatus"`
ReportData2CK BatchConfig `json:"reportData2CK"` ReportData2CK BatchConfig `json:"reportData2CK"`
RealTimeWarehousing BatchConfig `json:"realTimeWarehousing"` RealTimeWarehousing BatchConfig `json:"realTimeWarehousing"`
PprofHttpPort int `json:"pprofHttpPort"` PprofHttpPort uint16 `json:"pprofHttpPort"`
} }
type RedisConfig struct { type RedisConfig struct {
@ -80,7 +80,7 @@ type MysqlConfig struct {
} }
type ReportConfig struct { type ReportConfig struct {
ReportPort int `json:"reportPort"`//上报程序启动端口 ReportPort uint16 `json:"reportPort"`//上报程序启动端口
ReadTimeout int `json:"readTimeout"` ReadTimeout int `json:"readTimeout"`
WriteTimeout int `json:"writeTimeout"` WriteTimeout int `json:"writeTimeout"`
MaxConnsPerIP int `json:"maxConnsPerIP"` MaxConnsPerIP int `json:"maxConnsPerIP"`
@ -116,11 +116,11 @@ func (this *Config) GetKafkaCfgProducerType() string {
} }
type KafkaCfg struct { type KafkaCfg struct {
NumPartitions int32 `json:"numPartitions"`
Addresses []string `json:"addresses"` Addresses []string `json:"addresses"`
Username string `json:"username"` Username string `json:"username"`
Password string `json:"password"` Password string `json:"password"`
ReportTopicName string `json:"reportTopicName"` ReportTopicName string `json:"reportTopicName"`
NumPartitions int32 `json:"numPartitions"`
ConsumerGroupName string `json:"consumerGroupName"` ConsumerGroupName string `json:"consumerGroupName"`
RealTimeDataGroup string `json:"realTimeDataGroup"` RealTimeDataGroup string `json:"realTimeDataGroup"`
ReportData2CKGroup string `json:"reportData2CKGroup"` ReportData2CKGroup string `json:"reportData2CKGroup"`

View File

@ -10,9 +10,9 @@ import (
// GmUserModel BI用户 // GmUserModel BI用户
type GmUserModel struct { type GmUserModel struct {
ID int32 `json:"id" db:"id"` ID int32 `json:"id" db:"id"`
RoleId int32 `json:"role_id" db:"role_id"`
Username string `json:"username" db:"username"` Username string `json:"username" db:"username"`
Password string `json:"password" db:"password"` Password string `json:"password" db:"password"`
RoleId int32 `json:"role_id" db:"role_id"`
Realname string `json:"realname" db:"realname"` Realname string `json:"realname" db:"realname"`
CreateTime string `db:"create_time" json:"create_time"` CreateTime string `db:"create_time" json:"create_time"`
UpdateTime string `db:"update_time" json:"update_time"` UpdateTime string `db:"update_time" json:"update_time"`

View File

@ -44,11 +44,8 @@ func (this *ReportData2CK) Flush() (err error) {
rowsMap := map[string][][]interface{}{} rowsMap := map[string][][]interface{}{}
for _, data := range this.buffer { for _, data := range this.buffer {
for tableName, metric := range data { for tableName, metric := range data {
rows := [][]interface{}{} rows := [][]interface{}{}
if _, haveKey := rowsMap[tableName]; haveKey { if _, haveKey := rowsMap[tableName]; haveKey {
rows = rowsMap[tableName] rows = rowsMap[tableName]
} else { } else {
@ -98,7 +95,6 @@ func (this *ReportData2CK) Flush() (err error) {
logs.Logger.Error("CK入库失败", zap.Error(err)) logs.Logger.Error("CK入库失败", zap.Error(err))
return false return false
} }
log.Println("insertSql",insertSql)
stmt, err := tx.Prepare(insertSql) stmt, err := tx.Prepare(insertSql)
if err != nil { if err != nil {
logs.Logger.Error("CK入库失败", zap.Error(err)) logs.Logger.Error("CK入库失败", zap.Error(err))

View File

@ -42,7 +42,7 @@ func Init() *App {
Rbac, Rbac,
) )
runRouterGroupFn( return runRouterGroupFn(
app, app,
runOperaterLog, runOperaterLog,
runGmUser, runGmUser,
@ -53,13 +53,13 @@ func Init() *App {
runApp, runApp,
runUserGroup, runUserGroup,
) )
return app
} }
type routerGroupFn func(app *App) type routerGroupFn func(app *App)
func runRouterGroupFn(app *App, fns ...routerGroupFn) { func runRouterGroupFn(app *App, fns ...routerGroupFn) *App {
for _, fn := range fns { for _, fn := range fns {
fn(app) fn(app)
} }
return app
} }