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,20 @@
package(default_visibility = ["//visibility:public"])
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//app/service/main/assist/model/assist:all-srcs",
"//app/service/main/assist/model/message:all-srcs",
"//app/service/main/assist/model/notify:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,37 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"assist.go",
"rpc.go",
],
importpath = "go-common/app/service/main/assist/model/assist",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/account/api:go_default_library",
"//app/service/main/account/model:go_default_library",
"//library/ecode: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,121 @@
package assist
import (
accv1 "go-common/app/service/main/account/api"
accmdl "go-common/app/service/main/account/model"
"go-common/library/ecode"
"go-common/library/time"
)
var (
// ActEnum action enum
ActEnum = map[int64]string{
1: "delete", // 删除
2: "shield/hide", // 屏蔽或隐藏
3: "protect", // 保护
4: "disUser", // 拉黑用户
5: "dmPoolMove", // 移动弹幕到字幕池
6: "dmPoolIgnore", // 忽略字幕池的弹幕
7: "cancelDisUser", // 取消拉黑用户 reverse of disUser
8: "silence", // 直播禁言用户
9: "cancelSilence", // 直播取消禁言用户 reverse of silence
}
// TypeEnum type enum
TypeEnum = map[int64]string{
1: "arc_com", // 稿件的评论
2: "arc_dm", // 稿件的弹幕
3: "live", // 直播的禁言
}
// IdentifyEnum map
IdentifyEnum = map[int]error{
1: ecode.UserIDCheckInvalidCard,
2: ecode.UserIDCheckInvalidPhone,
}
)
const (
//Act Enum
ActDelete = 1 // 删除
ActShieldOrHide = 2 // 屏蔽或隐藏
ActProtect = 3 // 保护
ActDisUser = 4 // 拉黑用户
ActDmPoolMove = 5 // 移动弹幕到字幕池
ActDmPoolIgnore = 6 // 移动弹幕到字幕池
ActCancelDisUser = 7 // 取消拉黑用户 reverse of ActDisUser
ActSilence = 8 // 直播禁言用户
ActCancelSilence = 9 // 直播取消禁言用户 reverse of ActCancelSilence
//TypeEnum
TypeComment = 1
TypeDm = 2
TypeLive = 3
)
// Assist is Assists model.
type Assist struct {
Mid int64 `json:"mid"`
AssistMid int64 `json:"assist_mid"`
State int8 `json:"state"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
Total map[int8]map[int8]int `json:"total"`
}
// Log is single record for assist done
type Log struct {
ID int64 `json:"id"`
Mid int64 `json:"mid"`
AssistMid int64 `json:"assist_mid"`
Type int8 `json:"type"`
Action int8 `json:"action"`
SubjectID int64 `json:"subject_id"`
ObjectID string `json:"object_id"`
Detail string `json:"detail"`
State int8 `json:"state"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"-"`
}
// AssistRes is Assists model.
type AssistRes struct {
Allow int64 `json:"allow"`
Assist int64 `json:"assist"`
Count int64 `json:"count"`
}
// Up is AssitUp model for space
type Up struct {
Mid int64 `json:"mid"`
CTime time.Time `json:"-"`
}
// AssistUp is AssitUp model for space
type AssistUp struct {
Mid int64 `json:"mid"`
Name string `json:"uname"`
Sign string `json:"sign"`
Avatar string `json:"face"`
OfficialVerify accv1.OfficialInfo `json:"official_verify"`
CTime time.Time `json:"-"`
Vip accmdl.VipInfo `json:"vip"`
}
// Pager struct
type Pager struct {
Pn int64 `json:"current"`
Ps int64 `json:"size"`
Total int64 `json:"total"`
}
type AssistUpsPager struct {
Data []*AssistUp `json:"data"`
Pager Pager `json:"pager"`
}
// SortUpsByCtime .
type SortUpsByCtime []*AssistUp
func (as SortUpsByCtime) Len() int { return len(as) }
func (as SortUpsByCtime) Less(i, j int) bool {
return as[i].CTime > as[j].CTime
}
func (as SortUpsByCtime) Swap(i, j int) { as[i], as[j] = as[j], as[i] }

View File

@@ -0,0 +1,51 @@
package assist
import "time"
type ArgAssists struct {
Mid int64
RealIP string
}
type ArgAssist struct {
Mid int64
AssistMid int64
Type int64
RealIP string
}
// ArgAssistLogAdd add log
type ArgAssistLogAdd struct {
Mid int64
AssistMid int64
Type int64
Action int64
SubjectID int64
ObjectID string
Detail string
RealIP string
}
type ArgAssistLog struct {
Mid int64
AssistMid int64
LogID int64
RealIP string
}
type ArgAssistLogs struct {
Mid int64
AssistMid int64
Stime time.Time
Etime time.Time
Pn int
Ps int
RealIP string
}
type ArgAssistUps struct {
AssistMid int64
Pn int64
Ps int64
RealIP string
}

View File

@@ -0,0 +1,28 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["message.go"],
importpath = "go-common/app/service/main/assist/model/message",
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
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,17 @@
package message
// Relation str map to databus message
type Relation struct {
Action string `json:"action"`
Table string `json:"table"`
New struct {
Attr int `json:"attribute"`
FID int64 `json:"fid"`
MID int64 `json:"mid"`
} `json:"new"`
Old struct {
Attr int `json:"attribute"`
FID int64 `json:"fid"`
MID int64 `json:"mid"`
}
}

View File

@@ -0,0 +1,28 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["notify.go"],
importpath = "go-common/app/service/main/assist/model/notify",
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
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,15 @@
package notify
// AddTitle
const (
AddTitle = "骑士任命"
DelTitle = "解除骑士"
DelFollowerTitle = "拒绝加入您的骑士团"
AddContent = `你已经被up主#{%s>>}{"http://space.bilibili.com/%d/#!/"} 任命为骑士, 若想取消任命, 可前往关注列表处退出up主#{%s>>}{"http://space.bilibili.com/%d/#!/fans/follow"}的骑士团`
DelContent = `你已经被up主#{%s>>}{"http://space.bilibili.com/%d/#!/"} 取消了骑士权限`
DelFollowerContent = `#{%s>>}{"http://space.bilibili.com/%d/#!/"} 拒绝成为你的骑士团。退出成功!`
Mc = "1_8_1"
AddAssNotifyAct = 1
DelAssNotifyAct = 2
DelAssNotifyFollowerAct = 3
)