Commit aeb88cc0 authored by kzkzzzz's avatar kzkzzzz

feat: init

parent fcbe6006
Pipeline #1366 failed with stages
project=demo
type=service
.PHONY: init
# init env
......@@ -13,22 +14,25 @@ init:
go install github.com/cosmtrek/air@latest
.PHONY: api
# generate api service proto
api:
@bash script/gen-api.sh service $(project)
@bash script/gen-api.sh $(type) $(project)
.PHONY: service
service:
@bash script/gen-project.sh service $(project)
.PHONY: gen
gen:
@bash script/gen-project.sh $(type) $(project)
.PHONY: run
run:
@cd app/service/$(project) && air -c air.toml
@cd app/$(type)/$(project) && air -c air.toml
.PHONY: build
# build
build:
@cd app/service/$(project) && mkdir -p bin && go build -o bin/ ./...
@cd app/$(type)/$(project) && mkdir -p bin && go build -v -o bin/hilo-$(type)-$(project) ./cmd/$(project)
.PHONY: build-all
build-all:
@bash script/build-all.sh service
.PHONY: wire
wire:
@cd app/service/$(project)/cmd/$(project) && wire
\ No newline at end of file
@cd app/$(type)/$(project)/cmd/$(project) && wire
\ No newline at end of file
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: user/user.proto
package common
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type EThirdPartyType int32
const (
EThirdPartyType_UnknownThirdPartyType EThirdPartyType = 0
EThirdPartyType_Phone EThirdPartyType = 1
EThirdPartyType_Google EThirdPartyType = 2
EThirdPartyType_Facebook EThirdPartyType = 3
EThirdPartyType_Apple EThirdPartyType = 4
EThirdPartyType_WeChat EThirdPartyType = 5
)
// Enum value maps for EThirdPartyType.
var (
EThirdPartyType_name = map[int32]string{
0: "UnknownThirdPartyType",
1: "Phone",
2: "Google",
3: "Facebook",
4: "Apple",
5: "WeChat",
}
EThirdPartyType_value = map[string]int32{
"UnknownThirdPartyType": 0,
"Phone": 1,
"Google": 2,
"Facebook": 3,
"Apple": 4,
"WeChat": 5,
}
)
func (x EThirdPartyType) Enum() *EThirdPartyType {
p := new(EThirdPartyType)
*p = x
return p
}
func (x EThirdPartyType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (EThirdPartyType) Descriptor() protoreflect.EnumDescriptor {
return file_user_user_proto_enumTypes[0].Descriptor()
}
func (EThirdPartyType) Type() protoreflect.EnumType {
return &file_user_user_proto_enumTypes[0]
}
func (x EThirdPartyType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use EThirdPartyType.Descriptor instead.
func (EThirdPartyType) EnumDescriptor() ([]byte, []int) {
return file_user_user_proto_rawDescGZIP(), []int{0}
}
type ESex int32
const (
ESex_UnknownSex ESex = 0
ESex_Male ESex = 1
ESex_Female ESex = 2
)
// Enum value maps for ESex.
var (
ESex_name = map[int32]string{
0: "UnknownSex",
1: "Male",
2: "Female",
}
ESex_value = map[string]int32{
"UnknownSex": 0,
"Male": 1,
"Female": 2,
}
)
func (x ESex) Enum() *ESex {
p := new(ESex)
*p = x
return p
}
func (x ESex) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ESex) Descriptor() protoreflect.EnumDescriptor {
return file_user_user_proto_enumTypes[1].Descriptor()
}
func (ESex) Type() protoreflect.EnumType {
return &file_user_user_proto_enumTypes[1]
}
func (x ESex) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ESex.Descriptor instead.
func (ESex) EnumDescriptor() ([]byte, []int) {
return file_user_user_proto_rawDescGZIP(), []int{1}
}
type CvUserDetail struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ILikeCount *int32 `protobuf:"varint,1,opt,name=ILikeCount,proto3,oneof" json:"ILikeCount,omitempty"` //统计:我喜欢多少人
LikeCount *int32 `protobuf:"varint,2,opt,name=LikeCount,proto3,oneof" json:"LikeCount,omitempty"` //统计:多少人喜欢你, (本才才有数据,不是本人,数据为nil)
VisitCount *int32 `protobuf:"varint,3,opt,name=VisitCount,proto3,oneof" json:"VisitCount,omitempty"` //统计:多少人访问你
IsPush *int32 `protobuf:"varint,4,opt,name=IsPush,proto3,oneof" json:"IsPush,omitempty"` //消息提醒, 1:开启,2:关闭
DiamondNum *int32 `protobuf:"varint,5,opt,name=DiamondNum,proto3,oneof" json:"DiamondNum,omitempty"` //钻石数量(本人才有数据,不是本人,数据为nil)
IsLike *bool `protobuf:"varint,6,opt,name=IsLike,proto3,oneof" json:"IsLike,omitempty"` //是否喜欢(本人没有数据,//20210205 已废弃nil,产品说:可以自己喜欢自己)
IsSession *bool `protobuf:"varint,7,opt,name=IsSession,proto3,oneof" json:"IsSession,omitempty"` //是否存在会话(本人没有数据)
IsLikeMe *bool `protobuf:"varint,8,opt,name=IsLikeMe,proto3,oneof" json:"IsLikeMe,omitempty"`
HeartValue int32 `protobuf:"varint,9,opt,name=HeartValue,proto3" json:"HeartValue,omitempty"` // 与我之间永恒之心的值
HeartValueMax int32 `protobuf:"varint,10,opt,name=HeartValueMax,proto3" json:"HeartValueMax,omitempty"` // 与我之间永恒之心的最大值(0代表没有永恒之心,即没有相互关注)
MeetDays int32 `protobuf:"varint,11,opt,name=MeetDays,proto3" json:"MeetDays,omitempty"` // 成长关系建立的时间(天数)
WealthUserGrade int32 `protobuf:"varint,12,opt,name=WealthUserGrade,proto3" json:"WealthUserGrade,omitempty"` //财富等级
CharmUserGrade int32 `protobuf:"varint,13,opt,name=CharmUserGrade,proto3" json:"CharmUserGrade,omitempty"` //魅力等级
ActivityUserGrade int32 `protobuf:"varint,14,opt,name=ActivityUserGrade,proto3" json:"ActivityUserGrade,omitempty"` //活跃等级
CurrentRoom string `protobuf:"bytes,15,opt,name=CurrentRoom,proto3" json:"CurrentRoom,omitempty"` // 当前用户所在房间(产品叫“群组”)
MyGroupPower int64 `protobuf:"varint,16,opt,name=MyGroupPower,proto3" json:"MyGroupPower,omitempty"` // 当前用户所在势力
MyGroupPowerName string `protobuf:"bytes,17,opt,name=MyGroupPowerName,proto3" json:"MyGroupPowerName,omitempty"` // 当前用户所在势力绑定群组的名称
}
func (x *CvUserDetail) Reset() {
*x = CvUserDetail{}
if protoimpl.UnsafeEnabled {
mi := &file_user_user_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CvUserDetail) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CvUserDetail) ProtoMessage() {}
func (x *CvUserDetail) ProtoReflect() protoreflect.Message {
mi := &file_user_user_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CvUserDetail.ProtoReflect.Descriptor instead.
func (*CvUserDetail) Descriptor() ([]byte, []int) {
return file_user_user_proto_rawDescGZIP(), []int{0}
}
func (x *CvUserDetail) GetILikeCount() int32 {
if x != nil && x.ILikeCount != nil {
return *x.ILikeCount
}
return 0
}
func (x *CvUserDetail) GetLikeCount() int32 {
if x != nil && x.LikeCount != nil {
return *x.LikeCount
}
return 0
}
func (x *CvUserDetail) GetVisitCount() int32 {
if x != nil && x.VisitCount != nil {
return *x.VisitCount
}
return 0
}
func (x *CvUserDetail) GetIsPush() int32 {
if x != nil && x.IsPush != nil {
return *x.IsPush
}
return 0
}
func (x *CvUserDetail) GetDiamondNum() int32 {
if x != nil && x.DiamondNum != nil {
return *x.DiamondNum
}
return 0
}
func (x *CvUserDetail) GetIsLike() bool {
if x != nil && x.IsLike != nil {
return *x.IsLike
}
return false
}
func (x *CvUserDetail) GetIsSession() bool {
if x != nil && x.IsSession != nil {
return *x.IsSession
}
return false
}
func (x *CvUserDetail) GetIsLikeMe() bool {
if x != nil && x.IsLikeMe != nil {
return *x.IsLikeMe
}
return false
}
func (x *CvUserDetail) GetHeartValue() int32 {
if x != nil {
return x.HeartValue
}
return 0
}
func (x *CvUserDetail) GetHeartValueMax() int32 {
if x != nil {
return x.HeartValueMax
}
return 0
}
func (x *CvUserDetail) GetMeetDays() int32 {
if x != nil {
return x.MeetDays
}
return 0
}
func (x *CvUserDetail) GetWealthUserGrade() int32 {
if x != nil {
return x.WealthUserGrade
}
return 0
}
func (x *CvUserDetail) GetCharmUserGrade() int32 {
if x != nil {
return x.CharmUserGrade
}
return 0
}
func (x *CvUserDetail) GetActivityUserGrade() int32 {
if x != nil {
return x.ActivityUserGrade
}
return 0
}
func (x *CvUserDetail) GetCurrentRoom() string {
if x != nil {
return x.CurrentRoom
}
return ""
}
func (x *CvUserDetail) GetMyGroupPower() int64 {
if x != nil {
return x.MyGroupPower
}
return 0
}
func (x *CvUserDetail) GetMyGroupPowerName() string {
if x != nil {
return x.MyGroupPowerName
}
return ""
}
type UserBase struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` //不会有返回值
Avatar *string `protobuf:"bytes,2,opt,name=Avatar,proto3,oneof" json:"Avatar,omitempty"` //头像,不存在为nil
DefaultAvatar *bool `protobuf:"varint,3,opt,name=DefaultAvatar,proto3,oneof" json:"DefaultAvatar,omitempty"` //是否默认头像 true:是 false:不是
ExternalId *string `protobuf:"bytes,4,opt,name=ExternalId,proto3,oneof" json:"ExternalId,omitempty"` //用户对外ID
Nick *string `protobuf:"bytes,5,opt,name=Nick,proto3,oneof" json:"Nick,omitempty"` //昵称,不存在为nil
Description *string `protobuf:"bytes,6,opt,name=Description,proto3,oneof" json:"Description,omitempty"` //签名,不存在为nil
ESex *int32 `protobuf:"varint,7,opt,name=ESex,proto3,oneof" json:"ESex,omitempty"` //性别 1:男 2:女,不存在为nil
Country *string `protobuf:"bytes,8,opt,name=Country,proto3,oneof" json:"Country,omitempty"` //国家,不存在为nil
CountryIcon *string `protobuf:"bytes,9,opt,name=CountryIcon,proto3,oneof" json:"CountryIcon,omitempty"` //国旗图标,不存在为nil
Code *string `protobuf:"bytes,10,opt,name=Code,proto3,oneof" json:"Code,omitempty"` //邀请码
IsPrettyCode bool `protobuf:"varint,11,opt,name=IsPrettyCode,proto3" json:"IsPrettyCode,omitempty"` // 是否靓号
IsLogout bool `protobuf:"varint,12,opt,name=IsLogout,proto3" json:"IsLogout,omitempty"` //是否注销
Birthday *int64 `protobuf:"varint,13,opt,name=Birthday,proto3,oneof" json:"Birthday,omitempty"` //生日,如果是其它人用户信息,年龄则按照是否展示显示,如果是本人,年龄则按照是否存在展示
IsShowAge *bool `protobuf:"varint,14,opt,name=IsShowAge,proto3,oneof" json:"IsShowAge,omitempty"` // 是否展示年龄, 是本人才有数据,看其他用户均为nil
IsTradeUnion *bool `protobuf:"varint,15,opt,name=IsTradeUnion,proto3,oneof" json:"IsTradeUnion,omitempty"` // 是否工会成员, 只有是自己查自己,这个才有值,其它全为nil, 20220329 数据开放:原因:产品1对1视频聊天中,公会用户视频需要送礼物。改为: 全部人可以知道是否是公会用户。
IsAgentMgr *bool `protobuf:"varint,16,opt,name=IsAgentMgr,proto3,oneof" json:"IsAgentMgr,omitempty"` // 是否代理管理员, 只有自己查自己的时候才有值,其他情况为nil
IsTradeUnionMatchNotification *bool `protobuf:"varint,17,opt,name=IsTradeUnionMatchNotification,proto3,oneof" json:"IsTradeUnionMatchNotification,omitempty"` // 工会成员,是否开启了,匹配通知,只有 isTradeUnion值为true,这里才有值,
IsVip bool `protobuf:"varint,18,opt,name=IsVip,proto3" json:"IsVip,omitempty"` // 是否VIP用户
IsOfficialStaff bool `protobuf:"varint,19,opt,name=IsOfficialStaff,proto3" json:"IsOfficialStaff,omitempty"` // 是否是官方人员
VipExpireTime *int64 `protobuf:"varint,20,opt,name=VipExpireTime,proto3,oneof" json:"VipExpireTime,omitempty"` // VIP用户过期时间(只有自己查询自己,才返回)
Medals []int32 `protobuf:"varint,21,rep,packed,name=Medals,proto3" json:"Medals,omitempty"` // 勋章列表 TODO: 删除
MedalInfo []*CvMedal `protobuf:"bytes,22,rep,name=MedalInfo,proto3" json:"MedalInfo,omitempty"` // 勋章列表
Headwear *CvHeadwear `protobuf:"bytes,23,opt,name=Headwear,proto3,oneof" json:"Headwear,omitempty"` // 当前使用的头饰
Ride *CvProperty `protobuf:"bytes,24,opt,name=Ride,proto3" json:"Ride,omitempty"` // 当前使用的座驾
Noble *CvNoble `protobuf:"bytes,25,opt,name=Noble,proto3" json:"Noble,omitempty"`
}
func (x *UserBase) Reset() {
*x = UserBase{}
if protoimpl.UnsafeEnabled {
mi := &file_user_user_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserBase) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserBase) ProtoMessage() {}
func (x *UserBase) ProtoReflect() protoreflect.Message {
mi := &file_user_user_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UserBase.ProtoReflect.Descriptor instead.
func (*UserBase) Descriptor() ([]byte, []int) {
return file_user_user_proto_rawDescGZIP(), []int{1}
}
func (x *UserBase) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *UserBase) GetAvatar() string {
if x != nil && x.Avatar != nil {
return *x.Avatar
}
return ""
}
func (x *UserBase) GetDefaultAvatar() bool {
if x != nil && x.DefaultAvatar != nil {
return *x.DefaultAvatar
}
return false
}
func (x *UserBase) GetExternalId() string {
if x != nil && x.ExternalId != nil {
return *x.ExternalId
}
return ""
}
func (x *UserBase) GetNick() string {
if x != nil && x.Nick != nil {
return *x.Nick
}
return ""
}
func (x *UserBase) GetDescription() string {
if x != nil && x.Description != nil {
return *x.Description
}
return ""
}
func (x *UserBase) GetESex() int32 {
if x != nil && x.ESex != nil {
return *x.ESex
}
return 0
}
func (x *UserBase) GetCountry() string {
if x != nil && x.Country != nil {
return *x.Country
}
return ""
}
func (x *UserBase) GetCountryIcon() string {
if x != nil && x.CountryIcon != nil {
return *x.CountryIcon
}
return ""
}
func (x *UserBase) GetCode() string {
if x != nil && x.Code != nil {
return *x.Code
}
return ""
}
func (x *UserBase) GetIsPrettyCode() bool {
if x != nil {
return x.IsPrettyCode
}
return false
}
func (x *UserBase) GetIsLogout() bool {
if x != nil {
return x.IsLogout
}
return false
}
func (x *UserBase) GetBirthday() int64 {
if x != nil && x.Birthday != nil {
return *x.Birthday
}
return 0
}
func (x *UserBase) GetIsShowAge() bool {
if x != nil && x.IsShowAge != nil {
return *x.IsShowAge
}
return false
}
func (x *UserBase) GetIsTradeUnion() bool {
if x != nil && x.IsTradeUnion != nil {
return *x.IsTradeUnion
}
return false
}
func (x *UserBase) GetIsAgentMgr() bool {
if x != nil && x.IsAgentMgr != nil {
return *x.IsAgentMgr
}
return false
}
func (x *UserBase) GetIsTradeUnionMatchNotification() bool {
if x != nil && x.IsTradeUnionMatchNotification != nil {
return *x.IsTradeUnionMatchNotification
}
return false
}
func (x *UserBase) GetIsVip() bool {
if x != nil {
return x.IsVip
}
return false
}
func (x *UserBase) GetIsOfficialStaff() bool {
if x != nil {
return x.IsOfficialStaff
}
return false
}
func (x *UserBase) GetVipExpireTime() int64 {
if x != nil && x.VipExpireTime != nil {
return *x.VipExpireTime
}
return 0
}
func (x *UserBase) GetMedals() []int32 {
if x != nil {
return x.Medals
}
return nil
}
func (x *UserBase) GetMedalInfo() []*CvMedal {
if x != nil {
return x.MedalInfo
}
return nil
}
func (x *UserBase) GetHeadwear() *CvHeadwear {
if x != nil {
return x.Headwear
}
return nil
}
func (x *UserBase) GetRide() *CvProperty {
if x != nil {
return x.Ride
}
return nil
}
func (x *UserBase) GetNoble() *CvNoble {
if x != nil {
return x.Noble
}
return nil
}
type CvMedal struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
PicUrl string `protobuf:"bytes,2,opt,name=PicUrl,proto3" json:"PicUrl,omitempty"`
EffectUrl string `protobuf:"bytes,3,opt,name=EffectUrl,proto3" json:"EffectUrl,omitempty"`
}
func (x *CvMedal) Reset() {
*x = CvMedal{}
if protoimpl.UnsafeEnabled {
mi := &file_user_user_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CvMedal) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CvMedal) ProtoMessage() {}
func (x *CvMedal) ProtoReflect() protoreflect.Message {
mi := &file_user_user_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CvMedal.ProtoReflect.Descriptor instead.
func (*CvMedal) Descriptor() ([]byte, []int) {
return file_user_user_proto_rawDescGZIP(), []int{2}
}
func (x *CvMedal) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *CvMedal) GetPicUrl() string {
if x != nil {
return x.PicUrl
}
return ""
}
func (x *CvMedal) GetEffectUrl() string {
if x != nil {
return x.EffectUrl
}
return ""
}
type CvHeadwear struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
Using bool `protobuf:"varint,2,opt,name=Using,proto3" json:"Using,omitempty"`
PicUrl string `protobuf:"bytes,3,opt,name=PicUrl,proto3" json:"PicUrl,omitempty"`
EffectUrl string `protobuf:"bytes,4,opt,name=EffectUrl,proto3" json:"EffectUrl,omitempty"`
TimeLeft int64 `protobuf:"varint,5,opt,name=TimeLeft,proto3" json:"TimeLeft,omitempty"`
}
func (x *CvHeadwear) Reset() {
*x = CvHeadwear{}
if protoimpl.UnsafeEnabled {
mi := &file_user_user_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CvHeadwear) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CvHeadwear) ProtoMessage() {}
func (x *CvHeadwear) ProtoReflect() protoreflect.Message {
mi := &file_user_user_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CvHeadwear.ProtoReflect.Descriptor instead.
func (*CvHeadwear) Descriptor() ([]byte, []int) {
return file_user_user_proto_rawDescGZIP(), []int{3}
}
func (x *CvHeadwear) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *CvHeadwear) GetUsing() bool {
if x != nil {
return x.Using
}
return false
}
func (x *CvHeadwear) GetPicUrl() string {
if x != nil {
return x.PicUrl
}
return ""
}
func (x *CvHeadwear) GetEffectUrl() string {
if x != nil {
return x.EffectUrl
}
return ""
}
func (x *CvHeadwear) GetTimeLeft() int64 {
if x != nil {
return x.TimeLeft
}
return 0
}
type CvProperty struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"`
PicUrl string `protobuf:"bytes,2,opt,name=PicUrl,proto3" json:"PicUrl,omitempty"`
EffectUrl string `protobuf:"bytes,3,opt,name=EffectUrl,proto3" json:"EffectUrl,omitempty"`
Using bool `protobuf:"varint,4,opt,name=Using,proto3" json:"Using,omitempty"`
TimeLeft string `protobuf:"bytes,5,opt,name=TimeLeft,proto3" json:"TimeLeft,omitempty"`
SenderAvatar string `protobuf:"bytes,6,opt,name=SenderAvatar,proto3" json:"SenderAvatar,omitempty"`
ReceiverAvatar string `protobuf:"bytes,7,opt,name=ReceiverAvatar,proto3" json:"ReceiverAvatar,omitempty"`
}
func (x *CvProperty) Reset() {
*x = CvProperty{}
if protoimpl.UnsafeEnabled {
mi := &file_user_user_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CvProperty) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CvProperty) ProtoMessage() {}
func (x *CvProperty) ProtoReflect() protoreflect.Message {
mi := &file_user_user_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CvProperty.ProtoReflect.Descriptor instead.
func (*CvProperty) Descriptor() ([]byte, []int) {
return file_user_user_proto_rawDescGZIP(), []int{4}
}
func (x *CvProperty) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *CvProperty) GetPicUrl() string {
if x != nil {
return x.PicUrl
}
return ""
}
func (x *CvProperty) GetEffectUrl() string {
if x != nil {
return x.EffectUrl
}
return ""
}
func (x *CvProperty) GetUsing() bool {
if x != nil {
return x.Using
}
return false
}
func (x *CvProperty) GetTimeLeft() string {
if x != nil {
return x.TimeLeft
}
return ""
}
func (x *CvProperty) GetSenderAvatar() string {
if x != nil {
return x.SenderAvatar
}
return ""
}
func (x *CvProperty) GetReceiverAvatar() string {
if x != nil {
return x.ReceiverAvatar
}
return ""
}
type CvNoble struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Level int32 `protobuf:"varint,1,opt,name=Level,proto3" json:"Level,omitempty"`
EndTime int64 `protobuf:"varint,2,opt,name=EndTime,proto3" json:"EndTime,omitempty"`
}
func (x *CvNoble) Reset() {
*x = CvNoble{}
if protoimpl.UnsafeEnabled {
mi := &file_user_user_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CvNoble) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CvNoble) ProtoMessage() {}
func (x *CvNoble) ProtoReflect() protoreflect.Message {
mi := &file_user_user_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CvNoble.ProtoReflect.Descriptor instead.
func (*CvNoble) Descriptor() ([]byte, []int) {
return file_user_user_proto_rawDescGZIP(), []int{5}
}
func (x *CvNoble) GetLevel() int32 {
if x != nil {
return x.Level
}
return 0
}
func (x *CvNoble) GetEndTime() int64 {
if x != nil {
return x.EndTime
}
return 0
}
var File_user_user_proto protoreflect.FileDescriptor
var file_user_user_proto_rawDesc = []byte{
0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x22, 0xde, 0x05, 0x0a, 0x0c, 0x43, 0x76,
0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x23, 0x0a, 0x0a, 0x49, 0x4c,
0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00,
0x52, 0x0a, 0x49, 0x4c, 0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12,
0x21, 0x0a, 0x09, 0x4c, 0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01,
0x28, 0x05, 0x48, 0x01, 0x52, 0x09, 0x4c, 0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x88,
0x01, 0x01, 0x12, 0x23, 0x0a, 0x0a, 0x56, 0x69, 0x73, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 0x0a, 0x56, 0x69, 0x73, 0x69, 0x74, 0x43,
0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x49, 0x73, 0x50, 0x75, 0x73,
0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x48, 0x03, 0x52, 0x06, 0x49, 0x73, 0x50, 0x75, 0x73,
0x68, 0x88, 0x01, 0x01, 0x12, 0x23, 0x0a, 0x0a, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4e,
0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x48, 0x04, 0x52, 0x0a, 0x44, 0x69, 0x61, 0x6d,
0x6f, 0x6e, 0x64, 0x4e, 0x75, 0x6d, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x49, 0x73, 0x4c,
0x69, 0x6b, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x48, 0x05, 0x52, 0x06, 0x49, 0x73, 0x4c,
0x69, 0x6b, 0x65, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, 0x09, 0x49, 0x73, 0x53, 0x65, 0x73, 0x73,
0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x48, 0x06, 0x52, 0x09, 0x49, 0x73, 0x53,
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x1f, 0x0a, 0x08, 0x49, 0x73, 0x4c,
0x69, 0x6b, 0x65, 0x4d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x48, 0x07, 0x52, 0x08, 0x49,
0x73, 0x4c, 0x69, 0x6b, 0x65, 0x4d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1e, 0x0a, 0x0a, 0x48, 0x65,
0x61, 0x72, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,
0x48, 0x65, 0x61, 0x72, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x48, 0x65,
0x61, 0x72, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x78, 0x18, 0x0a, 0x20, 0x01, 0x28,
0x05, 0x52, 0x0d, 0x48, 0x65, 0x61, 0x72, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x78,
0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x65, 0x65, 0x74, 0x44, 0x61, 0x79, 0x73, 0x18, 0x0b, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x4d, 0x65, 0x65, 0x74, 0x44, 0x61, 0x79, 0x73, 0x12, 0x28, 0x0a, 0x0f,
0x57, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x61, 0x64, 0x65, 0x18,
0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x57, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x55, 0x73, 0x65,
0x72, 0x47, 0x72, 0x61, 0x64, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x72, 0x6d, 0x55,
0x73, 0x65, 0x72, 0x47, 0x72, 0x61, 0x64, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e,
0x43, 0x68, 0x61, 0x72, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x61, 0x64, 0x65, 0x12, 0x2c,
0x0a, 0x11, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72,
0x61, 0x64, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x41, 0x63, 0x74, 0x69, 0x76,
0x69, 0x74, 0x79, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x61, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b,
0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x18, 0x0f, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0b, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x22,
0x0a, 0x0c, 0x4d, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x10,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x4d, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x77,
0x65, 0x72, 0x12, 0x2a, 0x0a, 0x10, 0x4d, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x77,
0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x4d, 0x79,
0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x0d,
0x0a, 0x0b, 0x5f, 0x49, 0x4c, 0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x0c, 0x0a,
0x0a, 0x5f, 0x4c, 0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x0d, 0x0a, 0x0b, 0x5f,
0x56, 0x69, 0x73, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x49,
0x73, 0x50, 0x75, 0x73, 0x68, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e,
0x64, 0x4e, 0x75, 0x6d, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x49, 0x73, 0x4c, 0x69, 0x6b, 0x65, 0x42,
0x0c, 0x0a, 0x0a, 0x5f, 0x49, 0x73, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x0b, 0x0a,
0x09, 0x5f, 0x49, 0x73, 0x4c, 0x69, 0x6b, 0x65, 0x4d, 0x65, 0x22, 0x81, 0x09, 0x0a, 0x08, 0x55,
0x73, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61,
0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61,
0x72, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x0d, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41,
0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x48, 0x01, 0x52, 0x0d, 0x44,
0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x88, 0x01, 0x01, 0x12,
0x23, 0x0a, 0x0a, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x0a, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49,
0x64, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x4e, 0x69, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01,
0x28, 0x09, 0x48, 0x03, 0x52, 0x04, 0x4e, 0x69, 0x63, 0x6b, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a,
0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01,
0x28, 0x09, 0x48, 0x04, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x45, 0x53, 0x65, 0x78, 0x18, 0x07, 0x20, 0x01,
0x28, 0x05, 0x48, 0x05, 0x52, 0x04, 0x45, 0x53, 0x65, 0x78, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a,
0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x48, 0x06,
0x52, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x63, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28,
0x09, 0x48, 0x07, 0x52, 0x0b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x63, 0x6f, 0x6e,
0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28,
0x09, 0x48, 0x08, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x88, 0x01, 0x01, 0x12, 0x22, 0x0a, 0x0c,
0x49, 0x73, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x0b, 0x20, 0x01,
0x28, 0x08, 0x52, 0x0c, 0x49, 0x73, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x43, 0x6f, 0x64, 0x65,
0x12, 0x1a, 0x0a, 0x08, 0x49, 0x73, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x18, 0x0c, 0x20, 0x01,
0x28, 0x08, 0x52, 0x08, 0x49, 0x73, 0x4c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x12, 0x1f, 0x0a, 0x08,
0x42, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x48, 0x09,
0x52, 0x08, 0x42, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a,
0x09, 0x49, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x41, 0x67, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08,
0x48, 0x0a, 0x52, 0x09, 0x49, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x41, 0x67, 0x65, 0x88, 0x01, 0x01,
0x12, 0x27, 0x0a, 0x0c, 0x49, 0x73, 0x54, 0x72, 0x61, 0x64, 0x65, 0x55, 0x6e, 0x69, 0x6f, 0x6e,
0x18, 0x0f, 0x20, 0x01, 0x28, 0x08, 0x48, 0x0b, 0x52, 0x0c, 0x49, 0x73, 0x54, 0x72, 0x61, 0x64,
0x65, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x23, 0x0a, 0x0a, 0x49, 0x73, 0x41,
0x67, 0x65, 0x6e, 0x74, 0x4d, 0x67, 0x72, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x48, 0x0c, 0x52,
0x0a, 0x49, 0x73, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4d, 0x67, 0x72, 0x88, 0x01, 0x01, 0x12, 0x49,
0x0a, 0x1d, 0x49, 0x73, 0x54, 0x72, 0x61, 0x64, 0x65, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x4d, 0x61,
0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18,
0x11, 0x20, 0x01, 0x28, 0x08, 0x48, 0x0d, 0x52, 0x1d, 0x49, 0x73, 0x54, 0x72, 0x61, 0x64, 0x65,
0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x73, 0x56,
0x69, 0x70, 0x18, 0x12, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x49, 0x73, 0x56, 0x69, 0x70, 0x12,
0x28, 0x0a, 0x0f, 0x49, 0x73, 0x4f, 0x66, 0x66, 0x69, 0x63, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61,
0x66, 0x66, 0x18, 0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x49, 0x73, 0x4f, 0x66, 0x66, 0x69,
0x63, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x66, 0x66, 0x12, 0x29, 0x0a, 0x0d, 0x56, 0x69, 0x70,
0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x03,
0x48, 0x0e, 0x52, 0x0d, 0x56, 0x69, 0x70, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d,
0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x73, 0x18, 0x15,
0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x73, 0x12, 0x2d, 0x0a, 0x09,
0x4d, 0x65, 0x64, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x76, 0x4d, 0x65, 0x64, 0x61, 0x6c,
0x52, 0x09, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x33, 0x0a, 0x08, 0x48,
0x65, 0x61, 0x64, 0x77, 0x65, 0x61, 0x72, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e,
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x76, 0x48, 0x65, 0x61, 0x64, 0x77, 0x65, 0x61,
0x72, 0x48, 0x0f, 0x52, 0x08, 0x48, 0x65, 0x61, 0x64, 0x77, 0x65, 0x61, 0x72, 0x88, 0x01, 0x01,
0x12, 0x26, 0x0a, 0x04, 0x52, 0x69, 0x64, 0x65, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12,
0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x43, 0x76, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72,
0x74, 0x79, 0x52, 0x04, 0x52, 0x69, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x05, 0x4e, 0x6f, 0x62, 0x6c,
0x65, 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
0x2e, 0x43, 0x76, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x52, 0x05, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x42,
0x09, 0x0a, 0x07, 0x5f, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x44,
0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x42, 0x0d, 0x0a, 0x0b,
0x5f, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x42, 0x07, 0x0a, 0x05, 0x5f,
0x4e, 0x69, 0x63, 0x6b, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
0x74, 0x69, 0x6f, 0x6e, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x45, 0x53, 0x65, 0x78, 0x42, 0x0a, 0x0a,
0x08, 0x5f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x43, 0x6f,
0x75, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x63, 0x6f, 0x6e, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x43, 0x6f,
0x64, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x42, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x42,
0x0c, 0x0a, 0x0a, 0x5f, 0x49, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x41, 0x67, 0x65, 0x42, 0x0f, 0x0a,
0x0d, 0x5f, 0x49, 0x73, 0x54, 0x72, 0x61, 0x64, 0x65, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x42, 0x0d,
0x0a, 0x0b, 0x5f, 0x49, 0x73, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4d, 0x67, 0x72, 0x42, 0x20, 0x0a,
0x1e, 0x5f, 0x49, 0x73, 0x54, 0x72, 0x61, 0x64, 0x65, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x4d, 0x61,
0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42,
0x10, 0x0a, 0x0e, 0x5f, 0x56, 0x69, 0x70, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d,
0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x48, 0x65, 0x61, 0x64, 0x77, 0x65, 0x61, 0x72, 0x22, 0x4f,
0x0a, 0x07, 0x43, 0x76, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x69, 0x63,
0x55, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72,
0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x22,
0x84, 0x01, 0x0a, 0x0a, 0x43, 0x76, 0x48, 0x65, 0x61, 0x64, 0x77, 0x65, 0x61, 0x72, 0x12, 0x0e,
0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x14,
0x0a, 0x05, 0x55, 0x73, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x55,
0x73, 0x69, 0x6e, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72, 0x6c, 0x18, 0x03,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72, 0x6c, 0x12, 0x1c, 0x0a, 0x09,
0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
0x09, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x69,
0x6d, 0x65, 0x4c, 0x65, 0x66, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x54, 0x69,
0x6d, 0x65, 0x4c, 0x65, 0x66, 0x74, 0x22, 0xd0, 0x01, 0x0a, 0x0a, 0x43, 0x76, 0x50, 0x72, 0x6f,
0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72, 0x6c, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72, 0x6c, 0x12, 0x1c, 0x0a,
0x09, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x55,
0x73, 0x69, 0x6e, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x55, 0x73, 0x69, 0x6e,
0x67, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x4c, 0x65, 0x66, 0x74, 0x18, 0x05, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x4c, 0x65, 0x66, 0x74, 0x12, 0x22, 0x0a,
0x0c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x06, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61,
0x72, 0x12, 0x26, 0x0a, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61,
0x74, 0x61, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x69,
0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x22, 0x39, 0x0a, 0x07, 0x43, 0x76, 0x4e,
0x6f, 0x62, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x45, 0x6e,
0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x45, 0x6e, 0x64,
0x54, 0x69, 0x6d, 0x65, 0x2a, 0x68, 0x0a, 0x0f, 0x45, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61,
0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x6e, 0x6b, 0x6e, 0x6f,
0x77, 0x6e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65,
0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x10, 0x01, 0x12, 0x0a, 0x0a,
0x06, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x61, 0x63,
0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x10, 0x03, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x70, 0x70, 0x6c, 0x65,
0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x57, 0x65, 0x43, 0x68, 0x61, 0x74, 0x10, 0x05, 0x2a, 0x2c,
0x0a, 0x04, 0x45, 0x53, 0x65, 0x78, 0x12, 0x0e, 0x0a, 0x0a, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77,
0x6e, 0x53, 0x65, 0x78, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x61, 0x6c, 0x65, 0x10, 0x01,
0x12, 0x0a, 0x0a, 0x06, 0x46, 0x65, 0x6d, 0x61, 0x6c, 0x65, 0x10, 0x02, 0x42, 0x1d, 0x5a, 0x1b,
0x68, 0x69, 0x6c, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f,
0x75, 0x73, 0x65, 0x72, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_user_user_proto_rawDescOnce sync.Once
file_user_user_proto_rawDescData = file_user_user_proto_rawDesc
)
func file_user_user_proto_rawDescGZIP() []byte {
file_user_user_proto_rawDescOnce.Do(func() {
file_user_user_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_user_proto_rawDescData)
})
return file_user_user_proto_rawDescData
}
var file_user_user_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_user_user_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_user_user_proto_goTypes = []interface{}{
(EThirdPartyType)(0), // 0: common.EThirdPartyType
(ESex)(0), // 1: common.ESex
(*CvUserDetail)(nil), // 2: common.CvUserDetail
(*UserBase)(nil), // 3: common.UserBase
(*CvMedal)(nil), // 4: common.CvMedal
(*CvHeadwear)(nil), // 5: common.CvHeadwear
(*CvProperty)(nil), // 6: common.CvProperty
(*CvNoble)(nil), // 7: common.CvNoble
}
var file_user_user_proto_depIdxs = []int32{
4, // 0: common.UserBase.MedalInfo:type_name -> common.CvMedal
5, // 1: common.UserBase.Headwear:type_name -> common.CvHeadwear
6, // 2: common.UserBase.Ride:type_name -> common.CvProperty
7, // 3: common.UserBase.Noble:type_name -> common.CvNoble
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_user_user_proto_init() }
func file_user_user_proto_init() {
if File_user_user_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_user_user_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CvUserDetail); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_user_user_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserBase); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_user_user_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CvMedal); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_user_user_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CvHeadwear); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_user_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CvProperty); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_user_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CvNoble); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_user_user_proto_msgTypes[0].OneofWrappers = []interface{}{}
file_user_user_proto_msgTypes[1].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_user_user_proto_rawDesc,
NumEnums: 2,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_user_user_proto_goTypes,
DependencyIndexes: file_user_user_proto_depIdxs,
EnumInfos: file_user_user_proto_enumTypes,
MessageInfos: file_user_user_proto_msgTypes,
}.Build()
File_user_user_proto = out.File
file_user_user_proto_rawDesc = nil
file_user_user_proto_goTypes = nil
file_user_user_proto_depIdxs = nil
}
syntax = "proto3";
package common;
option go_package = "hilo/api/common/user;common";
enum EThirdPartyType {
UnknownThirdPartyType = 0;
Phone = 1;
Google = 2;
Facebook = 3;
Apple = 4;
WeChat = 5;
}
enum ESex {
UnknownSex = 0;
Male = 1;
Female = 2;
}
message CvUserDetail {
optional int32 ILikeCount = 1; //统计:我喜欢多少人
optional int32 LikeCount = 2; //统计:多少人喜欢你, (本才才有数据,不是本人,数据为nil)
optional int32 VisitCount = 3; //统计:多少人访问你
optional int32 IsPush = 4; //消息提醒, 1:开启,2:关闭
optional int32 DiamondNum = 5; //钻石数量(本人才有数据,不是本人,数据为nil)
optional bool IsLike = 6; //是否喜欢(本人没有数据,//20210205 已废弃nil,产品说:可以自己喜欢自己)
optional bool IsSession = 7; //是否存在会话(本人没有数据)
optional bool IsLikeMe = 8;
int32 HeartValue = 9; // 与我之间永恒之心的值
int32 HeartValueMax = 10; // 与我之间永恒之心的最大值(0代表没有永恒之心,即没有相互关注)
int32 MeetDays = 11; // 成长关系建立的时间(天数)
int32 WealthUserGrade = 12; //财富等级
int32 CharmUserGrade = 13; //魅力等级
int32 ActivityUserGrade = 14; //活跃等级
string CurrentRoom = 15; // 当前用户所在房间(产品叫“群组”)
int64 MyGroupPower = 16; // 当前用户所在势力
string MyGroupPowerName = 17; // 当前用户所在势力绑定群组的名称
}
message UserBase {
int32 Id = 1; //不会有返回值
optional string Avatar = 2; //头像,不存在为nil
optional bool DefaultAvatar = 3; //是否默认头像 true:是 false:不是
optional string ExternalId = 4; //用户对外ID
optional string Nick = 5; //昵称,不存在为nil
optional string Description = 6; //签名,不存在为nil
optional int32 ESex = 7; //性别 1:男 2:女,不存在为nil
optional string Country = 8; //国家,不存在为nil
optional string CountryIcon = 9; //国旗图标,不存在为nil
optional string Code = 10; //邀请码
bool IsPrettyCode = 11; // 是否靓号
bool IsLogout = 12; //是否注销
optional int64 Birthday = 13; //生日,如果是其它人用户信息,年龄则按照是否展示显示,如果是本人,年龄则按照是否存在展示
optional bool IsShowAge = 14; // 是否展示年龄, 是本人才有数据,看其他用户均为nil
optional bool IsTradeUnion = 15; // 是否工会成员, 只有是自己查自己,这个才有值,其它全为nil, 20220329 数据开放:原因:产品1对1视频聊天中,公会用户视频需要送礼物。改为: 全部人可以知道是否是公会用户。
optional bool IsAgentMgr = 16; // 是否代理管理员, 只有自己查自己的时候才有值,其他情况为nil
optional bool IsTradeUnionMatchNotification = 17; // 工会成员,是否开启了,匹配通知,只有 isTradeUnion值为true,这里才有值,
bool IsVip = 18; // 是否VIP用户
bool IsOfficialStaff = 19; // 是否是官方人员
optional int64 VipExpireTime = 20; // VIP用户过期时间(只有自己查询自己,才返回)
repeated int32 Medals = 21; // 勋章列表 TODO: 删除
repeated CvMedal MedalInfo = 22; // 勋章列表
optional CvHeadwear Headwear = 23; // 当前使用的头饰
CvProperty Ride = 24; // 当前使用的座驾
CvNoble Noble = 25;
}
message CvMedal {
int32 Id = 1;
string PicUrl = 2;
string EffectUrl = 3;
}
message CvHeadwear {
int32 Id = 1;
bool Using = 2;
string PicUrl = 3;
string EffectUrl = 4;
int64 TimeLeft = 5;
}
message CvProperty {
int32 Id = 1;
string PicUrl = 2;
string EffectUrl = 3;
bool Using = 4;
string TimeLeft = 5;
string SenderAvatar = 6;
string ReceiverAvatar = 7;
}
message CvNoble {
int32 Level = 1;
int64 EndTime = 2;
}
\ No newline at end of file
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: country.proto
package country
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type CountryModel struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id"`
Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name"`
ShortName string `protobuf:"bytes,3,opt,name=ShortName,proto3" json:"ShortName"`
Code string `protobuf:"bytes,4,opt,name=Code,proto3" json:"Code"`
Icon string `protobuf:"bytes,5,opt,name=Icon,proto3" json:"Icon"`
Icon2 string `protobuf:"bytes,6,opt,name=Icon2,proto3" json:"Icon2"`
Lang string `protobuf:"bytes,7,opt,name=Lang,proto3" json:"Lang"`
IsCommon int32 `protobuf:"varint,8,opt,name=IsCommon,proto3" json:"IsCommon"`
IsDefault int32 `protobuf:"varint,9,opt,name=IsDefault,proto3" json:"IsDefault"`
Status int32 `protobuf:"varint,10,opt,name=Status,proto3" json:"Status"`
CreatedTime *timestamppb.Timestamp `protobuf:"bytes,11,opt,name=CreatedTime,proto3" json:"CreatedTime"`
UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,12,opt,name=UpdatedTime,proto3" json:"UpdatedTime"`
StandardShortName string `protobuf:"bytes,13,opt,name=StandardShortName,proto3" json:"StandardShortName"`
}
func (x *CountryModel) Reset() {
*x = CountryModel{}
if protoimpl.UnsafeEnabled {
mi := &file_country_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CountryModel) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CountryModel) ProtoMessage() {}
func (x *CountryModel) ProtoReflect() protoreflect.Message {
mi := &file_country_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CountryModel.ProtoReflect.Descriptor instead.
func (*CountryModel) Descriptor() ([]byte, []int) {
return file_country_proto_rawDescGZIP(), []int{0}
}
func (x *CountryModel) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *CountryModel) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *CountryModel) GetShortName() string {
if x != nil {
return x.ShortName
}
return ""
}
func (x *CountryModel) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *CountryModel) GetIcon() string {
if x != nil {
return x.Icon
}
return ""
}
func (x *CountryModel) GetIcon2() string {
if x != nil {
return x.Icon2
}
return ""
}
func (x *CountryModel) GetLang() string {
if x != nil {
return x.Lang
}
return ""
}
func (x *CountryModel) GetIsCommon() int32 {
if x != nil {
return x.IsCommon
}
return 0
}
func (x *CountryModel) GetIsDefault() int32 {
if x != nil {
return x.IsDefault
}
return 0
}
func (x *CountryModel) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *CountryModel) GetCreatedTime() *timestamppb.Timestamp {
if x != nil {
return x.CreatedTime
}
return nil
}
func (x *CountryModel) GetUpdatedTime() *timestamppb.Timestamp {
if x != nil {
return x.UpdatedTime
}
return nil
}
func (x *CountryModel) GetStandardShortName() string {
if x != nil {
return x.StandardShortName
}
return ""
}
type GetCountryByShortNameReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ShortName string `protobuf:"bytes,1,opt,name=ShortName,proto3" json:"ShortName" validate:"required"` // @gotags: validate:"required"
}
func (x *GetCountryByShortNameReq) Reset() {
*x = GetCountryByShortNameReq{}
if protoimpl.UnsafeEnabled {
mi := &file_country_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetCountryByShortNameReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetCountryByShortNameReq) ProtoMessage() {}
func (x *GetCountryByShortNameReq) ProtoReflect() protoreflect.Message {
mi := &file_country_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetCountryByShortNameReq.ProtoReflect.Descriptor instead.
func (*GetCountryByShortNameReq) Descriptor() ([]byte, []int) {
return file_country_proto_rawDescGZIP(), []int{1}
}
func (x *GetCountryByShortNameReq) GetShortName() string {
if x != nil {
return x.ShortName
}
return ""
}
type GetCountryByShortNameRep struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data *CountryModel `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
}
func (x *GetCountryByShortNameRep) Reset() {
*x = GetCountryByShortNameRep{}
if protoimpl.UnsafeEnabled {
mi := &file_country_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetCountryByShortNameRep) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetCountryByShortNameRep) ProtoMessage() {}
func (x *GetCountryByShortNameRep) ProtoReflect() protoreflect.Message {
mi := &file_country_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetCountryByShortNameRep.ProtoReflect.Descriptor instead.
func (*GetCountryByShortNameRep) Descriptor() ([]byte, []int) {
return file_country_proto_rawDescGZIP(), []int{2}
}
func (x *GetCountryByShortNameRep) GetData() *CountryModel {
if x != nil {
return x.Data
}
return nil
}
var File_country_proto protoreflect.FileDescriptor
var file_country_proto_rawDesc = []byte{
0x0a, 0x0d, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x07, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9e, 0x03, 0x0a, 0x0c, 0x43, 0x6f,
0x75, 0x6e, 0x74, 0x72, 0x79, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61,
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c,
0x0a, 0x09, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x09, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x43, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65,
0x12, 0x12, 0x0a, 0x04, 0x49, 0x63, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
0x49, 0x63, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x63, 0x6f, 0x6e, 0x32, 0x18, 0x06, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x49, 0x63, 0x6f, 0x6e, 0x32, 0x12, 0x12, 0x0a, 0x04, 0x4c, 0x61,
0x6e, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4c, 0x61, 0x6e, 0x67, 0x12, 0x1a,
0x0a, 0x08, 0x49, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05,
0x52, 0x08, 0x49, 0x73, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x49, 0x73,
0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x49,
0x73, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x3c, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18,
0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
0x70, 0x52, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3c,
0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0c, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52,
0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x11,
0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d,
0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72,
0x64, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x38, 0x0a, 0x18, 0x47, 0x65,
0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x4e,
0x61, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x4e,
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x68, 0x6f, 0x72, 0x74,
0x4e, 0x61, 0x6d, 0x65, 0x22, 0x45, 0x0a, 0x18, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x72, 0x79, 0x42, 0x79, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x65, 0x70,
0x12, 0x29, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15,
0x2e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79,
0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0x6a, 0x0a, 0x07, 0x43,
0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x5f, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12,
0x21, 0x2e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x52,
0x65, 0x71, 0x1a, 0x21, 0x2e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x47, 0x65, 0x74,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x79, 0x53, 0x68, 0x6f, 0x72, 0x74, 0x4e, 0x61,
0x6d, 0x65, 0x52, 0x65, 0x70, 0x22, 0x00, 0x42, 0x1a, 0x5a, 0x18, 0x68, 0x69, 0x6c, 0x6f, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x3b, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_country_proto_rawDescOnce sync.Once
file_country_proto_rawDescData = file_country_proto_rawDesc
)
func file_country_proto_rawDescGZIP() []byte {
file_country_proto_rawDescOnce.Do(func() {
file_country_proto_rawDescData = protoimpl.X.CompressGZIP(file_country_proto_rawDescData)
})
return file_country_proto_rawDescData
}
var file_country_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_country_proto_goTypes = []interface{}{
(*CountryModel)(nil), // 0: country.CountryModel
(*GetCountryByShortNameReq)(nil), // 1: country.GetCountryByShortNameReq
(*GetCountryByShortNameRep)(nil), // 2: country.GetCountryByShortNameRep
(*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp
}
var file_country_proto_depIdxs = []int32{
3, // 0: country.CountryModel.CreatedTime:type_name -> google.protobuf.Timestamp
3, // 1: country.CountryModel.UpdatedTime:type_name -> google.protobuf.Timestamp
0, // 2: country.GetCountryByShortNameRep.data:type_name -> country.CountryModel
1, // 3: country.Country.GetCountryByShortName:input_type -> country.GetCountryByShortNameReq
2, // 4: country.Country.GetCountryByShortName:output_type -> country.GetCountryByShortNameRep
4, // [4:5] is the sub-list for method output_type
3, // [3:4] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_country_proto_init() }
func file_country_proto_init() {
if File_country_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_country_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CountryModel); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_country_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCountryByShortNameReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_country_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCountryByShortNameRep); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_country_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_country_proto_goTypes,
DependencyIndexes: file_country_proto_depIdxs,
MessageInfos: file_country_proto_msgTypes,
}.Build()
File_country_proto = out.File
file_country_proto_rawDesc = nil
file_country_proto_goTypes = nil
file_country_proto_depIdxs = nil
}
syntax = "proto3";
package country;
import "google/protobuf/timestamp.proto";
option go_package = "hilo/api/country;country";
// 定义服务
service Country {
rpc GetCountryByShortName (GetCountryByShortNameReq) returns (GetCountryByShortNameRep) {
}
}
message CountryModel {
int64 Id = 1;
string Name = 2;
string ShortName = 3;
string Code = 4;
string Icon = 5;
string Icon2 = 6;
string Lang = 7;
int32 IsCommon = 8;
int32 IsDefault = 9 ;
int32 Status = 10;
google.protobuf.Timestamp CreatedTime = 11;
google.protobuf.Timestamp UpdatedTime = 12;
string StandardShortName = 13;
}
message GetCountryByShortNameReq {
string ShortName = 1; // @gotags: validate:"required"
}
message GetCountryByShortNameRep {
CountryModel data = 1;
}
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.4
// source: country.proto
package country
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// CountryClient is the client API for Country service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type CountryClient interface {
GetCountryByShortName(ctx context.Context, in *GetCountryByShortNameReq, opts ...grpc.CallOption) (*GetCountryByShortNameRep, error)
}
type countryClient struct {
cc grpc.ClientConnInterface
}
func NewCountryClient(cc grpc.ClientConnInterface) CountryClient {
return &countryClient{cc}
}
func (c *countryClient) GetCountryByShortName(ctx context.Context, in *GetCountryByShortNameReq, opts ...grpc.CallOption) (*GetCountryByShortNameRep, error) {
out := new(GetCountryByShortNameRep)
err := c.cc.Invoke(ctx, "/country.Country/GetCountryByShortName", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// CountryServer is the server API for Country service.
// All implementations must embed UnimplementedCountryServer
// for forward compatibility
type CountryServer interface {
GetCountryByShortName(context.Context, *GetCountryByShortNameReq) (*GetCountryByShortNameRep, error)
mustEmbedUnimplementedCountryServer()
}
// UnimplementedCountryServer must be embedded to have forward compatible implementations.
type UnimplementedCountryServer struct {
}
func (UnimplementedCountryServer) GetCountryByShortName(context.Context, *GetCountryByShortNameReq) (*GetCountryByShortNameRep, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCountryByShortName not implemented")
}
func (UnimplementedCountryServer) mustEmbedUnimplementedCountryServer() {}
// UnsafeCountryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CountryServer will
// result in compilation errors.
type UnsafeCountryServer interface {
mustEmbedUnimplementedCountryServer()
}
func RegisterCountryServer(s grpc.ServiceRegistrar, srv CountryServer) {
s.RegisterService(&Country_ServiceDesc, srv)
}
func _Country_GetCountryByShortName_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetCountryByShortNameReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CountryServer).GetCountryByShortName(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/country.Country/GetCountryByShortName",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CountryServer).GetCountryByShortName(ctx, req.(*GetCountryByShortNameReq))
}
return interceptor(ctx, in, info, handler)
}
// Country_ServiceDesc is the grpc.ServiceDesc for Country service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Country_ServiceDesc = grpc.ServiceDesc{
ServiceName: "country.Country",
HandlerType: (*CountryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetCountryByShortName",
Handler: _Country_GetCountryByShortName_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "country.proto",
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: demo.proto
package demo
import (
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type DemoModel struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"`
Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value"`
CreatedAt int64 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at"`
UpdatedAt int64 `protobuf:"varint,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at"`
}
func (x *DemoModel) Reset() {
*x = DemoModel{}
if protoimpl.UnsafeEnabled {
mi := &file_demo_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DemoModel) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DemoModel) ProtoMessage() {}
func (x *DemoModel) ProtoReflect() protoreflect.Message {
mi := &file_demo_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DemoModel.ProtoReflect.Descriptor instead.
func (*DemoModel) Descriptor() ([]byte, []int) {
return file_demo_proto_rawDescGZIP(), []int{0}
}
func (x *DemoModel) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *DemoModel) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *DemoModel) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
func (x *DemoModel) GetCreatedAt() int64 {
if x != nil {
return x.CreatedAt
}
return 0
}
func (x *DemoModel) GetUpdatedAt() int64 {
if x != nil {
return x.UpdatedAt
}
return 0
}
type IdReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id" validate:"required,min=1"` // @gotags: validate:"required,min=1"
}
func (x *IdReq) Reset() {
*x = IdReq{}
if protoimpl.UnsafeEnabled {
mi := &file_demo_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *IdReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*IdReq) ProtoMessage() {}
func (x *IdReq) ProtoReflect() protoreflect.Message {
mi := &file_demo_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use IdReq.ProtoReflect.Descriptor instead.
func (*IdReq) Descriptor() ([]byte, []int) {
return file_demo_proto_rawDescGZIP(), []int{1}
}
func (x *IdReq) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
type ListReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page" validate:"min=0"` // @gotags: validate:"min=0"
Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size" validate:"min=0"` // @gotags: validate:"min=0"
}
func (x *ListReq) Reset() {
*x = ListReq{}
if protoimpl.UnsafeEnabled {
mi := &file_demo_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListReq) ProtoMessage() {}
func (x *ListReq) ProtoReflect() protoreflect.Message {
mi := &file_demo_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListReq.ProtoReflect.Descriptor instead.
func (*ListReq) Descriptor() ([]byte, []int) {
return file_demo_proto_rawDescGZIP(), []int{2}
}
func (x *ListReq) GetPage() int64 {
if x != nil {
return x.Page
}
return 0
}
func (x *ListReq) GetSize() int64 {
if x != nil {
return x.Size
}
return 0
}
type ListRep struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
List []*DemoModel `protobuf:"bytes,1,rep,name=list,proto3" json:"list"`
}
func (x *ListRep) Reset() {
*x = ListRep{}
if protoimpl.UnsafeEnabled {
mi := &file_demo_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListRep) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListRep) ProtoMessage() {}
func (x *ListRep) ProtoReflect() protoreflect.Message {
mi := &file_demo_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListRep.ProtoReflect.Descriptor instead.
func (*ListRep) Descriptor() ([]byte, []int) {
return file_demo_proto_rawDescGZIP(), []int{3}
}
func (x *ListRep) GetList() []*DemoModel {
if x != nil {
return x.List
}
return nil
}
type CreateReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name" validate:"required"` // @gotags: validate:"required"
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value" validate:"required"` // @gotags: validate:"required"
}
func (x *CreateReq) Reset() {
*x = CreateReq{}
if protoimpl.UnsafeEnabled {
mi := &file_demo_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CreateReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CreateReq) ProtoMessage() {}
func (x *CreateReq) ProtoReflect() protoreflect.Message {
mi := &file_demo_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CreateReq.ProtoReflect.Descriptor instead.
func (*CreateReq) Descriptor() ([]byte, []int) {
return file_demo_proto_rawDescGZIP(), []int{4}
}
func (x *CreateReq) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *CreateReq) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
type UpdateReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id" validate:"required"` // @gotags: validate:"required"
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name" validate:"required"` // @gotags: validate:"required"
Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value" validate:"required"` // @gotags: validate:"required"
}
func (x *UpdateReq) Reset() {
*x = UpdateReq{}
if protoimpl.UnsafeEnabled {
mi := &file_demo_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateReq) ProtoMessage() {}
func (x *UpdateReq) ProtoReflect() protoreflect.Message {
mi := &file_demo_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UpdateReq.ProtoReflect.Descriptor instead.
func (*UpdateReq) Descriptor() ([]byte, []int) {
return file_demo_proto_rawDescGZIP(), []int{5}
}
func (x *UpdateReq) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *UpdateReq) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *UpdateReq) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
type OKRep struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *OKRep) Reset() {
*x = OKRep{}
if protoimpl.UnsafeEnabled {
mi := &file_demo_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OKRep) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OKRep) ProtoMessage() {}
func (x *OKRep) ProtoReflect() protoreflect.Message {
mi := &file_demo_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OKRep.ProtoReflect.Descriptor instead.
func (*OKRep) Descriptor() ([]byte, []int) {
return file_demo_proto_rawDescGZIP(), []int{6}
}
type HelloReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"`
}
func (x *HelloReq) Reset() {
*x = HelloReq{}
if protoimpl.UnsafeEnabled {
mi := &file_demo_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HelloReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HelloReq) ProtoMessage() {}
func (x *HelloReq) ProtoReflect() protoreflect.Message {
mi := &file_demo_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HelloReq.ProtoReflect.Descriptor instead.
func (*HelloReq) Descriptor() ([]byte, []int) {
return file_demo_proto_rawDescGZIP(), []int{7}
}
func (x *HelloReq) GetName() string {
if x != nil {
return x.Name
}
return ""
}
type HelloRep struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message"`
}
func (x *HelloRep) Reset() {
*x = HelloRep{}
if protoimpl.UnsafeEnabled {
mi := &file_demo_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HelloRep) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HelloRep) ProtoMessage() {}
func (x *HelloRep) ProtoReflect() protoreflect.Message {
mi := &file_demo_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HelloRep.ProtoReflect.Descriptor instead.
func (*HelloRep) Descriptor() ([]byte, []int) {
return file_demo_proto_rawDescGZIP(), []int{8}
}
func (x *HelloRep) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
var File_demo_proto protoreflect.FileDescriptor
var file_demo_proto_rawDesc = []byte{
0x0a, 0x0a, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x64, 0x65,
0x6d, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61,
0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0x83, 0x01, 0x0a, 0x09, 0x44, 0x65, 0x6d, 0x6f, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61,
0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72,
0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x75, 0x70, 0x64,
0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x17, 0x0a, 0x05, 0x49, 0x64, 0x52, 0x65, 0x71, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x22,
0x31, 0x0a, 0x07, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61,
0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x12,
0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69,
0x7a, 0x65, 0x22, 0x2e, 0x0a, 0x07, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x12, 0x23, 0x0a,
0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x64, 0x65,
0x6d, 0x6f, 0x2e, 0x44, 0x65, 0x6d, 0x6f, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x52, 0x04, 0x6c, 0x69,
0x73, 0x74, 0x22, 0x35, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x45, 0x0a, 0x09, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x22, 0x07, 0x0a, 0x05, 0x4f, 0x4b, 0x52, 0x65, 0x70, 0x22, 0x1e, 0x0a, 0x08, 0x48, 0x65, 0x6c,
0x6c, 0x6f, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x24, 0x0a, 0x08, 0x48, 0x65, 0x6c,
0x6c, 0x6f, 0x52, 0x65, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32,
0xf9, 0x02, 0x0a, 0x04, 0x44, 0x65, 0x6d, 0x6f, 0x12, 0x43, 0x0a, 0x05, 0x48, 0x65, 0x6c, 0x6c,
0x6f, 0x12, 0x0e, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65,
0x71, 0x1a, 0x0e, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65,
0x70, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x12, 0x12, 0x2f, 0x64, 0x65, 0x6d, 0x6f,
0x2f, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x3f, 0x0a,
0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x43,
0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0b, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e,
0x4f, 0x4b, 0x52, 0x65, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x22, 0x0c, 0x2f,
0x64, 0x65, 0x6d, 0x6f, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x3f,
0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x0f, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0b, 0x2e, 0x64, 0x65, 0x6d, 0x6f,
0x2e, 0x4f, 0x4b, 0x52, 0x65, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x22, 0x0c,
0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x12,
0x36, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x0b, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x49, 0x64,
0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x44, 0x65, 0x6d, 0x6f, 0x4d,
0x6f, 0x64, 0x65, 0x6c, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x64,
0x65, 0x6d, 0x6f, 0x2f, 0x67, 0x65, 0x74, 0x12, 0x38, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12,
0x0d, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0d,
0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x70, 0x22, 0x12, 0x82,
0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12, 0x0a, 0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x2f, 0x6c, 0x69, 0x73,
0x74, 0x12, 0x38, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x0b, 0x2e, 0x64, 0x65,
0x6d, 0x6f, 0x2e, 0x49, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x0b, 0x2e, 0x64, 0x65, 0x6d, 0x6f, 0x2e,
0x4f, 0x4b, 0x52, 0x65, 0x70, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f,
0x64, 0x65, 0x6d, 0x6f, 0x2f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x14, 0x5a, 0x12, 0x68,
0x69, 0x6c, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x3b, 0x64, 0x65, 0x6d,
0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_demo_proto_rawDescOnce sync.Once
file_demo_proto_rawDescData = file_demo_proto_rawDesc
)
func file_demo_proto_rawDescGZIP() []byte {
file_demo_proto_rawDescOnce.Do(func() {
file_demo_proto_rawDescData = protoimpl.X.CompressGZIP(file_demo_proto_rawDescData)
})
return file_demo_proto_rawDescData
}
var file_demo_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_demo_proto_goTypes = []interface{}{
(*DemoModel)(nil), // 0: demo.DemoModel
(*IdReq)(nil), // 1: demo.IdReq
(*ListReq)(nil), // 2: demo.ListReq
(*ListRep)(nil), // 3: demo.ListRep
(*CreateReq)(nil), // 4: demo.CreateReq
(*UpdateReq)(nil), // 5: demo.UpdateReq
(*OKRep)(nil), // 6: demo.OKRep
(*HelloReq)(nil), // 7: demo.HelloReq
(*HelloRep)(nil), // 8: demo.HelloRep
}
var file_demo_proto_depIdxs = []int32{
0, // 0: demo.ListRep.list:type_name -> demo.DemoModel
7, // 1: demo.Demo.Hello:input_type -> demo.HelloReq
4, // 2: demo.Demo.Create:input_type -> demo.CreateReq
5, // 3: demo.Demo.Update:input_type -> demo.UpdateReq
1, // 4: demo.Demo.Get:input_type -> demo.IdReq
2, // 5: demo.Demo.List:input_type -> demo.ListReq
1, // 6: demo.Demo.Delete:input_type -> demo.IdReq
8, // 7: demo.Demo.Hello:output_type -> demo.HelloRep
6, // 8: demo.Demo.Create:output_type -> demo.OKRep
6, // 9: demo.Demo.Update:output_type -> demo.OKRep
0, // 10: demo.Demo.Get:output_type -> demo.DemoModel
3, // 11: demo.Demo.List:output_type -> demo.ListRep
6, // 12: demo.Demo.Delete:output_type -> demo.OKRep
7, // [7:13] is the sub-list for method output_type
1, // [1:7] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_demo_proto_init() }
func file_demo_proto_init() {
if File_demo_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_demo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DemoModel); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_demo_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IdReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_demo_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_demo_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListRep); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_demo_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CreateReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_demo_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_demo_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OKRep); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_demo_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HelloReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_demo_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HelloRep); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_demo_proto_rawDesc,
NumEnums: 0,
NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_demo_proto_goTypes,
DependencyIndexes: file_demo_proto_depIdxs,
MessageInfos: file_demo_proto_msgTypes,
}.Build()
File_demo_proto = out.File
file_demo_proto_rawDesc = nil
file_demo_proto_goTypes = nil
file_demo_proto_depIdxs = nil
}
syntax = "proto3";
package demo;
import "google/api/annotations.proto";
option go_package = "hilo/api/demo;demo";
// 定义服务
service Demo {
rpc Hello (HelloReq) returns (HelloRep) {
option (google.api.http) = {
get: "/demo/hello/{name}"
};
}
rpc Create (CreateReq) returns (OKRep) {
option (google.api.http) = {
post: "/demo/create",
body: "*"
};
}
rpc Update (UpdateReq) returns (OKRep) {
option (google.api.http) = {
post: "/demo/update",
body: "*"
};
}
rpc Get (IdReq) returns (DemoModel) {
option (google.api.http) = {
get: "/demo/get",
};
}
rpc List (ListReq) returns (ListRep) {
option (google.api.http) = {
get: "/demo/list",
};
}
rpc Delete (IdReq) returns (OKRep) {
option (google.api.http) = {
get: "/demo/delete",
};
}
}
message DemoModel {
int64 id = 1;
string name = 2;
string value = 3;
int64 created_at = 4;
int64 updated_at = 5;
}
message IdReq {
int64 id = 1; // @gotags: validate:"required,min=1"
}
message ListReq {
int64 page = 1; // @gotags: validate:"min=0"
int64 size = 2; // @gotags: validate:"min=0"
}
message ListRep {
repeated DemoModel list = 1;
}
message CreateReq {
string name = 1; // @gotags: validate:"required"
string value = 2; // @gotags: validate:"required"
}
message UpdateReq {
int64 id = 1; // @gotags: validate:"required"
string name = 2; // @gotags: validate:"required"
string value = 3; // @gotags: validate:"required"
}
message OKRep {}
message HelloReq {
string name = 1;
}
message HelloRep {
string message = 1;
}
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.4
// source: demo.proto
package demo
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// DemoClient is the client API for Demo service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type DemoClient interface {
Hello(ctx context.Context, in *HelloReq, opts ...grpc.CallOption) (*HelloRep, error)
Create(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*OKRep, error)
Update(ctx context.Context, in *UpdateReq, opts ...grpc.CallOption) (*OKRep, error)
Get(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*DemoModel, error)
List(ctx context.Context, in *ListReq, opts ...grpc.CallOption) (*ListRep, error)
Delete(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*OKRep, error)
}
type demoClient struct {
cc grpc.ClientConnInterface
}
func NewDemoClient(cc grpc.ClientConnInterface) DemoClient {
return &demoClient{cc}
}
func (c *demoClient) Hello(ctx context.Context, in *HelloReq, opts ...grpc.CallOption) (*HelloRep, error) {
out := new(HelloRep)
err := c.cc.Invoke(ctx, "/demo.Demo/Hello", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *demoClient) Create(ctx context.Context, in *CreateReq, opts ...grpc.CallOption) (*OKRep, error) {
out := new(OKRep)
err := c.cc.Invoke(ctx, "/demo.Demo/Create", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *demoClient) Update(ctx context.Context, in *UpdateReq, opts ...grpc.CallOption) (*OKRep, error) {
out := new(OKRep)
err := c.cc.Invoke(ctx, "/demo.Demo/Update", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *demoClient) Get(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*DemoModel, error) {
out := new(DemoModel)
err := c.cc.Invoke(ctx, "/demo.Demo/Get", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *demoClient) List(ctx context.Context, in *ListReq, opts ...grpc.CallOption) (*ListRep, error) {
out := new(ListRep)
err := c.cc.Invoke(ctx, "/demo.Demo/List", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *demoClient) Delete(ctx context.Context, in *IdReq, opts ...grpc.CallOption) (*OKRep, error) {
out := new(OKRep)
err := c.cc.Invoke(ctx, "/demo.Demo/Delete", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// DemoServer is the server API for Demo service.
// All implementations must embed UnimplementedDemoServer
// for forward compatibility
type DemoServer interface {
Hello(context.Context, *HelloReq) (*HelloRep, error)
Create(context.Context, *CreateReq) (*OKRep, error)
Update(context.Context, *UpdateReq) (*OKRep, error)
Get(context.Context, *IdReq) (*DemoModel, error)
List(context.Context, *ListReq) (*ListRep, error)
Delete(context.Context, *IdReq) (*OKRep, error)
mustEmbedUnimplementedDemoServer()
}
// UnimplementedDemoServer must be embedded to have forward compatible implementations.
type UnimplementedDemoServer struct {
}
func (UnimplementedDemoServer) Hello(context.Context, *HelloReq) (*HelloRep, error) {
return nil, status.Errorf(codes.Unimplemented, "method Hello not implemented")
}
func (UnimplementedDemoServer) Create(context.Context, *CreateReq) (*OKRep, error) {
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
}
func (UnimplementedDemoServer) Update(context.Context, *UpdateReq) (*OKRep, error) {
return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
}
func (UnimplementedDemoServer) Get(context.Context, *IdReq) (*DemoModel, error) {
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedDemoServer) List(context.Context, *ListReq) (*ListRep, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedDemoServer) Delete(context.Context, *IdReq) (*OKRep, error) {
return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedDemoServer) mustEmbedUnimplementedDemoServer() {}
// UnsafeDemoServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DemoServer will
// result in compilation errors.
type UnsafeDemoServer interface {
mustEmbedUnimplementedDemoServer()
}
func RegisterDemoServer(s grpc.ServiceRegistrar, srv DemoServer) {
s.RegisterService(&Demo_ServiceDesc, srv)
}
func _Demo_Hello_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HelloReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DemoServer).Hello(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/demo.Demo/Hello",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DemoServer).Hello(ctx, req.(*HelloReq))
}
return interceptor(ctx, in, info, handler)
}
func _Demo_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DemoServer).Create(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/demo.Demo/Create",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DemoServer).Create(ctx, req.(*CreateReq))
}
return interceptor(ctx, in, info, handler)
}
func _Demo_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DemoServer).Update(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/demo.Demo/Update",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DemoServer).Update(ctx, req.(*UpdateReq))
}
return interceptor(ctx, in, info, handler)
}
func _Demo_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DemoServer).Get(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/demo.Demo/Get",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DemoServer).Get(ctx, req.(*IdReq))
}
return interceptor(ctx, in, info, handler)
}
func _Demo_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DemoServer).List(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/demo.Demo/List",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DemoServer).List(ctx, req.(*ListReq))
}
return interceptor(ctx, in, info, handler)
}
func _Demo_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IdReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DemoServer).Delete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/demo.Demo/Delete",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DemoServer).Delete(ctx, req.(*IdReq))
}
return interceptor(ctx, in, info, handler)
}
// Demo_ServiceDesc is the grpc.ServiceDesc for Demo service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Demo_ServiceDesc = grpc.ServiceDesc{
ServiceName: "demo.Demo",
HandlerType: (*DemoServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Hello",
Handler: _Demo_Hello_Handler,
},
{
MethodName: "Create",
Handler: _Demo_Create_Handler,
},
{
MethodName: "Update",
Handler: _Demo_Update_Handler,
},
{
MethodName: "Get",
Handler: _Demo_Get_Handler,
},
{
MethodName: "List",
Handler: _Demo_List_Handler,
},
{
MethodName: "Delete",
Handler: _Demo_Delete_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "demo.proto",
}
// Code generated by protoc-gen-go-http. DO NOT EDIT.
// versions:
// - protoc-gen-go-http v2.3.1
// - protoc v3.19.4
// source: demo.proto
package demo
import (
context "context"
http "github.com/go-kratos/kratos/v2/transport/http"
binding "github.com/go-kratos/kratos/v2/transport/http/binding"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the kratos package it is being compiled against.
var _ = new(context.Context)
var _ = binding.EncodeURL
const _ = http.SupportPackageIsVersion1
const OperationDemoCreate = "/demo.Demo/Create"
const OperationDemoDelete = "/demo.Demo/Delete"
const OperationDemoGet = "/demo.Demo/Get"
const OperationDemoHello = "/demo.Demo/Hello"
const OperationDemoList = "/demo.Demo/List"
const OperationDemoUpdate = "/demo.Demo/Update"
type DemoHTTPServer interface {
Create(context.Context, *CreateReq) (*OKRep, error)
Delete(context.Context, *IdReq) (*OKRep, error)
Get(context.Context, *IdReq) (*DemoModel, error)
Hello(context.Context, *HelloReq) (*HelloRep, error)
List(context.Context, *ListReq) (*ListRep, error)
Update(context.Context, *UpdateReq) (*OKRep, error)
}
func RegisterDemoHTTPServer(s *http.Server, srv DemoHTTPServer) {
r := s.Route("/")
r.GET("/demo/hello/{name}", _Demo_Hello0_HTTP_Handler(srv))
r.POST("/demo/create", _Demo_Create0_HTTP_Handler(srv))
r.POST("/demo/update", _Demo_Update0_HTTP_Handler(srv))
r.GET("/demo/get", _Demo_Get0_HTTP_Handler(srv))
r.GET("/demo/list", _Demo_List0_HTTP_Handler(srv))
r.GET("/demo/delete", _Demo_Delete0_HTTP_Handler(srv))
}
func _Demo_Hello0_HTTP_Handler(srv DemoHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in HelloReq
if err := ctx.BindQuery(&in); err != nil {
return err
}
if err := ctx.BindVars(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationDemoHello)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.Hello(ctx, req.(*HelloReq))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*HelloRep)
return ctx.Result(200, reply)
}
}
func _Demo_Create0_HTTP_Handler(srv DemoHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in CreateReq
if err := ctx.Bind(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationDemoCreate)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.Create(ctx, req.(*CreateReq))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*OKRep)
return ctx.Result(200, reply)
}
}
func _Demo_Update0_HTTP_Handler(srv DemoHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in UpdateReq
if err := ctx.Bind(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationDemoUpdate)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.Update(ctx, req.(*UpdateReq))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*OKRep)
return ctx.Result(200, reply)
}
}
func _Demo_Get0_HTTP_Handler(srv DemoHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in IdReq
if err := ctx.BindQuery(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationDemoGet)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.Get(ctx, req.(*IdReq))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*DemoModel)
return ctx.Result(200, reply)
}
}
func _Demo_List0_HTTP_Handler(srv DemoHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in ListReq
if err := ctx.BindQuery(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationDemoList)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.List(ctx, req.(*ListReq))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*ListRep)
return ctx.Result(200, reply)
}
}
func _Demo_Delete0_HTTP_Handler(srv DemoHTTPServer) func(ctx http.Context) error {
return func(ctx http.Context) error {
var in IdReq
if err := ctx.BindQuery(&in); err != nil {
return err
}
http.SetOperation(ctx, OperationDemoDelete)
h := ctx.Middleware(func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.Delete(ctx, req.(*IdReq))
})
out, err := h(ctx, &in)
if err != nil {
return err
}
reply := out.(*OKRep)
return ctx.Result(200, reply)
}
}
type DemoHTTPClient interface {
Create(ctx context.Context, req *CreateReq, opts ...http.CallOption) (rsp *OKRep, err error)
Delete(ctx context.Context, req *IdReq, opts ...http.CallOption) (rsp *OKRep, err error)
Get(ctx context.Context, req *IdReq, opts ...http.CallOption) (rsp *DemoModel, err error)
Hello(ctx context.Context, req *HelloReq, opts ...http.CallOption) (rsp *HelloRep, err error)
List(ctx context.Context, req *ListReq, opts ...http.CallOption) (rsp *ListRep, err error)
Update(ctx context.Context, req *UpdateReq, opts ...http.CallOption) (rsp *OKRep, err error)
}
type DemoHTTPClientImpl struct {
cc *http.Client
}
func NewDemoHTTPClient(client *http.Client) DemoHTTPClient {
return &DemoHTTPClientImpl{client}
}
func (c *DemoHTTPClientImpl) Create(ctx context.Context, in *CreateReq, opts ...http.CallOption) (*OKRep, error) {
var out OKRep
pattern := "/demo/create"
path := binding.EncodeURL(pattern, in, false)
opts = append(opts, http.Operation(OperationDemoCreate))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}
func (c *DemoHTTPClientImpl) Delete(ctx context.Context, in *IdReq, opts ...http.CallOption) (*OKRep, error) {
var out OKRep
pattern := "/demo/delete"
path := binding.EncodeURL(pattern, in, true)
opts = append(opts, http.Operation(OperationDemoDelete))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}
func (c *DemoHTTPClientImpl) Get(ctx context.Context, in *IdReq, opts ...http.CallOption) (*DemoModel, error) {
var out DemoModel
pattern := "/demo/get"
path := binding.EncodeURL(pattern, in, true)
opts = append(opts, http.Operation(OperationDemoGet))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}
func (c *DemoHTTPClientImpl) Hello(ctx context.Context, in *HelloReq, opts ...http.CallOption) (*HelloRep, error) {
var out HelloRep
pattern := "/demo/hello/{name}"
path := binding.EncodeURL(pattern, in, true)
opts = append(opts, http.Operation(OperationDemoHello))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}
func (c *DemoHTTPClientImpl) List(ctx context.Context, in *ListReq, opts ...http.CallOption) (*ListRep, error) {
var out ListRep
pattern := "/demo/list"
path := binding.EncodeURL(pattern, in, true)
opts = append(opts, http.Operation(OperationDemoList))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "GET", path, nil, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}
func (c *DemoHTTPClientImpl) Update(ctx context.Context, in *UpdateReq, opts ...http.CallOption) (*OKRep, error) {
var out OKRep
pattern := "/demo/update"
path := binding.EncodeURL(pattern, in, false)
opts = append(opts, http.Operation(OperationDemoUpdate))
opts = append(opts, http.PathTemplate(pattern))
err := c.cc.Invoke(ctx, "POST", path, in, &out, opts...)
if err != nil {
return nil, err
}
return &out, err
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: mgr.proto
package mgr
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type CheckMgrImeiExistReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Imei string `protobuf:"bytes,1,opt,name=imei,proto3" json:"imei"`
}
func (x *CheckMgrImeiExistReq) Reset() {
*x = CheckMgrImeiExistReq{}
if protoimpl.UnsafeEnabled {
mi := &file_mgr_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CheckMgrImeiExistReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckMgrImeiExistReq) ProtoMessage() {}
func (x *CheckMgrImeiExistReq) ProtoReflect() protoreflect.Message {
mi := &file_mgr_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckMgrImeiExistReq.ProtoReflect.Descriptor instead.
func (*CheckMgrImeiExistReq) Descriptor() ([]byte, []int) {
return file_mgr_proto_rawDescGZIP(), []int{0}
}
func (x *CheckMgrImeiExistReq) GetImei() string {
if x != nil {
return x.Imei
}
return ""
}
type CheckMgrIpExistReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Ip string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip"`
}
func (x *CheckMgrIpExistReq) Reset() {
*x = CheckMgrIpExistReq{}
if protoimpl.UnsafeEnabled {
mi := &file_mgr_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CheckMgrIpExistReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckMgrIpExistReq) ProtoMessage() {}
func (x *CheckMgrIpExistReq) ProtoReflect() protoreflect.Message {
mi := &file_mgr_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckMgrIpExistReq.ProtoReflect.Descriptor instead.
func (*CheckMgrIpExistReq) Descriptor() ([]byte, []int) {
return file_mgr_proto_rawDescGZIP(), []int{1}
}
func (x *CheckMgrIpExistReq) GetIp() string {
if x != nil {
return x.Ip
}
return ""
}
type GetMgrUserStatusReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId"`
}
func (x *GetMgrUserStatusReq) Reset() {
*x = GetMgrUserStatusReq{}
if protoimpl.UnsafeEnabled {
mi := &file_mgr_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetMgrUserStatusReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMgrUserStatusReq) ProtoMessage() {}
func (x *GetMgrUserStatusReq) ProtoReflect() protoreflect.Message {
mi := &file_mgr_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMgrUserStatusReq.ProtoReflect.Descriptor instead.
func (*GetMgrUserStatusReq) Descriptor() ([]byte, []int) {
return file_mgr_proto_rawDescGZIP(), []int{2}
}
func (x *GetMgrUserStatusReq) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
type IsAgentReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserId int64 `protobuf:"varint,1,opt,name=userId,proto3" json:"userId"`
}
func (x *IsAgentReq) Reset() {
*x = IsAgentReq{}
if protoimpl.UnsafeEnabled {
mi := &file_mgr_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *IsAgentReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*IsAgentReq) ProtoMessage() {}
func (x *IsAgentReq) ProtoReflect() protoreflect.Message {
mi := &file_mgr_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use IsAgentReq.ProtoReflect.Descriptor instead.
func (*IsAgentReq) Descriptor() ([]byte, []int) {
return file_mgr_proto_rawDescGZIP(), []int{3}
}
func (x *IsAgentReq) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
type OkRep struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok"`
}
func (x *OkRep) Reset() {
*x = OkRep{}
if protoimpl.UnsafeEnabled {
mi := &file_mgr_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OkRep) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OkRep) ProtoMessage() {}
func (x *OkRep) ProtoReflect() protoreflect.Message {
mi := &file_mgr_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use OkRep.ProtoReflect.Descriptor instead.
func (*OkRep) Descriptor() ([]byte, []int) {
return file_mgr_proto_rawDescGZIP(), []int{4}
}
func (x *OkRep) GetOk() bool {
if x != nil {
return x.Ok
}
return false
}
var File_mgr_proto protoreflect.FileDescriptor
var file_mgr_proto_rawDesc = []byte{
0x0a, 0x09, 0x6d, 0x67, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6d, 0x67, 0x72,
0x1a, 0x0e, 0x6d, 0x67, 0x72, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0x2a, 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x4d, 0x67, 0x72, 0x49, 0x6d, 0x65, 0x69,
0x45, 0x78, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x6d, 0x65, 0x69,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x6d, 0x65, 0x69, 0x22, 0x24, 0x0a, 0x12,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x4d, 0x67, 0x72, 0x49, 0x70, 0x45, 0x78, 0x69, 0x73, 0x74, 0x52,
0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
0x69, 0x70, 0x22, 0x2d, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4d, 0x67, 0x72, 0x55, 0x73, 0x65, 0x72,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65,
0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
0x64, 0x22, 0x24, 0x0a, 0x0a, 0x49, 0x73, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12,
0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x17, 0x0a, 0x05, 0x4f, 0x6b, 0x52, 0x65, 0x70,
0x12, 0x0e, 0x0a, 0x02, 0x6f, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x02, 0x6f, 0x6b,
0x32, 0xec, 0x01, 0x0a, 0x03, 0x4d, 0x67, 0x72, 0x12, 0x3c, 0x0a, 0x11, 0x43, 0x68, 0x65, 0x63,
0x6b, 0x4d, 0x67, 0x72, 0x49, 0x6d, 0x65, 0x69, 0x45, 0x78, 0x69, 0x73, 0x74, 0x12, 0x19, 0x2e,
0x6d, 0x67, 0x72, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x4d, 0x67, 0x72, 0x49, 0x6d, 0x65, 0x69,
0x45, 0x78, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x6d, 0x67, 0x72, 0x2e, 0x4f,
0x6b, 0x52, 0x65, 0x70, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x0f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x4d,
0x67, 0x72, 0x49, 0x70, 0x45, 0x78, 0x69, 0x73, 0x74, 0x12, 0x17, 0x2e, 0x6d, 0x67, 0x72, 0x2e,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x4d, 0x67, 0x72, 0x49, 0x70, 0x45, 0x78, 0x69, 0x73, 0x74, 0x52,
0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x6d, 0x67, 0x72, 0x2e, 0x4f, 0x6b, 0x52, 0x65, 0x70, 0x22, 0x00,
0x12, 0x43, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4d, 0x67, 0x72, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x2e, 0x6d, 0x67, 0x72, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x67,
0x72, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x13,
0x2e, 0x6d, 0x67, 0x72, 0x2e, 0x4d, 0x4d, 0x67, 0x72, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x07, 0x49, 0x73, 0x41, 0x67, 0x65, 0x6e, 0x74,
0x12, 0x0f, 0x2e, 0x6d, 0x67, 0x72, 0x2e, 0x49, 0x73, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65,
0x71, 0x1a, 0x0a, 0x2e, 0x6d, 0x67, 0x72, 0x2e, 0x4f, 0x6b, 0x52, 0x65, 0x70, 0x22, 0x00, 0x42,
0x12, 0x5a, 0x10, 0x68, 0x69, 0x6c, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x67, 0x72, 0x3b,
0x6d, 0x67, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_mgr_proto_rawDescOnce sync.Once
file_mgr_proto_rawDescData = file_mgr_proto_rawDesc
)
func file_mgr_proto_rawDescGZIP() []byte {
file_mgr_proto_rawDescOnce.Do(func() {
file_mgr_proto_rawDescData = protoimpl.X.CompressGZIP(file_mgr_proto_rawDescData)
})
return file_mgr_proto_rawDescData
}
var file_mgr_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_mgr_proto_goTypes = []interface{}{
(*CheckMgrImeiExistReq)(nil), // 0: mgr.CheckMgrImeiExistReq
(*CheckMgrIpExistReq)(nil), // 1: mgr.CheckMgrIpExistReq
(*GetMgrUserStatusReq)(nil), // 2: mgr.GetMgrUserStatusReq
(*IsAgentReq)(nil), // 3: mgr.IsAgentReq
(*OkRep)(nil), // 4: mgr.OkRep
(*MMgrUserStatus)(nil), // 5: mgr.MMgrUserStatus
}
var file_mgr_proto_depIdxs = []int32{
0, // 0: mgr.Mgr.CheckMgrImeiExist:input_type -> mgr.CheckMgrImeiExistReq
1, // 1: mgr.Mgr.CheckMgrIpExist:input_type -> mgr.CheckMgrIpExistReq
2, // 2: mgr.Mgr.GetMgrUserStatus:input_type -> mgr.GetMgrUserStatusReq
3, // 3: mgr.Mgr.IsAgent:input_type -> mgr.IsAgentReq
4, // 4: mgr.Mgr.CheckMgrImeiExist:output_type -> mgr.OkRep
4, // 5: mgr.Mgr.CheckMgrIpExist:output_type -> mgr.OkRep
5, // 6: mgr.Mgr.GetMgrUserStatus:output_type -> mgr.MMgrUserStatus
4, // 7: mgr.Mgr.IsAgent:output_type -> mgr.OkRep
4, // [4:8] is the sub-list for method output_type
0, // [0:4] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_mgr_proto_init() }
func file_mgr_proto_init() {
if File_mgr_proto != nil {
return
}
file_mgr_base_proto_init()
if !protoimpl.UnsafeEnabled {
file_mgr_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CheckMgrImeiExistReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mgr_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CheckMgrIpExistReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mgr_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetMgrUserStatusReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mgr_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*IsAgentReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mgr_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OkRep); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_mgr_proto_rawDesc,
NumEnums: 0,
NumMessages: 5,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_mgr_proto_goTypes,
DependencyIndexes: file_mgr_proto_depIdxs,
MessageInfos: file_mgr_proto_msgTypes,
}.Build()
File_mgr_proto = out.File
file_mgr_proto_rawDesc = nil
file_mgr_proto_goTypes = nil
file_mgr_proto_depIdxs = nil
}
syntax = "proto3";
package mgr;
option go_package = "hilo/api/mgr;mgr";
import "mgr_base.proto";
// 定义服务
service Mgr {
rpc CheckMgrImeiExist (CheckMgrImeiExistReq) returns (OkRep) {}
rpc CheckMgrIpExist (CheckMgrIpExistReq) returns (OkRep) {}
rpc GetMgrUserStatus (GetMgrUserStatusReq) returns (MMgrUserStatus) {}
rpc IsAgent(IsAgentReq) returns (OkRep) {}
}
message CheckMgrImeiExistReq {
string imei = 1;
}
message CheckMgrIpExistReq {
string ip = 1;
}
message GetMgrUserStatusReq {
int64 userId = 1;
}
message IsAgentReq {
int64 userId = 1;
}
message OkRep {
bool ok = 1;
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: mgr_base.proto
package mgr
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type UserStatus int32
const (
UserStatus_None UserStatus = 0
//正常
UserStatus_Normal UserStatus = 1
//冻结
UserStatus_Freeze UserStatus = 2
)
// Enum value maps for UserStatus.
var (
UserStatus_name = map[int32]string{
0: "None",
1: "Normal",
2: "Freeze",
}
UserStatus_value = map[string]int32{
"None": 0,
"Normal": 1,
"Freeze": 2,
}
)
func (x UserStatus) Enum() *UserStatus {
p := new(UserStatus)
*p = x
return p
}
func (x UserStatus) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (UserStatus) Descriptor() protoreflect.EnumDescriptor {
return file_mgr_base_proto_enumTypes[0].Descriptor()
}
func (UserStatus) Type() protoreflect.EnumType {
return &file_mgr_base_proto_enumTypes[0]
}
func (x UserStatus) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use UserStatus.Descriptor instead.
func (UserStatus) EnumDescriptor() ([]byte, []int) {
return file_mgr_base_proto_rawDescGZIP(), []int{0}
}
type MMgrUserStatus struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` // id
UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id"` // 用户ID
Status UserStatus `protobuf:"varint,3,opt,name=status,proto3,enum=mgr.UserStatus" json:"status"` // 状态(1:永久冻结,2:封禁)
EndTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=end_time,json=endTime,proto3" json:"end_time"` // 解禁截至时间
CreatedTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_time,json=createdTime,proto3" json:"created_time"`
UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=updated_time,json=updatedTime,proto3" json:"updated_time"`
}
func (x *MMgrUserStatus) Reset() {
*x = MMgrUserStatus{}
if protoimpl.UnsafeEnabled {
mi := &file_mgr_base_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MMgrUserStatus) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MMgrUserStatus) ProtoMessage() {}
func (x *MMgrUserStatus) ProtoReflect() protoreflect.Message {
mi := &file_mgr_base_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MMgrUserStatus.ProtoReflect.Descriptor instead.
func (*MMgrUserStatus) Descriptor() ([]byte, []int) {
return file_mgr_base_proto_rawDescGZIP(), []int{0}
}
func (x *MMgrUserStatus) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *MMgrUserStatus) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *MMgrUserStatus) GetStatus() UserStatus {
if x != nil {
return x.Status
}
return UserStatus_None
}
func (x *MMgrUserStatus) GetEndTime() *timestamppb.Timestamp {
if x != nil {
return x.EndTime
}
return nil
}
func (x *MMgrUserStatus) GetCreatedTime() *timestamppb.Timestamp {
if x != nil {
return x.CreatedTime
}
return nil
}
func (x *MMgrUserStatus) GetUpdatedTime() *timestamppb.Timestamp {
if x != nil {
return x.UpdatedTime
}
return nil
}
var File_mgr_base_proto protoreflect.FileDescriptor
var file_mgr_base_proto_rawDesc = []byte{
0x0a, 0x0e, 0x6d, 0x67, 0x72, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x12, 0x03, 0x6d, 0x67, 0x72, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x97, 0x02, 0x0a, 0x0e, 0x4d, 0x4d, 0x67, 0x72, 0x55,
0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65,
0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72,
0x49, 0x64, 0x12, 0x27, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x6d, 0x67, 0x72, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x35, 0x0a, 0x08, 0x65,
0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69,
0x6d, 0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69,
0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d,
0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d,
0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
0x61, 0x6d, 0x70, 0x52, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65,
0x2a, 0x2e, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x08,
0x0a, 0x04, 0x4e, 0x6f, 0x6e, 0x65, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x6f, 0x72, 0x6d,
0x61, 0x6c, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x72, 0x65, 0x65, 0x7a, 0x65, 0x10, 0x02,
0x42, 0x12, 0x5a, 0x10, 0x68, 0x69, 0x6c, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x67, 0x72,
0x3b, 0x6d, 0x67, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_mgr_base_proto_rawDescOnce sync.Once
file_mgr_base_proto_rawDescData = file_mgr_base_proto_rawDesc
)
func file_mgr_base_proto_rawDescGZIP() []byte {
file_mgr_base_proto_rawDescOnce.Do(func() {
file_mgr_base_proto_rawDescData = protoimpl.X.CompressGZIP(file_mgr_base_proto_rawDescData)
})
return file_mgr_base_proto_rawDescData
}
var file_mgr_base_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_mgr_base_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_mgr_base_proto_goTypes = []interface{}{
(UserStatus)(0), // 0: mgr.UserStatus
(*MMgrUserStatus)(nil), // 1: mgr.MMgrUserStatus
(*timestamppb.Timestamp)(nil), // 2: google.protobuf.Timestamp
}
var file_mgr_base_proto_depIdxs = []int32{
0, // 0: mgr.MMgrUserStatus.status:type_name -> mgr.UserStatus
2, // 1: mgr.MMgrUserStatus.end_time:type_name -> google.protobuf.Timestamp
2, // 2: mgr.MMgrUserStatus.created_time:type_name -> google.protobuf.Timestamp
2, // 3: mgr.MMgrUserStatus.updated_time:type_name -> google.protobuf.Timestamp
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_mgr_base_proto_init() }
func file_mgr_base_proto_init() {
if File_mgr_base_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_mgr_base_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MMgrUserStatus); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_mgr_base_proto_rawDesc,
NumEnums: 1,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_mgr_base_proto_goTypes,
DependencyIndexes: file_mgr_base_proto_depIdxs,
EnumInfos: file_mgr_base_proto_enumTypes,
MessageInfos: file_mgr_base_proto_msgTypes,
}.Build()
File_mgr_base_proto = out.File
file_mgr_base_proto_rawDesc = nil
file_mgr_base_proto_goTypes = nil
file_mgr_base_proto_depIdxs = nil
}
syntax = "proto3";
package mgr;
option go_package = "hilo/api/mgr;mgr";
import "google/protobuf/timestamp.proto";
enum UserStatus {
None = 0;
//正常
Normal = 1;
//冻结
Freeze = 2;
}
message MMgrUserStatus {
int64 id = 1; // id
int64 user_id = 2; // 用户ID
UserStatus status = 3; // 状态(1:永久冻结,2:封禁)
google.protobuf.Timestamp end_time = 4; // 解禁截至时间
google.protobuf.Timestamp created_time = 5;
google.protobuf.Timestamp updated_time = 6;
}
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.4
// source: mgr.proto
package mgr
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// MgrClient is the client API for Mgr service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MgrClient interface {
CheckMgrImeiExist(ctx context.Context, in *CheckMgrImeiExistReq, opts ...grpc.CallOption) (*OkRep, error)
CheckMgrIpExist(ctx context.Context, in *CheckMgrIpExistReq, opts ...grpc.CallOption) (*OkRep, error)
GetMgrUserStatus(ctx context.Context, in *GetMgrUserStatusReq, opts ...grpc.CallOption) (*MMgrUserStatus, error)
IsAgent(ctx context.Context, in *IsAgentReq, opts ...grpc.CallOption) (*OkRep, error)
}
type mgrClient struct {
cc grpc.ClientConnInterface
}
func NewMgrClient(cc grpc.ClientConnInterface) MgrClient {
return &mgrClient{cc}
}
func (c *mgrClient) CheckMgrImeiExist(ctx context.Context, in *CheckMgrImeiExistReq, opts ...grpc.CallOption) (*OkRep, error) {
out := new(OkRep)
err := c.cc.Invoke(ctx, "/mgr.Mgr/CheckMgrImeiExist", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *mgrClient) CheckMgrIpExist(ctx context.Context, in *CheckMgrIpExistReq, opts ...grpc.CallOption) (*OkRep, error) {
out := new(OkRep)
err := c.cc.Invoke(ctx, "/mgr.Mgr/CheckMgrIpExist", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *mgrClient) GetMgrUserStatus(ctx context.Context, in *GetMgrUserStatusReq, opts ...grpc.CallOption) (*MMgrUserStatus, error) {
out := new(MMgrUserStatus)
err := c.cc.Invoke(ctx, "/mgr.Mgr/GetMgrUserStatus", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *mgrClient) IsAgent(ctx context.Context, in *IsAgentReq, opts ...grpc.CallOption) (*OkRep, error) {
out := new(OkRep)
err := c.cc.Invoke(ctx, "/mgr.Mgr/IsAgent", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MgrServer is the server API for Mgr service.
// All implementations must embed UnimplementedMgrServer
// for forward compatibility
type MgrServer interface {
CheckMgrImeiExist(context.Context, *CheckMgrImeiExistReq) (*OkRep, error)
CheckMgrIpExist(context.Context, *CheckMgrIpExistReq) (*OkRep, error)
GetMgrUserStatus(context.Context, *GetMgrUserStatusReq) (*MMgrUserStatus, error)
IsAgent(context.Context, *IsAgentReq) (*OkRep, error)
mustEmbedUnimplementedMgrServer()
}
// UnimplementedMgrServer must be embedded to have forward compatible implementations.
type UnimplementedMgrServer struct {
}
func (UnimplementedMgrServer) CheckMgrImeiExist(context.Context, *CheckMgrImeiExistReq) (*OkRep, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckMgrImeiExist not implemented")
}
func (UnimplementedMgrServer) CheckMgrIpExist(context.Context, *CheckMgrIpExistReq) (*OkRep, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckMgrIpExist not implemented")
}
func (UnimplementedMgrServer) GetMgrUserStatus(context.Context, *GetMgrUserStatusReq) (*MMgrUserStatus, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMgrUserStatus not implemented")
}
func (UnimplementedMgrServer) IsAgent(context.Context, *IsAgentReq) (*OkRep, error) {
return nil, status.Errorf(codes.Unimplemented, "method IsAgent not implemented")
}
func (UnimplementedMgrServer) mustEmbedUnimplementedMgrServer() {}
// UnsafeMgrServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MgrServer will
// result in compilation errors.
type UnsafeMgrServer interface {
mustEmbedUnimplementedMgrServer()
}
func RegisterMgrServer(s grpc.ServiceRegistrar, srv MgrServer) {
s.RegisterService(&Mgr_ServiceDesc, srv)
}
func _Mgr_CheckMgrImeiExist_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckMgrImeiExistReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MgrServer).CheckMgrImeiExist(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/mgr.Mgr/CheckMgrImeiExist",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MgrServer).CheckMgrImeiExist(ctx, req.(*CheckMgrImeiExistReq))
}
return interceptor(ctx, in, info, handler)
}
func _Mgr_CheckMgrIpExist_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckMgrIpExistReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MgrServer).CheckMgrIpExist(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/mgr.Mgr/CheckMgrIpExist",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MgrServer).CheckMgrIpExist(ctx, req.(*CheckMgrIpExistReq))
}
return interceptor(ctx, in, info, handler)
}
func _Mgr_GetMgrUserStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMgrUserStatusReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MgrServer).GetMgrUserStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/mgr.Mgr/GetMgrUserStatus",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MgrServer).GetMgrUserStatus(ctx, req.(*GetMgrUserStatusReq))
}
return interceptor(ctx, in, info, handler)
}
func _Mgr_IsAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IsAgentReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MgrServer).IsAgent(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/mgr.Mgr/IsAgent",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MgrServer).IsAgent(ctx, req.(*IsAgentReq))
}
return interceptor(ctx, in, info, handler)
}
// Mgr_ServiceDesc is the grpc.ServiceDesc for Mgr service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Mgr_ServiceDesc = grpc.ServiceDesc{
ServiceName: "mgr.Mgr",
HandlerType: (*MgrServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CheckMgrImeiExist",
Handler: _Mgr_CheckMgrImeiExist_Handler,
},
{
MethodName: "CheckMgrIpExist",
Handler: _Mgr_CheckMgrIpExist_Handler,
},
{
MethodName: "GetMgrUserStatus",
Handler: _Mgr_GetMgrUserStatus_Handler,
},
{
MethodName: "IsAgent",
Handler: _Mgr_IsAgent_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "mgr.proto",
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: auth.proto
package user
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type LoginReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ThirdPartyId string `protobuf:"bytes,1,opt,name=ThirdPartyId,proto3" json:"ThirdPartyId" validate:"required"` // @gotags: validate:"required"
ThirdPartyType EThirdPartyType `protobuf:"varint,2,opt,name=ThirdPartyType,proto3,enum=user.EThirdPartyType" json:"ThirdPartyType" validate:"required"` // @gotags: validate:"required"
ThirdPartyToken string `protobuf:"bytes,3,opt,name=ThirdPartyToken,proto3" json:"ThirdPartyToken" validate:"required"` // @gotags: validate:"required"
Sex ESex `protobuf:"varint,4,opt,name=Sex,proto3,enum=user.ESex" json:"Sex"`
Avatar string `protobuf:"bytes,5,opt,name=Avatar,proto3" json:"Avatar"`
Nick string `protobuf:"bytes,6,opt,name=Nick,proto3" json:"Nick"`
Country string `protobuf:"bytes,7,opt,name=Country,proto3" json:"Country"`
}
func (x *LoginReq) Reset() {
*x = LoginReq{}
if protoimpl.UnsafeEnabled {
mi := &file_auth_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LoginReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginReq) ProtoMessage() {}
func (x *LoginReq) ProtoReflect() protoreflect.Message {
mi := &file_auth_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginReq.ProtoReflect.Descriptor instead.
func (*LoginReq) Descriptor() ([]byte, []int) {
return file_auth_proto_rawDescGZIP(), []int{0}
}
func (x *LoginReq) GetThirdPartyId() string {
if x != nil {
return x.ThirdPartyId
}
return ""
}
func (x *LoginReq) GetThirdPartyType() EThirdPartyType {
if x != nil {
return x.ThirdPartyType
}
return EThirdPartyType_UnknownThirdPartyType
}
func (x *LoginReq) GetThirdPartyToken() string {
if x != nil {
return x.ThirdPartyToken
}
return ""
}
func (x *LoginReq) GetSex() ESex {
if x != nil {
return x.Sex
}
return ESex_UnknownSex
}
func (x *LoginReq) GetAvatar() string {
if x != nil {
return x.Avatar
}
return ""
}
func (x *LoginReq) GetNick() string {
if x != nil {
return x.Nick
}
return ""
}
func (x *LoginReq) GetCountry() string {
if x != nil {
return x.Country
}
return ""
}
type LoginRep struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Token string `protobuf:"bytes,1,opt,name=Token,proto3" json:"Token"`
RongyunToken string `protobuf:"bytes,2,opt,name=RongyunToken,proto3" json:"RongyunToken"`
TencentyunToken string `protobuf:"bytes,3,opt,name=TencentyunToken,proto3" json:"TencentyunToken"`
ThirdPartyType EThirdPartyType `protobuf:"varint,4,opt,name=ThirdPartyType,proto3,enum=user.EThirdPartyType" json:"ThirdPartyType"`
User *CvUserDetail `protobuf:"bytes,5,opt,name=User,proto3,oneof" json:"User"`
}
func (x *LoginRep) Reset() {
*x = LoginRep{}
if protoimpl.UnsafeEnabled {
mi := &file_auth_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LoginRep) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LoginRep) ProtoMessage() {}
func (x *LoginRep) ProtoReflect() protoreflect.Message {
mi := &file_auth_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use LoginRep.ProtoReflect.Descriptor instead.
func (*LoginRep) Descriptor() ([]byte, []int) {
return file_auth_proto_rawDescGZIP(), []int{1}
}
func (x *LoginRep) GetToken() string {
if x != nil {
return x.Token
}
return ""
}
func (x *LoginRep) GetRongyunToken() string {
if x != nil {
return x.RongyunToken
}
return ""
}
func (x *LoginRep) GetTencentyunToken() string {
if x != nil {
return x.TencentyunToken
}
return ""
}
func (x *LoginRep) GetThirdPartyType() EThirdPartyType {
if x != nil {
return x.ThirdPartyType
}
return EThirdPartyType_UnknownThirdPartyType
}
func (x *LoginRep) GetUser() *CvUserDetail {
if x != nil {
return x.User
}
return nil
}
var File_auth_proto protoreflect.FileDescriptor
var file_auth_proto_rawDesc = []byte{
0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x75, 0x73,
0x65, 0x72, 0x1a, 0x14, 0x63, 0x76, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x74, 0x61,
0x69, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x62,
0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfb, 0x01, 0x0a, 0x08, 0x4c, 0x6f,
0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50,
0x61, 0x72, 0x74, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x54, 0x68,
0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x49, 0x64, 0x12, 0x3d, 0x0a, 0x0e, 0x54, 0x68,
0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x15, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x45, 0x54, 0x68, 0x69, 0x72, 0x64,
0x50, 0x61, 0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0e, 0x54, 0x68, 0x69, 0x72, 0x64,
0x50, 0x61, 0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x54, 0x68, 0x69,
0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0f, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x03, 0x53, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x0a, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x45, 0x53, 0x65, 0x78, 0x52, 0x03, 0x53, 0x65,
0x78, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28,
0x09, 0x52, 0x06, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x69, 0x63,
0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x69, 0x63, 0x6b, 0x12, 0x18, 0x0a,
0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x22, 0xe3, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69,
0x6e, 0x52, 0x65, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x6f,
0x6e, 0x67, 0x79, 0x75, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0c, 0x52, 0x6f, 0x6e, 0x67, 0x79, 0x75, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x28,
0x0a, 0x0f, 0x54, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x79, 0x75, 0x6e, 0x54, 0x6f, 0x6b, 0x65,
0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x54, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74,
0x79, 0x75, 0x6e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x0e, 0x54, 0x68, 0x69, 0x72,
0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x15, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x45, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61,
0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61,
0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x18,
0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x43, 0x76, 0x55,
0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x48, 0x00, 0x52, 0x04, 0x55, 0x73, 0x65,
0x72, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x42, 0x14, 0x5a,
0x12, 0x68, 0x69, 0x6c, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x3b, 0x75,
0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_auth_proto_rawDescOnce sync.Once
file_auth_proto_rawDescData = file_auth_proto_rawDesc
)
func file_auth_proto_rawDescGZIP() []byte {
file_auth_proto_rawDescOnce.Do(func() {
file_auth_proto_rawDescData = protoimpl.X.CompressGZIP(file_auth_proto_rawDescData)
})
return file_auth_proto_rawDescData
}
var file_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_auth_proto_goTypes = []interface{}{
(*LoginReq)(nil), // 0: user.LoginReq
(*LoginRep)(nil), // 1: user.LoginRep
(EThirdPartyType)(0), // 2: user.EThirdPartyType
(ESex)(0), // 3: user.ESex
(*CvUserDetail)(nil), // 4: user.CvUserDetail
}
var file_auth_proto_depIdxs = []int32{
2, // 0: user.LoginReq.ThirdPartyType:type_name -> user.EThirdPartyType
3, // 1: user.LoginReq.Sex:type_name -> user.ESex
2, // 2: user.LoginRep.ThirdPartyType:type_name -> user.EThirdPartyType
4, // 3: user.LoginRep.User:type_name -> user.CvUserDetail
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_auth_proto_init() }
func file_auth_proto_init() {
if File_auth_proto != nil {
return
}
file_cv_user_detail_proto_init()
file_user_base_proto_init()
if !protoimpl.UnsafeEnabled {
file_auth_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoginReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_auth_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoginRep); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_auth_proto_msgTypes[1].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_auth_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_auth_proto_goTypes,
DependencyIndexes: file_auth_proto_depIdxs,
MessageInfos: file_auth_proto_msgTypes,
}.Build()
File_auth_proto = out.File
file_auth_proto_rawDesc = nil
file_auth_proto_goTypes = nil
file_auth_proto_depIdxs = nil
}
syntax = "proto3";
package user;
import "cv_user_detail.proto";
import "user_base.proto";
option go_package = "hilo/api/user;user";
message LoginReq {
string ThirdPartyId = 1; // @gotags: validate:"required"
EThirdPartyType ThirdPartyType = 2; // @gotags: validate:"required"
string ThirdPartyToken = 3; // @gotags: validate:"required"
ESex Sex = 4;
string Avatar = 5;
string Nick = 6;
string Country = 7;
}
message LoginRep {
string Token = 1;
string RongyunToken = 2;
string TencentyunToken = 3;
EThirdPartyType ThirdPartyType = 4;
optional CvUserDetail User = 5;
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: cv_user_detail.proto
package user
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type CvUserDetail struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ILikeCount int32 `protobuf:"varint,1,opt,name=ILikeCount,proto3" json:"ILikeCount"` //统计:我喜欢多少人
LikeCount int32 `protobuf:"varint,2,opt,name=LikeCount,proto3" json:"LikeCount"` //统计:多少人喜欢你, (本才才有数据,不是本人,数据为nil)
VisitCount int32 `protobuf:"varint,3,opt,name=VisitCount,proto3" json:"VisitCount"` //统计:多少人访问你
IsPush int32 `protobuf:"varint,4,opt,name=IsPush,proto3" json:"IsPush"` //消息提醒, 1:开启,2:关闭
DiamondNum int32 `protobuf:"varint,5,opt,name=DiamondNum,proto3" json:"DiamondNum"` //钻石数量(本人才有数据,不是本人,数据为nil)
IsLike bool `protobuf:"varint,6,opt,name=IsLike,proto3" json:"IsLike"` //是否喜欢(本人没有数据,//20210205 已废弃nil,产品说:可以自己喜欢自己)
IsSession bool `protobuf:"varint,7,opt,name=IsSession,proto3" json:"IsSession"` //是否存在会话(本人没有数据)
IsLikeMe bool `protobuf:"varint,8,opt,name=IsLikeMe,proto3" json:"IsLikeMe"`
HeartValue int32 `protobuf:"varint,9,opt,name=HeartValue,proto3" json:"HeartValue"` // 与我之间永恒之心的值
HeartValueMax int32 `protobuf:"varint,10,opt,name=HeartValueMax,proto3" json:"HeartValueMax"` // 与我之间永恒之心的最大值(0代表没有永恒之心,即没有相互关注)
MeetDays int32 `protobuf:"varint,11,opt,name=MeetDays,proto3" json:"MeetDays"` // 成长关系建立的时间(天数)
WealthUserGrade int32 `protobuf:"varint,12,opt,name=WealthUserGrade,proto3" json:"WealthUserGrade"` //财富等级
CharmUserGrade int32 `protobuf:"varint,13,opt,name=CharmUserGrade,proto3" json:"CharmUserGrade"` //魅力等级
ActivityUserGrade int32 `protobuf:"varint,14,opt,name=ActivityUserGrade,proto3" json:"ActivityUserGrade"` //活跃等级
CurrentRoom string `protobuf:"bytes,15,opt,name=CurrentRoom,proto3" json:"CurrentRoom"` // 当前用户所在房间(产品叫“群组”)
MyGroupPower int64 `protobuf:"varint,16,opt,name=MyGroupPower,proto3" json:"MyGroupPower"` // 当前用户所在势力
MyGroupPowerName string `protobuf:"bytes,17,opt,name=MyGroupPowerName,proto3" json:"MyGroupPowerName"` // 当前用户所在势力绑定群组的名称
Info *UserBase `protobuf:"bytes,18,opt,name=Info,proto3" json:"Info"`
}
func (x *CvUserDetail) Reset() {
*x = CvUserDetail{}
if protoimpl.UnsafeEnabled {
mi := &file_cv_user_detail_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CvUserDetail) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CvUserDetail) ProtoMessage() {}
func (x *CvUserDetail) ProtoReflect() protoreflect.Message {
mi := &file_cv_user_detail_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CvUserDetail.ProtoReflect.Descriptor instead.
func (*CvUserDetail) Descriptor() ([]byte, []int) {
return file_cv_user_detail_proto_rawDescGZIP(), []int{0}
}
func (x *CvUserDetail) GetILikeCount() int32 {
if x != nil {
return x.ILikeCount
}
return 0
}
func (x *CvUserDetail) GetLikeCount() int32 {
if x != nil {
return x.LikeCount
}
return 0
}
func (x *CvUserDetail) GetVisitCount() int32 {
if x != nil {
return x.VisitCount
}
return 0
}
func (x *CvUserDetail) GetIsPush() int32 {
if x != nil {
return x.IsPush
}
return 0
}
func (x *CvUserDetail) GetDiamondNum() int32 {
if x != nil {
return x.DiamondNum
}
return 0
}
func (x *CvUserDetail) GetIsLike() bool {
if x != nil {
return x.IsLike
}
return false
}
func (x *CvUserDetail) GetIsSession() bool {
if x != nil {
return x.IsSession
}
return false
}
func (x *CvUserDetail) GetIsLikeMe() bool {
if x != nil {
return x.IsLikeMe
}
return false
}
func (x *CvUserDetail) GetHeartValue() int32 {
if x != nil {
return x.HeartValue
}
return 0
}
func (x *CvUserDetail) GetHeartValueMax() int32 {
if x != nil {
return x.HeartValueMax
}
return 0
}
func (x *CvUserDetail) GetMeetDays() int32 {
if x != nil {
return x.MeetDays
}
return 0
}
func (x *CvUserDetail) GetWealthUserGrade() int32 {
if x != nil {
return x.WealthUserGrade
}
return 0
}
func (x *CvUserDetail) GetCharmUserGrade() int32 {
if x != nil {
return x.CharmUserGrade
}
return 0
}
func (x *CvUserDetail) GetActivityUserGrade() int32 {
if x != nil {
return x.ActivityUserGrade
}
return 0
}
func (x *CvUserDetail) GetCurrentRoom() string {
if x != nil {
return x.CurrentRoom
}
return ""
}
func (x *CvUserDetail) GetMyGroupPower() int64 {
if x != nil {
return x.MyGroupPower
}
return 0
}
func (x *CvUserDetail) GetMyGroupPowerName() string {
if x != nil {
return x.MyGroupPowerName
}
return ""
}
func (x *CvUserDetail) GetInfo() *UserBase {
if x != nil {
return x.Info
}
return nil
}
type UserBase struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id"` //不会有返回值
Avatar string `protobuf:"bytes,2,opt,name=Avatar,proto3" json:"Avatar"` //头像,不存在为nil
DefaultAvatar bool `protobuf:"varint,3,opt,name=DefaultAvatar,proto3" json:"DefaultAvatar"` //是否默认头像 true:是 false:不是
ExternalId string `protobuf:"bytes,4,opt,name=ExternalId,proto3" json:"ExternalId"` //用户对外ID
Nick string `protobuf:"bytes,5,opt,name=Nick,proto3" json:"Nick"` //昵称,不存在为nil
Description string `protobuf:"bytes,6,opt,name=Description,proto3" json:"Description"` //签名,不存在为nil
ESex int32 `protobuf:"varint,7,opt,name=ESex,proto3" json:"ESex"` //性别 1:男 2:女,不存在为nil
Country string `protobuf:"bytes,8,opt,name=Country,proto3" json:"Country"` //国家,不存在为nil
CountryIcon string `protobuf:"bytes,9,opt,name=CountryIcon,proto3" json:"CountryIcon"` //国旗图标,不存在为nil
Code string `protobuf:"bytes,10,opt,name=Code,proto3" json:"Code"` //邀请码
IsPrettyCode bool `protobuf:"varint,11,opt,name=IsPrettyCode,proto3" json:"IsPrettyCode"` // 是否靓号
IsLogout bool `protobuf:"varint,12,opt,name=IsLogout,proto3" json:"IsLogout"` //是否注销
Birthday int64 `protobuf:"varint,13,opt,name=Birthday,proto3" json:"Birthday"` //生日,如果是其它人用户信息,年龄则按照是否展示显示,如果是本人,年龄则按照是否存在展示
IsShowAge bool `protobuf:"varint,14,opt,name=IsShowAge,proto3" json:"IsShowAge"` // 是否展示年龄, 是本人才有数据,看其他用户均为nil
IsTradeUnion bool `protobuf:"varint,15,opt,name=IsTradeUnion,proto3" json:"IsTradeUnion"` // 是否工会成员, 只有是自己查自己,这个才有值,其它全为nil, 20220329 数据开放:原因:产品1对1视频聊天中,公会用户视频需要送礼物。改为: 全部人可以知道是否是公会用户。
IsAgentMgr bool `protobuf:"varint,16,opt,name=IsAgentMgr,proto3" json:"IsAgentMgr"` // 是否代理管理员, 只有自己查自己的时候才有值,其他情况为nil
IsTradeUnionMatchNotification bool `protobuf:"varint,17,opt,name=IsTradeUnionMatchNotification,proto3" json:"IsTradeUnionMatchNotification"` // 工会成员,是否开启了,匹配通知,只有 isTradeUnion值为true,这里才有值,
IsVip bool `protobuf:"varint,18,opt,name=IsVip,proto3" json:"IsVip"` // 是否VIP用户
IsOfficialStaff bool `protobuf:"varint,19,opt,name=IsOfficialStaff,proto3" json:"IsOfficialStaff"` // 是否是官方人员
VipExpireTime int64 `protobuf:"varint,20,opt,name=VipExpireTime,proto3" json:"VipExpireTime"` // VIP用户过期时间(只有自己查询自己,才返回)
Medals []int32 `protobuf:"varint,21,rep,packed,name=Medals,proto3" json:"Medals"` // 勋章列表 TODO: 删除
MedalInfo []*CvMedal `protobuf:"bytes,22,rep,name=MedalInfo,proto3" json:"MedalInfo"` // 勋章列表
Headwear *CvHeadwear `protobuf:"bytes,23,opt,name=Headwear,proto3" json:"Headwear"` // 当前使用的头饰
Ride *CvProperty `protobuf:"bytes,24,opt,name=Ride,proto3" json:"Ride"` // 当前使用的座驾
Noble *CvNoble `protobuf:"bytes,25,opt,name=Noble,proto3" json:"Noble"`
}
func (x *UserBase) Reset() {
*x = UserBase{}
if protoimpl.UnsafeEnabled {
mi := &file_cv_user_detail_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UserBase) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UserBase) ProtoMessage() {}
func (x *UserBase) ProtoReflect() protoreflect.Message {
mi := &file_cv_user_detail_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UserBase.ProtoReflect.Descriptor instead.
func (*UserBase) Descriptor() ([]byte, []int) {
return file_cv_user_detail_proto_rawDescGZIP(), []int{1}
}
func (x *UserBase) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *UserBase) GetAvatar() string {
if x != nil {
return x.Avatar
}
return ""
}
func (x *UserBase) GetDefaultAvatar() bool {
if x != nil {
return x.DefaultAvatar
}
return false
}
func (x *UserBase) GetExternalId() string {
if x != nil {
return x.ExternalId
}
return ""
}
func (x *UserBase) GetNick() string {
if x != nil {
return x.Nick
}
return ""
}
func (x *UserBase) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *UserBase) GetESex() int32 {
if x != nil {
return x.ESex
}
return 0
}
func (x *UserBase) GetCountry() string {
if x != nil {
return x.Country
}
return ""
}
func (x *UserBase) GetCountryIcon() string {
if x != nil {
return x.CountryIcon
}
return ""
}
func (x *UserBase) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *UserBase) GetIsPrettyCode() bool {
if x != nil {
return x.IsPrettyCode
}
return false
}
func (x *UserBase) GetIsLogout() bool {
if x != nil {
return x.IsLogout
}
return false
}
func (x *UserBase) GetBirthday() int64 {
if x != nil {
return x.Birthday
}
return 0
}
func (x *UserBase) GetIsShowAge() bool {
if x != nil {
return x.IsShowAge
}
return false
}
func (x *UserBase) GetIsTradeUnion() bool {
if x != nil {
return x.IsTradeUnion
}
return false
}
func (x *UserBase) GetIsAgentMgr() bool {
if x != nil {
return x.IsAgentMgr
}
return false
}
func (x *UserBase) GetIsTradeUnionMatchNotification() bool {
if x != nil {
return x.IsTradeUnionMatchNotification
}
return false
}
func (x *UserBase) GetIsVip() bool {
if x != nil {
return x.IsVip
}
return false
}
func (x *UserBase) GetIsOfficialStaff() bool {
if x != nil {
return x.IsOfficialStaff
}
return false
}
func (x *UserBase) GetVipExpireTime() int64 {
if x != nil {
return x.VipExpireTime
}
return 0
}
func (x *UserBase) GetMedals() []int32 {
if x != nil {
return x.Medals
}
return nil
}
func (x *UserBase) GetMedalInfo() []*CvMedal {
if x != nil {
return x.MedalInfo
}
return nil
}
func (x *UserBase) GetHeadwear() *CvHeadwear {
if x != nil {
return x.Headwear
}
return nil
}
func (x *UserBase) GetRide() *CvProperty {
if x != nil {
return x.Ride
}
return nil
}
func (x *UserBase) GetNoble() *CvNoble {
if x != nil {
return x.Noble
}
return nil
}
type CvMedal struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id"`
PicUrl string `protobuf:"bytes,2,opt,name=PicUrl,proto3" json:"PicUrl"`
EffectUrl string `protobuf:"bytes,3,opt,name=EffectUrl,proto3" json:"EffectUrl"`
}
func (x *CvMedal) Reset() {
*x = CvMedal{}
if protoimpl.UnsafeEnabled {
mi := &file_cv_user_detail_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CvMedal) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CvMedal) ProtoMessage() {}
func (x *CvMedal) ProtoReflect() protoreflect.Message {
mi := &file_cv_user_detail_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CvMedal.ProtoReflect.Descriptor instead.
func (*CvMedal) Descriptor() ([]byte, []int) {
return file_cv_user_detail_proto_rawDescGZIP(), []int{2}
}
func (x *CvMedal) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *CvMedal) GetPicUrl() string {
if x != nil {
return x.PicUrl
}
return ""
}
func (x *CvMedal) GetEffectUrl() string {
if x != nil {
return x.EffectUrl
}
return ""
}
type CvHeadwear struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id"`
Using bool `protobuf:"varint,2,opt,name=Using,proto3" json:"Using"`
PicUrl string `protobuf:"bytes,3,opt,name=PicUrl,proto3" json:"PicUrl"`
EffectUrl string `protobuf:"bytes,4,opt,name=EffectUrl,proto3" json:"EffectUrl"`
TimeLeft int64 `protobuf:"varint,5,opt,name=TimeLeft,proto3" json:"TimeLeft"`
}
func (x *CvHeadwear) Reset() {
*x = CvHeadwear{}
if protoimpl.UnsafeEnabled {
mi := &file_cv_user_detail_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CvHeadwear) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CvHeadwear) ProtoMessage() {}
func (x *CvHeadwear) ProtoReflect() protoreflect.Message {
mi := &file_cv_user_detail_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CvHeadwear.ProtoReflect.Descriptor instead.
func (*CvHeadwear) Descriptor() ([]byte, []int) {
return file_cv_user_detail_proto_rawDescGZIP(), []int{3}
}
func (x *CvHeadwear) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *CvHeadwear) GetUsing() bool {
if x != nil {
return x.Using
}
return false
}
func (x *CvHeadwear) GetPicUrl() string {
if x != nil {
return x.PicUrl
}
return ""
}
func (x *CvHeadwear) GetEffectUrl() string {
if x != nil {
return x.EffectUrl
}
return ""
}
func (x *CvHeadwear) GetTimeLeft() int64 {
if x != nil {
return x.TimeLeft
}
return 0
}
type CvProperty struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id"`
PicUrl string `protobuf:"bytes,2,opt,name=PicUrl,proto3" json:"PicUrl"`
EffectUrl string `protobuf:"bytes,3,opt,name=EffectUrl,proto3" json:"EffectUrl"`
Using bool `protobuf:"varint,4,opt,name=Using,proto3" json:"Using"`
TimeLeft string `protobuf:"bytes,5,opt,name=TimeLeft,proto3" json:"TimeLeft"`
SenderAvatar string `protobuf:"bytes,6,opt,name=SenderAvatar,proto3" json:"SenderAvatar"`
ReceiverAvatar string `protobuf:"bytes,7,opt,name=ReceiverAvatar,proto3" json:"ReceiverAvatar"`
}
func (x *CvProperty) Reset() {
*x = CvProperty{}
if protoimpl.UnsafeEnabled {
mi := &file_cv_user_detail_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CvProperty) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CvProperty) ProtoMessage() {}
func (x *CvProperty) ProtoReflect() protoreflect.Message {
mi := &file_cv_user_detail_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CvProperty.ProtoReflect.Descriptor instead.
func (*CvProperty) Descriptor() ([]byte, []int) {
return file_cv_user_detail_proto_rawDescGZIP(), []int{4}
}
func (x *CvProperty) GetId() int32 {
if x != nil {
return x.Id
}
return 0
}
func (x *CvProperty) GetPicUrl() string {
if x != nil {
return x.PicUrl
}
return ""
}
func (x *CvProperty) GetEffectUrl() string {
if x != nil {
return x.EffectUrl
}
return ""
}
func (x *CvProperty) GetUsing() bool {
if x != nil {
return x.Using
}
return false
}
func (x *CvProperty) GetTimeLeft() string {
if x != nil {
return x.TimeLeft
}
return ""
}
func (x *CvProperty) GetSenderAvatar() string {
if x != nil {
return x.SenderAvatar
}
return ""
}
func (x *CvProperty) GetReceiverAvatar() string {
if x != nil {
return x.ReceiverAvatar
}
return ""
}
type CvNoble struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Level int32 `protobuf:"varint,1,opt,name=Level,proto3" json:"Level"`
EndTime int64 `protobuf:"varint,2,opt,name=EndTime,proto3" json:"EndTime"`
}
func (x *CvNoble) Reset() {
*x = CvNoble{}
if protoimpl.UnsafeEnabled {
mi := &file_cv_user_detail_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CvNoble) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CvNoble) ProtoMessage() {}
func (x *CvNoble) ProtoReflect() protoreflect.Message {
mi := &file_cv_user_detail_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CvNoble.ProtoReflect.Descriptor instead.
func (*CvNoble) Descriptor() ([]byte, []int) {
return file_cv_user_detail_proto_rawDescGZIP(), []int{5}
}
func (x *CvNoble) GetLevel() int32 {
if x != nil {
return x.Level
}
return 0
}
func (x *CvNoble) GetEndTime() int64 {
if x != nil {
return x.EndTime
}
return 0
}
var File_cv_user_detail_proto protoreflect.FileDescriptor
var file_cv_user_detail_proto_rawDesc = []byte{
0x0a, 0x14, 0x63, 0x76, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0xee, 0x04, 0x0a,
0x0c, 0x43, 0x76, 0x55, 0x73, 0x65, 0x72, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x1e, 0x0a,
0x0a, 0x49, 0x4c, 0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x0a, 0x49, 0x4c, 0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a,
0x09, 0x4c, 0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
0x52, 0x09, 0x4c, 0x69, 0x6b, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x56,
0x69, 0x73, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x0a, 0x56, 0x69, 0x73, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x49,
0x73, 0x50, 0x75, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x73, 0x50,
0x75, 0x73, 0x68, 0x12, 0x1e, 0x0a, 0x0a, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4e, 0x75,
0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64,
0x4e, 0x75, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x73, 0x4c, 0x69, 0x6b, 0x65, 0x18, 0x06, 0x20,
0x01, 0x28, 0x08, 0x52, 0x06, 0x49, 0x73, 0x4c, 0x69, 0x6b, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x49,
0x73, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
0x49, 0x73, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x49, 0x73, 0x4c,
0x69, 0x6b, 0x65, 0x4d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x49, 0x73, 0x4c,
0x69, 0x6b, 0x65, 0x4d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x48, 0x65, 0x61, 0x72, 0x74, 0x56, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x48, 0x65, 0x61, 0x72, 0x74,
0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x48, 0x65, 0x61, 0x72, 0x74, 0x56, 0x61,
0x6c, 0x75, 0x65, 0x4d, 0x61, 0x78, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x48, 0x65,
0x61, 0x72, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x4d, 0x61, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x4d,
0x65, 0x65, 0x74, 0x44, 0x61, 0x79, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x4d,
0x65, 0x65, 0x74, 0x44, 0x61, 0x79, 0x73, 0x12, 0x28, 0x0a, 0x0f, 0x57, 0x65, 0x61, 0x6c, 0x74,
0x68, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x61, 0x64, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05,
0x52, 0x0f, 0x57, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x61, 0x64,
0x65, 0x12, 0x26, 0x0a, 0x0e, 0x43, 0x68, 0x61, 0x72, 0x6d, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72,
0x61, 0x64, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x43, 0x68, 0x61, 0x72, 0x6d,
0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x61, 0x64, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x41, 0x63, 0x74,
0x69, 0x76, 0x69, 0x74, 0x79, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x61, 0x64, 0x65, 0x18, 0x0e,
0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x55, 0x73,
0x65, 0x72, 0x47, 0x72, 0x61, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x43, 0x75, 0x72, 0x72, 0x65,
0x6e, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x43, 0x75,
0x72, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x22, 0x0a, 0x0c, 0x4d, 0x79, 0x47,
0x72, 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0c, 0x4d, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x12, 0x2a, 0x0a,
0x10, 0x4d, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x4e, 0x61, 0x6d,
0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x4d, 0x79, 0x47, 0x72, 0x6f, 0x75, 0x70,
0x50, 0x6f, 0x77, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x04, 0x49, 0x6e, 0x66,
0x6f, 0x18, 0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x55,
0x73, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xba, 0x06,
0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x76,
0x61, 0x74, 0x61, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x76, 0x61, 0x74,
0x61, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x76, 0x61,
0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x44, 0x65, 0x66, 0x61, 0x75,
0x6c, 0x74, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x45, 0x78, 0x74, 0x65,
0x72, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x45, 0x78,
0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x69, 0x63, 0x6b,
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x69, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b,
0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0b, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12,
0x0a, 0x04, 0x45, 0x53, 0x65, 0x78, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x45, 0x53,
0x65, 0x78, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20,
0x01, 0x28, 0x09, 0x52, 0x07, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x20, 0x0a, 0x0b,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x63, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x49, 0x63, 0x6f, 0x6e, 0x12, 0x12,
0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x43, 0x6f,
0x64, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x49, 0x73, 0x50, 0x72, 0x65, 0x74, 0x74, 0x79, 0x43, 0x6f,
0x64, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x49, 0x73, 0x50, 0x72, 0x65, 0x74,
0x74, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x49, 0x73, 0x4c, 0x6f, 0x67, 0x6f,
0x75, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x49, 0x73, 0x4c, 0x6f, 0x67, 0x6f,
0x75, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x42, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x18, 0x0d,
0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x42, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x12, 0x1c,
0x0a, 0x09, 0x49, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x41, 0x67, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28,
0x08, 0x52, 0x09, 0x49, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x41, 0x67, 0x65, 0x12, 0x22, 0x0a, 0x0c,
0x49, 0x73, 0x54, 0x72, 0x61, 0x64, 0x65, 0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x18, 0x0f, 0x20, 0x01,
0x28, 0x08, 0x52, 0x0c, 0x49, 0x73, 0x54, 0x72, 0x61, 0x64, 0x65, 0x55, 0x6e, 0x69, 0x6f, 0x6e,
0x12, 0x1e, 0x0a, 0x0a, 0x49, 0x73, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4d, 0x67, 0x72, 0x18, 0x10,
0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x49, 0x73, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x4d, 0x67, 0x72,
0x12, 0x44, 0x0a, 0x1d, 0x49, 0x73, 0x54, 0x72, 0x61, 0x64, 0x65, 0x55, 0x6e, 0x69, 0x6f, 0x6e,
0x4d, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x11, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1d, 0x49, 0x73, 0x54, 0x72, 0x61, 0x64, 0x65,
0x55, 0x6e, 0x69, 0x6f, 0x6e, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69,
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x73, 0x56, 0x69, 0x70, 0x18,
0x12, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x49, 0x73, 0x56, 0x69, 0x70, 0x12, 0x28, 0x0a, 0x0f,
0x49, 0x73, 0x4f, 0x66, 0x66, 0x69, 0x63, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x66, 0x66, 0x18,
0x13, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x49, 0x73, 0x4f, 0x66, 0x66, 0x69, 0x63, 0x69, 0x61,
0x6c, 0x53, 0x74, 0x61, 0x66, 0x66, 0x12, 0x24, 0x0a, 0x0d, 0x56, 0x69, 0x70, 0x45, 0x78, 0x70,
0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x56,
0x69, 0x70, 0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06,
0x4d, 0x65, 0x64, 0x61, 0x6c, 0x73, 0x18, 0x15, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x4d, 0x65,
0x64, 0x61, 0x6c, 0x73, 0x12, 0x2b, 0x0a, 0x09, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x49, 0x6e, 0x66,
0x6f, 0x18, 0x16, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x43,
0x76, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x52, 0x09, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x49, 0x6e, 0x66,
0x6f, 0x12, 0x2c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x64, 0x77, 0x65, 0x61, 0x72, 0x18, 0x17, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x43, 0x76, 0x48, 0x65, 0x61,
0x64, 0x77, 0x65, 0x61, 0x72, 0x52, 0x08, 0x48, 0x65, 0x61, 0x64, 0x77, 0x65, 0x61, 0x72, 0x12,
0x24, 0x0a, 0x04, 0x52, 0x69, 0x64, 0x65, 0x18, 0x18, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e,
0x75, 0x73, 0x65, 0x72, 0x2e, 0x43, 0x76, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x52,
0x04, 0x52, 0x69, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x18, 0x19,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x43, 0x76, 0x4e, 0x6f,
0x62, 0x6c, 0x65, 0x52, 0x05, 0x4e, 0x6f, 0x62, 0x6c, 0x65, 0x22, 0x4f, 0x0a, 0x07, 0x43, 0x76,
0x4d, 0x65, 0x64, 0x61, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72, 0x6c, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72, 0x6c, 0x12, 0x1c, 0x0a,
0x09, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x45, 0x66, 0x66, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x22, 0x84, 0x01, 0x0a, 0x0a,
0x43, 0x76, 0x48, 0x65, 0x61, 0x64, 0x77, 0x65, 0x61, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x55, 0x73,
0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x55, 0x73, 0x69, 0x6e, 0x67,
0x12, 0x16, 0x0a, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x45, 0x66, 0x66, 0x65,
0x63, 0x74, 0x55, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x45, 0x66, 0x66,
0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x4c, 0x65,
0x66, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x54, 0x69, 0x6d, 0x65, 0x4c, 0x65,
0x66, 0x74, 0x22, 0xd0, 0x01, 0x0a, 0x0a, 0x43, 0x76, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74,
0x79, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49,
0x64, 0x12, 0x16, 0x0a, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x06, 0x50, 0x69, 0x63, 0x55, 0x72, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x45, 0x66, 0x66,
0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x45, 0x66,
0x66, 0x65, 0x63, 0x74, 0x55, 0x72, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x55, 0x73, 0x69, 0x6e, 0x67,
0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x55, 0x73, 0x69, 0x6e, 0x67, 0x12, 0x1a, 0x0a,
0x08, 0x54, 0x69, 0x6d, 0x65, 0x4c, 0x65, 0x66, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x54, 0x69, 0x6d, 0x65, 0x4c, 0x65, 0x66, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x65, 0x6e,
0x64, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x26, 0x0a,
0x0e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18,
0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x41,
0x76, 0x61, 0x74, 0x61, 0x72, 0x22, 0x39, 0x0a, 0x07, 0x43, 0x76, 0x4e, 0x6f, 0x62, 0x6c, 0x65,
0x12, 0x14, 0x0a, 0x05, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x05, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x18, 0x0a, 0x07, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65,
0x42, 0x14, 0x5a, 0x12, 0x68, 0x69, 0x6c, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73, 0x65,
0x72, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_cv_user_detail_proto_rawDescOnce sync.Once
file_cv_user_detail_proto_rawDescData = file_cv_user_detail_proto_rawDesc
)
func file_cv_user_detail_proto_rawDescGZIP() []byte {
file_cv_user_detail_proto_rawDescOnce.Do(func() {
file_cv_user_detail_proto_rawDescData = protoimpl.X.CompressGZIP(file_cv_user_detail_proto_rawDescData)
})
return file_cv_user_detail_proto_rawDescData
}
var file_cv_user_detail_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_cv_user_detail_proto_goTypes = []interface{}{
(*CvUserDetail)(nil), // 0: user.CvUserDetail
(*UserBase)(nil), // 1: user.UserBase
(*CvMedal)(nil), // 2: user.CvMedal
(*CvHeadwear)(nil), // 3: user.CvHeadwear
(*CvProperty)(nil), // 4: user.CvProperty
(*CvNoble)(nil), // 5: user.CvNoble
}
var file_cv_user_detail_proto_depIdxs = []int32{
1, // 0: user.CvUserDetail.Info:type_name -> user.UserBase
2, // 1: user.UserBase.MedalInfo:type_name -> user.CvMedal
3, // 2: user.UserBase.Headwear:type_name -> user.CvHeadwear
4, // 3: user.UserBase.Ride:type_name -> user.CvProperty
5, // 4: user.UserBase.Noble:type_name -> user.CvNoble
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_cv_user_detail_proto_init() }
func file_cv_user_detail_proto_init() {
if File_cv_user_detail_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cv_user_detail_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CvUserDetail); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cv_user_detail_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UserBase); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cv_user_detail_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CvMedal); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cv_user_detail_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CvHeadwear); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cv_user_detail_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CvProperty); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_cv_user_detail_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CvNoble); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_cv_user_detail_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cv_user_detail_proto_goTypes,
DependencyIndexes: file_cv_user_detail_proto_depIdxs,
MessageInfos: file_cv_user_detail_proto_msgTypes,
}.Build()
File_cv_user_detail_proto = out.File
file_cv_user_detail_proto_rawDesc = nil
file_cv_user_detail_proto_goTypes = nil
file_cv_user_detail_proto_depIdxs = nil
}
syntax = "proto3";
package user;
option go_package = "hilo/api/user;user";
message CvUserDetail {
int32 ILikeCount = 1; //统计:我喜欢多少人
int32 LikeCount = 2; //统计:多少人喜欢你, (本才才有数据,不是本人,数据为nil)
int32 VisitCount = 3; //统计:多少人访问你
int32 IsPush = 4; //消息提醒, 1:开启,2:关闭
int32 DiamondNum = 5; //钻石数量(本人才有数据,不是本人,数据为nil)
bool IsLike = 6; //是否喜欢(本人没有数据,//20210205 已废弃nil,产品说:可以自己喜欢自己)
bool IsSession = 7; //是否存在会话(本人没有数据)
bool IsLikeMe = 8;
int32 HeartValue = 9; // 与我之间永恒之心的值
int32 HeartValueMax = 10; // 与我之间永恒之心的最大值(0代表没有永恒之心,即没有相互关注)
int32 MeetDays = 11; // 成长关系建立的时间(天数)
int32 WealthUserGrade = 12; //财富等级
int32 CharmUserGrade = 13; //魅力等级
int32 ActivityUserGrade = 14; //活跃等级
string CurrentRoom = 15; // 当前用户所在房间(产品叫“群组”)
int64 MyGroupPower = 16; // 当前用户所在势力
string MyGroupPowerName = 17; // 当前用户所在势力绑定群组的名称
UserBase Info = 18;
}
message UserBase {
int32 Id = 1; //不会有返回值
string Avatar = 2; //头像,不存在为nil
bool DefaultAvatar = 3; //是否默认头像 true:是 false:不是
string ExternalId = 4; //用户对外ID
string Nick = 5; //昵称,不存在为nil
string Description = 6; //签名,不存在为nil
int32 ESex = 7; //性别 1:男 2:女,不存在为nil
string Country = 8; //国家,不存在为nil
string CountryIcon = 9; //国旗图标,不存在为nil
string Code = 10; //邀请码
bool IsPrettyCode = 11; // 是否靓号
bool IsLogout = 12; //是否注销
int64 Birthday = 13; //生日,如果是其它人用户信息,年龄则按照是否展示显示,如果是本人,年龄则按照是否存在展示
bool IsShowAge = 14; // 是否展示年龄, 是本人才有数据,看其他用户均为nil
bool IsTradeUnion = 15; // 是否工会成员, 只有是自己查自己,这个才有值,其它全为nil, 20220329 数据开放:原因:产品1对1视频聊天中,公会用户视频需要送礼物。改为: 全部人可以知道是否是公会用户。
bool IsAgentMgr = 16; // 是否代理管理员, 只有自己查自己的时候才有值,其他情况为nil
bool IsTradeUnionMatchNotification = 17; // 工会成员,是否开启了,匹配通知,只有 isTradeUnion值为true,这里才有值,
bool IsVip = 18; // 是否VIP用户
bool IsOfficialStaff = 19; // 是否是官方人员
int64 VipExpireTime = 20; // VIP用户过期时间(只有自己查询自己,才返回)
repeated int32 Medals = 21; // 勋章列表 TODO: 删除
repeated CvMedal MedalInfo = 22; // 勋章列表
CvHeadwear Headwear = 23; // 当前使用的头饰
CvProperty Ride = 24; // 当前使用的座驾
CvNoble Noble = 25;
}
message CvMedal {
int32 Id = 1;
string PicUrl = 2;
string EffectUrl = 3;
}
message CvHeadwear {
int32 Id = 1;
bool Using = 2;
string PicUrl = 3;
string EffectUrl = 4;
int64 TimeLeft = 5;
}
message CvProperty {
int32 Id = 1;
string PicUrl = 2;
string EffectUrl = 3;
bool Using = 4;
string TimeLeft = 5;
string SenderAvatar = 6;
string ReceiverAvatar = 7;
}
message CvNoble {
int32 Level = 1;
int64 EndTime = 2;
}
\ No newline at end of file
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: user.proto
package user
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var File_user_proto protoreflect.FileDescriptor
var file_user_proto_rawDesc = []byte{
0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x75, 0x73,
0x65, 0x72, 0x1a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x31,
0x0a, 0x04, 0x55, 0x73, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12,
0x0e, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a,
0x0e, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x70, 0x22,
0x00, 0x42, 0x14, 0x5a, 0x12, 0x68, 0x69, 0x6c, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75, 0x73,
0x65, 0x72, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_user_proto_goTypes = []interface{}{
(*LoginReq)(nil), // 0: user.LoginReq
(*LoginRep)(nil), // 1: user.LoginRep
}
var file_user_proto_depIdxs = []int32{
0, // 0: user.User.Login:input_type -> user.LoginReq
1, // 1: user.User.Login:output_type -> user.LoginRep
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_user_proto_init() }
func file_user_proto_init() {
if File_user_proto != nil {
return
}
file_auth_proto_init()
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_user_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_user_proto_goTypes,
DependencyIndexes: file_user_proto_depIdxs,
}.Build()
File_user_proto = out.File
file_user_proto_rawDesc = nil
file_user_proto_goTypes = nil
file_user_proto_depIdxs = nil
}
syntax = "proto3";
package user;
import "auth.proto";
option go_package = "hilo/api/user;user";
// 定义服务
service User {
rpc Login (LoginReq) returns (LoginRep) {}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.19.4
// source: user_base.proto
package user
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type EThirdPartyType int32
const (
EThirdPartyType_UnknownThirdPartyType EThirdPartyType = 0
EThirdPartyType_Phone EThirdPartyType = 1
EThirdPartyType_Google EThirdPartyType = 2
EThirdPartyType_Facebook EThirdPartyType = 3
EThirdPartyType_Apple EThirdPartyType = 4
EThirdPartyType_WeChat EThirdPartyType = 5
)
// Enum value maps for EThirdPartyType.
var (
EThirdPartyType_name = map[int32]string{
0: "UnknownThirdPartyType",
1: "Phone",
2: "Google",
3: "Facebook",
4: "Apple",
5: "WeChat",
}
EThirdPartyType_value = map[string]int32{
"UnknownThirdPartyType": 0,
"Phone": 1,
"Google": 2,
"Facebook": 3,
"Apple": 4,
"WeChat": 5,
}
)
func (x EThirdPartyType) Enum() *EThirdPartyType {
p := new(EThirdPartyType)
*p = x
return p
}
func (x EThirdPartyType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (EThirdPartyType) Descriptor() protoreflect.EnumDescriptor {
return file_user_base_proto_enumTypes[0].Descriptor()
}
func (EThirdPartyType) Type() protoreflect.EnumType {
return &file_user_base_proto_enumTypes[0]
}
func (x EThirdPartyType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use EThirdPartyType.Descriptor instead.
func (EThirdPartyType) EnumDescriptor() ([]byte, []int) {
return file_user_base_proto_rawDescGZIP(), []int{0}
}
type ESex int32
const (
ESex_UnknownSex ESex = 0
ESex_Male ESex = 1
ESex_Female ESex = 2
)
// Enum value maps for ESex.
var (
ESex_name = map[int32]string{
0: "UnknownSex",
1: "Male",
2: "Female",
}
ESex_value = map[string]int32{
"UnknownSex": 0,
"Male": 1,
"Female": 2,
}
)
func (x ESex) Enum() *ESex {
p := new(ESex)
*p = x
return p
}
func (x ESex) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ESex) Descriptor() protoreflect.EnumDescriptor {
return file_user_base_proto_enumTypes[1].Descriptor()
}
func (ESex) Type() protoreflect.EnumType {
return &file_user_base_proto_enumTypes[1]
}
func (x ESex) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ESex.Descriptor instead.
func (ESex) EnumDescriptor() ([]byte, []int) {
return file_user_base_proto_rawDescGZIP(), []int{1}
}
type MUserOauth struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` // id
UserId int64 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id"` // 用户ID
ThirdPartyId string `protobuf:"bytes,3,opt,name=third_party_id,json=thirdPartyId,proto3" json:"third_party_id"` // 第三方ID
ThirdPartyType EThirdPartyType `protobuf:"varint,4,opt,name=third_party_type,json=thirdPartyType,proto3,enum=user.EThirdPartyType" json:"third_party_type"` // 第三方类型
ThirdPartyToken string `protobuf:"bytes,5,opt,name=third_party_token,json=thirdPartyToken,proto3" json:"third_party_token"` // 第三方token
CreatedTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_time,json=createdTime,proto3" json:"created_time"`
UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=updated_time,json=updatedTime,proto3" json:"updated_time"`
}
func (x *MUserOauth) Reset() {
*x = MUserOauth{}
if protoimpl.UnsafeEnabled {
mi := &file_user_base_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MUserOauth) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MUserOauth) ProtoMessage() {}
func (x *MUserOauth) ProtoReflect() protoreflect.Message {
mi := &file_user_base_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MUserOauth.ProtoReflect.Descriptor instead.
func (*MUserOauth) Descriptor() ([]byte, []int) {
return file_user_base_proto_rawDescGZIP(), []int{0}
}
func (x *MUserOauth) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *MUserOauth) GetUserId() int64 {
if x != nil {
return x.UserId
}
return 0
}
func (x *MUserOauth) GetThirdPartyId() string {
if x != nil {
return x.ThirdPartyId
}
return ""
}
func (x *MUserOauth) GetThirdPartyType() EThirdPartyType {
if x != nil {
return x.ThirdPartyType
}
return EThirdPartyType_UnknownThirdPartyType
}
func (x *MUserOauth) GetThirdPartyToken() string {
if x != nil {
return x.ThirdPartyToken
}
return ""
}
func (x *MUserOauth) GetCreatedTime() *timestamppb.Timestamp {
if x != nil {
return x.CreatedTime
}
return nil
}
func (x *MUserOauth) GetUpdatedTime() *timestamppb.Timestamp {
if x != nil {
return x.UpdatedTime
}
return nil
}
type MUser struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` // id
ExternalId string `protobuf:"bytes,2,opt,name=external_id,json=externalId,proto3" json:"external_id" validate:"required"` // @gotags: validate:"required" // 别名
Avatar string `protobuf:"bytes,3,opt,name=avatar,proto3" json:"avatar"` // 头像
DefaultAvatar int32 `protobuf:"varint,4,opt,name=default_avatar,json=defaultAvatar,proto3" json:"default_avatar"`
Nick string `protobuf:"bytes,5,opt,name=nick,proto3" json:"nick"` // 昵称
Sex ESex `protobuf:"varint,6,opt,name=sex,proto3,enum=user.ESex" json:"sex"` // 性别
Birthday int64 `protobuf:"varint,7,opt,name=birthday,proto3" json:"birthday"` // 出生日期
Country string `protobuf:"bytes,8,opt,name=country,proto3" json:"country"` // 国家
CountryIcon string `protobuf:"bytes,9,opt,name=country_icon,json=countryIcon,proto3" json:"country_icon"` // 国旗图标地址
Language string `protobuf:"bytes,10,opt,name=language,proto3" json:"language"`
Description string `protobuf:"bytes,11,opt,name=description,proto3" json:"description"` // 个性签名
IsPush int32 `protobuf:"varint,12,opt,name=is_push,json=isPush,proto3" json:"is_push"`
IsShowAge int32 `protobuf:"varint,13,opt,name=is_show_age,json=isShowAge,proto3" json:"is_show_age"`
Code string `protobuf:"bytes,14,opt,name=code,proto3" json:"code"` // 邀请码
OriginCode string `protobuf:"bytes,15,opt,name=origin_code,json=originCode,proto3" json:"origin_code"` // 原始邀请码
Status int32 `protobuf:"varint,16,opt,name=status,proto3" json:"status"` // 状态
DeviceType string `protobuf:"bytes,17,opt,name=device_type,json=deviceType,proto3" json:"device_type" validate:"required"` // @gotags: validate:"required" // ios,Android
LogoutTime int64 `protobuf:"varint,18,opt,name=logout_time,json=logoutTime,proto3" json:"logout_time"`
CreatedTime *timestamppb.Timestamp `protobuf:"bytes,19,opt,name=created_time,json=createdTime,proto3" json:"created_time"`
UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,20,opt,name=updated_time,json=updatedTime,proto3" json:"updated_time"`
}
func (x *MUser) Reset() {
*x = MUser{}
if protoimpl.UnsafeEnabled {
mi := &file_user_base_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MUser) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MUser) ProtoMessage() {}
func (x *MUser) ProtoReflect() protoreflect.Message {
mi := &file_user_base_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use MUser.ProtoReflect.Descriptor instead.
func (*MUser) Descriptor() ([]byte, []int) {
return file_user_base_proto_rawDescGZIP(), []int{1}
}
func (x *MUser) GetId() int64 {
if x != nil {
return x.Id
}
return 0
}
func (x *MUser) GetExternalId() string {
if x != nil {
return x.ExternalId
}
return ""
}
func (x *MUser) GetAvatar() string {
if x != nil {
return x.Avatar
}
return ""
}
func (x *MUser) GetDefaultAvatar() int32 {
if x != nil {
return x.DefaultAvatar
}
return 0
}
func (x *MUser) GetNick() string {
if x != nil {
return x.Nick
}
return ""
}
func (x *MUser) GetSex() ESex {
if x != nil {
return x.Sex
}
return ESex_UnknownSex
}
func (x *MUser) GetBirthday() int64 {
if x != nil {
return x.Birthday
}
return 0
}
func (x *MUser) GetCountry() string {
if x != nil {
return x.Country
}
return ""
}
func (x *MUser) GetCountryIcon() string {
if x != nil {
return x.CountryIcon
}
return ""
}
func (x *MUser) GetLanguage() string {
if x != nil {
return x.Language
}
return ""
}
func (x *MUser) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *MUser) GetIsPush() int32 {
if x != nil {
return x.IsPush
}
return 0
}
func (x *MUser) GetIsShowAge() int32 {
if x != nil {
return x.IsShowAge
}
return 0
}
func (x *MUser) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *MUser) GetOriginCode() string {
if x != nil {
return x.OriginCode
}
return ""
}
func (x *MUser) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
func (x *MUser) GetDeviceType() string {
if x != nil {
return x.DeviceType
}
return ""
}
func (x *MUser) GetLogoutTime() int64 {
if x != nil {
return x.LogoutTime
}
return 0
}
func (x *MUser) GetCreatedTime() *timestamppb.Timestamp {
if x != nil {
return x.CreatedTime
}
return nil
}
func (x *MUser) GetUpdatedTime() *timestamppb.Timestamp {
if x != nil {
return x.UpdatedTime
}
return nil
}
var File_user_base_proto protoreflect.FileDescriptor
var file_user_base_proto_rawDesc = []byte{
0x0a, 0x0f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x04, 0x75, 0x73, 0x65, 0x72, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc6, 0x02, 0x0a, 0x0a, 0x4d, 0x55, 0x73,
0x65, 0x72, 0x4f, 0x61, 0x75, 0x74, 0x68, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f,
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64,
0x12, 0x24, 0x0a, 0x0e, 0x74, 0x68, 0x69, 0x72, 0x64, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x79, 0x5f,
0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x68, 0x69, 0x72, 0x64, 0x50,
0x61, 0x72, 0x74, 0x79, 0x49, 0x64, 0x12, 0x3f, 0x0a, 0x10, 0x74, 0x68, 0x69, 0x72, 0x64, 0x5f,
0x70, 0x61, 0x72, 0x74, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e,
0x32, 0x15, 0x2e, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x45, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61,
0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0e, 0x74, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61,
0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x68, 0x69, 0x72, 0x64,
0x5f, 0x70, 0x61, 0x72, 0x74, 0x79, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0f, 0x74, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x12, 0x3d, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65,
0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69,
0x6d, 0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69,
0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73,
0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d,
0x65, 0x22, 0x86, 0x05, 0x0a, 0x05, 0x4d, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x65,
0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06,
0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76,
0x61, 0x74, 0x61, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f,
0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x64, 0x65,
0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x69, 0x63, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x69, 0x63, 0x6b, 0x12,
0x1c, 0x0a, 0x03, 0x73, 0x65, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x75,
0x73, 0x65, 0x72, 0x2e, 0x45, 0x53, 0x65, 0x78, 0x52, 0x03, 0x73, 0x65, 0x78, 0x12, 0x1a, 0x0a,
0x08, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52,
0x08, 0x62, 0x69, 0x72, 0x74, 0x68, 0x64, 0x61, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x75,
0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x72, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x69,
0x63, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x72, 0x79, 0x49, 0x63, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61,
0x67, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61,
0x67, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x70, 0x75, 0x73, 0x68, 0x18,
0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x69, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1e, 0x0a,
0x0b, 0x69, 0x73, 0x5f, 0x73, 0x68, 0x6f, 0x77, 0x5f, 0x61, 0x67, 0x65, 0x18, 0x0d, 0x20, 0x01,
0x28, 0x05, 0x52, 0x09, 0x69, 0x73, 0x53, 0x68, 0x6f, 0x77, 0x41, 0x67, 0x65, 0x12, 0x12, 0x0a,
0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64,
0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x64, 0x65,
0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x43, 0x6f,
0x64, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x10, 0x20, 0x01,
0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x65,
0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6c,
0x6f, 0x67, 0x6f, 0x75, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03,
0x52, 0x0a, 0x6c, 0x6f, 0x67, 0x6f, 0x75, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3d, 0x0a, 0x0c,
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x13, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b,
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3d, 0x0a, 0x0c, 0x75,
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0b, 0x75,
0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x2a, 0x68, 0x0a, 0x0f, 0x45, 0x54,
0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72, 0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a,
0x15, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72,
0x74, 0x79, 0x54, 0x79, 0x70, 0x65, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e,
0x65, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x10, 0x02, 0x12,
0x0c, 0x0a, 0x08, 0x46, 0x61, 0x63, 0x65, 0x62, 0x6f, 0x6f, 0x6b, 0x10, 0x03, 0x12, 0x09, 0x0a,
0x05, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x10, 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x57, 0x65, 0x43, 0x68,
0x61, 0x74, 0x10, 0x05, 0x2a, 0x2c, 0x0a, 0x04, 0x45, 0x53, 0x65, 0x78, 0x12, 0x0e, 0x0a, 0x0a,
0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x65, 0x78, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04,
0x4d, 0x61, 0x6c, 0x65, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x65, 0x6d, 0x61, 0x6c, 0x65,
0x10, 0x02, 0x42, 0x14, 0x5a, 0x12, 0x68, 0x69, 0x6c, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x75,
0x73, 0x65, 0x72, 0x3b, 0x75, 0x73, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_user_base_proto_rawDescOnce sync.Once
file_user_base_proto_rawDescData = file_user_base_proto_rawDesc
)
func file_user_base_proto_rawDescGZIP() []byte {
file_user_base_proto_rawDescOnce.Do(func() {
file_user_base_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_base_proto_rawDescData)
})
return file_user_base_proto_rawDescData
}
var file_user_base_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_user_base_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_user_base_proto_goTypes = []interface{}{
(EThirdPartyType)(0), // 0: user.EThirdPartyType
(ESex)(0), // 1: user.ESex
(*MUserOauth)(nil), // 2: user.MUserOauth
(*MUser)(nil), // 3: user.MUser
(*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp
}
var file_user_base_proto_depIdxs = []int32{
0, // 0: user.MUserOauth.third_party_type:type_name -> user.EThirdPartyType
4, // 1: user.MUserOauth.created_time:type_name -> google.protobuf.Timestamp
4, // 2: user.MUserOauth.updated_time:type_name -> google.protobuf.Timestamp
1, // 3: user.MUser.sex:type_name -> user.ESex
4, // 4: user.MUser.created_time:type_name -> google.protobuf.Timestamp
4, // 5: user.MUser.updated_time:type_name -> google.protobuf.Timestamp
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_user_base_proto_init() }
func file_user_base_proto_init() {
if File_user_base_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_user_base_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MUserOauth); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_user_base_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MUser); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_user_base_proto_rawDesc,
NumEnums: 2,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_user_base_proto_goTypes,
DependencyIndexes: file_user_base_proto_depIdxs,
EnumInfos: file_user_base_proto_enumTypes,
MessageInfos: file_user_base_proto_msgTypes,
}.Build()
File_user_base_proto = out.File
file_user_base_proto_rawDesc = nil
file_user_base_proto_goTypes = nil
file_user_base_proto_depIdxs = nil
}
syntax = "proto3";
package user;
import "google/protobuf/timestamp.proto";
option go_package = "hilo/api/user;user";
enum EThirdPartyType {
UnknownThirdPartyType = 0;
Phone = 1;
Google = 2;
Facebook = 3;
Apple = 4;
WeChat = 5;
}
enum ESex {
UnknownSex = 0;
Male = 1;
Female = 2;
}
message MUserOauth {
int64 id = 1; // id
int64 user_id = 2; // 用户ID
string third_party_id = 3; // 第三方ID
EThirdPartyType third_party_type = 4; // 第三方类型
string third_party_token = 5; // 第三方token
google.protobuf.Timestamp created_time = 6;
google.protobuf.Timestamp updated_time = 7;
}
message MUser {
int64 id = 1; // id
string external_id = 2; // @gotags: validate:"required" // 别名
string avatar = 3; // 头像
int32 default_avatar = 4;
string nick = 5; // 昵称
ESex sex = 6; // 性别
int64 birthday = 7; // 出生日期
string country = 8; // 国家
string country_icon = 9; // 国旗图标地址
string language = 10;
string description = 11; // 个性签名
int32 is_push = 12;
int32 is_show_age = 13;
string code = 14; // 邀请码
string origin_code = 15; // 原始邀请码
int32 status = 16; // 状态
string device_type = 17; // @gotags: validate:"required" // ios,Android
int64 logout_time = 18;
google.protobuf.Timestamp created_time = 19;
google.protobuf.Timestamp updated_time = 20;
}
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.4
// source: user.proto
package user
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// UserClient is the client API for User service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type UserClient interface {
Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginRep, error)
}
type userClient struct {
cc grpc.ClientConnInterface
}
func NewUserClient(cc grpc.ClientConnInterface) UserClient {
return &userClient{cc}
}
func (c *userClient) Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginRep, error) {
out := new(LoginRep)
err := c.cc.Invoke(ctx, "/user.User/Login", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// UserServer is the server API for User service.
// All implementations must embed UnimplementedUserServer
// for forward compatibility
type UserServer interface {
Login(context.Context, *LoginReq) (*LoginRep, error)
mustEmbedUnimplementedUserServer()
}
// UnimplementedUserServer must be embedded to have forward compatible implementations.
type UnimplementedUserServer struct {
}
func (UnimplementedUserServer) Login(context.Context, *LoginReq) (*LoginRep, error) {
return nil, status.Errorf(codes.Unimplemented, "method Login not implemented")
}
func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {}
// UnsafeUserServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to UserServer will
// result in compilation errors.
type UnsafeUserServer interface {
mustEmbedUnimplementedUserServer()
}
func RegisterUserServer(s grpc.ServiceRegistrar, srv UserServer) {
s.RegisterService(&User_ServiceDesc, srv)
}
func _User_Login_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LoginReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(UserServer).Login(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/user.User/Login",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(UserServer).Login(ctx, req.(*LoginReq))
}
return interceptor(ctx, in, info, handler)
}
// User_ServiceDesc is the grpc.ServiceDesc for User service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var User_ServiceDesc = grpc.ServiceDesc{
ServiceName: "user.User",
HandlerType: (*UserServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Login",
Handler: _User_Login_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "user.proto",
}
bin
tmp
\ No newline at end of file
FROM golang:1.16 AS builder
COPY ../../country /src
WORKDIR /src
RUN GOPROXY=https://goproxy.cn make build
FROM debian:stable-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
netbase \
&& rm -rf /var/lib/apt/lists/ \
&& apt-get autoremove -y && apt-get autoclean -y
COPY --from=builder /src/bin /app
WORKDIR /app
EXPOSE 8000
EXPOSE 9000
VOLUME /data/conf
CMD ["./server", "-conf", "/data/conf"]
root = "."
testdata_dir = "bin"
tmp_dir = "bin"
[build]
args_bin = []
bin = "./bin/hilo-service-country"
cmd = "go build -o bin/hilo-service-country ./cmd/country"
full_bin = ""
delay = 1000
exclude_dir = ["bin", "assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
kill_delay = "0.3s"
log = "build-errors.log"
send_interrupt = true
stop_on_error = true
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
time = false
[misc]
clean_on_exit = false
[screen]
clear_on_rebuild = false
package main
import (
"flag"
"github.com/go-kratos/kratos/contrib/registry/consul/v2"
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/go-kratos/kratos/v2/transport/grpc"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/jaeger"
"go.opentelemetry.io/otel/sdk/resource"
tracesdk "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.uber.org/zap"
"hilo/app/service/country/internal/conf"
"hilo/common/logz"
"hilo/common/util"
"math/rand"
"time"
"github.com/go-kratos/kratos/v2/log"
)
var (
id = util.GenServiceId()
)
func main() {
flag.Parse()
conf.LoadConfig()
rand.Seed(time.Now().UnixNano())
err := initTracer(conf.Conf.Jaeger.Url)
if err != nil {
panic(err)
}
l := logz.NewLogger(conf.Conf.Log, zap.AddCaller(), zap.AddCallerSkip(3))
defer l.Flush()
logger := log.With(l,
"service.id", id,
"service.name", conf.Conf.Server.Name,
"service.version", conf.Conf.Server.Version,
"trace.id", tracing.TraceID(),
"span.id", tracing.SpanID(),
)
log.SetLogger(logger)
app, cleanup, err := wireApp(conf.Conf.Server, conf.Conf.Data, conf.Conf.Consul, logger)
if err != nil {
panic(err)
}
defer cleanup()
// start and wait for stop signal
if err := app.Run(); err != nil {
panic(err)
}
}
func newApp(logger log.Logger, gs *grpc.Server, rr *consul.Registry) *kratos.App {
return kratos.New(
kratos.ID(id),
kratos.Name(conf.Conf.Server.Name),
kratos.Version(conf.Conf.Server.Version),
kratos.Metadata(map[string]string{}),
kratos.Logger(logger),
kratos.Server(
gs,
),
kratos.Registrar(rr),
)
}
// 设置全局trace
func initTracer(url string) error {
// 创建 Jaeger exporter
exp, err := jaeger.New(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint(url)))
if err != nil {
return err
}
tp := tracesdk.NewTracerProvider(
// 将基于父span的采样率设置为100%
tracesdk.WithSampler(tracesdk.ParentBased(tracesdk.TraceIDRatioBased(1.0))),
// 始终确保再生成中批量处理
tracesdk.WithBatcher(exp),
// 在资源中记录有关此应用程序的信息
tracesdk.WithResource(resource.NewSchemaless(
semconv.ServiceNameKey.String("kratos-trace"),
attribute.String("exporter", "jaeger"),
attribute.Float64("float", 312.23),
)),
)
otel.SetTracerProvider(tp)
return nil
}
//go:build wireinject
// +build wireinject
// The build tag makes sure the stub is not built in the final build.
package main
import (
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"hilo/app/service/country/internal/conf"
"hilo/app/service/country/internal/dao"
"hilo/app/service/country/internal/handler"
"hilo/app/service/country/internal/server"
"hilo/app/service/country/internal/service"
)
// wireApp init kratos application.
func wireApp(*conf.Server, *conf.Data, *conf.Consul, log.Logger) (*kratos.App, func(), error) {
panic(wire.Build(server.ProviderSet, dao.ProviderSet, service.ProviderSet, handler.ProviderSet, newApp))
}
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package main
import (
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/log"
"hilo/app/service/country/internal/conf"
"hilo/app/service/country/internal/dao"
"hilo/app/service/country/internal/handler"
"hilo/app/service/country/internal/server"
"hilo/app/service/country/internal/service"
)
// Injectors from wire.go:
// wireApp init kratos application.
func wireApp(confServer *conf.Server, data *conf.Data, consul *conf.Consul, logger log.Logger) (*kratos.App, func(), error) {
daoDao, cleanup, err := dao.NewDao(data)
if err != nil {
return nil, nil, err
}
countryService := service.NewCountryService(daoDao)
countryHandler := handler.NewCountryHandler(countryService)
grpcServer := server.NewGRPCServer(confServer, countryHandler)
registry := server.NewConsulRegister(consul)
app := newApp(logger, grpcServer, registry)
return app, func() {
cleanup()
}, nil
}
# 服务配置
Server:
Name: "hilo.service.country"
Version: "1.0.0"
Grpc:
Addr: "" # 为空随机端口, 使用注册中心服务发现
Timeout: 3 # 服务超时时间, 单位秒
# 注册中心
Consul:
Addr: 192.168.233.1:8500
# jaeger链路追踪 https://github.com/jaegertracing/jaeger
Jaeger:
Url: http://192.168.233.1:14268/api/traces
# 数据源
Data:
Mysql:
Dsn: root:yX0jPAhO0I4s2zlA@tcp(47.244.34.27:3306)/hilo?loc=Local&charset=utf8mb4&writeTimeout=3s&readTimeout=3s&timeout=2s&parseTime=true
MaxConn: 16 # 连接池最大连接数
MaxIdleConn: 4 # 连接池最小连接数
MaxLifetime: 1800 # 连接池内连接有效时间,单位秒
Debug: true
Redis:
Addr: 127.0.0.1:6379
Password: ""
DB: 15
# 日志
Log:
Color: true
Level: DEBUG
\ No newline at end of file
package conf
import (
"flag"
"hilo/common/conf"
"hilo/common/logz"
"hilo/common/mysql"
)
var (
confPath string
Conf = &Config{}
)
func init() {
flag.StringVar(&confPath, "conf", "config/config.yaml", "指定配置文件 eg: -conf config.yaml")
}
type Config struct {
Server *Server
Data *Data
Log *logz.Config
Consul *Consul
Jaeger *Jaeger
}
type Consul struct {
Addr string
}
type Jaeger struct {
Url string
}
type Data struct {
Mysql *mysql.Config
}
type Server struct {
Name string
Version string
Grpc struct {
Addr string
Timeout int
}
Http struct {
Addr string
Timeout int
}
}
func LoadConfig() {
conf.LoadFromYaml(confPath, &Conf)
}
package dao
import (
"hilo/app/service/country/internal/model"
)
func (d *Dao) GetCountryByShortName(shortName string) (res *model.ResCountry, err error) {
res = &model.ResCountry{}
err = d.DB.Where(&model.ResCountry{
ShortName: shortName,
}).First(res).Error
return
}
package dao
import (
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"gorm.io/gorm"
"hilo/app/service/country/internal/conf"
"hilo/common/mysql"
)
// ProviderSet is dao providers.
var ProviderSet = wire.NewSet(NewDao)
// Dao .
type Dao struct {
// TODO wrapped database client
DB *gorm.DB
}
// NewDao .
func NewDao(c *conf.Data) (*Dao, func(), error) {
db := mysql.NewDB(c.Mysql)
cleanup := func() {
d, _ := db.DB()
d.Close()
log.Debug("close data resources")
}
return &Dao{
DB: db,
}, cleanup, nil
}
package handler
import (
"google.golang.org/protobuf/types/known/timestamppb"
"hilo/api/service/country"
"hilo/app/service/country/internal/model"
)
func CountryModelToShortNameRep(m *model.ResCountry) *country.GetCountryByShortNameRep {
return &country.GetCountryByShortNameRep{
Data: &country.CountryModel{
Id: m.Id,
Name: m.Name,
ShortName: m.ShortName,
Code: m.Code,
Icon: m.Icon,
Icon2: m.Icon2,
Lang: m.Lang,
IsCommon: int32(m.IsCommon),
IsDefault: int32(m.IsDefault),
Status: int32(m.Status),
CreatedTime: timestamppb.New(m.CreatedTime),
UpdatedTime: timestamppb.New(m.UpdatedTime),
StandardShortName: m.StandardShortName,
},
}
}
package handler
import (
"context"
"hilo/api/service/country"
"hilo/app/service/country/internal/service"
)
// CountryHandler is a country handler.
type CountryHandler struct {
country.UnimplementedCountryServer
svc *service.CountryService
}
func (h *CountryHandler) GetCountryByShortName(ctx context.Context, req *country.GetCountryByShortNameReq) (*country.GetCountryByShortNameRep, error) {
m, err := h.svc.GetCountryByShortName(ctx, req.ShortName)
if err != nil {
return nil, err
}
return CountryModelToShortNameRep(m), nil
}
// NewCountryHandler new a country handler.
func NewCountryHandler(uc *service.CountryService) *CountryHandler {
return &CountryHandler{svc: uc}
}
var _ country.CountryServer = &CountryHandler{}
package handler
import "github.com/google/wire"
// ProviderSet is handler providers.
var ProviderSet = wire.NewSet(NewCountryHandler)
package model
import (
"time"
)
type ResCountry struct {
Code string `json:"code"` // Code
CreatedTime time.Time `json:"created_time"` // CreatedTime
Icon string `json:"icon"` // 图标
Icon2 string `json:"icon2"` // 国旗2
Id int64 `json:"id"` // id
IsCommon int `json:"is_common"` // 是否常见
IsDefault int `json:"is_default"` // IsDefault
Lang string `json:"lang"` // 语言
Name string `json:"name"` // 名字
Remarks string `json:"remarks"` // 备注
ShortName string `json:"short_name"` // 缩写
StandardShortName string `json:"standard_short_name"` // 国际标准缩写
Status int `json:"status"` // Status
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
}
func (r *ResCountry) TableName() string {
return "res_country"
}
package server
import (
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/middleware/recovery"
"github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/go-kratos/kratos/v2/transport/grpc"
"hilo/api/service/country"
"hilo/app/service/country/internal/conf"
"hilo/app/service/country/internal/handler"
"time"
)
// NewGRPCServer new a gRPC server.
func NewGRPCServer(c *conf.Server, svc *handler.CountryHandler) *grpc.Server {
var opts = []grpc.ServerOption{
grpc.Middleware(
recovery.Recovery(),
tracing.Server(),
ValidateParams(),
),
}
if c.Grpc.Addr != "" {
opts = append(opts, grpc.Address(c.Grpc.Addr))
}
if c.Grpc.Timeout != 0 {
opts = append(opts, grpc.Timeout(time.Duration(c.Grpc.Timeout)*time.Second))
}
srv := grpc.NewServer(opts...)
country.RegisterCountryServer(srv, svc)
logHelper = log.NewHelper(log.GetLogger())
return srv
}
package server
import (
"context"
"github.com/go-kratos/kratos/v2/middleware"
"github.com/go-kratos/kratos/v2/transport"
"hilo/common/errm"
"hilo/common/validate"
)
// ValidateParams 验证参数
func ValidateParams() middleware.Middleware {
return func(handler middleware.Handler) middleware.Handler {
return func(ctx context.Context, req interface{}) (interface{}, error) {
if tr, ok := transport.FromServerContext(ctx); ok {
err := validate.Struct(req)
if err != nil {
logHelper.WithContext(ctx).Warnf("[%s]参数验证失败: %s", tr.Operation(), err.Error())
return nil, errm.ParamsError(err.Error())
}
}
return handler(ctx, req)
}
}
}
package server
import (
"github.com/go-kratos/kratos/contrib/registry/consul/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"github.com/hashicorp/consul/api"
"hilo/app/service/country/internal/conf"
)
// ProviderSet is server providers.
var (
ProviderSet = wire.NewSet(NewGRPCServer, NewConsulRegister)
logHelper *log.Helper
)
func NewConsulRegister(conf *conf.Consul) *consul.Registry {
cfg := api.DefaultConfig()
cfg.Address = conf.Addr
consulClient, err := api.NewClient(cfg)
if err != nil {
panic(err)
}
registry := consul.New(consulClient,
consul.WithHealthCheck(true),
)
return registry
}
package service
import (
"context"
"github.com/go-kratos/kratos/v2/log"
"hilo/app/service/country/internal/dao"
"hilo/app/service/country/internal/model"
)
// CountryService is a Country service.
type CountryService struct {
dao *dao.Dao
log *log.Helper
}
func NewCountryService(dao *dao.Dao) *CountryService {
return &CountryService{
dao: dao,
log: log.NewHelper(log.GetLogger()),
}
}
func (s *CountryService) GetCountryByShortName(ctx context.Context, shortName string) (*model.ResCountry, error) {
return s.dao.GetCountryByShortName(shortName)
}
package service
import "github.com/google/wire"
// ProviderSet is service providers.
var ProviderSet = wire.NewSet(NewCountryService)
# Generated with protoc-gen-openapi
# https://github.com/google/gnostic/tree/master/cmd/protoc-gen-openapi
openapi: 3.0.3
info:
title: Greeter API
description: The greeting service definition.
version: 0.0.1
paths:
/helloworld/{name}:
get:
tags:
- Greeter
- subgroup
description: Sends a greeting
operationId: Greeter_SayHello
parameters:
- name: name
in: path
required: true
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/helloworld.v1.HelloReply'
components:
schemas:
helloworld.v1.HelloReply:
type: object
properties:
message:
type: string
description: The response message containing the greetings
tags:
- name: Greeter
......@@ -4,8 +4,8 @@ tmp_dir = "bin"
[build]
args_bin = []
bin = "./bin/demo"
cmd = "go build -o bin/ ./..."
bin = "./bin/hilo-service-demo"
cmd = "go build -o bin/hilo-service-demo ./cmd/demo"
full_bin = ""
delay = 1000
exclude_dir = ["bin", "assets", "tmp", "vendor", "testdata"]
......
......@@ -4,37 +4,31 @@ import (
"flag"
"github.com/go-kratos/kratos/contrib/registry/consul/v2"
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/go-kratos/kratos/v2/transport/grpc"
"github.com/go-kratos/kratos/v2/transport/http"
"github.com/hashicorp/consul/api"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/jaeger"
"go.opentelemetry.io/otel/sdk/resource"
tracesdk "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.uber.org/zap"
"gokratos-base/app/service/demo/internal/conf"
"gokratos-base/common/logz"
"os"
"github.com/go-kratos/kratos/v2/log"
"hilo/app/service/demo/internal/conf"
"hilo/common/logz"
"hilo/common/util"
"math/rand"
"time"
)
// go build -ldflags "-X main.Version=x.y.z"
var (
// Name is the name of the compiled software.
Name string
// Version is the version of the compiled software.
Version string
id, _ = os.Hostname()
id = util.GenServiceId()
)
func main() {
flag.Parse()
conf.LoadConfig()
rand.Seed(time.Now().UnixNano())
err := initTracer(conf.Conf.Jaeger.Url)
if err != nil {
......@@ -53,7 +47,7 @@ func main() {
)
log.SetLogger(logger)
app, cleanup, err := wireApp(conf.Conf.Server, conf.Conf.Data, logger)
app, cleanup, err := wireApp(conf.Conf.Server, conf.Conf.Data, conf.Conf.Consul, logger)
if err != nil {
panic(err)
}
......@@ -65,15 +59,7 @@ func main() {
}
}
func newApp(logger log.Logger, hs *http.Server, gs *grpc.Server) *kratos.App {
cfg := api.DefaultConfig()
cfg.Address = conf.Conf.Consul.Addr
consulClient, err := api.NewClient(cfg)
if err != nil {
panic(err)
}
registry := consul.New(consulClient)
func newApp(logger log.Logger, hs *http.Server, gs *grpc.Server, rr *consul.Registry) *kratos.App {
return kratos.New(
kratos.ID(id),
kratos.Name(conf.Conf.Server.Name),
......@@ -84,7 +70,7 @@ func newApp(logger log.Logger, hs *http.Server, gs *grpc.Server) *kratos.App {
hs,
gs,
),
kratos.Registrar(registry),
kratos.Registrar(rr),
)
}
......@@ -103,8 +89,6 @@ func initTracer(url string) error {
// 在资源中记录有关此应用程序的信息
tracesdk.WithResource(resource.NewSchemaless(
semconv.ServiceNameKey.String("kratos-trace"),
attribute.String("exporter", "jaeger"),
attribute.Float64("float", 312.23),
)),
)
......
......@@ -9,14 +9,14 @@ import (
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"gokratos-base/app/service/demo/internal/biz"
"gokratos-base/app/service/demo/internal/conf"
"gokratos-base/app/service/demo/internal/data"
"gokratos-base/app/service/demo/internal/server"
"gokratos-base/app/service/demo/internal/service"
"hilo/app/service/demo/internal/conf"
"hilo/app/service/demo/internal/dao"
"hilo/app/service/demo/internal/handler"
"hilo/app/service/demo/internal/server"
"hilo/app/service/demo/internal/service"
)
// wireApp init kratos application.
func wireApp(*conf.Server, *conf.Data, log.Logger) (*kratos.App, func(), error) {
panic(wire.Build(server.ProviderSet, data.ProviderSet, biz.ProviderSet, service.ProviderSet, newApp))
func wireApp(*conf.Server, *conf.Data, *conf.Consul, log.Logger) (*kratos.App, func(), error) {
panic(wire.Build(server.ProviderSet, dao.ProviderSet, service.ProviderSet, handler.ProviderSet, newApp))
}
......@@ -9,27 +9,27 @@ package main
import (
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/log"
"gokratos-base/app/service/demo/internal/biz"
"gokratos-base/app/service/demo/internal/conf"
"gokratos-base/app/service/demo/internal/data"
"gokratos-base/app/service/demo/internal/server"
"gokratos-base/app/service/demo/internal/service"
"hilo/app/service/demo/internal/conf"
"hilo/app/service/demo/internal/dao"
"hilo/app/service/demo/internal/handler"
"hilo/app/service/demo/internal/server"
"hilo/app/service/demo/internal/service"
)
// Injectors from wire.go:
// wireApp init kratos application.
func wireApp(confServer *conf.Server, confData *conf.Data, logger log.Logger) (*kratos.App, func(), error) {
dataData, cleanup, err := data.NewData(confData)
func wireApp(confServer *conf.Server, data *conf.Data, consul *conf.Consul, logger log.Logger) (*kratos.App, func(), error) {
daoDao, cleanup, err := dao.NewDao(data)
if err != nil {
return nil, nil, err
}
demoRepo := data.NewDemoRepo(dataData)
demoUseCase := biz.NewDemoUseCase(demoRepo)
demoService := service.NewDemoService(demoUseCase)
httpServer := server.NewHTTPServer(confServer, demoService)
grpcServer := server.NewGRPCServer(confServer, demoService)
app := newApp(logger, httpServer, grpcServer)
demoUseService := service.NewDemoService(daoDao)
demoHandler := handler.NewDemoHandler(demoUseService)
httpServer := server.NewHTTPServer(confServer, demoHandler)
grpcServer := server.NewGRPCServer(confServer, demoHandler)
registry := server.NewConsulRegister(consul)
app := newApp(logger, httpServer, grpcServer, registry)
return app, func() {
cleanup()
}, nil
......
# 服务配置
Server:
Name: "service.demo"
Name: "hilo.service.demo"
Version: "1.0.0"
Mode: local
Grpc:
Addr: "0.0.0.0:8001" # 为空随机端口, 使用注册中心服务发现
Addr: "" # 为空随机端口, 使用注册中心服务发现
Timeout: 3 # 服务超时时间, 单位秒
Http:
Addr: "0.0.0.0:8000" # 为空随机端口, 使用注册中心服务发现
Addr: "" # 为空随机端口, 使用注册中心服务发现
Timeout: 3 # 服务超时时间, 单位秒
# 注册中心
......@@ -20,7 +21,7 @@ Jaeger:
# 数据源
Data:
Mysql:
Dsn: temp:temp666@tcp(127.0.0.1:3306)/site?loc=Local&charset=utf8mb4&writeTimeout=3s&readTimeout=3s&timeout=2s&parseTime=true
Dsn: temp:temp666@tcp(127.0.0.1:3306)/hilo?loc=Local&charset=utf8mb4&writeTimeout=3s&readTimeout=3s&timeout=2s&parseTime=true
MaxConn: 16 # 连接池最大连接数
MaxIdleConn: 4 # 连接池最小连接数
MaxLifetime: 1800 # 连接池内连接有效时间,单位秒
......
package biz
import "github.com/google/wire"
// ProviderSet is biz providers.
var ProviderSet = wire.NewSet(NewDemoUseCase)
package biz
import (
"context"
"github.com/go-kratos/kratos/v2/log"
"gokratos-base/app/service/demo/internal/model"
)
// DemoRepo is a Greater repo.
type DemoRepo interface {
Save(ctx context.Context, m *model.Demo) error
Update(ctx context.Context, m *model.Demo) error
GetByID(ctx context.Context, id int) (res *model.Demo, err error)
List(ctx context.Context, limit, offset int) (res []*model.Demo, err error)
DeleteByID(ctx context.Context, id int) (err error)
}
// DemoUseCase is a Demo useCase.
type DemoUseCase struct {
repo DemoRepo
log *log.Helper
}
type ListReq struct {
Page int
Size int
}
// NewDemoUseCase new a Demo useCase.
func NewDemoUseCase(repo DemoRepo) *DemoUseCase {
return &DemoUseCase{
repo: repo,
log: log.NewHelper(log.GetLogger()),
}
}
// CreateDemo creates a Demo, and returns the new Demo.
func (uc *DemoUseCase) CreateDemo(ctx context.Context, m *model.Demo) error {
return uc.repo.Save(ctx, m)
}
func (uc *DemoUseCase) UpdateDemo(ctx context.Context, m *model.Demo) error {
return uc.repo.Update(ctx, m)
}
func (uc *DemoUseCase) GetDemo(ctx context.Context, id int) (*model.Demo, error) {
uc.log.WithContext(ctx).Info("qqqqqqqqqqqqqqqq")
m, err := uc.repo.GetByID(ctx, id)
if err != nil {
return nil, err
}
return m, nil
}
func (uc *DemoUseCase) ListDemo(ctx context.Context, req *ListReq) ([]*model.Demo, error) {
if req.Page <= 0 {
req.Page = 1
}
if req.Size <= 0 {
req.Size = 20
}
if req.Size >= 100 {
req.Size = 100
}
offset := (req.Page - 1) * req.Size
return uc.repo.List(ctx, req.Size, offset)
}
func (uc *DemoUseCase) DeleteDemo(ctx context.Context, id int) error {
return uc.repo.DeleteByID(ctx, int(id))
}
......@@ -2,10 +2,11 @@ package conf
import (
"flag"
"gokratos-base/common/conf"
"gokratos-base/common/logz"
"gokratos-base/common/mysql"
"gokratos-base/common/redis"
"hilo/common/conf"
"hilo/common/env"
"hilo/common/logz"
"hilo/common/mysql"
"hilo/common/redis"
)
var (
......@@ -40,6 +41,7 @@ type Data struct {
type Server struct {
Name string
Mode string
Version string
Grpc struct {
Addr string
......@@ -54,3 +56,15 @@ type Server struct {
func LoadConfig() {
conf.LoadFromYaml(confPath, &Conf)
}
func GetMode() string {
return Conf.Server.Mode
}
func AppIsRelease() bool {
return GetMode() == env.RELEASE
}
func AppIsLocal() bool {
return GetMode() == env.LOCAL
}
package data
package dao
import (
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"gokratos-base/app/service/demo/internal/conf"
"gokratos-base/common/mysql"
"gokratos-base/common/redis"
"gorm.io/gorm"
"hilo/app/service/demo/internal/conf"
"hilo/common/mysql"
"hilo/common/redis"
)
// ProviderSet is data providers.
var ProviderSet = wire.NewSet(NewData, NewDemoRepo)
// ProviderSet is dao providers.
var ProviderSet = wire.NewSet(NewDao)
// Data .
type Data struct {
// TODO wrapped database client
// Dao .
type Dao struct {
DB *gorm.DB
Redis *redis.WrapClient
}
// NewData .
func NewData(c *conf.Data) (*Data, func(), error) {
// NewDao .
func NewDao(c *conf.Data) (*Dao, func(), error) {
db := mysql.NewDB(c.Mysql)
rs := redis.NewRedis(c.Redis)
cleanup := func() {
......@@ -30,7 +29,7 @@ func NewData(c *conf.Data) (*Data, func(), error) {
log.Debug("close data resources")
}
return &Data{
return &Dao{
DB: db,
Redis: rs,
}, cleanup, nil
......
package dao
import (
"context"
"hilo/app/service/demo/internal/model"
"time"
)
func (d *Dao) Save(ctx context.Context, m *model.Demo) error {
err := d.DB.Model(&model.Demo{}).Create(m).Error
return err
}
func (d *Dao) Update(ctx context.Context, m *model.Demo) error {
err := d.DB.Where("id = ?", m.Id).Updates(&model.Demo{
Name: m.Name,
Value: m.Value,
UpdatedAt: int(time.Now().Unix()),
}).Error
return err
}
func (d *Dao) GetByID(ctx context.Context, id int) (res *model.Demo, err error) {
res = &model.Demo{}
err = d.DB.Model(&model.Demo{}).Where("id = ?", id).Take(res).Error
return
}
func (d *Dao) List(ctx context.Context, limit, offset int) (res []*model.Demo, err error) {
res = make([]*model.Demo, 0)
err = d.DB.Model(&model.Demo{}).Limit(limit).Offset(offset).Order("id desc").Find(&res).Error
return
}
func (d *Dao) DeleteByID(ctx context.Context, id int) (err error) {
err = d.DB.Model(&model.Demo{}).Where("id = ?", id).Delete(&model.Demo{}).Error
return
}
package data
import (
"context"
"gokratos-base/app/service/demo/internal/biz"
"gokratos-base/app/service/demo/internal/model"
"time"
)
type demoRepo struct {
data *Data
}
var _ biz.DemoRepo = &demoRepo{}
// NewDemoRepo .
func NewDemoRepo(data *Data) biz.DemoRepo {
return &demoRepo{
data: data,
}
}
func (r *demoRepo) Save(ctx context.Context, m *model.Demo) error {
err := r.data.DB.Model(&model.Demo{}).Create(m).Error
return err
}
func (r *demoRepo) Update(ctx context.Context, m *model.Demo) error {
err := r.data.DB.Where("id = ?", m.Id).Updates(&model.Demo{
Name: m.Name,
Value: m.Value,
UpdatedAt: int(time.Now().Unix()),
}).Error
return err
}
func (r *demoRepo) GetByID(ctx context.Context, id int) (res *model.Demo, err error) {
res = &model.Demo{}
err = r.data.DB.Model(&model.Demo{}).Where("id = ?", id).Take(res).Error
return
}
func (r *demoRepo) List(ctx context.Context, limit, offset int) (res []*model.Demo, err error) {
res = make([]*model.Demo, 0)
err = r.data.DB.Model(&model.Demo{}).Limit(limit).Offset(offset).Order("id desc").Find(&res).Error
return
}
func (r *demoRepo) DeleteByID(ctx context.Context, id int) (err error) {
err = r.data.DB.Model(&model.Demo{}).Where("id = ?", id).Delete(&model.Demo{}).Error
return
}
package service
package handler
import (
"gokratos-base/api/service/demo"
"gokratos-base/app/service/demo/internal/model"
"hilo/api/service/demo"
"hilo/app/service/demo/internal/model"
)
func DemoModelToRep(m *model.Demo) *demo.DemoModel {
......
package handler
import (
"context"
"hilo/api/service/demo"
"hilo/app/service/demo/internal/model"
"hilo/app/service/demo/internal/service"
)
// DemoHandler is a demo handler.
type DemoHandler struct {
demo.UnimplementedDemoServer
uc *service.DemoUseService
}
// Hello implements DemoServer.
func (h *DemoHandler) Hello(ctx context.Context, req *demo.HelloReq) (*demo.HelloRep, error) {
return &demo.HelloRep{Message: "Hello " + req.Name}, nil
}
func (h *DemoHandler) Create(ctx context.Context, req *demo.CreateReq) (*demo.OKRep, error) {
err := h.uc.CreateDemo(ctx, &model.Demo{Name: req.Name, Value: req.Value})
if err != nil {
return nil, err
}
return nil, nil
}
func (h *DemoHandler) Update(ctx context.Context, req *demo.UpdateReq) (*demo.OKRep, error) {
err := h.uc.UpdateDemo(ctx, &model.Demo{Id: int(req.Id), Name: req.Name, Value: req.Value})
if err != nil {
return nil, err
}
return &demo.OKRep{}, nil
}
func (h *DemoHandler) Get(ctx context.Context, req *demo.IdReq) (*demo.DemoModel, error) {
res, err := h.uc.GetDemo(ctx, int(req.Id))
if err != nil {
return nil, err
}
return DemoModelToRep(res), nil
}
func (h *DemoHandler) List(ctx context.Context, req *demo.ListReq) (*demo.ListRep, error) {
list, err := h.uc.ListDemo(ctx, &service.ListReq{
Page: int(req.Page),
Size: int(req.Size),
})
if err != nil {
return nil, err
}
rep := &demo.ListRep{}
rep.List = make([]*demo.DemoModel, 0, len(list))
for _, v := range list {
rep.List = append(rep.List, DemoModelToRep(v))
}
return rep, nil
}
func (h *DemoHandler) Delete(ctx context.Context, req *demo.IdReq) (*demo.OKRep, error) {
err := h.uc.DeleteDemo(ctx, int(req.Id))
if err != nil {
return nil, err
}
return &demo.OKRep{}, nil
}
var _ demo.DemoServer = &DemoHandler{}
// NewDemoHandler new a demo handler.
func NewDemoHandler(uc *service.DemoUseService) *DemoHandler {
return &DemoHandler{uc: uc}
}
package handler
import "github.com/google/wire"
// ProviderSet is handler providers.
var ProviderSet = wire.NewSet(NewDemoHandler)
......@@ -5,14 +5,14 @@ import (
"github.com/go-kratos/kratos/v2/middleware/recovery"
"github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/go-kratos/kratos/v2/transport/grpc"
"gokratos-base/api/service/demo"
"gokratos-base/app/service/demo/internal/conf"
"gokratos-base/app/service/demo/internal/service"
"hilo/api/service/demo"
"hilo/app/service/demo/internal/conf"
"hilo/app/service/demo/internal/handler"
"time"
)
// NewGRPCServer new a gRPC server.
func NewGRPCServer(c *conf.Server, svc *service.DemoService) *grpc.Server {
func NewGRPCServer(c *conf.Server, svc *handler.DemoHandler) *grpc.Server {
var opts = []grpc.ServerOption{
grpc.Middleware(
recovery.Recovery(),
......
package server
import (
"github.com/go-kratos/kratos/v2/middleware/auth/jwt"
"github.com/go-kratos/kratos/v2/middleware/recovery"
"github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/go-kratos/kratos/v2/transport/http"
jwtv4 "github.com/golang-jwt/jwt/v4"
"gokratos-base/api/service/demo"
"gokratos-base/app/service/demo/internal/conf"
"gokratos-base/app/service/demo/internal/service"
"gokratos-base/common/httpext"
"hilo/api/service/demo"
"hilo/app/service/demo/internal/conf"
"hilo/app/service/demo/internal/handler"
"hilo/common/httpext"
"time"
)
// NewHTTPServer new a http server.
func NewHTTPServer(c *conf.Server, svc *service.DemoService) *http.Server {
func NewHTTPServer(c *conf.Server, svc *handler.DemoHandler) *http.Server {
var opts = []http.ServerOption{
http.Middleware(
recovery.Recovery(),
tracing.Server(),
jwt.Server(func(token *jwtv4.Token) (interface{}, error) {
return []byte("testkey"), nil
}),
ValidateParams(),
),
http.ResponseEncoder(httpext.Encoder),
......
......@@ -4,8 +4,8 @@ import (
"context"
"github.com/go-kratos/kratos/v2/middleware"
"github.com/go-kratos/kratos/v2/transport"
"gokratos-base/common/errm"
"gokratos-base/common/validate"
"hilo/common/errm"
"hilo/common/validate"
)
// ValidateParams 验证参数
......
package server
import (
"github.com/go-kratos/kratos/contrib/registry/consul/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"github.com/hashicorp/consul/api"
"hilo/app/service/demo/internal/conf"
)
// ProviderSet is server providers.
var (
ProviderSet = wire.NewSet(NewHTTPServer, NewGRPCServer)
ProviderSet = wire.NewSet(NewHTTPServer, NewGRPCServer, NewConsulRegister)
logHelper *log.Helper
)
func NewConsulRegister(conf *conf.Consul) *consul.Registry {
cfg := api.DefaultConfig()
cfg.Address = conf.Addr
consulClient, err := api.NewClient(cfg)
if err != nil {
panic(err)
}
registry := consul.New(consulClient,
consul.WithHealthCheck(true),
)
return registry
}
......@@ -2,76 +2,68 @@ package service
import (
"context"
"gokratos-base/api/service/demo"
"gokratos-base/app/service/demo/internal/biz"
"gokratos-base/app/service/demo/internal/model"
"github.com/go-kratos/kratos/v2/log"
"hilo/app/service/demo/internal/dao"
"hilo/app/service/demo/internal/model"
)
// DemoService is a demo service.
type DemoService struct {
demo.UnimplementedDemoServer
uc *biz.DemoUseCase
// DemoUseService is a Demo service.
type DemoUseService struct {
dao *dao.Dao
log *log.Helper
}
var _ demo.DemoServer = &DemoService{}
type ListReq struct {
Page int
Size int
}
// NewDemoService new a demo service.
func NewDemoService(uc *biz.DemoUseCase) *DemoService {
return &DemoService{uc: uc}
// NewDemoService new a Demo service.
func NewDemoService(dao *dao.Dao) *DemoUseService {
return &DemoUseService{
dao: dao,
log: log.NewHelper(log.GetLogger()),
}
}
// Hello implements DemoServer.
func (s *DemoService) Hello(ctx context.Context, req *demo.HelloReq) (*demo.HelloRep, error) {
return &demo.HelloRep{Message: "Hello " + req.Name}, nil
func (s *DemoUseService) CreateDemo(ctx context.Context, m *model.Demo) error {
return s.dao.Save(ctx, m)
}
func (s *DemoService) Create(ctx context.Context, req *demo.CreateReq) (*demo.OKRep, error) {
err := s.uc.CreateDemo(ctx, &model.Demo{Name: req.Name, Value: req.Value})
if err != nil {
return nil, err
}
return nil, nil
func (s *DemoUseService) UpdateDemo(ctx context.Context, m *model.Demo) error {
return s.dao.Update(ctx, m)
}
func (s *DemoService) Update(ctx context.Context, req *demo.UpdateReq) (*demo.OKRep, error) {
err := s.uc.UpdateDemo(ctx, &model.Demo{Id: int(req.Id), Name: req.Name, Value: req.Value})
func (s *DemoUseService) GetDemo(ctx context.Context, id int) (*model.Demo, error) {
s.log.WithContext(ctx).Info("qqqqqqqqqqqqqqqq")
m, err := s.dao.GetByID(ctx, id)
if err != nil {
return nil, err
}
return &demo.OKRep{}, nil
return m, nil
}
func (s *DemoService) Get(ctx context.Context, req *demo.IdReq) (*demo.DemoModel, error) {
res, err := s.uc.GetDemo(ctx, int(req.Id))
if err != nil {
return nil, err
func (s *DemoUseService) ListDemo(ctx context.Context, req *ListReq) ([]*model.Demo, error) {
if req.Page <= 0 {
req.Page = 1
}
return DemoModelToRep(res), nil
}
func (s *DemoService) List(ctx context.Context, req *demo.ListReq) (*demo.ListRep, error) {
list, err := s.uc.ListDemo(ctx, &biz.ListReq{
Page: int(req.Page),
Size: int(req.Size),
})
if req.Size <= 0 {
req.Size = 20
}
if err != nil {
return nil, err
if req.Size >= 100 {
req.Size = 100
}
rep := &demo.ListRep{}
rep.List = make([]*demo.DemoModel, 0, len(list))
offset := (req.Page - 1) * req.Size
for _, v := range list {
rep.List = append(rep.List, DemoModelToRep(v))
}
return rep, nil
return s.dao.List(ctx, req.Size, offset)
}
func (s *DemoService) Delete(ctx context.Context, req *demo.IdReq) (*demo.OKRep, error) {
err := s.uc.DeleteDemo(ctx, int(req.Id))
if err != nil {
return nil, err
}
return &demo.OKRep{}, nil
func (s *DemoUseService) DeleteDemo(ctx context.Context, id int) error {
return s.dao.DeleteByID(ctx, int(id))
}
bin
tmp
\ No newline at end of file
FROM golang:1.16 AS builder
COPY ../../mgr /src
WORKDIR /src
RUN GOPROXY=https://goproxy.cn make build
FROM debian:stable-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
netbase \
&& rm -rf /var/lib/apt/lists/ \
&& apt-get autoremove -y && apt-get autoclean -y
COPY --from=builder /src/bin /app
WORKDIR /app
EXPOSE 8000
EXPOSE 9000
VOLUME /data/conf
CMD ["./server", "-conf", "/data/conf"]
root = "."
testdata_dir = "bin"
tmp_dir = "bin"
[build]
args_bin = []
bin = "./bin/hilo-service-mgr"
cmd = "go build -o bin/hilo-service-mgr ./cmd/mgr"
full_bin = ""
delay = 1000
exclude_dir = ["bin", "assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
kill_delay = "0.3s"
log = "build-errors.log"
send_interrupt = true
stop_on_error = true
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
time = false
[misc]
clean_on_exit = false
[screen]
clear_on_rebuild = false
package main
import (
"flag"
"github.com/go-kratos/kratos/contrib/registry/consul/v2"
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/go-kratos/kratos/v2/transport/grpc"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/jaeger"
"go.opentelemetry.io/otel/sdk/resource"
tracesdk "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.uber.org/zap"
"hilo/app/service/mgr/internal/conf"
"hilo/common/logz"
"hilo/common/util"
"math/rand"
"time"
)
var (
id = util.GenServiceId()
)
func main() {
flag.Parse()
conf.LoadConfig()
rand.Seed(time.Now().UnixNano())
err := initTracer(conf.Conf.Jaeger.Url)
if err != nil {
panic(err)
}
l := logz.NewLogger(conf.Conf.Log, zap.AddCaller(), zap.AddCallerSkip(3))
defer l.Flush()
logger := log.With(l,
"service.id", id,
"service.name", conf.Conf.Server.Name,
"service.version", conf.Conf.Server.Version,
"trace.id", tracing.TraceID(),
"span.id", tracing.SpanID(),
)
log.SetLogger(logger)
app, cleanup, err := wireApp(conf.Conf.Server, conf.Conf.Data, conf.Conf.Consul, logger)
if err != nil {
panic(err)
}
defer cleanup()
// start and wait for stop signal
if err := app.Run(); err != nil {
panic(err)
}
}
func newApp(logger log.Logger, gs *grpc.Server, rr *consul.Registry) *kratos.App {
return kratos.New(
kratos.ID(id),
kratos.Name(conf.Conf.Server.Name),
kratos.Version(conf.Conf.Server.Version),
kratos.Metadata(map[string]string{}),
kratos.Logger(logger),
kratos.Server(
gs,
),
kratos.Registrar(rr),
)
}
// 设置全局trace
func initTracer(url string) error {
// 创建 Jaeger exporter
exp, err := jaeger.New(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint(url)))
if err != nil {
return err
}
tp := tracesdk.NewTracerProvider(
// 将基于父span的采样率设置为100%
tracesdk.WithSampler(tracesdk.ParentBased(tracesdk.TraceIDRatioBased(1.0))),
// 始终确保再生成中批量处理
tracesdk.WithBatcher(exp),
// 在资源中记录有关此应用程序的信息
tracesdk.WithResource(resource.NewSchemaless(
semconv.ServiceNameKey.String("kratos-trace"),
attribute.String("exporter", "jaeger"),
attribute.Float64("float", 312.23),
)),
)
otel.SetTracerProvider(tp)
return nil
}
//go:build wireinject
// +build wireinject
// The build tag makes sure the stub is not built in the final build.
package main
import (
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"hilo/app/service/mgr/internal/conf"
"hilo/app/service/mgr/internal/dao"
"hilo/app/service/mgr/internal/handler"
"hilo/app/service/mgr/internal/server"
"hilo/app/service/mgr/internal/service"
)
// wireApp init kratos application.
func wireApp(*conf.Server, *conf.Data, *conf.Consul, log.Logger) (*kratos.App, func(), error) {
panic(wire.Build(server.ProviderSet, dao.ProviderSet, service.ProviderSet, handler.ProviderSet, newApp))
}
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package main
import (
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/log"
"hilo/app/service/mgr/internal/conf"
"hilo/app/service/mgr/internal/dao"
"hilo/app/service/mgr/internal/handler"
"hilo/app/service/mgr/internal/server"
"hilo/app/service/mgr/internal/service"
)
// Injectors from wire.go:
// wireApp init kratos application.
func wireApp(confServer *conf.Server, data *conf.Data, consul *conf.Consul, logger log.Logger) (*kratos.App, func(), error) {
daoDao, cleanup, err := dao.NewDao(data)
if err != nil {
return nil, nil, err
}
mgrService := service.NewMgrService(daoDao)
mgrHandler := handler.NewMgrHandler(mgrService)
grpcServer := server.NewGRPCServer(confServer, mgrHandler)
registry := server.NewConsulRegister(consul)
app := newApp(logger, grpcServer, registry)
return app, func() {
cleanup()
}, nil
}
# 服务配置
Server:
Name: "hilo.service.mgr"
Version: "1.0.0"
Grpc:
Addr: "" # 为空随机端口, 使用注册中心服务发现
Timeout: 3 # 服务超时时间, 单位秒
# 注册中心
Consul:
Addr: 192.168.233.1:8500
# jaeger链路追踪 https://github.com/jaegertracing/jaeger
Jaeger:
Url: http://192.168.233.1:14268/api/traces
# 数据源
Data:
Mysql:
Dsn: root:yX0jPAhO0I4s2zlA@tcp(47.244.34.27:3306)/hilo?loc=Local&charset=utf8mb4&writeTimeout=3s&readTimeout=3s&timeout=2s&parseTime=true
MaxConn: 16 # 连接池最大连接数
MaxIdleConn: 4 # 连接池最小连接数
MaxLifetime: 1800 # 连接池内连接有效时间,单位秒
Debug: true
# 日志
Log:
Color: true
Level: DEBUG
\ No newline at end of file
package conf
import (
"flag"
"hilo/common/conf"
"hilo/common/logz"
"hilo/common/mysql"
)
var (
confPath string
Conf = &Config{}
)
func init() {
flag.StringVar(&confPath, "conf", "config/config.yaml", "指定配置文件 eg: -conf config.yaml")
}
type Config struct {
Server *Server
Data *Data
Log *logz.Config
Consul *Consul
Jaeger *Jaeger
}
type Consul struct {
Addr string
}
type Jaeger struct {
Url string
}
type Data struct {
Mysql *mysql.Config
}
type Server struct {
Name string
Version string
Grpc struct {
Addr string
Timeout int
}
Http struct {
Addr string
Timeout int
}
}
func LoadConfig() {
conf.LoadFromYaml(confPath, &Conf)
}
package dao
import (
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"gorm.io/gorm"
"hilo/app/service/mgr/internal/conf"
"hilo/common/mysql"
)
// ProviderSet is dao providers.
var ProviderSet = wire.NewSet(NewDao)
// Dao .
type Dao struct {
// TODO wrapped database client
DB *gorm.DB
}
// NewDao .
func NewDao(c *conf.Data) (*Dao, func(), error) {
db := mysql.NewDB(c.Mysql)
cleanup := func() {
d, _ := db.DB()
d.Close()
log.Debug("close data resources")
}
return &Dao{
DB: db,
}, cleanup, nil
}
package dao
import (
"gorm.io/gorm"
"hilo/app/service/mgr/internal/model"
)
func (d *Dao) CheckMgrImeiExist(imei string) (bool, error) {
var id int
err := d.DB.Model(&model.MgrImei{}).Where("imei = ?", imei).Take(&id).Error
if err != nil && err != gorm.ErrRecordNotFound {
return false, err
}
if id > 0 {
return true, nil
}
return false, nil
}
func (d *Dao) CheckMgrIpExist(ip string) (bool, error) {
var id int
err := d.DB.Model(&model.MgrIp{}).Where("ip = ?", ip).Take(&id).Error
if err != nil && err != gorm.ErrRecordNotFound {
return false, err
}
if id > 0 {
return true, nil
}
return false, nil
}
func (d *Dao) GetMgrUserStatus(userId int64) (res *model.MgrUserStatus, err error) {
res = &model.MgrUserStatus{}
err = d.DB.Model(&model.MgrUserStatus{}).Where(&model.MgrUserStatus{
UserId: userId,
}).Take(res).Error
// 正常状态
if err == gorm.ErrRecordNotFound {
res.Status = model.NormalStatus
res.UserId = userId
err = nil
return
}
return
}
package handler
import "github.com/google/wire"
// ProviderSet is handler providers.
var ProviderSet = wire.NewSet(NewMgrHandler)
package handler
import (
"context"
"google.golang.org/protobuf/types/known/timestamppb"
"hilo/api/service/mgr"
"hilo/app/service/mgr/internal/service"
)
// MgrHandler is a mgr handler.
type MgrHandler struct {
mgr.UnimplementedMgrServer
svc *service.MgrService
}
func (h *MgrHandler) IsAgent(ctx context.Context, req *mgr.IsAgentReq) (*mgr.OkRep, error) {
ok := h.svc.IsAgent(req.UserId)
return &mgr.OkRep{Ok: ok}, nil
}
func (h *MgrHandler) GetMgrUserStatus(ctx context.Context, req *mgr.GetMgrUserStatusReq) (*mgr.MMgrUserStatus, error) {
res, err := h.svc.GetMgrUserStatus(req.UserId)
if err != nil {
return nil, err
}
return &mgr.MMgrUserStatus{
Id: res.Id,
UserId: res.UserId,
Status: mgr.UserStatus(res.Status),
EndTime: timestamppb.New(res.EndTime),
CreatedTime: timestamppb.New(res.CreatedTime),
UpdatedTime: timestamppb.New(res.UpdatedTime),
}, nil
}
func (h *MgrHandler) CheckMgrImeiExist(ctx context.Context, req *mgr.CheckMgrImeiExistReq) (*mgr.OkRep, error) {
ok, err := h.svc.CheckMgrImeiExist(req.Imei)
if err != nil {
return nil, err
}
return &mgr.OkRep{Ok: ok}, nil
}
func (h *MgrHandler) CheckMgrIpExist(ctx context.Context, req *mgr.CheckMgrIpExistReq) (*mgr.OkRep, error) {
ok, err := h.svc.CheckMgrIpExist(req.Ip)
if err != nil {
return nil, err
}
return &mgr.OkRep{Ok: ok}, nil
}
var _ mgr.MgrServer = &MgrHandler{}
// NewMgrHandler new a mgr handler.
func NewMgrHandler(uc *service.MgrService) *MgrHandler {
return &MgrHandler{svc: uc}
}
package model
import (
"time"
)
type AgentMgr struct {
AgentId int64 `json:"agent_id"` // 代理id
CreatedTime time.Time `json:"created_time"` // 新增时间
Id int64 `json:"id"` // id
UpdatedTime time.Time `json:"updated_time"` // 更新时间
UserId int64 `json:"user_id"` // UserId
}
func (a *AgentMgr) TableName() string {
return "agent_mgr"
}
package model
import (
"time"
)
type MgrImei struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Id int64 `json:"id"` // id
Imei string `json:"imei"` // 设备码
MgrId int64 `json:"mgr_id"` // 管理人ID
ReasonType int `json:"reason_type"` // 处理原因
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
}
func (m *MgrImei) TableName() string {
return "mgr_imei"
}
package model
import (
"time"
)
type MgrIp struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Id int64 `json:"id"` // id
Ip string `json:"ip"` // 设备码
MgrId int64 `json:"mgr_id"` // 管理人ID
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
}
func (m *MgrIp) TableName() string {
return "mgr_ip"
}
package model
import (
"time"
)
const (
NormalStatus = 1 // 正常
FreezeStatus = 2 // 冻结
)
type MgrUserStatus struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
EndTime time.Time `json:"end_time"` // 解禁截至时间
Id int64 `json:"id"` // id
Status int `json:"status"` // 状态(1:永久冻结,2:封禁)
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户ID
}
func (m *MgrUserStatus) TableName() string {
return "mgr_user_status"
}
package server
import (
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/middleware/recovery"
"github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/go-kratos/kratos/v2/transport/grpc"
"hilo/api/service/mgr"
"hilo/app/service/mgr/internal/conf"
"hilo/app/service/mgr/internal/handler"
"time"
)
// NewGRPCServer new a gRPC server.
func NewGRPCServer(c *conf.Server, svc *handler.MgrHandler) *grpc.Server {
var opts = []grpc.ServerOption{
grpc.Middleware(
recovery.Recovery(),
tracing.Server(),
ValidateParams(),
),
}
if c.Grpc.Addr != "" {
opts = append(opts, grpc.Address(c.Grpc.Addr))
}
if c.Grpc.Timeout != 0 {
opts = append(opts, grpc.Timeout(time.Duration(c.Grpc.Timeout)*time.Second))
}
srv := grpc.NewServer(opts...)
mgr.RegisterMgrServer(srv, svc)
logHelper = log.NewHelper(log.GetLogger())
return srv
}
package server
import (
"context"
"github.com/go-kratos/kratos/v2/middleware"
"github.com/go-kratos/kratos/v2/transport"
"hilo/common/errm"
"hilo/common/validate"
)
// ValidateParams 验证参数
func ValidateParams() middleware.Middleware {
return func(handler middleware.Handler) middleware.Handler {
return func(ctx context.Context, req interface{}) (interface{}, error) {
if tr, ok := transport.FromServerContext(ctx); ok {
err := validate.Struct(req)
if err != nil {
logHelper.WithContext(ctx).Warnf("[%s]参数验证失败: %s", tr.Operation(), err.Error())
return nil, errm.ParamsError(err.Error())
}
}
return handler(ctx, req)
}
}
}
package server
import (
"github.com/go-kratos/kratos/contrib/registry/consul/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"github.com/hashicorp/consul/api"
"hilo/app/service/mgr/internal/conf"
)
// ProviderSet is server providers.
var (
ProviderSet = wire.NewSet(NewGRPCServer, NewConsulRegister)
logHelper *log.Helper
)
func NewConsulRegister(conf *conf.Consul) *consul.Registry {
cfg := api.DefaultConfig()
cfg.Address = conf.Addr
consulClient, err := api.NewClient(cfg)
if err != nil {
panic(err)
}
registry := consul.New(consulClient,
consul.WithHealthCheck(true),
)
return registry
}
package service
import (
"github.com/go-kratos/kratos/v2/log"
"hilo/app/service/mgr/internal/dao"
"hilo/app/service/mgr/internal/model"
)
// MgrService is a Mgr service.
type MgrService struct {
dao *dao.Dao
log *log.Helper
}
func (s *MgrService) CheckMgrImeiExist(imei string) (bool, error) {
return s.dao.CheckMgrImeiExist(imei)
}
func (s *MgrService) CheckMgrIpExist(ip string) (bool, error) {
return s.dao.CheckMgrIpExist(ip)
}
func (s *MgrService) GetMgrUserStatus(userId int64) (*model.MgrUserStatus, error) {
return s.dao.GetMgrUserStatus(userId)
}
func (s *MgrService) IsAgent(userId int64) bool {
data := model.AgentMgr{}
return s.dao.DB.Where(&model.AgentMgr{UserId: userId}).First(&data).Error == nil
}
// NewMgrService new a Mgr service.
func NewMgrService(dao *dao.Dao) *MgrService {
return &MgrService{
dao: dao,
log: log.NewHelper(log.GetLogger()),
}
}
package service
import "github.com/google/wire"
// ProviderSet is service providers.
var ProviderSet = wire.NewSet(NewMgrService)
# Generated with protoc-gen-openapi
# https://github.com/google/gnostic/tree/master/cmd/protoc-gen-openapi
openapi: 3.0.3
info:
title: Greeter API
description: The greeting service definition.
version: 0.0.1
paths:
/helloworld/{name}:
get:
tags:
- Greeter
- subgroup
description: Sends a greeting
operationId: Greeter_SayHello
parameters:
- name: name
in: path
required: true
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/helloworld.v1.HelloReply'
components:
schemas:
helloworld.v1.HelloReply:
type: object
properties:
message:
type: string
description: The response message containing the greetings
tags:
- name: Greeter
bin
tmp
\ No newline at end of file
FROM golang:1.16 AS builder
COPY ../../user /src
WORKDIR /src
RUN GOPROXY=https://goproxy.cn make build
FROM debian:stable-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
netbase \
&& rm -rf /var/lib/apt/lists/ \
&& apt-get autoremove -y && apt-get autoclean -y
COPY --from=builder /src/bin /app
WORKDIR /app
EXPOSE 8000
EXPOSE 9000
VOLUME /data/conf
CMD ["./server", "-conf", "/data/conf"]
root = "."
testdata_dir = "bin"
tmp_dir = "bin"
[build]
args_bin = []
bin = "./bin/hilo-service-user"
cmd = "go build -o bin/hilo-service-user ./cmd/user"
full_bin = ""
delay = 1000
exclude_dir = ["bin", "assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
kill_delay = "0.3s"
log = "build-errors.log"
send_interrupt = true
stop_on_error = true
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
time = false
[misc]
clean_on_exit = false
[screen]
clear_on_rebuild = false
package main
import (
"flag"
"fmt"
"github.com/go-kratos/kratos/contrib/registry/consul/v2"
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/go-kratos/kratos/v2/transport/grpc"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/jaeger"
"go.opentelemetry.io/otel/sdk/resource"
tracesdk "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
"go.uber.org/zap"
"hilo/app/service/user/internal/conf"
"hilo/common/aws"
"hilo/common/logz"
"hilo/common/tencent"
"hilo/common/util"
"math/rand"
"time"
"github.com/go-kratos/kratos/v2/log"
)
var (
id = util.GenServiceId()
)
func main() {
flag.Parse()
conf.LoadConfig()
rand.Seed(time.Now().UnixNano())
err := initTracer(conf.Conf.Jaeger.Url)
if err != nil {
panic(err)
}
l := logz.NewLogger(conf.Conf.Log, zap.AddCaller(), zap.AddCallerSkip(3))
defer l.Flush()
logger := log.With(l,
"service.id", id,
"service.name", conf.Conf.Server.Name,
"service.version", conf.Conf.Server.Version,
"trace.id", tracing.TraceID(),
"span.id", tracing.SpanID(),
)
log.SetLogger(logger)
aws.SetAws(aws.NewAWS(conf.Conf.Aws))
tencent.SetTencentYun(tencent.NewTencentYun(conf.Conf.TencentYun))
app, cleanup, err := wireApp(
conf.Conf.Server, conf.Conf.Client, conf.Conf.Data, conf.Conf.Consul,
logger,
)
if err != nil {
panic(err)
}
defer cleanup()
// start and wait for stop signal
if err := app.Run(); err != nil {
panic(err)
}
}
func newApp(logger log.Logger, gs *grpc.Server, rr *consul.Registry) *kratos.App {
return kratos.New(
kratos.ID(id),
kratos.Name(conf.Conf.Server.Name),
kratos.Version(conf.Conf.Server.Version),
kratos.Metadata(map[string]string{}),
kratos.Logger(logger),
kratos.Server(
gs,
),
kratos.Registrar(rr),
)
}
// 设置全局trace
func initTracer(url string) error {
// 创建 Jaeger exporter
exp, err := jaeger.New(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint(url)))
if err != nil {
return err
}
tp := tracesdk.NewTracerProvider(
// 将基于父span的采样率设置为100%
tracesdk.WithSampler(tracesdk.ParentBased(tracesdk.TraceIDRatioBased(1.0))),
// 始终确保再生成中批量处理
tracesdk.WithBatcher(exp),
// 在资源中记录有关此应用程序的信息
tracesdk.WithResource(resource.NewSchemaless(
semconv.ServiceNameKey.String(fmt.Sprintf("kratos-trace-%s", conf.Conf.Server.Name)),
//attribute.String("exporter", "jaeger"),
//attribute.Float64("float", 312.23),
)),
)
otel.SetTracerProvider(tp)
return nil
}
//go:build wireinject
// +build wireinject
// The build tag makes sure the stub is not built in the final build.
package main
import (
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"hilo/app/service/user/internal/conf"
"hilo/app/service/user/internal/dao"
"hilo/app/service/user/internal/handler"
"hilo/app/service/user/internal/server"
"hilo/app/service/user/internal/service"
)
// wireApp init kratos application.
func wireApp(*conf.Server, *conf.Client, *conf.Data, *conf.Consul, log.Logger) (*kratos.App, func(), error) {
panic(wire.Build(server.ProviderSet, dao.ProviderSet, service.ProviderSet, handler.ProviderSet, newApp))
}
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package main
import (
"github.com/go-kratos/kratos/v2"
"github.com/go-kratos/kratos/v2/log"
"hilo/app/service/user/internal/conf"
"hilo/app/service/user/internal/dao"
"hilo/app/service/user/internal/handler"
"hilo/app/service/user/internal/server"
"hilo/app/service/user/internal/service"
)
// Injectors from wire.go:
// wireApp init kratos application.
func wireApp(confServer *conf.Server, client *conf.Client, data *conf.Data, consul *conf.Consul, logger log.Logger) (*kratos.App, func(), error) {
registry := server.NewConsulRegister(consul)
countryClient := dao.NewCountryClient(client, registry)
mgrClient := dao.NewMgrClient(client, registry)
daoDao, cleanup, err := dao.NewDao(data, countryClient, mgrClient)
if err != nil {
return nil, nil, err
}
userService := service.NewUserService(daoDao)
handlerUserService := handler.NewUserHandler(userService)
grpcServer := server.NewGRPCServer(confServer, handlerUserService)
app := newApp(logger, grpcServer, registry)
return app, func() {
cleanup()
}, nil
}
# 服务配置
Server:
Name: "hilo.service.user"
Version: "1.0.0"
Mode: local
Grpc:
Addr: "0.0.0.0:8001" # 为空随机端口, 使用注册中心服务发现
Timeout: 3 # 服务超时时间, 单位秒
Client:
Country:
Endpoint: "discovery:///hilo.service.country"
Mgr:
Endpoint: "discovery:///hilo.service.mgr"
# 注册中心
Consul:
Addr: 192.168.233.1:8500
# jaeger链路追踪 https://github.com/jaegertracing/jaeger
Jaeger:
Url: http://192.168.233.1:14268/api/traces
# 数据源
Data:
Mysql:
# Dsn: temp:temp666@tcp(127.0.0.1:3306)/site?loc=Local&charset=utf8mb4&writeTimeout=3s&readTimeout=3s&timeout=2s&parseTime=true
Dsn: root:yX0jPAhO0I4s2zlA@tcp(47.244.34.27:3306)/hilo?loc=Local&charset=utf8mb4&writeTimeout=3s&readTimeout=3s&timeout=2s&parseTime=true
MaxConn: 16 # 连接池最大连接数
MaxIdleConn: 4 # 连接池最小连接数
MaxLifetime: 1800 # 连接池内连接有效时间,单位秒
Debug: true
Redis:
Addr: 127.0.0.1:6379
Password: ""
DB: 15
Auth:
ImeiTotal: 3
ImeiOauth: 3
AccountIp: 3
AccountIpDuration: 3
Jwt:
Expire: 24h
Secret: qwe123
Issuer: hilo.service.user
TencentYun:
TencentYunAppId: 1233
TencentYunKey: string
# 日志
Log:
Color: true
Level: DEBUG
\ No newline at end of file
package conf
import (
"flag"
"hilo/common/aws"
"hilo/common/conf"
"hilo/common/env"
"hilo/common/logz"
"hilo/common/mysql"
"hilo/common/oss"
"hilo/common/redis"
"hilo/common/tencent"
)
var (
confPath string
Conf = &Config{}
)
func init() {
flag.StringVar(&confPath, "conf", "config/config.yaml", "指定配置文件 eg: -conf config.yaml")
}
type Config struct {
Server *Server
Data *Data
Log *logz.Config
Consul *Consul
Jaeger *Jaeger
Aws *aws.Config
Oss *oss.Config
TencentYun *tencent.Config
Auth *Auth
Client *Client
}
type Auth struct {
ImeiTotalLimit int
ImeiOauthLimit int
AccountIpLimit int
AccountIpDurationLimit int
Jwt struct {
Expire string
Secret string
Issuer string
}
}
type Consul struct {
Addr string
}
type Jaeger struct {
Url string
}
type Data struct {
Mysql *mysql.Config
Redis *redis.Config
}
type Server struct {
Name string
Version string
Mode string
Grpc struct {
Addr string
Timeout int
}
Http struct {
Addr string
Timeout int
}
}
type Client struct {
Mgr struct {
Endpoint string
}
Country struct {
Endpoint string
}
}
func LoadConfig() {
conf.LoadFromYaml(confPath, &Conf)
}
func GetMode() string {
return Conf.Server.Mode
}
func AppIsRelease() bool {
return GetMode() == env.RELEASE
}
func AppIsLocal() bool {
return GetMode() == env.LOCAL
}
package dao
import (
"context"
"github.com/go-kratos/kratos/contrib/registry/consul/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/middleware/recovery"
"github.com/go-kratos/kratos/v2/transport/grpc"
"github.com/google/wire"
"gorm.io/gorm"
"hilo/api/service/country"
"hilo/api/service/mgr"
"hilo/app/service/user/internal/conf"
"hilo/common/httpclient"
"hilo/common/mysql"
"hilo/common/redis"
"net/http"
"time"
)
var ProviderSet = wire.NewSet(NewDao, NewCountryClient, NewMgrClient)
// Dao .
type Dao struct {
DB *gorm.DB
Redis *redis.WrapClient
Http *http.Client
MgrClient mgr.MgrClient
CountryClient country.CountryClient
}
func NewDao(c *conf.Data, countryClient country.CountryClient, mgrClient mgr.MgrClient) (*Dao, func(), error) {
db := mysql.NewDB(c.Mysql)
rs := redis.NewRedis(c.Redis)
httpClient := httpclient.NewClient()
cleanup := func() {
d, _ := db.DB()
d.Close()
rs.Client.Close()
httpClient.CloseIdleConnections()
log.Debug("close Dao resources")
}
return &Dao{
DB: db,
Redis: rs,
Http: httpClient,
CountryClient: countryClient,
MgrClient: mgrClient,
}, cleanup, nil
}
func NewMgrClient(conf *conf.Client, rr *consul.Registry) mgr.MgrClient {
conn, err := grpc.DialInsecure(
context.Background(),
grpc.WithEndpoint(conf.Mgr.Endpoint),
grpc.WithDiscovery(rr),
grpc.WithMiddleware(
recovery.Recovery(),
),
grpc.WithTimeout(time.Second*2),
)
if err != nil {
panic(err)
}
return mgr.NewMgrClient(conn)
}
func NewCountryClient(conf *conf.Client, rr *consul.Registry) country.CountryClient {
conn, err := grpc.DialInsecure(
context.Background(),
grpc.WithEndpoint(conf.Country.Endpoint),
grpc.WithDiscovery(rr),
grpc.WithMiddleware(
recovery.Recovery(),
),
grpc.WithTimeout(time.Second*2),
)
if err != nil {
panic(err)
}
return country.NewCountryClient(conn)
}
package dao
import (
"gorm.io/gorm"
"hilo/app/service/user/internal/model"
)
func (d *Dao) GetGroupInfo(groupId string) (*model.GroupInfo, error) {
r := &model.GroupInfo{}
err := d.DB.Where(&model.GroupInfo{ImGroupId: groupId}).First(r).Error
if err != nil {
if err == gorm.ErrRecordNotFound {
return nil, nil
} else {
return nil, err
}
}
return r, nil
}
func (d *Dao) GetGroupPowerUser(userId int64) (*model.GroupPowerUser, error) {
groupPowerUser := &model.GroupPowerUser{}
err := d.DB.Where(&model.GroupPowerUser{UserId: userId}).First(groupPowerUser).Error
if err != nil && err != gorm.ErrRecordNotFound {
return nil, err
}
return groupPowerUser, nil
}
func (d *Dao) GetGroupPower(id int64) (*model.GroupPower, error) {
groupPower := &model.GroupPower{}
if err := d.DB.Model(&model.GroupPower{}).First(groupPower, id).Error; err != nil {
return nil, err
}
return groupPower, nil
}
package dao
import (
"hilo/app/service/user/internal/model"
)
func (d *Dao) GetAllMedal() ([]*model.ResMedal, error) {
rows := make([]*model.ResMedal, 0)
err := d.DB.Find(&rows).Error
if err != nil {
return nil, err
}
return rows, nil
}
func (d *Dao) GetAllMedalMap() (map[int]*model.ResMedal, error) {
rows, err := d.GetAllMedal()
if err != nil {
return nil, err
}
result := make(map[int]*model.ResMedal, len(rows))
for _, i := range rows {
result[(i.Id)] = i
}
return result, nil
}
package dao
import (
"gorm.io/gorm"
"hilo/app/service/user/internal/model"
"time"
)
func (d *Dao) GetUser(userId int64) (res *model.User, err error) {
res = &model.User{}
err = d.DB.Model(&model.User{}).Where("id = ?", userId).Take(res).Error
return
}
func (d *Dao) CreateUser(user *model.User) (*model.User, error) {
now := time.Now()
user.CreatedTime = now
user.UpdatedTime = now
err := d.DB.Model(&model.User{}).Create(user).Error
return user, err
}
func (d *Dao) UpdateUser(userId int64, user *model.User) (res *model.User, err error) {
now := time.Now()
user.UpdatedTime = now
err = d.DB.Model(&model.User{}).Where("id = ?", userId).Updates(user).Error
return user, err
}
func (d *Dao) UpdateUserOauth(id int64, uo *model.UserOauth) (res *model.UserOauth, err error) {
err = d.DB.Model(&model.UserOauth{}).Where("id = ?", id).Updates(uo).Error
return uo, err
}
func (d *Dao) GetUserOauth(thirdPartyId string, thirdPartyType int) (res *model.UserOauth, err error) {
res = &model.UserOauth{}
err = d.DB.Model(&model.UserOauth{}).
Where("third_party_id = ? and third_party_type = ?", thirdPartyId, thirdPartyType).
Take(res).
Error
if err != nil && err == gorm.ErrRecordNotFound {
return nil, nil
}
return
}
func (d *Dao) CountImei(imei string) (int64, error) {
var c int64 = 0
if err := d.DB.Model(&model.UserImei{}).Where("imei = ?", imei).
Count(&c).Error; err != nil {
return 0, err
}
return c, nil
}
func (d *Dao) CountImeiThird(imei string, thirdPartyType int) (int64, error) {
var c int64 = 0
if err := d.DB.Table((&model.UserImei{}).TableName()).
Joins("left join user_oauth o on o.user_id = user_imei.user_id").
Where("user_imei.imei = ?", imei).
Where("o.third_party_type = ?", thirdPartyType).
Count(&c).Error; err != nil {
return 0, err
}
return c, nil
}
func (d *Dao) CountIp(ip string, beginTime time.Time) (int64, error) {
var c int64 = 0
if err := d.DB.Model(&model.UserIp{}).Where("ip = ?", ip).
Where("created_time >= ?", beginTime).Count(&c).Error; err != nil {
return 0, err
}
return c, nil
}
func (d *Dao) AddUserIp(userId int64, ip string) (err error) {
res := &model.UserIp{}
err = d.DB.Where(&model.UserIp{UserId: userId}).Take(res).Error
if err != nil && err != gorm.ErrRecordNotFound {
return err
}
now := time.Now()
if err == gorm.ErrRecordNotFound {
err = d.DB.Model(&model.UserIp{}).Create(&model.UserIp{
Ip: ip,
CreatedTime: now,
UpdatedTime: now,
UserId: userId,
}).Error
} else {
err = d.DB.Model(&model.UserIp{}).Where("user_id = ?", userId).Updates(&model.UserIp{
Ip: ip,
UpdatedTime: now,
}).Error
}
return
}
func (d *Dao) GetVip(userId int64) (*model.UserVip, error) {
rows := make([]*model.UserVip, 0)
err := d.DB.Where("user_id = ? AND expire_at >= NOW()", userId).Find(&rows).Error
if err != nil {
return nil, err
}
if len(rows) > 0 {
return rows[0], nil
}
return nil, nil
}
func (d *Dao) GetUserMedal(userId int64) ([]int, error) {
rows := make([]*model.UserMedal, 0)
if err := d.DB.Model(&model.UserMedal{}).Where("user_id = ? AND (end_time >= NOW() or end_time is null)", userId).Find(&rows).Error; err != nil {
return nil, err
}
result := make([]int, 0)
for _, i := range rows {
result = append(result, i.MedalId)
}
return result, nil
}
func (d *Dao) BatchGetPropertyMapByUserIds(userIds []int64) (map[int64]int64, error) {
rows := make([]*model.UserProperty, 0)
if err := d.DB.Model(&model.UserProperty{}).
Where("end_time > NOW() AND user_id IN ?", userIds).Order("id DESC").Find(&rows).Error; err != nil {
return nil, err
}
result := make(map[int64]int64, 0)
tmp := make(map[int64]int64, 0)
for _, i := range rows {
if _, ok := result[i.UserId]; !ok {
if i.Using == model.UserPropertyYesUsing {
// using = true且id最大,就确定是当前使用的
result[i.UserId] = i.PropertyId
} else if _, ok := tmp[i.UserId]; !ok {
// using = false且id最大,先记下,因为不知道还有没有using=true的
tmp[i.UserId] = i.PropertyId
}
}
}
for k, v := range tmp {
// result中没有的,就采用tmp保存的
if _, ok := result[k]; !ok {
result[k] = v
}
}
return result, nil
}
func (d *Dao) GetUserProperty(userId int64, propertyId int64) (*model.UserProperty, error) {
userProperty := &model.UserProperty{}
if err := d.DB.Model(&model.UserProperty{}).Where(&model.UserProperty{
UserId: userId,
PropertyId: propertyId,
}).First(&userProperty).Error; err != nil {
if err == gorm.ErrRecordNotFound {
return &model.UserProperty{
UserId: userId,
PropertyId: propertyId,
EndTime: time.Now(),
}, nil
} else {
return nil, err
}
}
return userProperty, nil
}
// ListNoble 查询用户未过期的贵族
func (d *Dao) ListNoble(userId int64) ([]*model.UserNoble, error) {
rows := make([]*model.UserNoble, 0)
if err := d.DB.Where("end_time>=NOW() and user_id = ?", userId).Order("level DESC").Find(&rows).Error; err != nil {
return nil, err
}
return rows, nil
}
func (d *Dao) GetDiamond(userId int64) (*model.CvDiamond, error) {
var diamondAccount = &model.DiamondAccount{}
err := d.DB.Model(&model.DiamondAccount{}).Where(&model.DiamondAccount{
UserId: userId,
}).First(&diamondAccount).Error
if err != nil {
return nil, err
}
return &model.CvDiamond{DiamondNum: diamondAccount.DiamondNum}, nil
}
package handler
import (
"google.golang.org/protobuf/types/known/timestamppb"
"hilo/api/service/user"
"hilo/app/service/user/internal/model"
)
func ProtoToUser(src *user.MUser) *model.User {
return &model.User{
Avatar: src.Avatar,
Birthday: src.Birthday,
Code: src.Code,
Country: src.Country,
CountryIcon: src.CountryIcon,
DefaultAvatar: int(src.DefaultAvatar),
Description: src.Description,
DeviceType: src.DeviceType,
ExternalId: src.ExternalId,
IsPush: int(src.IsPush),
IsShowAge: int(src.IsShowAge),
Language: src.Language,
LogoutTime: src.LogoutTime,
Nick: src.Nick,
OriginCode: src.OriginCode,
Sex: int(src.Sex),
Status: int8(src.Status),
}
}
func UserToProto(src *model.User) *user.MUser {
return &user.MUser{
Avatar: src.Avatar,
Birthday: src.Birthday,
Code: src.Code,
Country: src.Country,
CountryIcon: src.CountryIcon,
DefaultAvatar: int32(src.DefaultAvatar),
Description: src.Description,
DeviceType: src.DeviceType,
ExternalId: src.ExternalId,
IsPush: int32(src.IsPush),
IsShowAge: int32(src.IsShowAge),
Language: src.Language,
LogoutTime: src.LogoutTime,
Nick: src.Nick,
OriginCode: src.OriginCode,
Sex: user.ESex(src.Sex),
Status: int32(src.Status),
}
}
func UserOAuthToProto(src *model.UserOauth) *user.MUserOauth {
return &user.MUserOauth{
Id: src.Id,
UserId: src.UserId,
ThirdPartyId: src.ThirdPartyId,
ThirdPartyType: user.EThirdPartyType(src.ThirdPartyType),
ThirdPartyToken: src.ThirdPartyToken,
CreatedTime: timestamppb.New(src.CreatedTime),
UpdatedTime: timestamppb.New(src.UpdatedTime),
}
}
package handler
import "github.com/google/wire"
// ProviderSet is service providers.
var ProviderSet = wire.NewSet(NewUserHandler)
package handler
import (
"context"
"hilo/api/service/user"
"hilo/app/service/user/internal/service"
)
type UserService struct {
user.UnimplementedUserServer
svc *service.UserService
}
func (s *UserService) Login(ctx context.Context, req *user.LoginReq) (*user.LoginRep, error) {
res, err := s.svc.Login(ctx, req)
if err != nil {
return nil, err
}
return res, nil
}
var _ user.UserServer = &UserService{}
func NewUserHandler(svc *service.UserService) *UserService {
return &UserService{svc: svc}
}
package model
import (
"time"
)
type DiamondAccount struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
DiamondNum int `json:"diamond_num"` // 钻石数量
Id int64 `json:"id"` // id
Status int `json:"status"` // 状态
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // user_id
}
func (d *DiamondAccount) TableName() string {
return "diamond_account"
}
package model
import (
"time"
)
type GroupInfo struct {
ChannelId string `json:"channel_id"` // ChannelId
Code string `json:"code"` // Code
Country string `json:"country"` // 国家
CreatedTime time.Time `json:"created_time"` // CreatedTime
EntryLevel int `json:"entry_level"` // EntryLevel
FaceUrl string `json:"face_url"` // FaceUrl
Id int64 `json:"id"` // id
ImGroupId string `json:"im_group_id"` // ImGroupId
Introduction string `json:"introduction"` // Introduction
LoadHistory int `json:"load_history"` // LoadHistory
MicNumType int `json:"mic_num_type"` // MicNumType
MicOn int `json:"mic_on"` // MicOn
Name string `json:"name"` // Name
Notification string `json:"notification"` // Notification
OriginCode string `json:"origin_code"` // OriginCode
Owner int64 `json:"owner"` // Owner
Password string `json:"password"` // Password
ThemeId int `json:"theme_id"` // ThemeId
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
}
func (g *GroupInfo) TableName() string {
return "group_info"
}
package model
import (
"time"
)
type GroupPower struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
GroupUid string `json:"group_uid"` // 群组UID
Id int64 `json:"id"` // id
Name string `json:"name"` // 运营后台看的
Status int `json:"status"` // 状态
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
}
func (g *GroupPower) TableName() string {
return "group_power"
}
package model
import (
"time"
)
type GroupPowerUser struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
GroupPowerId int64 `json:"group_power_id"` // 国家势力ID
Id int64 `json:"id"` // id
Role int `json:"role"` // 角色
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户
}
func (g *GroupPowerUser) TableName() string {
return "group_power_user"
}
package model
import (
"time"
)
type MatchActityUserScore struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Grade int `json:"grade"` // 等级
Id int64 `json:"id"` // id
Score int `json:"score"` // 分数
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // user_id
}
func (m *MatchActityUserScore) TableName() string {
return "match_actity_user_score"
}
package model
import (
"time"
)
type MatchCharmUserScore struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Grade int `json:"grade"` // 等级
Id int64 `json:"id"` // id
Score int `json:"score"` // 分数
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // user_id
}
func (m *MatchCharmUserScore) TableName() string {
return "match_charm_user_score"
}
package model
import (
"time"
)
type MatchWealthUserScore struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Grade int `json:"grade"` // 等级
Id int64 `json:"id"` // id
Score int `json:"score"` // 分数
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // user_id
}
func (m *MatchWealthUserScore) TableName() string {
return "match_wealth_user_score"
}
package model
import (
"time"
)
type ResHeadwear struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
EffectUrl string `json:"effect_url"` // 特效
Id int64 `json:"id"` // id
Name string `json:"name"` // 头饰名称
PicUrl string `json:"pic_url"` // 图片
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
}
func (r *ResHeadwear) TableName() string {
return "res_headwear"
}
package model
import (
"time"
)
type ResMedal struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
I int `json:"i"` // 排序
Id int `json:"id"` // id
Name string `json:"name"` // Name
NoPicUrl string `json:"no_pic_url"` // NoPicUrl
PicUrl string `json:"pic_url"` // PicUrl
Scope int `json:"scope"` // Scope
SvgaUrl string `json:"svga_url"` // SvgaUrl
Threshold int `json:"threshold"` // Threshold
Type int `json:"type"` // Type
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
}
func (r *ResMedal) TableName() string {
return "res_medal"
}
package model
import (
"time"
)
type SessionView struct {
CallbackTime time.Time `json:"callback_time"` // im回调时间
CreatedTime time.Time `json:"created_time"` // CreatedTime
I int `json:"i"` // I
Id int64 `json:"id"` // id
LogicDel int `json:"logic_del"` // LogicDel
OtherUserId int64 `json:"other_user_id"` // other_user_id
SessionId int64 `json:"session_id"` // session_id
SessionUid string `json:"session_uid"` // session_uid
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // user_id
}
func (s *SessionView) TableName() string {
return "session_view"
}
package model
import (
"time"
)
type SuperManager struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Id int64 `json:"id"` // id
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户ID
}
func (s *SuperManager) TableName() string {
return "super_manager"
}
package model
import (
"time"
)
const (
UserNormalStatus = 1 // 正常
UserFreezeStatus = 2 // 冻结
)
type User struct {
Avatar string `json:"avatar"` // 头像
Birthday int64 `json:"birthday"` // 出生日期
Code string `json:"code"` // 邀请码
Country string `json:"country"` // 国家
CountryIcon string `json:"country_icon"` // 国旗图标地址
CreatedTime time.Time `json:"created_time"` // CreatedTime
DefaultAvatar int `json:"default_avatar"` // DefaultAvatar
Description string `json:"description"` // 个性签名
DeviceType string `json:"device_type"` // ios,Android
ExternalId string `json:"external_id"` // 别名
Id int64 `json:"id"` // id
IsPush int `json:"is_push"` // IsPush
IsShowAge int `json:"is_show_age"` // IsShowAge
Language string `json:"language"` // Language
LogoutTime int64 `json:"logout_time"` // LogoutTime
Nick string `json:"nick"` // 昵称
OriginCode string `json:"origin_code"` // 原始邀请码
Sex int `json:"sex"` // 性别
Status int8 `json:"status"` // 状态
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
}
func (u *User) TableName() string {
return "user"
}
func (u *User) IsPrettyCode() bool {
return u.Code != u.OriginCode
}
// CvUserDetail 用户详细信息
type CvUserDetail struct {
CvUserBase
//统计:我喜欢多少人
ILikeCount int `json:"iLikeCount"`
//统计:多少人喜欢你, (本才才有数据,不是本人,数据为nil)
LikeCount int `json:"likeCount"`
//统计:多少人访问你
VisitCount int `json:"visitCount"`
//消息提醒, 1:开启,2:关闭
IsPush uint8 `json:"isPush"`
//钻石数量(本人才有数据,不是本人,数据为nil)???? 用0 或者-1 不用那么费事
DiamondNum int `json:"diamondNum"`
//是否喜欢(本人没有数据,//20210205 已废弃nil,产品说:可以自己喜欢自己)
IsLike bool `json:"isLike"`
//是否存在会话(本人没有数据)
IsSession bool `json:"isSession"`
//ID
//ID *mysql.ID `json:"id,omitempty"`
//是否工会成员, 只有是自己查自己,这个才有值,其它全为nil
//IsTradeUnion *bool `json:"isTradeUnion"`
//工会成员,是否开启了,匹配通知,只有 isTradeUnion值为true,这里才有值,
//IsTradeUnionMatchNotification *bool `json:"isTradeUnionMatchNotification"`
//是否可以免费通话,自己本人没有数据
//IsVideoFreeCan *bool `json:"isVideoCanFree"`
//别人是否喜欢我,自己本人没有数据 (20210205 已废弃nil,产品说:可以自己喜欢自己)
IsLikeMe bool `json:"isLikeMe"`
HeartValue uint32 `json:"heartValue"` // 与我之间永恒之心的值
HeartValueMax uint32 `json:"heartValueMax"` // 与我之间永恒之心的最大值(0代表没有永恒之心,即没有相互关注)
MeetDays uint `json:"meetDays"` // 成长关系建立的时间(天数)
WealthUserGrade int `json:"wealthUserGrade"` //财富等级
CharmUserGrade int `json:"charmUserGrade"` //魅力等级
ActivityUserGrade int `json:"activityUserGrade"` //活跃等级
CurrentRoom string `json:"currentRoom"` // 当前用户所在房间(产品叫“群组”)
MyGroupPower int64 `json:"myGroupPower"` // 当前用户所在势力
MyGroupPowerName string `json:"myGroupPowerName"` // 当前用户所在势力绑定群组的名称
}
// CvUserBase 用户基本信息
type CvUserBase struct {
//不会有返回值
Id int64 `json:"id,omitempty"`
//头像,不存在为nil
Avatar string `json:"avatar"`
//是否默认头像 true:是 false:不是
DefaultAvatar bool `json:"defaultAvatar"`
//用户对外ID
ExternalId string `json:"externalId"`
//昵称,不存在为nil
Nick string `json:"nick"`
//签名,不存在为nil
Description string `json:"description"`
//性别 1:男 2:女,不存在为nil
Sex uint8 `json:"sex"`
//国家,不存在为nil
Country string `json:"country"`
//国旗图标,不存在为nil
CountryIcon string `json:"countryIcon"`
//邀请码
Code string `json:"code"`
IsPrettyCode bool `json:"isPrettyCode"` // 是否靓号
IsLogout bool `json:"isLogout"` //是否注销
//生日,如果是其它人用户信息,年龄则按照是否展示显示,如果是本人,年龄则按照是否存在展示
Birthday int64 `json:"birthday"`
//是否展示年龄, 是本人才有数据,看其他用户均为nil
IsShowAge uint8 `json:"isShowAge"`
//是否工会成员, 只有是自己查自己,这个才有值,其它全为nil, 20220329 数据开放:原因:产品1对1视频聊天中,公会用户视频需要送礼物。改为: 全部人可以知道是否是公会用户。
IsTradeUnion bool `json:"isTradeUnion"`
//是否代理管理员, 只有自己查自己的时候才有值,其他情况为nil
IsAgentMgr bool `json:"isAgentMgr"`
//工会成员,是否开启了,匹配通知,只有 isTradeUnion值为true,这里才有值,
IsTradeUnionMatchNotification bool `json:"isTradeUnionMatchNotification"`
//是否VIP用户
IsVip bool `json:"isVip"`
//是否是官方人员
IsOfficialStaff bool `json:"isOfficialStaff"`
//VIP用户过期时间(只有自己查询自己,才返回)
VipExpireTime int64 `json:"vipExpireTime"`
Medals []int `json:"medals"` // 勋章列表 TODO: 删除
MedalInfo []*CvMedal `json:"medalInfo"` // 勋章列表
Headwear *CvHeadwear `json:"headwear"` // 当前使用的头饰
Ride *CvProperty `json:"ride"` // 当前使用的座驾
Noble *CvNoble `json:"noble"` // 当前的
}
type CvHeadwear struct {
Id uint64 `json:"id"`
Using bool `json:"using"`
PicUrl string `json:"picUrl"`
EffectUrl string `json:"effectUrl"`
TimeLeft int64 `json:"timeLeft"` // 离到期还有多少秒(过期则是负数)
}
type CvProperty struct {
Id uint64 `json:"id"`
PicUrl string `json:"picUrl"`
EffectUrl string `json:"effectUrl"`
Using bool `json:"using"`
TimeLeft int64 `json:"timeLeft"` // 离到期还有多少秒(过期则是负数)
SenderAvatar string `json:"senderAvatar"`
ReceiverAvatar string `json:"receiverAvatar"`
}
type CvMedal struct {
Id uint32 `json:"id"`
PicUrl string `json:"picUrl"`
EffectUrl string `json:"effectUrl"`
}
type CvNoble struct {
Level uint16 `json:"level"`
EndTime int64 `json:"endTime"`
}
type CvDiamond struct {
//钻石数量
DiamondNum int `json:"diamondNum"`
}
type CvDiamondBean struct {
//钻石数量
DiamondNum int `json:"diamondNum"`
//豆子数量
BeanNum string `json:"beanNum"`
}
package model
import (
"time"
)
const (
//我喜欢的数量
CountTypeLike = 1
//我拉黑的数量
CountTypeBlock = 2
//我被喜欢的次数
CountTypeLikeMe = 3
)
type UserCount struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Id int64 `json:"id"` // id
Num int `json:"num"` // 数量
Type int `json:"type"` // 类型
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // user_id
}
func (u *UserCount) TableName() string {
return "user_count"
}
package model
import (
"time"
)
const (
UserHeadwearYesUsing int = 1
UserHeadwearNoUsing int = 0
)
type UserHeadwear struct {
CreatedTime time.Time `json:"created_time"` // 新增时间
EndTime time.Time `json:"end_time"` // 有效截至时间
HeadwearId int64 `json:"headwear_id"` // 头饰ID
Id int64 `json:"id"` // id
UpdatedTime time.Time `json:"updated_time"` // 更新时间
UserId int64 `json:"user_id"` // 用户ID
Using int `json:"using"` // Using
}
func (u *UserHeadwear) TableName() string {
return "user_headwear"
}
package model
import (
"time"
)
type UserImei struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Id int64 `json:"id"` // id
Imei string `json:"imei"` // 设备码
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户ID
}
func (u *UserImei) TableName() string {
return "user_imei"
}
package model
import (
"time"
)
type UserIp struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Id int64 `json:"id"` // id
Ip string `json:"ip"` // ip
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户ID
}
func (u *UserIp) TableName() string {
return "user_ip"
}
package model
import (
"time"
)
type UserLike struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Id int64 `json:"id"` // id
LikeUserId int64 `json:"like_user_id"` // 被喜欢者ID
SceneType int `json:"scene_type"` // 1:随机匹配
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 喜欢者ID
}
func (u *UserLike) TableName() string {
return "user_like"
}
package model
import (
"time"
)
type UserMedal struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
EndTime time.Time `json:"end_time"` // 有效截至时间
Id int64 `json:"id"` // id
MedalId int `json:"medal_id"` // 勋章ID
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户ID
}
func (u *UserMedal) TableName() string {
return "user_medal"
}
package model
import (
"time"
)
type UserNoble struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
EndTime time.Time `json:"end_time"` // 有效截至时间
Id int64 `json:"id"` // id
Level int `json:"level"` // 贵族等级
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户ID
}
func (u *UserNoble) TableName() string {
return "user_noble"
}
package model
import (
"time"
)
type UserOauth struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Id int64 `json:"id"` // id
ThirdPartyId string `json:"third_party_id"` // 第三方ID
ThirdPartyToken string `json:"third_party_token"` // 第三方token
ThirdPartyType int `json:"third_party_type"` // 第三方类型
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户ID
}
func (u *UserOauth) TableName() string {
return "user_oauth"
}
package model
import (
"time"
)
const (
UserPropertyYesUsing = 1
UserPropertyNoUsing = 0
)
type UserProperty struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
EndTime time.Time `json:"end_time"` // 有效截至时间
Id int64 `json:"id"` // id
PropertyId int64 `json:"property_id"` // 道具ID
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户ID
Using int `json:"using"` // Using
}
func (u *UserProperty) TableName() string {
return "user_property"
}
package model
import (
"time"
)
type UserTradeUnion struct {
AgentId int64 `json:"agent_id"` // 不存在则为0
CreatedTime time.Time `json:"created_time"` // 新增时间
Id int64 `json:"id"` // id
MatchNotification int `json:"match_notification"` // MatchNotification
StarchatId int64 `json:"starchat_id"` // StarchatId
UpdatedTime time.Time `json:"updated_time"` // 更新时间
UserId int64 `json:"user_id"` // 用户ID
}
func (u *UserTradeUnion) TableName() string {
return "user_trade_union"
}
package model
import (
"time"
)
type UserVip struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
ExpireAt time.Time `json:"expire_at"` // 过期时间
Id int64 `json:"id"` // id
Platform int `json:"platform"` // 平台
Type int `json:"type"` // 类型(1:用户充值 2:后台赠送)
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户ID
VipSubscribeOrderId int64 `json:"vip_subscribe_order_id"` // vip订阅订单
}
func (u *UserVip) TableName() string {
return "user_vip"
}
package model
import (
"time"
)
type UserVisit struct {
CreatedTime time.Time `json:"created_time"` // CreatedTime
Id int64 `json:"id"` // id
N int `json:"n"` // 访问次数
UpdatedTime time.Time `json:"updated_time"` // UpdatedTime
UserId int64 `json:"user_id"` // 用户
VisitUserId int64 `json:"visit_user_id"` // 访问者
}
func (u *UserVisit) TableName() string {
return "user_visit"
}
package pkg
import (
"context"
uuid "github.com/satori/go.uuid"
"hilo/app/service/user/internal/conf"
_const "hilo/common/const"
"strings"
)
func GetUUID() string {
return strings.Replace(uuid.NewV4().String(), "-", "", -1)
}
// MakeFullUrl 补全url,区分处理oss和aws两种情况
func MakeFullUrl(url string) string {
if strings.HasPrefix(url, conf.Conf.Oss.OssCdn) || strings.HasPrefix(url, conf.Conf.Aws.Cdn) {
return url
} else if strings.HasPrefix(url, "nextvideo/") {
return conf.Conf.Oss.OssCdn + url
} else if strings.HasPrefix(url, conf.Conf.Aws.Dir) {
return conf.Conf.Aws.Cdn + url
} else {
return url
}
}
func GetDeviceType(ctx context.Context) string {
value, ok := ctx.Value(_const.DeviceType).(string)
if !ok {
return ""
}
return value
}
package pkg
import (
"fmt"
"github.com/golang-jwt/jwt/v4"
"hilo/app/service/user/internal/conf"
"time"
)
// Claims 载荷,增加用户别名
type Claims struct {
UserId int64
ExternalId string
jwt.StandardClaims
}
func GenerateJwtToken(userId int64, externalId string) (string, error) {
jwtConfig := conf.Conf.Auth.Jwt
duration, err := time.ParseDuration(jwtConfig.Expire)
if err != nil {
return "", fmt.Errorf("jwt parse time err: %s", err)
}
expireTime := time.Now().Add(duration)
claims := Claims{
UserId: userId,
ExternalId: externalId,
StandardClaims: jwt.StandardClaims{
ExpiresAt: expireTime.Unix(), //过期时间
Issuer: jwtConfig.Issuer, //签名的发行者
},
}
tokenClaims := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
token, err := tokenClaims.SignedString([]byte(jwtConfig.Secret))
return token, err
}
package server
import (
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/middleware/recovery"
"github.com/go-kratos/kratos/v2/middleware/tracing"
"github.com/go-kratos/kratos/v2/transport/grpc"
"hilo/api/service/user"
"hilo/app/service/user/internal/conf"
"hilo/app/service/user/internal/handler"
"time"
)
// NewGRPCServer new a gRPC server.
func NewGRPCServer(c *conf.Server, svc *handler.UserService) *grpc.Server {
var opts = []grpc.ServerOption{
grpc.Middleware(
recovery.Recovery(),
tracing.Server(),
ValidateParams(),
),
}
if c.Grpc.Addr != "" {
opts = append(opts, grpc.Address(c.Grpc.Addr))
}
if c.Grpc.Timeout != 0 {
opts = append(opts, grpc.Timeout(time.Duration(c.Grpc.Timeout)*time.Second))
}
srv := grpc.NewServer(opts...)
user.RegisterUserServer(srv, svc)
logHelper = log.NewHelper(log.GetLogger())
return srv
}
package server
import (
"context"
"github.com/go-kratos/kratos/v2/middleware"
"github.com/go-kratos/kratos/v2/transport"
"hilo/common/errm"
"hilo/common/validate"
)
// ValidateParams 验证参数
func ValidateParams() middleware.Middleware {
return func(handler middleware.Handler) middleware.Handler {
return func(ctx context.Context, req interface{}) (interface{}, error) {
if tr, ok := transport.FromServerContext(ctx); ok {
err := validate.Struct(req)
if err != nil {
logHelper.WithContext(ctx).Warnf("[%s]参数验证失败: %s", tr.Operation(), err.Error())
return nil, errm.ParamsError(err.Error())
}
}
return handler(ctx, req)
}
}
}
package server
import (
"github.com/go-kratos/kratos/contrib/registry/consul/v2"
"github.com/go-kratos/kratos/v2/log"
"github.com/google/wire"
"github.com/hashicorp/consul/api"
"hilo/app/service/user/internal/conf"
)
// ProviderSet is server providers.
var (
ProviderSet = wire.NewSet(NewGRPCServer, NewConsulRegister)
logHelper *log.Helper
)
func NewConsulRegister(conf *conf.Consul) *consul.Registry {
cfg := api.DefaultConfig()
cfg.Address = conf.Addr
consulClient, err := api.NewClient(cfg)
if err != nil {
panic(err)
}
registry := consul.New(consulClient,
consul.WithHealthCheck(true),
)
return registry
}
package service
import (
"context"
"github.com/spf13/cast"
"gorm.io/gorm"
"hilo/api/service/mgr"
"hilo/app/service/user/internal/model"
"hilo/common/mysql"
)
func (s *UserService) GetUserDetail(ctx context.Context, user *model.User) (*model.CvUserDetail, error) {
userId := user.Id
//统计喜欢
var likeN int64
err := s.dao.DB.Model(&model.UserLike{}).Where(&model.UserLike{UserId: userId}).Count(&likeN).Error
if err != nil {
return nil, err
}
//统计是否存在会话
var sessionN int64
err = s.dao.DB.Model(&model.SessionView{}).Where(&model.SessionView{OtherUserId: userId}).Count(&sessionN).Error
if err != nil {
return nil, err
}
var likeMe int64
err = s.dao.DB.Model(&model.UserLike{}).Where(&model.UserLike{LikeUserId: userId}).Count(&likeMe).Error
if err != nil {
return nil, err
}
var wealthUserScore *model.MatchWealthUserScore
if err = s.dao.DB.Model(&model.MatchWealthUserScore{}).Where(&model.MatchWealthUserScore{UserId: userId}).First(&wealthUserScore).Error; err != nil {
if err != nil {
if err == gorm.ErrRecordNotFound {
wealthUserScore = &model.MatchWealthUserScore{
UserId: userId,
Score: 0,
Grade: 0,
}
} else {
return nil, err
}
}
}
var charmUserScore model.MatchCharmUserScore
if err = s.dao.DB.Model(&model.MatchCharmUserScore{}).Where(model.MatchCharmUserScore{
UserId: userId,
}).First(&charmUserScore).Error; err != nil {
if err != nil {
if err == gorm.ErrRecordNotFound {
charmUserScore = model.MatchCharmUserScore{
UserId: userId,
Score: 0,
Grade: 0,
}
} else {
return nil, err
}
}
}
var activityUserScore model.MatchActityUserScore
if err = s.dao.DB.Model(&model.MatchActityUserScore{}).Where(&model.MatchActityUserScore{
UserId: userId,
}).First(&activityUserScore).Error; err != nil {
if err != nil {
if err == gorm.ErrRecordNotFound {
activityUserScore = model.MatchActityUserScore{
UserId: userId,
Score: 0,
Grade: 0,
}
} else {
return nil, err
}
}
}
isVip, expireTime, err := s.IsVip(userId)
if err != nil {
return nil, err
}
headwear, err := s.GetCvHeadwear(userId)
if err != nil {
return nil, err
}
medals := make(map[uint64][]int, 0)
medal, err := s.dao.GetUserMedal(userId)
if err != nil {
return nil, err
}
medals[uint64(userId)] = medal
medals, medalInfo, err := s.getMedalInfoMap(medals)
if err != nil {
return nil, err
}
//rooms TODO
groupPowerId, groupPowerName, err := s.GetUserGroupPowerInfo(userId)
if err != nil {
return nil, err
}
//mp, err := s.dao.BatchGetPropertyMapByUserIds([]int64{userId})
//if err != nil {
// return nil, err
//}
// properties TODO
ride := &model.CvProperty{}
noble, err := s.FindActiveNoble(userId)
if err != nil {
return nil, err
}
userTradeUnion, err := s.GetUserTradeUnion(userId)
if err != nil {
return nil, err
}
superManagerMap, err := s.GetSuperManagerMap([]int64{userId})
if err != nil {
return nil, err
}
cvUserDetail := &model.CvUserDetail{
CvUserBase: model.CvUserBase{
Id: user.Id,
Avatar: IfLogoutStr(IfLogout(user.LogoutTime), "", user.Avatar),
DefaultAvatar: cast.ToBool(user.DefaultAvatar),
ExternalId: user.ExternalId,
Nick: IfLogoutStr(IfLogout(user.LogoutTime), user.Code, user.Nick),
Description: IfLogoutStr(IfLogout(user.LogoutTime), "", user.Description),
Sex: uint8(user.Sex),
Country: user.Country,
CountryIcon: user.CountryIcon,
Code: user.Code,
IsPrettyCode: user.IsPrettyCode(),
IsVip: isVip,
IsOfficialStaff: superManagerMap[userId],
VipExpireTime: expireTime,
Medals: IfLogoutMedals(IfLogout(user.LogoutTime), []int{}, medals[uint64(userId)]),
MedalInfo: IfLogoutMedalInfo(IfLogout(user.LogoutTime), []*model.CvMedal{}, medalInfo[uint64(userId)]),
Headwear: IfLogoutHeadwear(IfLogout(user.LogoutTime), nil, headwear),
Ride: IfLogoutRide(IfLogout(user.LogoutTime), &model.CvProperty{}, ride),
},
IsPush: uint8(user.IsPush),
IsLike: likeN > 0,
IsLikeMe: likeMe > 0,
WealthUserGrade: wealthUserScore.Grade,
CharmUserGrade: charmUserScore.Grade,
ActivityUserGrade: activityUserScore.Grade,
CurrentRoom: "0",
MyGroupPower: groupPowerId,
MyGroupPowerName: groupPowerName,
}
if noble != nil {
cvUserDetail.Noble = &model.CvNoble{
Level: uint16(noble.Level),
EndTime: noble.EndTime.Unix(),
}
}
//本人,计算,喜欢统计,钻石数量
cvUserDetail.IsShowAge = uint8(user.IsShowAge)
cvUserDetail.Birthday = user.Birthday
//喜欢统计
var userCount model.UserCount
err = s.dao.DB.Model(&model.UserCount{}).Where(&model.UserCount{
UserId: userId,
Type: model.CountTypeLikeMe,
}).First(&userCount).Error
if err != nil && err != gorm.ErrRecordNotFound {
return nil, err
}
cvUserDetail.LikeCount = userCount.Num
//我喜欢统计
var userILikeCount model.UserCount
err = s.dao.DB.Where(&model.UserCount{
UserId: userId,
Type: model.CountTypeLike,
}).First(&userILikeCount).Error
if err != nil && err != gorm.ErrRecordNotFound {
return nil, err
}
cvUserDetail.ILikeCount = userILikeCount.Num
//访问统计
var visitCount int64
err = s.dao.DB.Model(&model.UserVisit{}).Where(&model.UserVisit{
VisitUserId: userId,
}).Count(&visitCount).Error
if err != nil && err != gorm.ErrRecordNotFound {
return nil, err
}
cvUserDetail.VisitCount = int(visitCount)
//钻石数量
cvDiamond, err := s.dao.GetDiamond(userId)
if err != nil {
return nil, err
}
cvUserDetail.DiamondNum = cvDiamond.DiamondNum
isAgent, _ := s.dao.MgrClient.IsAgent(ctx, &mgr.IsAgentReq{UserId: userId})
cvUserDetail.IsAgentMgr = isAgent.Ok
if userTradeUnion == nil {
cvUserDetail.IsTradeUnion = false
cvUserDetail.IsTradeUnionMatchNotification = false
} else {
cvUserDetail.IsTradeUnion = true
cvUserDetail.IsTradeUnionMatchNotification = mysql.OpenClose(userTradeUnion.MatchNotification) == mysql.OPEN
}
// 永恒之心的值 TODO
//hv, ok := hvMap[user.ID]
//if ok {
// cvUserDetail.HeartValue = hv.HeartValue
// cvUserDetail.HeartValueMax = hv.HeartValueMax
// cvUserDetail.MeetDays = hv.MeetDays
//} else {
// cvUserDetail.HeartValueMax = 0
//}
cvUserDetail.HeartValueMax = 0
return cvUserDetail, nil
}
func (s *UserService) getMedalInfoMap(medals map[uint64][]int) (map[uint64][]int, map[uint64][]*model.CvMedal, error) {
resMedals, err := s.dao.GetAllMedalMap()
if err != nil {
return nil, nil, err
}
medalIds := make(map[uint64][]int)
medalMap := make(map[uint64][]*model.CvMedal, 0)
// 只选择合法的勋章
for u, i := range medals {
medalIds[u] = make([]int, 0)
medalMap[u] = make([]*model.CvMedal, 0)
for _, j := range i {
if e, ok := resMedals[j]; ok {
medalIds[u] = append(medalIds[u], j)
medalMap[u] = append(medalMap[u], &model.CvMedal{
Id: uint32(j),
PicUrl: e.PicUrl,
EffectUrl: e.SvgaUrl,
})
}
}
}
return medalIds, medalMap, nil
}
func (s *UserService) GetUserGroupPowerInfo(userId int64) (int64, string, error) {
gpu, err := s.dao.GetGroupPowerUser(userId)
if err != nil {
return 0, "", err
}
if gpu == nil || gpu.GroupPowerId == 0 {
return 0, "", nil
}
gp, err := s.dao.GetGroupPower(gpu.GroupPowerId)
if err != nil {
return 0, "", err
}
powerName := ""
if gp != nil && len(gp.GroupUid) > 0 {
gi, err := s.dao.GetGroupInfo(gp.GroupUid)
if err != nil {
return 0, "", err
}
if gi != nil {
// 只要前15个字
s := []rune(gi.Name)
if len(s) <= 15 {
powerName = string(s)
} else {
powerName = string(s[0:15])
}
}
}
return gpu.GroupPowerId, powerName, nil
}
func (s *UserService) FindActiveNoble(userId int64) (*model.UserNoble, error) {
records, err := s.dao.ListNoble(userId)
if err != nil {
return nil, err
}
if len(records) <= 0 {
return nil, nil
}
return records[0], nil
}
// GetUserTradeUnion 判断是否工会
func (s *UserService) GetUserTradeUnion(userId int64) (*model.UserTradeUnion, error) {
var userTradeUnion model.UserTradeUnion
if err := s.dao.DB.Model(&model.UserTradeUnion{
UserId: userId,
}).First(&userTradeUnion).Error; err != nil {
if err == gorm.ErrRecordNotFound {
return nil, nil
} else {
return nil, err
}
}
return &userTradeUnion, nil
}
func (s *UserService) GetSuperManagerMap(userIds []int64) (map[int64]bool, error) {
if len(userIds) == 0 {
return map[int64]bool{}, nil
}
var superManagers = make([]*model.SuperManager, 0)
if err := s.dao.DB.Model(&model.SuperManager{}).Where("user_id in (?)", userIds).
Find(&superManagers).Error; err != nil {
return nil, err
}
//转换成map
rs := map[int64]bool{}
for i, _ := range userIds {
rs[userIds[i]] = false
}
for i := range superManagers {
rs[superManagers[i].UserId] = true
}
return rs, nil
}
package service
import "hilo/common/errm"
var (
UserFreeze = errm.New(9000, "freeze")
PhoneTokenFail = errm.New(2002, "Not yet registered, please use other login methods to register")
AuthAccessTokenFail = errm.New(2009, "auth access token fail")
RegisterFail = errm.New(2010, "Register Fail")
)
package service
import (
"gorm.io/gorm"
"hilo/app/service/user/internal/model"
"time"
)
func (s *UserService) GetCvHeadwear(userId int64) (*model.CvHeadwear, error) {
userHeadwear := model.UserHeadwear{}
if err := s.dao.DB.Model(&model.UserHeadwear{}).Where(&model.UserHeadwear{
UserId: userId,
}).Where("end_time >= ?", time.Now()).Order("`using` DESC, updated_time DESC").First(&userHeadwear).Error; err != nil {
if err == gorm.ErrRecordNotFound {
return nil, nil
} else {
return nil, err
}
}
// res暂时未拆服务
resHeadwear := model.ResHeadwear{}
if err := s.dao.DB.Model(&model.ResHeadwear{}).First(&resHeadwear, userHeadwear.HeadwearId).Error; err != nil {
return nil, err
}
return &model.CvHeadwear{
Id: uint64(userHeadwear.HeadwearId),
PicUrl: resHeadwear.PicUrl,
EffectUrl: resHeadwear.EffectUrl,
Using: userHeadwear.Using == model.UserHeadwearYesUsing,
}, nil
}
package service
import (
"context"
"crypto/rsa"
"encoding/base64"
"encoding/json"
"github.com/golang-jwt/jwt/v4"
"github.com/spf13/cast"
"github.com/tidwall/gjson"
"google.golang.org/grpc/peer"
"hilo/api/service/country"
"hilo/api/service/mgr"
"hilo/api/service/user"
"hilo/app/service/user/internal/conf"
"hilo/app/service/user/internal/model"
"hilo/app/service/user/internal/pkg"
"hilo/common/aws"
"hilo/common/errm"
"hilo/common/httpclient"
"hilo/common/mysql"
"hilo/common/tencent"
"hilo/common/util"
"math/big"
"net"
"strings"
"time"
)
const (
PublicKeyReqUrl = "https://appleid.apple.com/auth/keys"
AppleUrl = "https://appleid.apple.com"
ApplicationClientId = "com.qiahao.nextvideo"
)
type JwtClaims struct {
jwt.StandardClaims
}
type JwtHeader struct {
Kid string `json:"kid"`
Alg string `json:"alg"`
}
type JwtKeys struct {
Kty string `json:"kty"`
Kid string `json:"kid"`
Use string `json:"use"`
Alg string `json:"alg"`
N string `json:"n"`
E string `json:"e"`
}
func (s *UserService) Login(ctx context.Context, req *user.LoginReq) (*user.LoginRep, error) {
var imei string
if imei != "" {
res, err := s.dao.MgrClient.CheckMgrImeiExist(ctx, &mgr.CheckMgrImeiExistReq{Imei: imei})
if err != nil {
return nil, errm.CommonError(err.Error())
}
if res.Ok == false {
return nil, UserFreeze
}
}
var ip string
if pr, ok := peer.FromContext(ctx); ok {
if tcpAddr, ok := pr.Addr.(*net.TCPAddr); ok {
ip = tcpAddr.IP.String()
} else {
ip = pr.Addr.String()
}
}
//if ip != "" {
// resp, err := s.dao.MgrClient.CheckMgrIpExist(ctx, &mgr.CheckMgrIpExistReq{Ip: ip})
// if err != nil {
// return nil, errm.CommonError(err.Error())
// }
// if resp.Ok == false {
// s.log.WithContext(ctx).Error(UserFreeze)
// return nil, UserFreeze
// }
//}
var (
userInfo *model.User
)
flag, token, userInfo, err := s.logoutCheckOauth(req.ThirdPartyId, int(req.ThirdPartyType))
if err != nil {
return nil, err
}
if conf.AppIsRelease() {
if ok := s.verifyAuthToken(req.ThirdPartyId, req.ThirdPartyType, req.ThirdPartyToken, token); !ok {
if req.ThirdPartyType == user.EThirdPartyType_Phone {
return nil, PhoneTokenFail
} else {
return nil, AuthAccessTokenFail
}
}
}
if !flag {
//不是空图片,上传到AWS
if req.Avatar != "" {
image, err := aws.Global.UploadImage(req.Avatar)
if err != nil {
return nil, err
} else {
req.Avatar = image
}
}
// 注册
userInfo, err = s.register(ctx, imei, ip, req)
if err != nil {
return nil, err
}
//userId = u.Id
} else {
// 登陆成功
// 更新平台信息
userInfo.DeviceType = pkg.GetDeviceType(ctx)
_, err = s.dao.UpdateUser(userInfo.Id, userInfo)
if err != nil {
return nil, err
}
}
// 可以异步执行, 错误不处理
err2 := s.dao.AddUserIp(userInfo.Id, ip)
if err2 != nil {
s.log.Errorf("add user ip err : %s", err2)
}
mgrStatus, eTime, err := s.SyncMgrUserStatus(ctx, userInfo.Id)
if err != nil {
return nil, err
}
if mgrStatus == mgr.UserStatus_Freeze {
return nil, UserFreeze.WithMetadata(map[string]string{"timestamp": cast.ToString(eTime)})
}
txSig, err := tencent.Global.GetUserSig(userInfo.ExternalId)
if err != nil {
return nil, err
}
// 兼容于ios就版本,不然ios就退登 // 融云 TODO
//if strings.Index(c.GetHeader("User-Agent"), "Hilo/1.4.1 (iPhone") >= 0 {
// ryToken, _ = rongyun.Auth(string(user.ExternalId), string(paramUserLogin.Nick), string(paramUserLogin.Avatar))
//}
jwtToken, err := pkg.GenerateJwtToken(userInfo.Id, userInfo.ExternalId)
if err != nil {
return nil, err
}
detail, err := s.GetUserDetail(ctx, userInfo)
if err != nil {
return nil, err
}
res := &user.LoginRep{
Token: jwtToken,
RongyunToken: txSig,
TencentyunToken: txSig,
ThirdPartyType: req.ThirdPartyType,
User: &user.CvUserDetail{
ILikeCount: int32(detail.ILikeCount),
LikeCount: 0,
VisitCount: 0,
IsPush: 0,
DiamondNum: 0,
IsLike: false,
IsSession: false,
IsLikeMe: false,
HeartValue: 0,
HeartValueMax: 0,
MeetDays: 0,
WealthUserGrade: 0,
CharmUserGrade: 0,
ActivityUserGrade: 0,
CurrentRoom: "",
MyGroupPower: 0,
MyGroupPowerName: "",
Info: &user.UserBase{
Id: 0,
Avatar: "",
DefaultAvatar: false,
ExternalId: "",
Nick: "",
Description: "",
ESex: 0,
Country: "",
CountryIcon: "",
Code: "",
IsPrettyCode: false,
IsLogout: false,
Birthday: 0,
IsShowAge: false,
IsTradeUnion: false,
IsAgentMgr: false,
IsTradeUnionMatchNotification: false,
IsVip: false,
IsOfficialStaff: false,
VipExpireTime: 0,
Medals: nil,
MedalInfo: nil,
Headwear: nil,
Ride: nil,
Noble: nil,
},
},
}
return res, nil
}
func (s *UserService) SyncMgrUserStatus(ctx context.Context, userId int64) (mgr.UserStatus, int64, error) {
res, err := s.dao.MgrClient.GetMgrUserStatus(ctx, &mgr.GetMgrUserStatusReq{UserId: userId})
if err != nil {
return mgr.UserStatus_None, 0, err
}
if res.Status == mgr.UserStatus_Normal {
if res.EndTime == nil {
return mgr.UserStatus_Freeze, 0, nil
}
now := time.Now()
et := res.EndTime.AsTime()
if now.After(et) {
_, err2 := s.dao.UpdateUser(userId, &model.User{Status: model.UserNormalStatus})
if err2 != nil {
s.log.Errorf("UpdateUser status err: %s", err2)
}
return mgr.UserStatus_Normal, 0, nil
} else {
return mgr.UserStatus_Freeze, et.Unix() - now.Unix(), nil
}
}
return mgr.UserStatus_Normal, 0, nil
}
func (s *UserService) register(ctx context.Context, imei string, ip string, req *user.LoginReq) (*model.User, error) {
if conf.AppIsRelease() {
if imei != "" {
if c, err := s.dao.CountImei(imei); err != nil {
return nil, errm.DbError(err.Error())
} else if int(c) > conf.Conf.Auth.ImeiTotalLimit {
return nil, RegisterFail
}
if c, err := s.dao.CountImeiThird(imei, int(req.ThirdPartyType)); err != nil {
return nil, errm.DbError(err.Error())
} else if int(c) > conf.Conf.Auth.ImeiOauthLimit {
return nil, RegisterFail
}
}
if ip != "" {
beginTime := time.Now().Add(-1 * time.Duration(conf.Conf.Auth.AccountIpDurationLimit) * time.Second)
if c, err := s.dao.CountIp(ip, beginTime); err != nil {
return nil, errm.DbError(err.Error())
} else if int(c) > conf.Conf.Auth.AccountIpLimit {
return nil, RegisterFail
}
}
}
//userOauth := &model.UserOauth{
// ThirdPartyId: req.ThirdPartyId,
// ThirdPartyType: int(req.ThirdPartyType),
// ThirdPartyToken: req.ThirdPartyToken,
//}
if req.Avatar != "" {
req.Avatar = pkg.MakeFullUrl(req.Avatar)
}
countryIcon := ""
if req.Country != "" {
res, err := s.dao.CountryClient.GetCountryByShortName(ctx, &country.GetCountryByShortNameReq{
ShortName: req.Country,
})
if err != nil {
return nil, err
}
countryIcon = res.Data.Icon
req.Country = res.Data.Name
}
u := &model.User{
ExternalId: util.GetRandStrByUUID(),
Avatar: req.Avatar,
DefaultAvatar: 1,
Nick: req.Nick,
Sex: int(req.Sex),
Birthday: 0,
Country: req.Country,
CountryIcon: countryIcon,
Description: "",
IsPush: int(mysql.CLOSE),
IsShowAge: int(mysql.OPEN),
DeviceType: pkg.GetDeviceType(ctx),
}
cu, err := s.dao.CreateUser(u)
if err != nil {
return nil, errm.DbError(err.Error())
}
err = tencent.Global.UserRegister(ctx, cu.ExternalId, cu.Nick, cu.Avatar)
if err != nil {
s.log.WithContext(ctx).Errorf("tencent register err : %s", err)
return nil, err
}
// TODO: 新增金币等事件发布, 服务间异步通信可以考虑broker
return u, nil
}
func (s *UserService) logoutCheckOauth(thirdPartyId string, thirdPartyType int) (
flag bool, phoneToken string, u *model.User, err error,
) {
userOauth, err2 := s.dao.GetUserOauth(thirdPartyId, thirdPartyType)
if err2 != nil {
err = err2
return
}
if userOauth == nil {
return
}
u, err2 = s.dao.GetUser(userOauth.UserId)
if err2 != nil {
err = err2
return
}
if u.LogoutTime > 0 && (time.Now().Unix() > u.LogoutTime) {
//userOauth.ThirdPartyId = userOauth.ThirdPartyId + "&" + pkg.GetRandStrByUUID()
userOauth.ThirdPartyId = ""
_, err2 := s.dao.UpdateUserOauth(u.Id, userOauth)
if err2 != nil {
err = err2
return
}
} else {
phoneToken = userOauth.ThirdPartyToken
flag = true
}
return
}
func (s *UserService) verifyAuthToken(thirdPartyId string, thirdPartyType user.EThirdPartyType, thirdPartyToken string, phoneToken string) bool {
switch thirdPartyType {
case user.EThirdPartyType_Google:
return s.verifyGoogleToken(thirdPartyToken)
case user.EThirdPartyType_Facebook:
return s.verifyFaceBookToken(thirdPartyId, thirdPartyToken)
case user.EThirdPartyType_Apple:
return s.verifyAppleIdentityToken(thirdPartyToken, thirdPartyId)
case user.EThirdPartyType_WeChat:
return s.verifyWechatToken(thirdPartyId, thirdPartyToken)
case user.EThirdPartyType_Phone:
/*if (thirdPartyId == "12610000999" && thirdPartyToken == "Hilo2020") || (thirdPartyId == "12610000001" && thirdPartyToken == "Hilo@05#A") {
return true
}*/
//同时拦截phone的注册,不允许phone的注册,想通过phone
if thirdPartyToken != "" && phoneToken != "" && thirdPartyToken == phoneToken {
return true
}
}
return false
}
/**
* 校验wechat
**/
func (s *UserService) verifyWechatToken(thirdPartyId string, thirdPartyToken string) bool {
url := "https://api.weixin.qq.com/sns/auth?access_token=" + thirdPartyToken + "&openid=" + thirdPartyId
resString, err := httpclient.GetRemoteContent(url)
if err != nil {
s.log.Error(err)
return false
}
errcode := gjson.Get(resString, "errcode").String()
if errcode != "0" {
s.log.Error("wechat 校验失败,结果:", errcode, " opneId:", thirdPartyId, " token:", thirdPartyToken)
return false
}
return true
}
func (s *UserService) verifyFaceBookToken(thirdPartyId string, thirdPartyToken string) bool {
url := "https://graph.facebook.com/" + thirdPartyId + "?fields=id,name,gender,picture&access_token=" + thirdPartyToken
resString, err := httpclient.GetRemoteContent(url)
if err != nil {
s.log.Error(err)
return false
}
infoID := gjson.Get(resString, "id").String()
if len(infoID) > 0 {
return true
}
return false
}
func (s *UserService) verifyGoogleToken(thirdPartyToken string) bool {
tokenEncode, explodeBool := explodeToken(thirdPartyToken)
if !explodeBool {
s.log.Errorf("google token 校验失败:%v", thirdPartyToken)
return false
}
tokenDecode, err := base64.RawURLEncoding.DecodeString(tokenEncode)
if err != nil {
s.log.Error(err)
return false
}
tokenDecodeJson := string(tokenDecode)
androidTokenRes := gjson.GetMany(tokenDecodeJson, "iss", "azp", "aud", "sub")
if androidTokenRes[0].String() == "https://accounts.google.com" &&
len(androidTokenRes[1].String()) > 0 &&
len(androidTokenRes[2].String()) > 0 && len(androidTokenRes[3].String()) > 0 {
return true
}
return true
}
func explodeToken(thirdPartyToken string) (string, bool) {
tokens := strings.Split(thirdPartyToken, ".")
if len(tokens) != 3 {
return "", false
}
return tokens[1], true
}
// 认证客户端传递过来的token是否有效
func (s *UserService) verifyAppleIdentityToken(cliToken string, cliUserID string) bool {
// 数据由 头部、载荷、签名 三部分组成
cliTokenArr := strings.Split(cliToken, ".")
if len(cliTokenArr) < 3 {
//syslog.Logger().Errorln("cliToken Split err ! cliToken = ", cliToken)
s.log.Error("cliToken Split err")
return false
}
// 解析cliToken的header获取kid
cliHeader, err := jwt.DecodeSegment(cliTokenArr[0])
if err != nil {
//syslog.Logger().Errorln(err.Error())
s.log.Errorf("VerifyIdentityToken err :%v", err)
return false
}
var jHeader JwtHeader
err = json.Unmarshal(cliHeader, &jHeader)
if err != nil {
//syslog.Logger().Errorln(err.Error())
s.log.Errorf("VerifyIdentityToken err :%v", err)
return false
}
// 效验pubKey 及 token
token, err := jwt.ParseWithClaims(cliToken, &JwtClaims{}, func(token *jwt.Token) (interface{}, error) {
return GetRSAPublicKey(jHeader.Kid), nil
})
if err != nil {
//syslog.Logger().Errorln(err.Error())
s.log.Errorf("VerifyIdentityToken err :%v", err)
return false
}
// 信息验证
if claims, ok := token.Claims.(*JwtClaims); ok && token.Valid {
if claims.Issuer != AppleUrl || claims.Audience != ApplicationClientId || claims.Subject != cliUserID {
//syslog.Logger().Errorln("verify token info fail, info is not match")
s.log.Errorf("verify token info fail, info is not match")
return false
}
// here is verify ok !
} else {
s.log.Errorf("token claims parse fail")
return false
}
return true
}
// GetRSAPublicKey 向苹果服务器获取解密signature所需要用的publicKey
func GetRSAPublicKey(kid string) *rsa.PublicKey {
response, err := httpclient.GetRemoteBody(PublicKeyReqUrl)
if err != nil {
//syslog.Logger().Errorln(err.Error())
return nil
}
var jKeys map[string][]JwtKeys
err = json.Unmarshal(response, &jKeys)
if err != nil {
//syslog.Logger().Errorln(err.Error())
return nil
}
// 获取验证所需的公钥
var pubKey rsa.PublicKey
// 通过cliHeader的kid比对获取n和e值 构造公钥
for _, data := range jKeys {
for _, val := range data {
if val.Kid == kid {
nBin, _ := base64.RawURLEncoding.DecodeString(val.N)
nData := new(big.Int).SetBytes(nBin)
eBin, _ := base64.RawURLEncoding.DecodeString(val.E)
eData := new(big.Int).SetBytes(eBin)
pubKey.N = nData
pubKey.E = int(eData.Uint64())
break
}
}
}
if pubKey.E <= 0 {
//syslog.Logger().Errorln("rsa.PublicKey get fail !")
return nil
}
return &pubKey
}
package service
import "github.com/google/wire"
var ProviderSet = wire.NewSet(NewUserService)
package service
import (
"github.com/go-kratos/kratos/v2/log"
"hilo/app/service/user/internal/dao"
"hilo/app/service/user/internal/model"
"time"
)
type UserService struct {
dao *dao.Dao
log *log.Helper
}
func NewUserService(dao *dao.Dao) *UserService {
return &UserService{
dao: dao,
log: log.NewHelper(log.GetLogger()),
}
}
func IfLogout(logoutTime int64) bool {
return logoutTime > 0 && time.Now().Unix() > logoutTime
}
func IfLogoutMedals(condition bool, trueVal, falseVal []int) []int {
if condition {
return trueVal
}
return falseVal
}
func IfLogoutMedalInfo(condition bool, trueVal, falseVal []*model.CvMedal) []*model.CvMedal {
if condition {
return trueVal
}
return falseVal
}
func IfLogoutHeadwear(condition bool, trueVal, falseVal *model.CvHeadwear) *model.CvHeadwear {
if condition {
return trueVal
}
return falseVal
}
func IfLogoutRide(condition bool, trueVal, falseVal *model.CvProperty) *model.CvProperty {
if condition {
return trueVal
}
return falseVal
}
func IfLogoutStr(condition bool, trueVal, falseVal string) string {
if condition {
return trueVal
}
return falseVal
}
func IfLogoutNick(condition bool, code string, nick string) string {
if condition {
return "Hilo No." + code
}
return nick
}
package service
// StrNil 空字符串转成nil
func StrNil(msg string) *string {
if msg == "" {
return nil
}
return &msg
}
package service
// IsVip 检查某用户是否Vip
func (s *UserService) IsVip(userId int64) (bool, int64, error) {
uv, err := s.dao.GetVip(userId)
if err != nil {
return false, 0, err
}
if uv == nil {
return false, 0, nil
}
ts := uv.ExpireAt.Unix()
return true, ts, nil
}
package aws
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/s3"
"hilo/common/httpclient"
"hilo/common/util"
//"hilo/biz/util"
//hiloCfg "hilo/common/config"
//"hilo/common/mylogrus"
"log"
"mime/multipart"
)
var Global *Aws
type (
Config struct {
Bucket string
Cdn string
Dir string
}
Aws struct {
Config *Config
Cfg aws.Config
}
)
func NewAWS(conf *Config) *Aws {
// Load the Shared AWS Configuration (~/.aws/config)
a := &Aws{
Config: conf,
}
var err error = nil
cfg, err := config.LoadDefaultConfig(context.TODO())
if err != nil {
log.Fatal(err)
}
a.Cfg = cfg
return a
}
func SetAws(a *Aws) {
Global = a
}
func (a *Aws) UploadImage(imagPath string) (string, error) {
resp, _ := httpclient.Default.Get(imagPath)
// Create an Amazon S3 service client
client := s3.NewFromConfig(a.Cfg)
fileName := a.Config.Dir + "image/" + util.GetRandStrByUUID()
ct := "image/jpeg"
_, err := client.PutObject(context.TODO(), &s3.PutObjectInput{
Bucket: aws.String(a.Config.Bucket),
Key: aws.String(fileName),
Body: resp.Body,
ContentLength: resp.ContentLength,
ContentType: &ct,
})
if err != nil {
return "", err
}
return fileName, nil
}
func (a *Aws) UploadImageFile(imagFile multipart.File, t string, contentType *string) (string, error) {
// Create an Amazon S3 service client
client := s3.NewFromConfig(a.Cfg)
fileName := a.Config.Dir + "manager/" + t
_, err := client.PutObject(context.TODO(), &s3.PutObjectInput{
Bucket: aws.String(a.Config.Bucket),
Key: aws.String(fileName),
Body: imagFile,
ContentType: contentType,
})
if err != nil {
return "", err
}
return fileName, nil
}
package _const
const (
TraceId = "traceId"
UserId = "userId"
ExternalId = "externalId"
Code = "code"
Nick = "nick"
Avatar = "avatar"
Country = "country"
ExternalId1 = "externalId1"
ExternalId2 = "externalId2"
MgrId = "mgrId"
DeviceType = "deviceType"
DeviceVersion = "deviceVersion"
AppVersion = "appVersion"
ActionResult = "actionResult"
)
package env
const (
LOCAL string = "local"
RELEASE string = "release"
)
......@@ -20,3 +20,6 @@ func CommonError(message string) *errors.Error {
func ParamsError(message string) *errors.Error {
return errors.New(int(ParamsErrorCode), GetCodeText(ParamsErrorCode), message)
}
func DbError(message string) *errors.Error {
return errors.New(int(DbErrorCode), GetCodeText(DbErrorCode), message)
}
package httpclient
import (
"io/ioutil"
"net/http"
"time"
)
var Default *http.Client
func init() {
Default = NewClient()
}
func NewClient() *http.Client {
// TODO: 相关参数可以考虑传参定义
tr := http.DefaultTransport.(*http.Transport).Clone()
tr.MaxIdleConnsPerHost = 32
tr.MaxConnsPerHost = 32
tr.MaxIdleConns = 64
tr.IdleConnTimeout = time.Second * 30
tr.DisableKeepAlives = false
client := &http.Client{
Transport: tr,
Timeout: time.Second * 5,
}
return client
}
func GetRemoteContent(url string) (string, error) {
resp, err := Default.Get(url)
if err != nil {
return "", err
}
defer resp.Body.Close()
body, err2 := ioutil.ReadAll(resp.Body)
if err2 != nil {
return "", err
}
return string(body), nil
}
func GetRemoteBody(url string) ([]byte, error) {
resp, err := Default.Get(url)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err2 := ioutil.ReadAll(resp.Body)
if err2 != nil {
return nil, err
}
return body, nil
}
package mysql
// OpenClose 开启关闭
type OpenClose = uint8
const (
OPEN OpenClose = 1
CLOSE OpenClose = 2
)
......@@ -24,6 +24,7 @@ func NewDB(conf *Config) (db *gorm.DB) {
}
db, err = gorm.Open(mysql.Open(conf.Dsn), &gorm.Config{
SkipDefaultTransaction: true,
Logger: gormLogger.Default.LogMode(level),
})
......
package oss
type Config struct {
OssAccessKeyId string
OssAccessKeySecret string
OssRoleArn string
OssEndPoint string
OssBucket string
OssCdn string
OssExpiredTime uint
OssStsPoint string
OssSts string
OssStsAes string
}
package tencent
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/tencentyun/tls-sig-api-v2-golang/tencentyun"
"hilo/common/httpclient"
"io/ioutil"
)
type (
Config struct {
TencentYunAppId int
TencentYunKey string
}
TencentYun struct {
Config *Config
}
)
var (
Global *TencentYun
)
func SetTencentYun(ty *TencentYun) {
Global = ty
}
func NewTencentYun(conf *Config) *TencentYun {
return &TencentYun{Config: conf}
}
func (t *TencentYun) getAdminSig() (string, error) {
sig, err := tencentyun.GenUserSig(t.Config.TencentYunAppId, t.Config.TencentYunKey, "administrator", 86400*180)
if err != nil {
return "", err
}
return sig, nil
}
func (t *TencentYun) GetUserSig(externalId string) (string, error) {
sig, err := tencentyun.GenUserSig(t.Config.TencentYunAppId, t.Config.TencentYunKey, externalId, 86400*180)
if err != nil {
return "", err
}
return sig, nil
}
func (t *TencentYun) UserRegister(ctx context.Context, externalId string, nick string, avatar string) error {
type BodyStruct struct {
Identifier string
Nick string
FaceUrl string
}
type RespStruct struct {
ActionStatus string
ErrorInfo string
ErrorCode int
}
url, err := t.getLoginUrl()
if err != nil {
return err
}
body := BodyStruct{
Identifier: externalId,
Nick: nick,
FaceUrl: avatar,
}
jsonStr, err := json.Marshal(body)
if err != nil {
return err
}
resp, err := httpclient.Default.Post(url, "application/json", bytes.NewBuffer(jsonStr))
defer resp.Body.Close()
if err != nil {
return err
}
result, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
respStruct := RespStruct{}
if err := json.Unmarshal(result, &respStruct); err != nil {
return err
}
if respStruct.ErrorCode == 0 {
return nil
} else {
return fmt.Errorf(fmt.Sprintf("tencentyun UserRegister resp ErrorCode:%v, ErrorInfo:%v", respStruct.ErrorCode, respStruct.ErrorInfo))
}
}
package tencent
import (
"fmt"
"math/rand"
)
const (
timUrl = "https://console.tim.qq.com/v4"
//loginUrl = timUrl + "/im_open_login_svc/account_import?sdkappid={{appid}}&identifier={{externalId}}&usersig={{userSin}}&random={{random}}&contenttype=json"
)
func (t *TencentYun) getLoginUrl() (string, error) {
sig, err := t.getAdminSig()
if err != nil {
return "", err
}
return fmt.Sprintf("%s/im_open_login_svc/account_import?sdkappid=%d&identifier=%s&usersig=%s&random=%d&contenttype=json",
timUrl,
t.Config.TencentYunAppId,
"administrator",
sig,
rand.Intn(10000),
), nil
}
package hashutil
package util
import "encoding/base64"
......
package hashutil
package util
import (
"crypto/md5"
......
package util
import (
"fmt"
uuid "github.com/satori/go.uuid"
"os"
"strings"
)
func GenServiceId() string {
name, _ := os.Hostname()
return fmt.Sprintf("%s_%s", name, uuid.NewV4().String())
}
func GetRandStrByUUID() string {
return strings.Replace(uuid.NewV4().String(), "-", "", -1)
}
module gokratos-base
module hilo
go 1.17
go 1.18
require (
github.com/gin-gonic/gin v1.8.1
......@@ -23,6 +23,24 @@ require (
require (
github.com/armon/go-metrics v0.3.10 // indirect
github.com/aws/aws-sdk-go v1.44.53 // indirect
github.com/aws/aws-sdk-go-v2 v1.16.7 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3 // indirect
github.com/aws/aws-sdk-go-v2/config v1.15.14 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.12.9 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.9 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.8 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.8 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.11.12 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.16.9 // indirect
github.com/aws/smithy-go v1.12.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fatih/color v1.13.0 // indirect
......@@ -48,6 +66,7 @@ require (
github.com/imdario/mergo v0.3.12 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.4 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect
......@@ -59,10 +78,15 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
github.com/tencentyun/tls-sig-api-v2-golang v1.3.0 // indirect
github.com/tidwall/gjson v1.14.1 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
go.opentelemetry.io/otel v1.8.0 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.8.0 // indirect
......
......@@ -71,6 +71,42 @@ github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8
github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aws/aws-sdk-go v1.44.53 h1:2MErE8gRyBLuE1fuH2Sqlj1xoN3S6/jXb0aO/A1jGfk=
github.com/aws/aws-sdk-go v1.44.53/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go-v2 v1.16.7 h1:zfBwXus3u14OszRxGcqCDS4MfMCv10e8SMJ2r8Xm0Ns=
github.com/aws/aws-sdk-go-v2 v1.16.7/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3 h1:S/ZBwevQkr7gv5YxONYpGQxlMFFYSRfz3RMcjsC9Qhk=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.3/go.mod h1:gNsR5CaXKmQSSzrmGxmwmct/r+ZBfbxorAuXYsj/M5Y=
github.com/aws/aws-sdk-go-v2/config v1.15.14 h1:+BqpqlydTq4c2et9Daury7gE+o67P4lbk7eybiCBNc4=
github.com/aws/aws-sdk-go-v2/config v1.15.14/go.mod h1:CQBv+VVv8rR5z2xE+Chdh5m+rFfsqeY4k0veEZeq6QM=
github.com/aws/aws-sdk-go-v2/credentials v1.12.9 h1:DloAJr0/jbvm0iVRFDFh8GlWxrOd9XKyX82U+dfVeZs=
github.com/aws/aws-sdk-go-v2/credentials v1.12.9/go.mod h1:2Vavxl1qqQXJ8MUcQZTsIEW8cwenFCWYXtLRPba3L/o=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8 h1:VfBdn2AxwMbFyJN/lF/xuT3SakomJ86PZu3rCxb5K0s=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.8/go.mod h1:oL1Q3KuCq1D4NykQnIvtRiBGLUXhcpY5pl6QZB2XEPU=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14 h1:2C0pYHcUBmdzPj+EKNC4qj97oK6yjrUhc1KoSodglvk=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14/go.mod h1:kdjrMwHwrC3+FsKhNcCMJ7tUVj/8uSD5CZXeQ4wV6fM=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8 h1:2J+jdlBJWEmTyAwC82Ym68xCykIvnSnIN18b8xHGlcc=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8/go.mod h1:ZIV8GYoC6WLBW5KGs+o4rsc65/ozd+eQ0L31XF5VDwk=
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15 h1:QquxR7NH3ULBsKC+NoTpilzbKKS+5AELfNREInbhvas=
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.15/go.mod h1:Tkrthp/0sNBShQQsamR7j/zY4p19tVTAs+nnqhH6R3c=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.5 h1:tEEHn+PGAxRVqMPEhtU8oCSW/1Ge3zP5nUgPrGQNUPs=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.0.5/go.mod h1:aIwFF3dUk95ocCcA3zfk3nhz0oLkpzHFWuMp8l/4nNs=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3 h1:4n4KCtv5SUoT5Er5XV41huuzrCqepxlW3SDI9qHQebc=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.3/go.mod h1:gkb2qADY+OHaGLKNTYxMaQNacfeyQpZ4csDTQMeFmcw=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.9 h1:gVv2vXOMqJeR4ZHHV32K7LElIJIIzyw/RU1b0lSfWTQ=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.9/go.mod h1:EF5RLnD9l0xvEWwMRcktIS/dI6lF8lU5eV3B13k6sWo=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.8 h1:oKnAXxSF2FUvfgw8uzU/v9OTYorJJZ8eBmWhr9TWVVQ=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.8/go.mod h1:rDVhIMAX9N2r8nWxDUlbubvvaFMnfsm+3jAV7q+rpM4=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.8 h1:TlN1UC39A0LUNoD51ubO5h32haznA+oVe15jO9O4Lj0=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.13.8/go.mod h1:JlVwmWtT/1c5W+6oUsjXjAJ0iJZ+hlghdrDy/8JxGCU=
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.1 h1:OKQIQ0QhEBmGr2LfT952meIZz3ujrPYnxH+dO/5ldnI=
github.com/aws/aws-sdk-go-v2/service/s3 v1.27.1/go.mod h1:NffjpNsMUFXp6Ok/PahrktAncoekWrywvmIK83Q2raE=
github.com/aws/aws-sdk-go-v2/service/sso v1.11.12 h1:760bUnTX/+d693FT6T6Oa7PZHfEQT9XMFZeM5IQIB0A=
github.com/aws/aws-sdk-go-v2/service/sso v1.11.12/go.mod h1:MO4qguFjs3wPGcCSpQ7kOFTwRvb+eu+fn+1vKleGHUk=
github.com/aws/aws-sdk-go-v2/service/sts v1.16.9 h1:yOfILxyjmtr2ubRkRJldlHDFBhf5vw4CzhbwWIBmimQ=
github.com/aws/aws-sdk-go-v2/service/sts v1.16.9/go.mod h1:O1IvkYxr+39hRf960Us6j0x1P8pDqhTX+oXM5kQNl/Y=
github.com/aws/smithy-go v1.12.0 h1:gXpeZel/jPoWQ7OEmLIgCUnhkFftqNfwWUwAHSlp1v0=
github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
......@@ -312,6 +348,9 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.4 h1:tHnRBy1i5F2Dh8BAFxqFzxKqqvezXrL2OW1TnX+Mlas=
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
......@@ -431,6 +470,8 @@ github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUA
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shirou/gopsutil/v3 v3.21.8/go.mod h1:YWp/H8Qs5fVmf17v7JNZzA0mPJ+mS2e9JdiUF9LlKzQ=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
......@@ -459,6 +500,14 @@ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMT
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI=
github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs=
github.com/tencentyun/tls-sig-api-v2-golang v1.3.0 h1:mW4onVqOP6MqkJtTay74Tch6NvjwQRXeCuhUC/p6YYk=
github.com/tencentyun/tls-sig-api-v2-golang v1.3.0/go.mod h1:0L1MSijyEq6a74xZ02h0qKfN8y6RcvDiNabIZWXereE=
github.com/tidwall/gjson v1.14.1 h1:iymTbGkQBhveq21bEvAQ81I0LEBork8BFe1CUZXdyuo=
github.com/tidwall/gjson v1.14.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=
github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
......
......@@ -3,172 +3,8 @@
openapi: 3.0.3
info:
title: Demo API
description: 定义服务
title: ""
version: 0.0.1
paths:
/demo/create:
post:
tags:
- Demo
operationId: Demo_Create
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/demo.CreateReq'
required: true
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/demo.OKRep'
/demo/delete:
get:
tags:
- Demo
operationId: Demo_Delete
parameters:
- name: id
in: query
schema:
type: integer
format: int64
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/demo.OKRep'
/demo/get:
get:
tags:
- Demo
operationId: Demo_Get
parameters:
- name: id
in: query
schema:
type: integer
format: int64
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/demo.DemoModel'
/demo/hello/{name}:
get:
tags:
- Demo
operationId: Demo_Hello
parameters:
- name: name
in: path
required: true
schema:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/demo.HelloRep'
/demo/list:
get:
tags:
- Demo
operationId: Demo_List
parameters:
- name: page
in: query
schema:
type: integer
format: int64
- name: size
in: query
schema:
type: integer
format: int64
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/demo.ListRep'
/demo/update:
post:
tags:
- Demo
operationId: Demo_Update
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/demo.UpdateReq'
required: true
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/demo.OKRep'
paths: {}
components:
schemas:
demo.CreateReq:
type: object
properties:
name:
type: string
value:
type: string
demo.DemoModel:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
value:
type: string
createdAt:
type: integer
format: int64
updatedAt:
type: integer
format: int64
demo.HelloRep:
type: object
properties:
message:
type: string
demo.ListRep:
type: object
properties:
list:
type: array
items:
$ref: '#/components/schemas/demo.DemoModel'
demo.OKRep:
type: object
properties: {}
demo.UpdateReq:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
value:
type: string
tags:
- name: Demo
schemas: {}
#!/bin/bash
# 编译指定类型的所有项目 ./script/build-all.sh service
# 有命令错误直接退出脚本
set -e
# 项目类型
project_type=$1
if [[ -z $project_type ]]; then
echo '项目类型不能为空'
exit 1
fi
# 获取项目根目录
root=$(dirname $(cd $(dirname $0) && pwd))
cd $root
for sub in app/$project_type/*; do
cd $sub
echo "start build ${sub} ..."
mkdir -p bin | true
project=${sub##*/} # 根据路径截取项目名
go build -o bin/hilo-$project_type-$project ./cmd/$project
echo "finish build ${sub}"
echo ''
cd $root
done
......@@ -16,9 +16,15 @@ fi
root=$(dirname $(cd $(dirname $0) && pwd))
cd $root
COMMON_PROTO_FILES=$(find api/common -name *.proto)
API_PROTO_FILES=$(find api/$project_type/$project -name *.proto)
protoc --proto_path=./api/common \
--go_out=paths=source_relative:./api/common \
$COMMON_PROTO_FILES
protoc --proto_path=./api/$project_type/$project \
--proto_path=./api \
--proto_path=./third_party \
--go_out=paths=source_relative:./api/$project_type/$project \
--go-http_out=paths=source_relative:./api/$project_type/$project \
......
......@@ -47,9 +47,12 @@ replace() {
# 重命名目录和文件
mv api/$project_type/$project/demo.proto api/$project_type/$project/$project.proto
mv app/$project_type/$project/cmd/demo app/$project_type/$project/cmd/$project
mv app/$project_type/$project/internal/biz/demo.go app/$project_type/$project/internal/biz/$project.go
mv app/$project_type/$project/internal/data/demo.go app/$project_type/$project/internal/data/$project.go
mv app/$project_type/$project/internal/service/demo.go app/$project_type/$project/internal/service/$project.go
mv app/$project_type/$project/internal/dao/demo.go app/$project_type/$project/internal/dao/$project.go
mv app/$project_type/$project/internal/handler/demo.go app/$project_type/$project/internal/handler/$project.go
# 排除搜索bin二进制目录
rm -rf app/$project_type/$project/bin/*
# 替换文件内容, linux和mac的sed命令有点区别
if [[ $os = "Darwin" ]]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment