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_test",
"go_library",
)
go_test(
name = "go_default_test",
srcs = ["rpc_test.go"],
embed = [":go_default_library"],
rundir = ".",
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = ["rpc.go"],
importpath = "go-common/app/service/main/point/rpc/client",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/point/model:go_default_library",
"//library/net/rpc: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,70 @@
package client
import (
"context"
"go-common/app/service/main/point/model"
"go-common/library/net/rpc"
)
const (
_pointInfo = "RPC.PointInfo"
_pointConsume = "RPC.ConsumePoint"
_pointAdd = "RPC.PointAdd"
_pointHistory = "RPC.PointHistory"
_pointAddByBp = "RPC.PointAddByBp"
)
const (
_appid = "account.service.point"
)
// Service is a question service.
type Service struct {
client *rpc.Client2
}
// New new rpc service.
func New(c *rpc.ClientConfig) (s *Service) {
s = &Service{}
s.client = rpc.NewDiscoveryCli(_appid, c)
return
}
// Ping rpc ping.
func (s *Service) Ping(c context.Context, arg *struct{}) (res *int, err error) {
err = s.client.Call(c, "RPC.Ping", arg, res)
return
}
//PointInfo point info.
func (s *Service) PointInfo(c context.Context, arg *model.ArgRPCMid) (res *model.PointInfo, err error) {
res = new(model.PointInfo)
err = s.client.Call(c, _pointInfo, arg, res)
return
}
//ConsumePoint consume point.
func (s *Service) ConsumePoint(c context.Context, arg *model.ArgPointConsume) (status int8, err error) {
err = s.client.Call(c, _pointConsume, arg, &status)
return
}
//AddPoint add point.
func (s *Service) AddPoint(c context.Context, arg *model.ArgPoint) (status int8, err error) {
err = s.client.Call(c, _pointAdd, arg, &status)
return
}
// PointHistory point history.
func (s *Service) PointHistory(c context.Context, arg *model.ArgRPCPointHistory) (res *model.PointHistoryResp, err error) {
res = new(model.PointHistoryResp)
err = s.client.Call(c, _pointHistory, arg, res)
return
}
// PointAddByBp point add by bp.
func (s *Service) PointAddByBp(c context.Context, arg *model.ArgPointAdd) (res *int64, err error) {
err = s.client.Call(c, _pointAddByBp, arg, &res)
return
}

View File

@@ -0,0 +1 @@
package client