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,46 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_test",
"go_library",
)
go_test(
name = "go_default_test",
srcs = ["pendant_test.go"],
embed = [":go_default_library"],
rundir = ".",
tags = ["automanaged"],
)
go_library(
name = "go_default_library",
srcs = [
"client.go",
"common.go",
"medal.go",
"pendant.go",
],
importpath = "go-common/app/service/main/usersuit/rpc/client",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/usersuit/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,92 @@
package client
import (
"context"
"go-common/app/service/main/usersuit/model"
"go-common/library/net/rpc"
)
const (
_appid = "account.service.usersuit"
)
var (
_noRes = &struct{}{}
)
// Service2 struct
type Service2 struct {
client *rpc.Client2
}
// New Service2 init
func New(c *rpc.ClientConfig) (s *Service2) {
s = &Service2{}
s.client = rpc.NewDiscoveryCli(_appid, c)
return
}
const (
_buy = "RPC.Buy"
_apply = "RPC.Apply"
_stat = "RPC.Stat"
_generate = "RPC.Generate"
_list = "RPC.List"
_equip = "RPC.Equip"
_grantByMids = "RPC.GrantByMids"
_groupPendantMid = "RPC.GroupPendantMid"
)
// Buy buy invite
func (s *Service2) Buy(c context.Context, arg *model.ArgBuy) (res []*model.Invite, err error) {
res = make([]*model.Invite, 0)
err = s.client.Call(c, _buy, arg, &res)
return
}
// Apply apply
func (s *Service2) Apply(c context.Context, arg *model.ArgApply) (err error) {
err = s.client.Call(c, _apply, arg, _noRes)
return
}
// Stat stat
func (s *Service2) Stat(c context.Context, arg *model.ArgStat) (res *model.InviteStat, err error) {
res = new(model.InviteStat)
err = s.client.Call(c, _stat, arg, res)
return
}
// Generate generator
func (s *Service2) Generate(c context.Context, arg *model.ArgGenerate) (res []*model.Invite, err error) {
res = make([]*model.Invite, 0)
err = s.client.Call(c, _generate, arg, &res)
return
}
// List list
func (s *Service2) List(c context.Context, arg *model.ArgList) (res []*model.Invite, err error) {
res = make([]*model.Invite, 0)
err = s.client.Call(c, _list, arg, &res)
return
}
// Equip pendant equip.
func (s *Service2) Equip(c context.Context, arg *model.ArgEquip) (err error) {
err = s.client.Call(c, _equip, arg, _noRes)
return
}
// GrantByMids one pendant give to multiple users.
func (s *Service2) GrantByMids(c context.Context, arg *model.ArgGrantByMids) (err error) {
err = s.client.Call(c, _grantByMids, arg, _noRes)
return
}
// GroupPendantMid get share group pendant by mid
func (s *Service2) GroupPendantMid(c context.Context, arg *model.ArgGPMID) (res []*model.GroupPendantList, err error) {
res = make([]*model.GroupPendantList, 0)
err = s.client.Call(c, _groupPendantMid, arg, &res)
return
}

View File

@@ -0,0 +1,18 @@
package client
import (
"context"
"go-common/app/service/main/usersuit/model"
)
const (
_pointFlag = "RPC.PointFlag"
)
// PointFlag obtain new pendant noify.
func (s *Service2) PointFlag(c context.Context, arg *model.ArgMID) (res *model.PointFlag, err error) {
res = new(model.PointFlag)
err = s.client.Call(c, _pointFlag, arg, res)
return
}

View File

@@ -0,0 +1,75 @@
package client
import (
"context"
"go-common/app/service/main/usersuit/model"
)
const (
_medalHomeInfo = "RPC.MedalHomeInfo"
_medalUserInfo = "RPC.MedalUserInfo"
_medalInstall = "RPC.MedalInstall"
_medalPopup = "RPC.MedalPopup"
_medalMyInfo = "RPC.MedalMyInfo"
_medalAllInfo = "RPC.MedalAllInfo"
_medalGrant = "RPC.MedalGrant"
_medalActivated = "RPC.MedalActivated"
_medalActivatedMulti = "RPC.MedalActivatedMulti"
)
// MedalHomeInfo return user mdeal home info.
func (s *Service2) MedalHomeInfo(c context.Context, arg *model.ArgMid) (res []*model.MedalHomeInfo, err error) {
err = s.client.Call(c, _medalHomeInfo, arg, &res)
return
}
// MedalUserInfo return medal user info.
func (s *Service2) MedalUserInfo(c context.Context, arg *model.ArgMedalUserInfo) (res *model.MedalUserInfo, err error) {
res = new(model.MedalUserInfo)
err = s.client.Call(c, _medalUserInfo, arg, res)
return
}
// MedalInstall install or uninstall medal.
func (s *Service2) MedalInstall(c context.Context, arg *model.ArgMedalInstall) (err error) {
err = s.client.Call(c, _medalInstall, arg, _noRes)
return
}
// MedalPopup return medal popup.
func (s *Service2) MedalPopup(c context.Context, arg *model.ArgMid) (res *model.MedalPopup, err error) {
res = new(model.MedalPopup)
err = s.client.Call(c, _medalPopup, arg, res)
return
}
// MedalMyInfo return medal my info.
func (s *Service2) MedalMyInfo(c context.Context, arg *model.ArgMid) (res []*model.MedalMyInfos, err error) {
err = s.client.Call(c, _medalMyInfo, arg, &res)
return
}
// MedalAllInfo return medal all info.
func (s *Service2) MedalAllInfo(c context.Context, arg *model.ArgMid) (res *model.MedalAllInfos, err error) {
err = s.client.Call(c, _medalAllInfo, arg, &res)
return
}
// MedalGrant send a medal to user.
func (s *Service2) MedalGrant(c context.Context, arg *model.ArgMIDNID) (err error) {
err = s.client.Call(c, _medalGrant, arg, _noRes)
return
}
// MedalActivated get the user activated medal info.
func (s *Service2) MedalActivated(c context.Context, arg *model.ArgMid) (res *model.MedalInfo, err error) {
err = s.client.Call(c, _medalActivated, arg, &res)
return
}
// MedalActivatedMulti Multi get the user activated medal info(at most 50).
func (s *Service2) MedalActivatedMulti(c context.Context, arg *model.ArgMids) (res map[int64]*model.MedalInfo, err error) {
err = s.client.Call(c, _medalActivatedMulti, arg, &res)
return
}

View File

@@ -0,0 +1,24 @@
package client
import (
"context"
"go-common/app/service/main/usersuit/model"
)
const (
_pendantEquip = "RPC.Equipment"
_pendantEquips = "RPC.Equipments"
)
// Equipment obtian equipment by mid
func (s *Service2) Equipment(c context.Context, arg *model.ArgEquipment) (res *model.PendantEquip, err error) {
res = new(model.PendantEquip)
err = s.client.Call(c, _pendantEquip, arg.Mid, res)
return
}
// Equipments obtian equipment by mids
func (s *Service2) Equipments(c context.Context, arg *model.ArgEquipments) (res map[int64]*model.PendantEquip, err error) {
err = s.client.Call(c, _pendantEquips, arg.Mids, &res)
return
}

View File

@@ -0,0 +1,10 @@
package client
import (
"testing"
)
// TestRPC_Equipment test
func TestRPC_Equipment(t *testing.T) {
}