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,71 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
proto_library(
name = "api_proto",
srcs = ["api.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "api_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_grpc"],
importpath = "go-common/app/service/main/account/api",
proto = ":api_proto",
tags = ["automanaged"],
deps = [
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
],
)
go_library(
name = "go_default_library",
srcs = [
"client.go",
"copy_autogenerated.go",
"mock.go",
"vip.go",
],
embed = [":api_go_proto"],
importpath = "go-common/app/service/main/account/api",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/member/model:go_default_library",
"//library/net/rpc/warden:go_default_library",
"//library/time:go_default_library",
"//vendor/github.com/golang/mock/gomock:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_x_net//context:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//app/service/main/account/api/gorpc:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,240 @@
// +bili:type=service
syntax = "proto3";
package account.service;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option go_package = "api";
message Card {
int64 mid = 1 [(gogoproto.jsontag) = "mid"];
string name = 2 [(gogoproto.jsontag) = "name"];
string sex = 3 [(gogoproto.jsontag) = "sex"];
string face = 4 [(gogoproto.jsontag) = "face"];
string sign = 5 [(gogoproto.jsontag) = "sign"];
int32 rank = 6 [(gogoproto.jsontag) = "rank"];
int32 level = 7 [(gogoproto.jsontag) = "level"];
int32 silence = 8 [(gogoproto.jsontag) = "silence"];
VipInfo vip = 9 [(gogoproto.jsontag) = "vip", (gogoproto.nullable) = false];
PendantInfo pendant = 10
[(gogoproto.jsontag) = "pendant", (gogoproto.nullable) = false];
NameplateInfo nameplate = 11
[(gogoproto.jsontag) = "nameplate", (gogoproto.nullable) = false];
OfficialInfo official = 12
[(gogoproto.jsontag) = "official", (gogoproto.nullable) = false];
}
message Info {
int64 mid = 1 [(gogoproto.jsontag) = "mid"];
string name = 2 [(gogoproto.jsontag) = "name"];
string sex = 3 [(gogoproto.jsontag) = "sex"];
string face = 4 [(gogoproto.jsontag) = "face"];
string sign = 5 [(gogoproto.jsontag) = "sign"];
int32 rank = 6 [(gogoproto.jsontag) = "rank"];
}
message Profile {
int64 mid = 1 [(gogoproto.jsontag) = "mid"];
string name = 2 [(gogoproto.jsontag) = "name"];
string sex = 3 [(gogoproto.jsontag) = "sex"];
string face = 4 [(gogoproto.jsontag) = "face"];
string sign = 5 [(gogoproto.jsontag) = "sign"];
int32 rank = 6 [(gogoproto.jsontag) = "rank"];
int32 level = 7 [(gogoproto.jsontag) = "level"];
int32 join_time = 8 [(gogoproto.jsontag) = "jointime"];
int32 moral = 9 [(gogoproto.jsontag) = "moral"];
int32 silence = 10 [(gogoproto.jsontag) = "silence"];
int32 email_status = 11 [(gogoproto.jsontag) = "email_status"];
int32 tel_status = 12 [(gogoproto.jsontag) = "tel_status"];
int32 identification = 13 [(gogoproto.jsontag) = "identification"];
VipInfo vip = 14 [(gogoproto.jsontag) = "vip", (gogoproto.nullable) = false];
PendantInfo pendant = 15
[(gogoproto.jsontag) = "pendant", (gogoproto.nullable) = false];
NameplateInfo nameplate = 16
[(gogoproto.jsontag) = "nameplate", (gogoproto.nullable) = false];
OfficialInfo official = 17
[(gogoproto.jsontag) = "official", (gogoproto.nullable) = false];
int64 birthday = 18 [
(gogoproto.jsontag) = "birthday",
(gogoproto.casttype) = "go-common/library/time.Time"
];
int32 is_tourist = 19 [(gogoproto.jsontag) = "is_tourist"];
}
// +bili:deepcopy-gen=true
// +bili:deepcopy-gen:structs=go-common/app/service/main/member/model.LevelInfo
message LevelInfo {
int32 cur = 1 [(gogoproto.jsontag) = "current_level"];
int32 min = 2 [(gogoproto.jsontag) = "current_min"];
int32 now_exp = 3 [(gogoproto.jsontag) = "current_exp"];
int32 next_exp = 4 [(gogoproto.jsontag) = "next_exp"];
}
message VipInfo {
int32 type = 1 [(gogoproto.jsontag) = "type"];
int32 status = 2 [(gogoproto.jsontag) = "status"];
int64 due_date = 3 [(gogoproto.jsontag) = "due_date"];
int32 vip_pay_type = 4 [(gogoproto.jsontag) = "vip_pay_type"];
}
message PendantInfo {
int32 pid = 1 [(gogoproto.jsontag) = "pid", (gogoproto.casttype) = "int"];
string name = 2 [(gogoproto.jsontag) = "name"];
string image = 3 [(gogoproto.jsontag) = "image"];
int64 expire = 4
[(gogoproto.jsontag) = "expire", (gogoproto.casttype) = "int"];
}
message NameplateInfo {
int32 nid = 1 [(gogoproto.jsontag) = "nid", (gogoproto.casttype) = "int"];
string name = 2 [(gogoproto.jsontag) = "name"];
string image = 3 [(gogoproto.jsontag) = "image"];
string image_small = 4 [(gogoproto.jsontag) = "image_small"];
string level = 5 [(gogoproto.jsontag) = "level"];
string condition = 6 [(gogoproto.jsontag) = "condition"];
}
// +bili:deepcopy-gen=true
// +bili:deepcopy-gen:structs=go-common/app/service/main/member/model.OfficialInfo
message OfficialInfo {
int32 role = 1 [(gogoproto.jsontag) = "role", (gogoproto.casttype) = "int8"];
string title = 2 [(gogoproto.jsontag) = "title"];
string desc = 3 [(gogoproto.jsontag) = "desc"];
}
message MidReq {
int64 mid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
string real_ip = 2;
}
message MidsReq {
repeated int64 mids = 1
[(gogoproto.moretags) = "validate:\"gt=0,dive,gt=0\""];
string real_ip = 2;
}
message NamesReq {
repeated string names = 1
[(gogoproto.moretags) = "validate:\"gt=0,dive,gt=0\""];
string real_ip = 2;
}
message ExpReq {
int64 mid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
double exp = 2;
string operater = 3;
string operate = 4;
string reason = 5;
string real_ip = 6;
}
message MoralReq {
int64 mid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
double moral = 2;
string oper = 3;
string reason = 4;
string remark = 5;
string real_ip = 6;
}
message RelationReq {
int64 mid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
int64 owner = 2;
string real_ip = 3;
}
message RelationsReq {
int64 mid = 1 [(gogoproto.moretags) = "validate:\"gt=0,required\""];
repeated int64 owners = 2;
string real_ip = 3;
}
message RichRelationReq {
int64 owner = 1;
repeated int64 mids = 2
[(gogoproto.moretags) = "validate:\"gt=0,dive,gt=0\""];
string real_ip = 3;
}
message InfoReply {
Info info = 1;
}
message InfosReply {
map<int64, Info> infos = 1;
}
message CardReply {
Card card = 1;
}
message CardsReply {
map<int64, Card> cards = 1;
}
message ProfileReply {
Profile profile = 1;
}
message ProfileStatReply {
Profile profile = 1;
LevelInfo level_info = 2 [(gogoproto.nullable) = false];
double coins = 3;
int64 following = 4;
int64 follower = 5;
}
message RelationReply {
bool following = 1;
}
message AttentionsReply {
repeated int64 attentions = 1;
}
message BlacksReply {
map<int64, bool> black_list = 1;
}
message RelationsReply {
map<int64, RelationReply> relations = 1;
}
message RichRelationsReply {
map<int64, int32> rich_relations = 1;
}
// +bili:deepcopy-gen=true
// +bili:deepcopy-gen:structs=go-common/app/service/main/account/api.VipInfo
message VipReply {
int32 type = 1;
int32 status = 2;
int64 due_date = 3;
int32 vip_pay_type = 4;
}
message VipsReply {
map<int64, VipReply> vips = 1;
}
message ExpReply {}
message MoralReply {}
service Account {
rpc Info3(MidReq) returns (InfoReply);
rpc Infos3(MidsReq) returns (InfosReply);
rpc InfosByName3(NamesReq) returns (InfosReply);
rpc Card3(MidReq) returns (CardReply);
rpc Cards3(MidsReq) returns (CardsReply);
rpc Profile3(MidReq) returns (ProfileReply);
rpc ProfileWithStat3(MidReq) returns (ProfileStatReply);
rpc AddExp3(ExpReq) returns (ExpReply);
rpc AddMoral3(MoralReq) returns (MoralReply);
rpc Relation3(RelationReq) returns (RelationReply);
rpc Attentions3(MidReq) returns (AttentionsReply);
rpc Blacks3(MidReq) returns (BlacksReply);
rpc Relations3(RelationsReq) returns (RelationsReply);
rpc RichRelations3(RichRelationReq) returns (RichRelationsReply);
rpc Vip3(MidReq) returns (VipReply);
rpc Vips3(MidsReq) returns (VipsReply);
}

View File

@@ -0,0 +1,22 @@
package api
import (
"context"
"go-common/library/net/rpc/warden"
"google.golang.org/grpc"
)
// AppID unique app id for service discovery
const AppID = "account.service"
// NewClient new member grpc client
func NewClient(cfg *warden.ClientConfig, opts ...grpc.DialOption) (AccountClient, error) {
client := warden.NewClient(cfg, opts...)
conn, err := client.Dial(context.Background(), "discovery://default/"+AppID)
if err != nil {
return nil, err
}
return NewAccountClient(conn), nil
}

View File

@@ -0,0 +1,137 @@
// Code generated by deepcopy-gen. DO NOT EDIT.
package api
import (
model "go-common/app/service/main/member/model"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LevelInfo) DeepCopyInto(out *LevelInfo) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LevelInfo.
func (in *LevelInfo) DeepCopy() *LevelInfo {
if in == nil {
return nil
}
out := new(LevelInfo)
in.DeepCopyInto(out)
return out
}
// DeepCopyAsIntoLevelInfo is an autogenerated deepcopy function, copying the receiver, writing into model.LevelInfo.
func (in *LevelInfo) DeepCopyAsIntoLevelInfo(out *model.LevelInfo) {
out.Cur = in.Cur
out.Min = in.Min
out.NowExp = in.NowExp
out.NextExp = in.NextExp
return
}
// DeepCopyFromLevelInfo is an autogenerated deepcopy function, copying the receiver, writing into model.LevelInfo.
func (out *LevelInfo) DeepCopyFromLevelInfo(in *model.LevelInfo) {
out.Cur = in.Cur
out.Min = in.Min
out.NowExp = in.NowExp
out.NextExp = in.NextExp
return
}
// DeepCopyAsLevelInfo is an autogenerated deepcopy function, copying the receiver, creating a new model.LevelInfo.
func (in *LevelInfo) DeepCopyAsLevelInfo() *model.LevelInfo {
if in == nil {
return nil
}
out := new(model.LevelInfo)
in.DeepCopyAsIntoLevelInfo(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *OfficialInfo) DeepCopyInto(out *OfficialInfo) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OfficialInfo.
func (in *OfficialInfo) DeepCopy() *OfficialInfo {
if in == nil {
return nil
}
out := new(OfficialInfo)
in.DeepCopyInto(out)
return out
}
// DeepCopyAsIntoOfficialInfo is an autogenerated deepcopy function, copying the receiver, writing into model.OfficialInfo.
func (in *OfficialInfo) DeepCopyAsIntoOfficialInfo(out *model.OfficialInfo) {
out.Role = in.Role
out.Title = in.Title
out.Desc = in.Desc
return
}
// DeepCopyFromOfficialInfo is an autogenerated deepcopy function, copying the receiver, writing into model.OfficialInfo.
func (out *OfficialInfo) DeepCopyFromOfficialInfo(in *model.OfficialInfo) {
out.Role = in.Role
out.Title = in.Title
out.Desc = in.Desc
return
}
// DeepCopyAsOfficialInfo is an autogenerated deepcopy function, copying the receiver, creating a new model.OfficialInfo.
func (in *OfficialInfo) DeepCopyAsOfficialInfo() *model.OfficialInfo {
if in == nil {
return nil
}
out := new(model.OfficialInfo)
in.DeepCopyAsIntoOfficialInfo(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VipReply) DeepCopyInto(out *VipReply) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VipReply.
func (in *VipReply) DeepCopy() *VipReply {
if in == nil {
return nil
}
out := new(VipReply)
in.DeepCopyInto(out)
return out
}
// DeepCopyAsIntoVipInfo is an autogenerated deepcopy function, copying the receiver, writing into VipInfo.
func (in *VipReply) DeepCopyAsIntoVipInfo(out *VipInfo) {
out.Type = in.Type
out.Status = in.Status
out.DueDate = in.DueDate
out.VipPayType = in.VipPayType
return
}
// DeepCopyFromVipInfo is an autogenerated deepcopy function, copying the receiver, writing into VipInfo.
func (out *VipReply) DeepCopyFromVipInfo(in *VipInfo) {
out.Type = in.Type
out.Status = in.Status
out.DueDate = in.DueDate
out.VipPayType = in.VipPayType
return
}
// DeepCopyAsVipInfo is an autogenerated deepcopy function, copying the receiver, creating a new VipInfo.
func (in *VipReply) DeepCopyAsVipInfo() *VipInfo {
if in == nil {
return nil
}
out := new(VipInfo)
in.DeepCopyAsIntoVipInfo(out)
return out
}

View File

@@ -0,0 +1,33 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["account3.go"],
importpath = "go-common/app/service/main/account/api/gorpc",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/account/api:go_default_library",
"//app/service/main/account/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,152 @@
package client
import (
"context"
v1 "go-common/app/service/main/account/api"
"go-common/app/service/main/account/model"
"go-common/library/net/rpc"
)
const (
_info3 = "RPC.Info3"
_card3 = "RPC.Card3"
_infos3 = "RPC.Infos3"
_infosByName3 = "RPC.InfosByName3"
_cards3 = "RPC.Cards3"
_profile3 = "RPC.Profile3"
_profileStat3 = "RPC.ProfileWithStat3"
_addExp3 = "RPC.AddExp3"
_addMoral3 = "RPC.AddMoral3"
_relation3 = "RPC.Relation3"
_relations3 = "RPC.Relations3"
_attentions3 = "RPC.Attentions3"
_blacks3 = "RPC.Blacks3"
_richRelations3 = "RPC.RichRelations3"
)
const (
_appid = "account.service"
)
var (
_noArg = &struct{}{}
)
// Service3 for server client3
type Service3 struct {
client *rpc.Client2
}
// New3 for new struct Service2 obj
// DEPRECATED: Please use gRPC service instead.
func New3(c *rpc.ClientConfig) (s *Service3) {
s = &Service3{}
s.client = rpc.NewDiscoveryCli(_appid, c)
return
}
// Info3 receive ArgMid contains mid and real ip, then init user info.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) Info3(c context.Context, arg *model.ArgMid) (res *v1.Info, err error) {
res = new(v1.Info)
err = s.client.Call(c, _info3, arg, res)
return
}
// Card3 receive ArgMid contains mid and real ip, then init user card.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) Card3(c context.Context, arg *model.ArgMid) (res *v1.Card, err error) {
res = new(v1.Card)
err = s.client.Call(c, _card3, arg, res)
return
}
// Infos3 receive ArgMids contains mid and real ip, then init user info.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) Infos3(c context.Context, arg *model.ArgMids) (res map[int64]*v1.Info, err error) {
err = s.client.Call(c, _infos3, arg, &res)
return
}
// InfosByName3 receive ArgMids contains mid and real ip, then init user info.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) InfosByName3(c context.Context, arg *model.ArgNames) (res map[int64]*v1.Info, err error) {
err = s.client.Call(c, _infosByName3, arg, &res)
return
}
// Cards3 receive ArgMids contains mid and real ip, then init user card.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) Cards3(c context.Context, arg *model.ArgMids) (res map[int64]*v1.Card, err error) {
err = s.client.Call(c, _cards3, arg, &res)
return
}
// Profile3 get user profile.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) Profile3(c context.Context, arg *model.ArgMid) (res *v1.Profile, err error) {
res = new(v1.Profile)
err = s.client.Call(c, _profile3, arg, res)
return
}
// ProfileWithStat3 get user profile.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) ProfileWithStat3(c context.Context, arg *model.ArgMid) (res *model.ProfileStat, err error) {
res = new(model.ProfileStat)
err = s.client.Call(c, _profileStat3, arg, res)
return
}
// AddExp3 receive ArgExp contains mid, money and reason, then add exp for user.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) AddExp3(c context.Context, arg *model.ArgExp) (err error) {
err = s.client.Call(c, _addExp3, arg, _noArg)
return
}
// AddMoral3 receive ArgMoral contains mid, moral, oper, reason and remark, then add moral for user.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) AddMoral3(c context.Context, arg *model.ArgMoral) (err error) {
err = s.client.Call(c, _addMoral3, arg, _noArg)
return
}
// Relation3 get user friend relation.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) Relation3(c context.Context, arg *model.ArgRelation) (res *model.Relation, err error) {
res = new(model.Relation)
err = s.client.Call(c, _relation3, arg, res)
return
}
// Relations3 batch get user friend relation.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) Relations3(c context.Context, arg *model.ArgRelations) (res map[int64]*model.Relation, err error) {
err = s.client.Call(c, _relations3, arg, &res)
return
}
// Attentions3 get user attentions ,include followings and whispers.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) Attentions3(c context.Context, arg *model.ArgMid) (res []int64, err error) {
err = s.client.Call(c, _attentions3, arg, &res)
return
}
// Blacks3 get user black list.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) Blacks3(c context.Context, arg *model.ArgMid) (res map[int64]struct{}, err error) {
err = s.client.Call(c, _blacks3, arg, &res)
return
}
// RichRelations3 get relation between owner and mids.
// DEPRECATED: Please use gRPC service instead.
func (s *Service3) RichRelations3(c context.Context, arg *model.ArgRichRelation) (res map[int64]int, err error) {
err = s.client.Call(c, _richRelations3, arg, &res)
return
}

