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,38 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"hbase.go",
"model.go",
"msg.go",
"reply.go",
],
importpath = "go-common/app/job/main/figure/model",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/job/main/reply/model/reply:go_default_library",
"//library/log:go_default_library",
"//vendor/github.com/pkg/errors: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,54 @@
package model
var (
//ActionCounterTable action counter
ActionCounterTable = "ugc:figureactioncounter"
//ACFamilyUser user family
ACFamilyUser = "user"
//ACColumnCoins column
ACColumnCoins = "coins"
//ACColumnDanmaku column
ACColumnDanmaku = "danmuka"
//ACColumnReplyAct reply act
ACColumnReplyAct = "replies"
//ACColumnReplyLiked reply like
ACColumnReplyLiked = "reply_liked"
//ACColumnReplyHate reply hate
ACColumnReplyHate = "reply_hate"
//ACColumnLowRisk low risk
ACColumnLowRisk = "coin_low_risk"
//ACColumnHighRisk high risk
ACColumnHighRisk = "coin_high_risk"
//ACColumnReplyReoprtPassed report reply passed
ACColumnReplyReoprtPassed = "report_reply_passed"
//ACColumnDanmakuReoprtPassed danmaku reply passed
ACColumnDanmakuReoprtPassed = "report_danmaku_passed"
//ACColumnPublishReplyDeleted report reply passed
ACColumnPublishReplyDeleted = "publish_reply_deleted"
//ACColumnPublishDanmakuDeleted report reply passed
ACColumnPublishDanmakuDeleted = "publish_danmaku_deleted"
//ACColumnPayMoney user pay money
ACColumnPayMoney = "pay_money"
//ACColumnPayLiveMoney user pay money for live
ACColumnPayLiveMoney = "pay_live_money"
//UserInfoTable user info
UserInfoTable = "ugc:figureuserstatus"
//USFamilyUser user family
USFamilyUser = "user"
//USColumnExp exp
USColumnExp = "exp"
//USColumnSpyScore spy score
USColumnSpyScore = "spy_score"
//USColumnArchiveViews archive views
USColumnArchiveViews = "archive_views"
//USColumnVipStatus vip status
USColumnVipStatus = "vip_status"
//USColumnBlockedRage blocked rage
USColumnBlockedRage = "blocked_rage"
)

View File

@@ -0,0 +1,60 @@
package model
import (
"encoding/json"
"time"
)
// Figure user figure model
type Figure struct {
ID int32 `json:"-"`
Mid int64 `json:"mid"`
Score int32 `json:"score"`
LawfulScore int32 `json:"lawful_score"`
WideScore int32 `json:"wide_score"`
FriendlyScore int32 `json:"friendly_score"`
BountyScore int32 `json:"bounty_score"`
CreativityScore int32 `json:"creativity_score"`
Ver int32 `json:"-"`
Ctime time.Time `json:"-"`
Mtime time.Time `json:"-"`
}
// BinlogMsg dm binlog msg
type BinlogMsg struct {
Action string `json:"action"`
Table string `json:"table"`
New json.RawMessage `json:"new"`
Old json.RawMessage `json:"old"`
}
// ReplyInfo Reply info.
type ReplyInfo struct {
Mid int64 `json:"mid"`
Oid int64 `json:"oid"`
Type int8 `json:"type"`
Ctime int64 `json:"ctime"`
}
// ReplyAction reply action.
type ReplyAction struct {
Mid int64 `json:"mid"`
Action int8 `json:"action"`
Oid int64 `json:"oid"`
Type int8 `json:"type"`
Ctime int64 `json:"ctime"`
}
// DMAction danmaku report action.
type DMAction struct {
Action string `json:"action"`
Data DMData `json:"data"`
}
// DMData danmaku report action.
type DMData struct {
ID int64 `json:"id"`
Dmid int64 `json:"dmid"`
OwnerUID int64 `json:"dm_owner_uid"`
ReportUID int64 `json:"uid"`
}

View File

@@ -0,0 +1,65 @@
package model
import (
"encoding/json"
"strconv"
"go-common/library/log"
"github.com/pkg/errors"
)
// MsgCanal canal message struct
type MsgCanal struct {
Action string `json:"action"`
Table string `json:"table"`
New json.RawMessage `json:"new"`
Old json.RawMessage `json:"old"`
}
// MsgVipInfo message for user vip staus
type MsgVipInfo struct {
Mid int64 `json:"mid"`
Type int8 `json:"type"`
Timestamp int64 `json:"ts"`
}
type MsgAccountLog struct {
Mid int64 `json:"mid"`
IP string `json:"ip"`
TS int64 `json:"ts"`
Content map[string]string `json:"content"`
}
func (m *MsgAccountLog) ExpFrom() (exp int) {
var (
fromExp = m.Content["from_exp"]
err error
)
if exp, err = strconv.Atoi(fromExp); err != nil {
err = errors.Wrapf(err, "fromExp (%s)", fromExp)
log.Error("%+v", err)
exp = 0
}
return
}
func (m *MsgAccountLog) ExpTo() (exp int) {
var (
toExp = m.Content["to_exp"]
err error
)
if exp, err = strconv.Atoi(toExp); err != nil {
err = errors.Wrapf(err, "toExp (%s)", toExp)
log.Error("%+v", err)
exp = 0
}
return
}
func (m *MsgAccountLog) IsViewExp() bool {
var (
operater = m.Content["operater"]
)
return operater == "watch"
}

View File

@@ -0,0 +1,31 @@
package model
import (
repmol "go-common/app/job/main/reply/model/reply"
)
// ReplyEvent reply event
type ReplyEvent struct {
Action string `json:"action"`
Mid int64 `json:"mid"`
Subject *repmol.Subject `json:"subject"`
Reply *repmol.Reply `json:"reply"`
Report *repmol.Report `json:"report"`
}
const (
// EventAdd add reply
EventAdd = "reply"
// EventLike add like
EventLike = "like"
// EventLikeCancel like cal
EventLikeCancel = "like_cancel"
// EventHate hate
EventHate = "hate"
// EventHateCancel hate cal
EventHateCancel = "hate_cancel"
// EventReportDel user report approved
EventReportDel = "report_del"
// EventReportRecover user report recover
EventReportRecover = "report_recover"
)