Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"account.go",
"config.go",
"databus.go",
"event.go",
"eventmsg.go",
"factor.go",
"factor_group.go",
"params.go",
"punishment.go",
"qcloud.go",
"risk.go",
"rpc.go",
"service.go",
"spy.go",
"stat.go",
"user_event_history.go",
"user_info.go",
],
importpath = "go-common/app/service/main/spy/model",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/account/model:go_default_library",
"//library/time:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,35 @@
package model
import accmdl "go-common/app/service/main/account/model"
// TelInfo def.
type TelInfo struct {
Mid int64 `json:"mid"`
Tel string `json:"tel"`
JoinIP string `json:"join_ip"`
JoinTime int64 `json:"join_time"`
}
// AuditInfo is.
type AuditInfo struct {
Mid int64 `json:"mid"`
BindTel bool `json:"bind_tel"`
BindMail bool `json:"bind_mail"`
Rank int64 `json:"rank"`
SpaceSta int64 `json:"spacesta"`
}
// ProfileInfo profile info.
type ProfileInfo = accmdl.Profile
// TelRiskInfo tel risk info.
type TelRiskInfo struct {
TelRiskLevel int8
RestoreHistory *UserEventHistory
UnicomGiftState int
}
// UnicomGiftState unicom gift state.
type UnicomGiftState struct {
State int `json:"state"`
}

View File

@@ -0,0 +1,39 @@
package model
import "time"
// config properties.
const (
LimitBlockCount = "limitBlockCount"
LessBlockScore = "lessBlockScore"
AutoBlock = "autoBlock"
AutoBlockOpen = 1
)
const (
//BlockReasonSize block reason size
BlockReasonSize = 4
//BlockLockKey cycle block
BlockLockKey = "cycleblock"
//VipEnableStatus enable status
VipEnableStatus int32 = 1
//VipNonType non vip
VipNonType int32 = 0
// ReliveCheckTimes relive check times
ReliveCheckTimes = 1
// DoubleCheckRemake double check remake
DoubleCheckRemake = "导入二次验证,恢复行为得分"
// RetryTimes retry times
RetryTimes = 3
// SpyInitScore spy init score
SpyInitScore = 100
)
// Config def.
type Config struct {
ID int64
Property string
Name string
Val string
Ctime time.Time
}

View File

@@ -0,0 +1,20 @@
package model
// ScoreChange DataBus spy score change.
type ScoreChange struct {
Mid int64 `json:"mid"`
Score int8 `json:"score"`
BaseScore int8 `json:"base_score"`
EventScore int8 `json:"event_score"`
TS int64 `json:"ts"`
Reason string `json:"reason"`
RiskLevel int8 `json:"risk_level"`
}
const (
//CoinReason coin reason ref update score
CoinReason = "coin-service"
//CoinHighRisk coin high risk
CoinHighRisk = 7
)

View File

@@ -0,0 +1,16 @@
package model
import (
"go-common/library/time"
)
// Event def.
type Event struct {
ID int64
Name string // 事件标示
NickName string // 事件可读昵称
ServiceID int64
Status int8 // 0:删除 1:未删除
CTime time.Time
MTime time.Time
}

View File

@@ -0,0 +1,20 @@
package model
import (
"go-common/library/time"
)
// EventMessage event from bigdata def.
type EventMessage struct {
Time time.Time `json:"time"`
IP string `json:"ip"`
Service string `json:"service"`
Event string `json:"event"`
ActiveMid int64 `json:"active_mid"`
TargetMid int64 `json:"target_mid"`
TargetID int64 `json:"target_id"`
Args interface{} `json:"args"`
Result string `json:"result"`
Effect string `json:"effect"`
RiskLevel int8 `json:"risk_level"`
}

View File

@@ -0,0 +1,18 @@
package model
import (
"go-common/library/time"
)
// Factor def.
type Factor struct {
ID int64
NickName string //风险因子名字
ServiceID int64
EventID int64
GroupID int64
RiskLevel int8 //风险等级1-9
FactorVal float64 //风险得分
CTime time.Time
MTime time.Time
}

View File

@@ -0,0 +1,12 @@
package model
import (
"go-common/library/time"
)
// FactorGroup is.
type FactorGroup struct {
ID int64
Name string //风险因子组名
CTime time.Time
}

