Create & Init Project...
This commit is contained in:
45
app/service/main/vip/cmd/BUILD
Normal file
45
app/service/main/vip/cmd/BUILD
Normal file
@ -0,0 +1,45 @@
|
||||
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 = ["vip-service-test.toml"],
|
||||
importpath = "go-common/app/service/main/vip/cmd",
|
||||
tags = ["automanaged"],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//app/service/main/vip/conf:go_default_library",
|
||||
"//app/service/main/vip/http:go_default_library",
|
||||
"//app/service/main/vip/rpc/server:go_default_library",
|
||||
"//app/service/main/vip/server/grpc:go_default_library",
|
||||
"//app/service/main/vip/service:go_default_library",
|
||||
"//library/ecode/tip:go_default_library",
|
||||
"//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"],
|
||||
)
|
57
app/service/main/vip/cmd/main.go
Normal file
57
app/service/main/vip/cmd/main.go
Normal file
@ -0,0 +1,57 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"go-common/app/service/main/vip/conf"
|
||||
"go-common/app/service/main/vip/http"
|
||||
rpc "go-common/app/service/main/vip/rpc/server"
|
||||
grpc "go-common/app/service/main/vip/server/grpc"
|
||||
"go-common/app/service/main/vip/service"
|
||||
ecode "go-common/library/ecode/tip"
|
||||
"go-common/library/log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
flag.Parse()
|
||||
// init conf,log,trace,stat,perf.
|
||||
if err := conf.Init(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
log.Init(conf.Conf.Log)
|
||||
defer log.Close()
|
||||
// service init
|
||||
svr := service.New(conf.Conf)
|
||||
//ecode init FIXME
|
||||
ecode.Init(conf.Conf.Ecode)
|
||||
// rpc server init
|
||||
rpcSvr := rpc.New(conf.Conf, svr)
|
||||
http.Init(conf.Conf, svr)
|
||||
ws := grpc.New(conf.Conf.WardenServer, svr)
|
||||
// signal handler
|
||||
log.Info("vip-service start")
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
|
||||
for {
|
||||
s := <-c
|
||||
log.Info("vip-service get a signal %s", s.String())
|
||||
switch s {
|
||||
case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
|
||||
rpcSvr.Close()
|
||||
ws.Shutdown(context.Background())
|
||||
time.Sleep(time.Second * 2)
|
||||
log.Info("vip-service exit")
|
||||
return
|
||||
case syscall.SIGHUP:
|
||||
// TODO reload
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
210
app/service/main/vip/cmd/vip-service-test.toml
Normal file
210
app/service/main/vip/cmd/vip-service-test.toml
Normal file
@ -0,0 +1,210 @@
|
||||
# This is a TOML document. Boom.
|
||||
version = "1.0.0"
|
||||
|
||||
MsgURI = "http://uat-message.bilibili.com"
|
||||
PayURI = "http://pay.bilibili.co"
|
||||
vipURI = "http://uat-vip.bilibili.co"
|
||||
|
||||
|
||||
|
||||
[payConf]
|
||||
CustomerID = 10004
|
||||
Token ="0ff3d296ee0d7a28b4db1d761d2db907"
|
||||
OrderNotifyURL ="http://uat-vip.bilibili.co/pay/payOrderNotify"
|
||||
SignNotifyURL ="http://uat-vip.bilibili.co/pay/paySignNotify"
|
||||
returnUrl = "https://uat-account.bilibili.com/account/big?type=payCallBack"
|
||||
PlanID = 108217
|
||||
ProductID ="vip_buy"
|
||||
Version ="1.0"
|
||||
OrderExpire = 600
|
||||
SignType = "MD5"
|
||||
IAPProductID = {1 = "tv.danmaku.bilianimex1VIPbf1",3="tv.danmaku.bilianimex3VIPbf1",12="tv.danmaku.bilianimex12VIPbf1"}
|
||||
AutoProductID = "tv.danmaku.bilianimexAuto1VIP"
|
||||
ProductIDTpl = "VIP_DEFAULT_PRODUCT_%d"
|
||||
|
||||
[property]
|
||||
annualVipBcoinDay = 10
|
||||
annualVipBcoinCouponMoney = 5
|
||||
annualVipBcoinCouponActivityId = 142
|
||||
MsgURL = "http://uat-message.bilibili.com"
|
||||
PayURL = "http://uat-pay.bilibili.com"
|
||||
PayCoURL = "http://pay.bilibili.co"
|
||||
AccountURL = "http://account.bilibili.com/api"
|
||||
PassportURL = "http://passport.bilibili.co"
|
||||
pointGetRule = {2 = 20,3 = 50}
|
||||
VipURL = "http://uat-vip.bilibili.co"
|
||||
pointActiveDate = {startDate = "2018-02-01",endDate = "2018-04-01"}
|
||||
payType = {android ="alipay,wechat,bp",ios="iospay"}
|
||||
payChannelMapping = {3="wechat",100="IAP",10015="wechat"}
|
||||
expireDay = 60
|
||||
activeDate = "2018-01-01"
|
||||
pointBalance = 1250
|
||||
BubbleTicker = "60s"
|
||||
TokenBID="account"
|
||||
apiURL="http://uat-api.bilibili.com"
|
||||
apiCoUrl = "http://uat-api.bilibili.co"
|
||||
confMap = {1="限时五折",2="五折"}
|
||||
pointExchangeTitle = {title = "您的积分足以兑换%s大会员,快去兑换吧!",expired = "300"}
|
||||
WillExpiredTitle = {title = "您的大会员资格即将失效,快点续期吧!",expired = "250"}
|
||||
expiredTitle = {title = "您的大会员资格已经失效,快点续期吧!",expired = "200"}
|
||||
tipButtonName = "开通"
|
||||
tipButtonLink = "bilibili://user_center/vip/buy/22"
|
||||
allowanceSwitch = 1
|
||||
codeSwitch = 1
|
||||
giveSwitch = 1
|
||||
codeOpenedSearchSize = 5
|
||||
panelBgURL = "http://i0.hdslb.com/bfs/vip/BG@3x.png"
|
||||
welfareBgHost = "http://uat-i%v.hdslb.com"
|
||||
|
||||
[bm]
|
||||
addr = "0.0.0.0:6821"
|
||||
maxListen = 1000
|
||||
timeout = "2s"
|
||||
|
||||
[rpcServer2]
|
||||
[[rpcServer2.servers]]
|
||||
proto = "tcp"
|
||||
addr = "0.0.0.0:6009"
|
||||
weight = 10
|
||||
[rpcServer2.zookeeper]
|
||||
root = "/microservice/vip/"
|
||||
addrs = ["172.18.33.50:2199","172.18.33.51:2199","172.18.33.52:2199"]
|
||||
timeout = "1s"
|
||||
|
||||
[memcache]
|
||||
name = "vip"
|
||||
proto = "tcp"
|
||||
addr = "172.18.33.60:11234"
|
||||
idle = 8
|
||||
active = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "10s"
|
||||
expire = "24h"
|
||||
|
||||
[identify]
|
||||
whiteAccessKey = ""
|
||||
whiteMid = 0
|
||||
[identify.app]
|
||||
key = "6a29f8ed87407c11"
|
||||
secret = "d3c5a85f5b895a03735b5d20a273bc57"
|
||||
[identify.memcache]
|
||||
name = "go-business/identify"
|
||||
proto = "unix"
|
||||
addr = "/tmp/uat-platform-identify-mc.sock"
|
||||
active = 5
|
||||
idle = 3
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "80s"
|
||||
[identify.host]
|
||||
auth = "http://uat-passport.bilibili.com"
|
||||
secret = "http://uat-open.bilibili.com"
|
||||
[identify.httpClient]
|
||||
key = "f022126a8a365e20"
|
||||
secret = "b7b86838145d634b487e67b811b8fab2"
|
||||
dial = "30ms"
|
||||
timeout = "100ms"
|
||||
keepAlive = "60s"
|
||||
[identify.httpClient.breaker]
|
||||
window = "10s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
[identify.httpClient.url]
|
||||
"http://uat-passport.bilibili.co/intranet/auth/tokenInfo" = {timeout = "100ms"}
|
||||
"http://uat-passport.bilibili.co/intranet/auth/cookieInfo" = {timeout = "100ms"}
|
||||
"http://uat-open.bilibili.co/api/getsecret" = {timeout = "500ms"}
|
||||
|
||||
[mysql]
|
||||
addr = "172.16.33.205"
|
||||
dsn = "zhaozhihao:MN9havOfnzY3kd6L78IVucRxgywe0p2P@tcp(172.16.33.205:3308)/bilibili_vip?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
|
||||
active = 5
|
||||
idle = 2
|
||||
IdleTimeout ="4h"
|
||||
queryTimeout = "2s"
|
||||
execTimeout = "2s"
|
||||
tranTimeout = "2s"
|
||||
[mysql.breaker]
|
||||
window = "3s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
|
||||
[oldMysql]
|
||||
addr = "172.22.34.101"
|
||||
dsn = "vip:qwDb5kQ0syUIo8EKNGrAvcdZLCnROm4j@tcp(172.22.34.101:3309)/vip?timeout=5s&readTimeout=5s&writeTimeout=5s&parseTime=true&loc=Local&charset=utf8,utf8mb4"
|
||||
active = 8
|
||||
idle = 5
|
||||
IdleTimeout ="4h"
|
||||
queryTimeout = "200ms"
|
||||
execTimeout = "200ms"
|
||||
tranTimeout = "300ms"
|
||||
[oldMysql.breaker]
|
||||
window = "3s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
|
||||
|
||||
[redis]
|
||||
name = "vip"
|
||||
proto = "tcp"
|
||||
addr = "172.18.33.61:6879"
|
||||
idle = 10
|
||||
active = 10
|
||||
dialTimeout = "1s"
|
||||
readTimeout = "1s"
|
||||
writeTimeout = "1s"
|
||||
idleTimeout = "10s"
|
||||
expire = "1m"
|
||||
|
||||
[httpClient]
|
||||
key = "f022126a8a365e20"
|
||||
secret = "b7b86838145d634b487e67b811b8fab2"
|
||||
dial = "1s"
|
||||
timeout = "2s"
|
||||
keepAlive = "60s"
|
||||
[httpClient.breaker]
|
||||
window = "10s"
|
||||
sleep = "100ms"
|
||||
bucket = 10
|
||||
ratio = 0.5
|
||||
request = 100
|
||||
|
||||
|
||||
[rpcClient2]
|
||||
[rpcClient2.account]
|
||||
timeout = "1s"
|
||||
[rpcClient2.point]
|
||||
timeout = "1s"
|
||||
[rpcClient2.coupon]
|
||||
timeout = "1s"
|
||||
[rpcClient2.member]
|
||||
timeout = "300ms"
|
||||
|
||||
[associateConf]
|
||||
grantDurationMap = {1=8,12=3}
|
||||
bilibiliBuyDurationMap = {1=9,12=5}
|
||||
actStartTime = 1544488082
|
||||
actEndTime = 1554488082
|
||||
bilibiliPrizeGrantKeyMap = {"coupon_ele_1"="193710024520181211112507","coupon_ele_2"="421488078220181211112656"}
|
||||
mailCouponID1="9c09cb6a8950753a"
|
||||
mailCouponID2="3d005e8ba01c5cb0"
|
||||
|
||||
[eLEConf]
|
||||
key = "4400479257"
|
||||
secret = "23x01bb2592378e55a874c5f0073884ec2f2d869"
|
||||
|
||||
[Host]
|
||||
ele = "https://httpizza.ele.me/base.openapi.proxy.ppe"
|
||||
mail = "http://uat-mall.bilibili.co"
|
||||
|
||||
[wardenServer]
|
||||
addr = "0.0.0.0:9000"
|
||||
timeout = "3s"
|
Reference in New Issue
Block a user