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,35 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["app_conf.go"],
importpath = "go-common/app/interface/live/app-interface/service/v1/app_conf",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/interface/live/app-interface/api/http/v1:go_default_library",
"//app/interface/live/app-interface/conf:go_default_library",
"//app/service/live/resource/sdk:go_default_library",
"//library/ecode: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"],
)

View File

@@ -0,0 +1,56 @@
package v1
import (
"context"
v1appconfpb "go-common/app/interface/live/app-interface/api/http/v1"
"go-common/app/interface/live/app-interface/conf"
titansSdk "go-common/app/service/live/resource/sdk"
"go-common/library/ecode"
"go-common/library/log"
)
//AppConfService struct
type AppConfService struct {
conf *conf.Config
}
// NewAppConfService init
func NewAppConfService(c *conf.Config) (s *AppConfService) {
s = &AppConfService{
conf: c,
}
InitTitan()
return s
}
//GetConf 获取移动端配置
func (s *AppConfService) GetConf(ctx context.Context, req *v1appconfpb.GetConfReq) (resp *v1appconfpb.GetConfResp, err error) {
value, ok := s.conf.AppConf[req.GetKey()]
if !ok {
log.Error("[AppConf] GetConf Key err: %s", req.GetKey())
return nil, ecode.AppConfKeyErr
}
resp = &v1appconfpb.GetConfResp{
Value: value,
}
conf, terr := titansSdk.Get(req.GetKey())
if terr != nil {
log.Error("[AppConf] GetConf titansSdk.Get err: %+v", err)
}
if conf != "" {
resp.Value = conf
}
return
}
//InitTitan 初始化kv配置
func InitTitan() {
conf := &titansSdk.Config{
TreeId: 61019,
Expire: 1,
}
titansSdk.Init(conf)
}