Create & Init Project...
This commit is contained in:
29
app/admin/main/dm/model/oplog/BUILD
Normal file
29
app/admin/main/dm/model/oplog/BUILD
Normal file
@ -0,0 +1,29 @@
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load(
|
||||
"@io_bazel_rules_go//go:def.bzl",
|
||||
"go_library",
|
||||
)
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["oplog.go"],
|
||||
importpath = "go-common/app/admin/main/dm/model/oplog",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = ["//library/log: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"],
|
||||
)
|
89
app/admin/main/dm/model/oplog/oplog.go
Normal file
89
app/admin/main/dm/model/oplog/oplog.go
Normal file
@ -0,0 +1,89 @@
|
||||
package oplog
|
||||
|
||||
import (
|
||||
"go-common/library/log"
|
||||
)
|
||||
|
||||
// Infoc operation log for administrator
|
||||
type Infoc struct {
|
||||
Oid int64 `json:"oid"`
|
||||
Type int32 `json:"type"`
|
||||
DMIds []int64 `json:"dmids"`
|
||||
Subject string `json:"subject"`
|
||||
OriginVal string `json:"origin_val"`
|
||||
CurrentVal string `json:"current_val"`
|
||||
OperationTime string `json:"optime"`
|
||||
OperatorType OperatorType `json:"operator_type"`
|
||||
Operator int64 `json:"operator"`
|
||||
Source Source `json:"source"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// InfocResult data model for infoc type operation log storing in hbase
|
||||
type InfocResult struct {
|
||||
Oid string `json:"oid"`
|
||||
Type string `json:"type"`
|
||||
Subject string `json:"subject"`
|
||||
CurrentVal string `json:"current_val"`
|
||||
OperationTime string `json:"operation_time"`
|
||||
OperatorType string `json:"operator_type"`
|
||||
Operator string `json:"operator"`
|
||||
Source string `json:"source"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
// Source enum integer value
|
||||
type Source int
|
||||
|
||||
// Source enum definition list
|
||||
const (
|
||||
_ Source = iota
|
||||
SourceManager
|
||||
SourceUp
|
||||
SourcePlayer
|
||||
)
|
||||
|
||||
// String returns the Source enmu description
|
||||
func (source Source) String() string {
|
||||
var text string
|
||||
switch source {
|
||||
case SourceManager:
|
||||
text = "运营后台"
|
||||
case SourceUp:
|
||||
text = "创作中心"
|
||||
case SourcePlayer:
|
||||
text = "播放器"
|
||||
default:
|
||||
log.Warn("String() Unknow Source, warn(%v)")
|
||||
text = "未知来源"
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
// OperatorType enum integer value
|
||||
type OperatorType int
|
||||
|
||||
// OperatorType enum definition list
|
||||
const (
|
||||
_ OperatorType = iota
|
||||
OperatorAdmin
|
||||
OperatorMember
|
||||
OperatorSystem
|
||||
)
|
||||
|
||||
// String returns the Source enmu description
|
||||
func (opType OperatorType) String() string {
|
||||
var text string
|
||||
switch opType {
|
||||
case OperatorAdmin:
|
||||
text = "管理员"
|
||||
case OperatorMember:
|
||||
text = "用户"
|
||||
case OperatorSystem:
|
||||
text = "系统"
|
||||
default:
|
||||
log.Warn("String() Unknow Source, warn(%v)")
|
||||
text = "未知来源"
|
||||
}
|
||||
return text
|
||||
}
|
Reference in New Issue
Block a user