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,41 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"BaseInfo.go",
"Feed.go",
"dao.go",
],
importpath = "go-common/app/interface/live/app-interface/dao/relation",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/interface/live/app-interface/conf:go_default_library",
"//app/interface/live/app-interface/dao:go_default_library",
"//app/service/live/relation/api/liverpc/v1:go_default_library",
"//library/ecode:go_default_library",
"//library/log:go_default_library",
"//library/net/rpc/liverpc/context:go_default_library",
"//vendor/github.com/pkg/errors: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,59 @@
package relation
import (
"context"
"github.com/pkg/errors"
ServiceConf "go-common/app/interface/live/app-interface/conf"
"go-common/app/interface/live/app-interface/dao"
relationV1 "go-common/app/service/live/relation/api/liverpc/v1"
"go-common/library/ecode"
"go-common/library/log"
rpcCtx "go-common/library/net/rpc/liverpc/context"
"time"
)
// GetGiftInfo 获取给我关注的人送礼(金瓜子)信息
func (d *Dao) GetGiftInfo(ctx context.Context, params ServiceConf.ChunkCallInfo) (giftInfo map[int64]int64, err error) {
relationParams := &relationV1.BaseInfoGetGiftInfoReq{}
ret, err := dao.RelationApi.V1BaseInfo.GetGiftInfo(rpcCtx.WithTimeout(ctx, time.Duration(params.RPCTimeout)*time.Millisecond), relationParams)
if err != nil {
return
}
erelongInfo, success := ServiceConf.CheckReturn(err, ret.Code, ret.Msg, "gift", params.RPCTimeout, params.ChunkSize, params.ChunkNum)
if !success {
if err != nil {
err = errors.WithMessage(ecode.PkIDRecordFrameWorkCallError, "GET SEA PATROL FAIL")
log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|error:%+v"+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s",
err, erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName)
} else {
err = errors.WithMessage(ecode.PkIDLiveRPCCodeError, "GET SEA PATROL FAIL")
log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|error:%+v"+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s",
err, erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName)
}
return giftInfo, nil
}
if ret.Data == nil || len(ret.Data) < 0 {
erelongInfo.ErrType = ServiceConf.EmptyResultEn
erelongInfo.ErrDesc = ServiceConf.EmptyResult
log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d",
erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName)
return giftInfo, nil
}
for _, v := range ret.Data {
giftInfo[v.Mid] = v.Gold
}
return
}
// GetAttentionListGroupBy 获取分组的关注列表
func (d *Dao) GetAttentionListGroupBy(ctx context.Context, params ServiceConf.ChunkCallInfo) (relationInfo map[int64]*relationV1.BaseInfoGetFollowTypeResp_UidInfo, attentionErr error) {
attentionData, attentionErr := dao.RelationApi.V1BaseInfo.GetFollowType(
rpcCtx.WithTimeout(ctx, time.Duration(params.RPCTimeout)*time.Millisecond),
&relationV1.BaseInfoGetFollowTypeReq{})
if attentionErr != nil || attentionData == nil {
attentionErr = ecode.AttentionListRPCError
return
}
relationInfo = attentionData.Data
return
}

View File

@@ -0,0 +1 @@
package relation

View File

@@ -0,0 +1,33 @@
package relation
import (
"context"
"go-common/app/interface/live/app-interface/conf"
)
// Dao dao
type Dao struct {
c *conf.Config
}
// New init mysql db
func New(c *conf.Config) (dao *Dao) {
dao = &Dao{
c: c,
}
return
}
// Close close the resource.
func (d *Dao) Close() {
return
}
// Ping dao ping
func (d *Dao) Ping(c context.Context) error {
// TODO: if you need use mc,redis, please add
// check
return nil
}