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,43 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_binary",
"go_library",
)
go_binary(
name = "cmd",
embed = [":go_default_library"],
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["main.go"],
data = ["mcn-job-test.toml"],
importpath = "go-common/app/job/main/mcn/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/job/main/mcn/conf:go_default_library",
"//app/job/main/mcn/server/http:go_default_library",
"//library/ecode/tip:go_default_library",
"//library/log:go_default_library",
"//library/net/trace: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,38 @@
[MailTemplateConf]
SignTmplTitle = """[{{Now.Format "2006-01-02"}}] MCN-签约到期提醒"""
SignTmplContent = """
<html>
<body>
<table border="1">
<tr>
<td>昵称(uid)</td>
<td>到期提示信息</td>
</tr>
{{range .}}
<tr>
<td>{{.McnName}}{{.McnMid}}</td>
<td>{{.EndDate.Time.Format "2006-01-02"}} 签约即将到期,请尽快去<a href="http://up-profit.bilibili.co/allowance/#/mcn/mcnList">【up主CRM-MCN签约管理】查看</a></td>
</tr>
{{end}}
</table>
</body>
</html>
"""
PayTmplTitle = """[{{Now.Format "2006-01-02"}}] MCN-"""
PayTmplContent = """
<html>
<body>
<table border=1>
<tr>
<td>(uid)</td>
<td></td>
</tr>
{{range .}}
<tr>
<td>{{.McnName}}{{.McnMid}}</td>
<td>{{.DueDate.Time.Format "2006-01-02"}} {{printf "%.2f" .GetPayValue}}<a href="http://up-profit.bilibili.co/allowance/#/mcn/mcnList">upCRM-MCN</a></td>
</tr>
{{end}}
</table>
</body>
</html>"""

View File

@@ -0,0 +1,43 @@
package main
import (
"flag"
"os"
"os/signal"
"syscall"
"go-common/app/job/main/mcn/conf"
"go-common/app/job/main/mcn/server/http"
ecode "go-common/library/ecode/tip"
"go-common/library/log"
"go-common/library/net/trace"
)
func main() {
flag.Parse()
if err := conf.Init(); err != nil {
panic(err)
}
log.Init(conf.Conf.Log)
// log.SetFormat("[%D %T] [%L] [%S] %M")
defer log.Close()
log.Info("start")
trace.Init(conf.Conf.Tracer)
defer trace.Close()
ecode.Init(conf.Conf.Ecode)
http.Init(conf.Conf)
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
for {
s := <-c
log.Info("get a signal %s", s.String())
switch s {
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
log.Info("exit")
return
case syscall.SIGHUP:
default:
return
}
}
}

View File

@@ -0,0 +1,50 @@
[log]
stdout = true
[mysql]
addr = "172.16.33.205:3306"
dsn = "upcrm:DdL6c5JaWCYKMAQ10PURbfeImow9HXlx@tcp(172.16.33.205:3306)/bilibili_upcrm?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 5
idle = 1
idleTimeout ="4h"
queryTimeout = "200ms"
execTimeout = "300ms"
tranTimeout = "400ms"
[mysql.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[memcache]
name = "mcn-admin"
proto = "tcp"
addr = "172.18.33.60:11216"
active = 10
idle = 10
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
[property]
upMcnSignStateCron = "0 0 0 * * ?"
upMcnUpStateCron = "0 0 0 * * ?"
upExpirePayCron = "0 0 0 * * ?"
upMcnDataSummaryCron = "0 5 0 * * ?"
mcnRecommendCron = "@hourly"
dealFailRecommendCron = "@hourly"
checkMcnSignUpDueCron = "0 20 0 * * ?"
[MailConf]
host = "smtp.exmail.qq.com"
port = 465
username = "manager@bilibili.com"
password = "123"
DueMailReceivers = [""] # 需要发送的额外管理员名称
DueAuthorityGroups = ["mcnplan@bilibili.com"]
[GRPCClient]
[GRPCClient.account]
timeout = "1s"