View File

@@ -0,0 +1,554 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: api.pb.go
// Package api is a generated GoMock package.
package api
import (
gomock "github.com/golang/mock/gomock"
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
reflect "reflect"
)
// MockAccountClient is a mock of AccountClient interface
type MockAccountClient struct {
ctrl *gomock.Controller
recorder *MockAccountClientMockRecorder
}
// MockAccountClientMockRecorder is the mock recorder for MockAccountClient
type MockAccountClientMockRecorder struct {
mock *MockAccountClient
}
// NewMockAccountClient creates a new mock instance
func NewMockAccountClient(ctrl *gomock.Controller) *MockAccountClient {
mock := &MockAccountClient{ctrl: ctrl}
mock.recorder = &MockAccountClientMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockAccountClient) EXPECT() *MockAccountClientMockRecorder {
return m.recorder
}
// Info3 mocks base method
func (m *MockAccountClient) Info3(ctx context.Context, in *MidReq, opts ...grpc.CallOption) (*InfoReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Info3", varargs...)
ret0, _ := ret[0].(*InfoReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Info3 indicates an expected call of Info3
func (mr *MockAccountClientMockRecorder) Info3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Info3", reflect.TypeOf((*MockAccountClient)(nil).Info3), varargs...)
}
// Infos3 mocks base method
func (m *MockAccountClient) Infos3(ctx context.Context, in *MidsReq, opts ...grpc.CallOption) (*InfosReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Infos3", varargs...)
ret0, _ := ret[0].(*InfosReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Infos3 indicates an expected call of Infos3
func (mr *MockAccountClientMockRecorder) Infos3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Infos3", reflect.TypeOf((*MockAccountClient)(nil).Infos3), varargs...)
}
// InfosByName3 mocks base method
func (m *MockAccountClient) InfosByName3(ctx context.Context, in *NamesReq, opts ...grpc.CallOption) (*InfosReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "InfosByName3", varargs...)
ret0, _ := ret[0].(*InfosReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// InfosByName3 indicates an expected call of InfosByName3
func (mr *MockAccountClientMockRecorder) InfosByName3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InfosByName3", reflect.TypeOf((*MockAccountClient)(nil).InfosByName3), varargs...)
}
// Card3 mocks base method
func (m *MockAccountClient) Card3(ctx context.Context, in *MidReq, opts ...grpc.CallOption) (*CardReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Card3", varargs...)
ret0, _ := ret[0].(*CardReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Card3 indicates an expected call of Card3
func (mr *MockAccountClientMockRecorder) Card3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Card3", reflect.TypeOf((*MockAccountClient)(nil).Card3), varargs...)
}
// Cards3 mocks base method
func (m *MockAccountClient) Cards3(ctx context.Context, in *MidsReq, opts ...grpc.CallOption) (*CardsReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Cards3", varargs...)
ret0, _ := ret[0].(*CardsReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Cards3 indicates an expected call of Cards3
func (mr *MockAccountClientMockRecorder) Cards3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cards3", reflect.TypeOf((*MockAccountClient)(nil).Cards3), varargs...)
}
// Profile3 mocks base method
func (m *MockAccountClient) Profile3(ctx context.Context, in *MidReq, opts ...grpc.CallOption) (*ProfileReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Profile3", varargs...)
ret0, _ := ret[0].(*ProfileReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Profile3 indicates an expected call of Profile3
func (mr *MockAccountClientMockRecorder) Profile3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Profile3", reflect.TypeOf((*MockAccountClient)(nil).Profile3), varargs...)
}
// ProfileWithStat3 mocks base method
func (m *MockAccountClient) ProfileWithStat3(ctx context.Context, in *MidReq, opts ...grpc.CallOption) (*ProfileStatReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "ProfileWithStat3", varargs...)
ret0, _ := ret[0].(*ProfileStatReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ProfileWithStat3 indicates an expected call of ProfileWithStat3
func (mr *MockAccountClientMockRecorder) ProfileWithStat3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProfileWithStat3", reflect.TypeOf((*MockAccountClient)(nil).ProfileWithStat3), varargs...)
}
// AddExp3 mocks base method
func (m *MockAccountClient) AddExp3(ctx context.Context, in *ExpReq, opts ...grpc.CallOption) (*ExpReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "AddExp3", varargs...)
ret0, _ := ret[0].(*ExpReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// AddExp3 indicates an expected call of AddExp3
func (mr *MockAccountClientMockRecorder) AddExp3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddExp3", reflect.TypeOf((*MockAccountClient)(nil).AddExp3), varargs...)
}
// AddMoral3 mocks base method
func (m *MockAccountClient) AddMoral3(ctx context.Context, in *MoralReq, opts ...grpc.CallOption) (*MoralReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "AddMoral3", varargs...)
ret0, _ := ret[0].(*MoralReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// AddMoral3 indicates an expected call of AddMoral3
func (mr *MockAccountClientMockRecorder) AddMoral3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddMoral3", reflect.TypeOf((*MockAccountClient)(nil).AddMoral3), varargs...)
}
// Relation3 mocks base method
func (m *MockAccountClient) Relation3(ctx context.Context, in *RelationReq, opts ...grpc.CallOption) (*RelationReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Relation3", varargs...)
ret0, _ := ret[0].(*RelationReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Relation3 indicates an expected call of Relation3
func (mr *MockAccountClientMockRecorder) Relation3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Relation3", reflect.TypeOf((*MockAccountClient)(nil).Relation3), varargs...)
}
// Attentions3 mocks base method
func (m *MockAccountClient) Attentions3(ctx context.Context, in *MidReq, opts ...grpc.CallOption) (*AttentionsReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Attentions3", varargs...)
ret0, _ := ret[0].(*AttentionsReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Attentions3 indicates an expected call of Attentions3
func (mr *MockAccountClientMockRecorder) Attentions3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Attentions3", reflect.TypeOf((*MockAccountClient)(nil).Attentions3), varargs...)
}
// Blacks3 mocks base method
func (m *MockAccountClient) Blacks3(ctx context.Context, in *MidReq, opts ...grpc.CallOption) (*BlacksReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Blacks3", varargs...)
ret0, _ := ret[0].(*BlacksReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Blacks3 indicates an expected call of Blacks3
func (mr *MockAccountClientMockRecorder) Blacks3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Blacks3", reflect.TypeOf((*MockAccountClient)(nil).Blacks3), varargs...)
}
// Relations3 mocks base method
func (m *MockAccountClient) Relations3(ctx context.Context, in *RelationsReq, opts ...grpc.CallOption) (*RelationsReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Relations3", varargs...)
ret0, _ := ret[0].(*RelationsReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Relations3 indicates an expected call of Relations3
func (mr *MockAccountClientMockRecorder) Relations3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Relations3", reflect.TypeOf((*MockAccountClient)(nil).Relations3), varargs...)
}
// RichRelations3 mocks base method
func (m *MockAccountClient) RichRelations3(ctx context.Context, in *RichRelationReq, opts ...grpc.CallOption) (*RichRelationsReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "RichRelations3", varargs...)
ret0, _ := ret[0].(*RichRelationsReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// RichRelations3 indicates an expected call of RichRelations3
func (mr *MockAccountClientMockRecorder) RichRelations3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RichRelations3", reflect.TypeOf((*MockAccountClient)(nil).RichRelations3), varargs...)
}
// Vip3 mocks base method
func (m *MockAccountClient) Vip3(ctx context.Context, in *MidReq, opts ...grpc.CallOption) (*VipReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Vip3", varargs...)
ret0, _ := ret[0].(*VipReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Vip3 indicates an expected call of Vip3
func (mr *MockAccountClientMockRecorder) Vip3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Vip3", reflect.TypeOf((*MockAccountClient)(nil).Vip3), varargs...)
}
// Vips3 mocks base method
func (m *MockAccountClient) Vips3(ctx context.Context, in *MidsReq, opts ...grpc.CallOption) (*VipsReply, error) {
varargs := []interface{}{ctx, in}
for _, a := range opts {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Vips3", varargs...)
ret0, _ := ret[0].(*VipsReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Vips3 indicates an expected call of Vips3
func (mr *MockAccountClientMockRecorder) Vips3(ctx, in interface{}, opts ...interface{}) *gomock.Call {
varargs := append([]interface{}{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Vips3", reflect.TypeOf((*MockAccountClient)(nil).Vips3), varargs...)
}
// MockAccountServer is a mock of AccountServer interface
type MockAccountServer struct {
ctrl *gomock.Controller
recorder *MockAccountServerMockRecorder
}
// MockAccountServerMockRecorder is the mock recorder for MockAccountServer
type MockAccountServerMockRecorder struct {
mock *MockAccountServer
}
// NewMockAccountServer creates a new mock instance
func NewMockAccountServer(ctrl *gomock.Controller) *MockAccountServer {
mock := &MockAccountServer{ctrl: ctrl}
mock.recorder = &MockAccountServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockAccountServer) EXPECT() *MockAccountServerMockRecorder {
return m.recorder
}
// Info3 mocks base method
func (m *MockAccountServer) Info3(arg0 context.Context, arg1 *MidReq) (*InfoReply, error) {
ret := m.ctrl.Call(m, "Info3", arg0, arg1)
ret0, _ := ret[0].(*InfoReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Info3 indicates an expected call of Info3
func (mr *MockAccountServerMockRecorder) Info3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Info3", reflect.TypeOf((*MockAccountServer)(nil).Info3), arg0, arg1)
}
// Infos3 mocks base method
func (m *MockAccountServer) Infos3(arg0 context.Context, arg1 *MidsReq) (*InfosReply, error) {
ret := m.ctrl.Call(m, "Infos3", arg0, arg1)
ret0, _ := ret[0].(*InfosReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Infos3 indicates an expected call of Infos3
func (mr *MockAccountServerMockRecorder) Infos3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Infos3", reflect.TypeOf((*MockAccountServer)(nil).Infos3), arg0, arg1)
}
// InfosByName3 mocks base method
func (m *MockAccountServer) InfosByName3(arg0 context.Context, arg1 *NamesReq) (*InfosReply, error) {
ret := m.ctrl.Call(m, "InfosByName3", arg0, arg1)
ret0, _ := ret[0].(*InfosReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// InfosByName3 indicates an expected call of InfosByName3
func (mr *MockAccountServerMockRecorder) InfosByName3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InfosByName3", reflect.TypeOf((*MockAccountServer)(nil).InfosByName3), arg0, arg1)
}
// Card3 mocks base method
func (m *MockAccountServer) Card3(arg0 context.Context, arg1 *MidReq) (*CardReply, error) {
ret := m.ctrl.Call(m, "Card3", arg0, arg1)
ret0, _ := ret[0].(*CardReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Card3 indicates an expected call of Card3
func (mr *MockAccountServerMockRecorder) Card3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Card3", reflect.TypeOf((*MockAccountServer)(nil).Card3), arg0, arg1)
}
// Cards3 mocks base method
func (m *MockAccountServer) Cards3(arg0 context.Context, arg1 *MidsReq) (*CardsReply, error) {
ret := m.ctrl.Call(m, "Cards3", arg0, arg1)
ret0, _ := ret[0].(*CardsReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Cards3 indicates an expected call of Cards3
func (mr *MockAccountServerMockRecorder) Cards3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cards3", reflect.TypeOf((*MockAccountServer)(nil).Cards3), arg0, arg1)
}
// Profile3 mocks base method
func (m *MockAccountServer) Profile3(arg0 context.Context, arg1 *MidReq) (*ProfileReply, error) {
ret := m.ctrl.Call(m, "Profile3", arg0, arg1)
ret0, _ := ret[0].(*ProfileReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Profile3 indicates an expected call of Profile3
func (mr *MockAccountServerMockRecorder) Profile3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Profile3", reflect.TypeOf((*MockAccountServer)(nil).Profile3), arg0, arg1)
}
// ProfileWithStat3 mocks base method
func (m *MockAccountServer) ProfileWithStat3(arg0 context.Context, arg1 *MidReq) (*ProfileStatReply, error) {
ret := m.ctrl.Call(m, "ProfileWithStat3", arg0, arg1)
ret0, _ := ret[0].(*ProfileStatReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ProfileWithStat3 indicates an expected call of ProfileWithStat3
func (mr *MockAccountServerMockRecorder) ProfileWithStat3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProfileWithStat3", reflect.TypeOf((*MockAccountServer)(nil).ProfileWithStat3), arg0, arg1)
}
// AddExp3 mocks base method
func (m *MockAccountServer) AddExp3(arg0 context.Context, arg1 *ExpReq) (*ExpReply, error) {
ret := m.ctrl.Call(m, "AddExp3", arg0, arg1)
ret0, _ := ret[0].(*ExpReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// AddExp3 indicates an expected call of AddExp3
func (mr *MockAccountServerMockRecorder) AddExp3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddExp3", reflect.TypeOf((*MockAccountServer)(nil).AddExp3), arg0, arg1)
}
// AddMoral3 mocks base method
func (m *MockAccountServer) AddMoral3(arg0 context.Context, arg1 *MoralReq) (*MoralReply, error) {
ret := m.ctrl.Call(m, "AddMoral3", arg0, arg1)
ret0, _ := ret[0].(*MoralReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// AddMoral3 indicates an expected call of AddMoral3
func (mr *MockAccountServerMockRecorder) AddMoral3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddMoral3", reflect.TypeOf((*MockAccountServer)(nil).AddMoral3), arg0, arg1)
}
// Relation3 mocks base method
func (m *MockAccountServer) Relation3(arg0 context.Context, arg1 *RelationReq) (*RelationReply, error) {
ret := m.ctrl.Call(m, "Relation3", arg0, arg1)
ret0, _ := ret[0].(*RelationReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Relation3 indicates an expected call of Relation3
func (mr *MockAccountServerMockRecorder) Relation3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Relation3", reflect.TypeOf((*MockAccountServer)(nil).Relation3), arg0, arg1)
}
// Attentions3 mocks base method
func (m *MockAccountServer) Attentions3(arg0 context.Context, arg1 *MidReq) (*AttentionsReply, error) {
ret := m.ctrl.Call(m, "Attentions3", arg0, arg1)
ret0, _ := ret[0].(*AttentionsReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Attentions3 indicates an expected call of Attentions3
func (mr *MockAccountServerMockRecorder) Attentions3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Attentions3", reflect.TypeOf((*MockAccountServer)(nil).Attentions3), arg0, arg1)
}
// Blacks3 mocks base method
func (m *MockAccountServer) Blacks3(arg0 context.Context, arg1 *MidReq) (*BlacksReply, error) {
ret := m.ctrl.Call(m, "Blacks3", arg0, arg1)
ret0, _ := ret[0].(*BlacksReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Blacks3 indicates an expected call of Blacks3
func (mr *MockAccountServerMockRecorder) Blacks3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Blacks3", reflect.TypeOf((*MockAccountServer)(nil).Blacks3), arg0, arg1)
}
// Relations3 mocks base method
func (m *MockAccountServer) Relations3(arg0 context.Context, arg1 *RelationsReq) (*RelationsReply, error) {
ret := m.ctrl.Call(m, "Relations3", arg0, arg1)
ret0, _ := ret[0].(*RelationsReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Relations3 indicates an expected call of Relations3
func (mr *MockAccountServerMockRecorder) Relations3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Relations3", reflect.TypeOf((*MockAccountServer)(nil).Relations3), arg0, arg1)
}
// RichRelations3 mocks base method
func (m *MockAccountServer) RichRelations3(arg0 context.Context, arg1 *RichRelationReq) (*RichRelationsReply, error) {
ret := m.ctrl.Call(m, "RichRelations3", arg0, arg1)
ret0, _ := ret[0].(*RichRelationsReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// RichRelations3 indicates an expected call of RichRelations3
func (mr *MockAccountServerMockRecorder) RichRelations3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RichRelations3", reflect.TypeOf((*MockAccountServer)(nil).RichRelations3), arg0, arg1)
}
// Vip3 mocks base method
func (m *MockAccountServer) Vip3(arg0 context.Context, arg1 *MidReq) (*VipReply, error) {
ret := m.ctrl.Call(m, "Vip3", arg0, arg1)
ret0, _ := ret[0].(*VipReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Vip3 indicates an expected call of Vip3
func (mr *MockAccountServerMockRecorder) Vip3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Vip3", reflect.TypeOf((*MockAccountServer)(nil).Vip3), arg0, arg1)
}
// Vips3 mocks base method
func (m *MockAccountServer) Vips3(arg0 context.Context, arg1 *MidsReq) (*VipsReply, error) {
ret := m.ctrl.Call(m, "Vips3", arg0, arg1)
ret0, _ := ret[0].(*VipsReply)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Vips3 indicates an expected call of Vips3
func (mr *MockAccountServerMockRecorder) Vips3(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Vips3", reflect.TypeOf((*MockAccountServer)(nil).Vips3), arg0, arg1)
}

View File

@@ -0,0 +1,19 @@
package api
const (
_normalVip = 1 //月度大会员
_annualVip = 2 //年度会员
_statusAvailable = 1 //未过期
_statusFrozen = 2 //冻结
)
// IsValid decide the user is valid vip or not.
func (v *VipInfo) IsValid() bool {
return v.Status == _statusAvailable && (v.Type == _normalVip || v.Type == _annualVip)
}
// IsFrozen decide the user is frozen vip or not.
func (v *VipInfo) IsFrozen() bool {
return v.Status == _statusFrozen
}