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,44 @@
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 = ["test.toml"],
importpath = "go-common/app/service/main/tv/cmd",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/tv/internal/conf:go_default_library",
"//app/service/main/tv/internal/server/grpc:go_default_library",
"//app/service/main/tv/internal/server/http:go_default_library",
"//app/service/main/tv/internal/service: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,49 @@
package main
import (
"context"
"flag"
"os"
"os/signal"
"syscall"
"time"
"go-common/app/service/main/tv/internal/conf"
"go-common/app/service/main/tv/internal/server/grpc"
"go-common/app/service/main/tv/internal/server/http"
"go-common/app/service/main/tv/internal/service"
"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)
defer log.Close()
log.Info("tv-service start")
trace.Init(conf.Conf.Tracer)
defer trace.Close()
svc := service.New(conf.Conf)
grpcServ := grpc.New(conf.Conf.GRPC, svc)
http.Init(conf.Conf, svc)
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:
svc.Close()
grpcServ.Shutdown(context.Background())
log.Info("tv-service exit")
time.Sleep(time.Second)
return
case syscall.SIGHUP:
default:
return
}
}
}

View File

@@ -0,0 +1,81 @@
[grpc]
timeout = "6s"
[httpClient]
key = "cadf599ba8b3796a"
secret = "42fbb979aa742013d713a088f912673b"
dial = "6s"
timeout = "6s"
keepAlive = "60s"
timer = 10
[httpClient.breaker]
window = "10s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[memcache]
name = "tv"
proto = "tcp"
addr = "127.0.0.1:11231"
idle = 100
active = 100
dialTimeout = "1s"
readTimeout = "1s"
writeTimeout = "1s"
idleTimeout = "10s"
expire = "36h"
relateExpire = "20m"
arcExpire = "20m"
viewExpire = "20m"
cmsExpire = "36h"
cacheExpire = "1h"
hisExpire = "3m"
mangoExpire = "10m"
[accountRPC]
timeout = "1s"
[mysql]
addr= "172.16.33.205:3308"
dsn = "test:test@tcp(172.16.33.205:3308)/bilibili_tv?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
active = 20
idle = 10
idleTimeout ="4h"
queryTimeout = "2000ms"
execTimeout = "2000ms"
tranTimeout = "5000ms"
[mysql.breaker]
window = "3s"
sleep = "100ms"
bucket = 10
ratio = 0.5
request = 100
[pay]
payExpireDuration = "4h"
renewFromDuration = "48h"
renewToDuration = "24h"
qrURL = "http://callback-api.bilibili.cn/x/tv/vip/order/create"
guestQrURL = "http://callback-api.bilibili.cn/x/tv/vip/order/create"
[cacheTTL]
userInfoTTl = 1800
payParamTTL = 900
[yst]
key = "snm112901*!lkkjWngso4%*&o+-(j242Ssdrfslj"
domain = "gwboss.test.atianqi.com:443/boss/inter/bili"
[mvip]
BatchUserInfoUrl = "http://api.bilibili.co/x/internal/big/useBatchInfo"
[mvip.BatchIdsMap]
1 = 21
23 = 21
[ticker]
panelRefreshDuration = "5s"
unpaidDurationStime = "25m"
unpaidDurationEtime = "30m"
unpaidRefreshDuratuion = "30s"