View File

@@ -0,0 +1,7 @@
package model
// NotifyInfo notify.
type NotifyInfo struct {
Mid int64 `json:"mid"`
Action string `json:"action"`
}

View File

@@ -0,0 +1,20 @@
package model
import (
"go-common/library/time"
)
const (
//PunishmentTypeBlock 封禁
PunishmentTypeBlock = 1
)
// Punishment def.
type Punishment struct {
ID int64
Mid int64
Type int8 //封禁原因
Reason string //惩罚原因
CTime time.Time
MTime time.Time
}

View File

@@ -0,0 +1,23 @@
package model
// Reg Pro args.
const (
AccountType = 4
)
// Tel level .
const (
Nomal int8 = iota
LevelOne
LevelTwo
LevelThree
LevelFour
)
// QcloudRegProResp def.
type QcloudRegProResp struct {
Code int `json:"code"`
CodeDesc string `json:"codeDesc"`
Message string `json:"message"`
Level int8 `json:"level"`
}

View File

@@ -0,0 +1,19 @@
package model
import "time"
// Tel Expire
const (
TelExpireMonth = 3
QcloudType = 1
)
// TelRiskLevel def.
type TelRiskLevel struct {
ID int64 `json:"id"`
Mid int64 `json:"mid"`
Level int8 `json:"level"`
Origin int8 `json:"origin"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
}

View File

@@ -0,0 +1,53 @@
package model
import (
"go-common/library/time"
)
// ArgReBuild rebuild args
type ArgReBuild struct {
Mid int64
Reason string
}
// ArgReset is.
type ArgReset struct {
Mid int64
ReLiveTime bool
EventScore bool
BaseScore bool
Operator string
}
// ArgUserScore rpc arg for getting user score.
type ArgUserScore struct {
Mid int64
IP string
}
// ArgHandleEvent rpc arg for handling spy event.
type ArgHandleEvent struct {
Time time.Time
IP string `json:"ip"`
Service string `json:"service"`
Event string `json:"event"`
ActiveMid int64 `json:"active_mid"`
TargetMid int64 `json:"target_mid"`
TargetID int64 `json:"target_id"`
Args interface{} `json:"args"`
Result string `json:"result"`
Effect string `json:"effect"`
RiskLevel int8 `json:"risk_level"`
}
// ArgUser rpc arg for getting user info.
type ArgUser struct {
Mid int64
IP string
}
// ArgStat rpc arg for getting user stat.
type ArgStat struct {
ID int64
Mid int64
}

View File

@@ -0,0 +1,15 @@
package model
import (
"go-common/library/time"
)
// Service def.
type Service struct {
ID int64
Name string //服务标识
NickName string //服务可读昵称
Status int8
CTime time.Time
MTime time.Time
}

View File

@@ -0,0 +1,7 @@
package model
// UserScore rpc return for getting user score.
type UserScore struct {
Mid int64 `json:"mid"`
Score int8 `json:"score"`
}

View File

@@ -0,0 +1,8 @@
package model
// Statistics def.
type Statistics struct {
Quantity int64 `json:"quantity"`
EventID int64 `json:"event_id"`
EventName string `json:"event_name"`
}

View File

@@ -0,0 +1,19 @@
package model
import (
"go-common/library/time"
)
// UserEventHistory history of user event def.
type UserEventHistory struct {
ID int64
Mid int64
EventID int64
Score int8
BaseScore int8
EventScore int8
Remark string
Reason string // 事件原因 == eventmsg.Effect
FactorVal float64
CTime time.Time
}

View File

@@ -0,0 +1,25 @@
package model
import (
"go-common/library/time"
)
const (
// StateNormal UserInfo 正常状态
StateNormal = 0
// StateBlock UserInfo 封禁状态
StateBlock = 1
)
// UserInfo def.
type UserInfo struct {
ID int64 `json:"id"`
Mid int64 `json:"mid"`
Score int8 `json:"score"` //真实得分
BaseScore int8 `json:"base_score"` //基础信息得分
EventScore int8 `json:"event_score"` //事件得分
State int8 `json:"state"` //状态 : 正常/封禁
ReliveTimes int8 `json:"relive_times"` //画像得分恢复次数
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}