Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into liwei
This commit is contained in:
commit
f0df016e8b
@ -9,6 +9,8 @@ import (
|
|||||||
|
|
||||||
func (r *Robot) handleFriendMsg(msg *pb.UserMessage) {
|
func (r *Robot) handleFriendMsg(msg *pb.UserMessage) {
|
||||||
switch msg.SubType {
|
switch msg.SubType {
|
||||||
|
case friend.Friend_SubType_List:
|
||||||
|
r.handleFriendList(msg)
|
||||||
case friend.Friend_SubType_Apply:
|
case friend.Friend_SubType_Apply:
|
||||||
r.handleFriendApply(msg)
|
r.handleFriendApply(msg)
|
||||||
case friend.Friend_SubType_ApplyList:
|
case friend.Friend_SubType_ApplyList:
|
||||||
@ -32,7 +34,7 @@ func (r *Robot) handleFriendMsg(msg *pb.UserMessage) {
|
|||||||
func (r *Robot) FriendList() {
|
func (r *Robot) FriendList() {
|
||||||
req := &pb.Friend_List_Req{}
|
req := &pb.Friend_List_Req{}
|
||||||
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_List}
|
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_List}
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -53,7 +55,7 @@ func (r *Robot) FriendSearch(nickName string) {
|
|||||||
NickName: nickName,
|
NickName: nickName,
|
||||||
}
|
}
|
||||||
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Search}
|
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Search}
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -74,7 +76,7 @@ func (r *Robot) FriendApply(friendId string) {
|
|||||||
FriendId: friendId,
|
FriendId: friendId,
|
||||||
}
|
}
|
||||||
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Apply}
|
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Apply}
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -93,7 +95,7 @@ func (r *Robot) handleFriendApply(msg *pb.UserMessage) {
|
|||||||
func (r *Robot) FriendApplyList() {
|
func (r *Robot) FriendApplyList() {
|
||||||
req := &pb.Friend_ApplyList_Req{}
|
req := &pb.Friend_ApplyList_Req{}
|
||||||
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_ApplyList}
|
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_ApplyList}
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -114,7 +116,7 @@ func (r *Robot) FriendAgree(friendIds []string) {
|
|||||||
FriendIds: friendIds,
|
FriendIds: friendIds,
|
||||||
}
|
}
|
||||||
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Agree}
|
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Agree}
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -135,7 +137,7 @@ func (r *Robot) FriendRefuse(friendIds []string) {
|
|||||||
FriendIds: friendIds,
|
FriendIds: friendIds,
|
||||||
}
|
}
|
||||||
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Refuse}
|
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Refuse}
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -154,7 +156,7 @@ func (r *Robot) handleFriendRefuse(msg *pb.UserMessage) {
|
|||||||
func (r *Robot) FriendBlacklist() {
|
func (r *Robot) FriendBlacklist() {
|
||||||
req := &pb.Friend_BlackList_Req{}
|
req := &pb.Friend_BlackList_Req{}
|
||||||
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Blacklist}
|
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_Blacklist}
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -170,10 +172,10 @@ func (r *Robot) handleFriendBlacklist(msg *pb.UserMessage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//添加黑名单
|
//添加黑名单
|
||||||
func (r *Robot) FriendAddBlack() {
|
func (r *Robot) FriendAddBlack(friendId string) {
|
||||||
req := &pb.Friend_BlackAdd_Req{}
|
req := &pb.Friend_BlackAdd_Req{FriendId: friendId}
|
||||||
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_AddBlack}
|
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_AddBlack}
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
@ -194,7 +196,7 @@ func (r *Robot) FriendDelBlack(friendId string) {
|
|||||||
FriendId: friendId,
|
FriendId: friendId,
|
||||||
}
|
}
|
||||||
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_DelBlack}
|
head := &pb.UserMessage{MainType: string(comm.SM_FriendModule), SubType: friend.Friend_SubType_DelBlack}
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -17,7 +17,7 @@ func (r *Robot) handlePackMsg(msg *pb.UserMessage) {
|
|||||||
func (r *Robot) QueryUserPack() {
|
func (r *Robot) QueryUserPack() {
|
||||||
req := &pb.Pack_Getlist_Req{IType: 1}
|
req := &pb.Pack_Getlist_Req{IType: 1}
|
||||||
head := &pb.UserMessage{MainType: "pack", SubType: "queryuserpackreq"}
|
head := &pb.UserMessage{MainType: "pack", SubType: "queryuserpackreq"}
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -85,7 +85,7 @@ func (r *Robot) handleMsg(msg *pb.UserMessage) {
|
|||||||
//在这里添加玩家成功登录以后的测试方法
|
//在这里添加玩家成功登录以后的测试方法
|
||||||
func (r *Robot) onUserLoaded() {
|
func (r *Robot) onUserLoaded() {
|
||||||
//user
|
//user
|
||||||
r.CreateUser("乐谷6171")
|
// r.CreateUser("乐谷6171")
|
||||||
|
|
||||||
//friend
|
//friend
|
||||||
// r.FriendApply("1_62aa8f30d25fb8c1a7d90b50")
|
// r.FriendApply("1_62aa8f30d25fb8c1a7d90b50")
|
||||||
@ -94,8 +94,8 @@ func (r *Robot) onUserLoaded() {
|
|||||||
// r.FriendApplyList()
|
// r.FriendApplyList()
|
||||||
// r.FriendList()
|
// r.FriendList()
|
||||||
// r.FriendBlacklist()
|
// r.FriendBlacklist()
|
||||||
// r.FriendAddBlack()
|
// r.FriendAddBlack("0_62b01623e4c60c3db8bfe6da")
|
||||||
// r.FriendDelBlack("")
|
// r.FriendDelBlack("0_62b01623e4c60c3db8bfe6da")
|
||||||
// r.FriendSearch("乐谷5")
|
// r.FriendSearch("乐谷5")
|
||||||
|
|
||||||
//pack
|
//pack
|
||||||
@ -104,6 +104,7 @@ func (r *Robot) onUserLoaded() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *Robot) SendToClient(msg *pb.UserMessage, rsp proto.Message) error {
|
func (r *Robot) SendToClient(msg *pb.UserMessage, rsp proto.Message) error {
|
||||||
|
//模拟客户端 每次请求都会生成新的秘钥
|
||||||
msg.Sec = r.BuildSecStr()
|
msg.Sec = r.BuildSecStr()
|
||||||
if comm.ProtoMarshal(rsp, msg) {
|
if comm.ProtoMarshal(rsp, msg) {
|
||||||
data, _ := proto.Marshal(msg)
|
data, _ := proto.Marshal(msg)
|
||||||
@ -160,7 +161,11 @@ func (r *Robot) AccountRegister(account string, sid int32) {
|
|||||||
|
|
||||||
//打印响应
|
//打印响应
|
||||||
func printReply(msg *pb.UserMessage, rsp interface{}) {
|
func printReply(msg *pb.UserMessage, rsp interface{}) {
|
||||||
log.Printf("rsp [%s.%s] [%v]", msg.MainType, msg.SubType, rsp)
|
if m, ok := rsp.(*pb.ErrorNotify); ok {
|
||||||
|
log.Printf("rsp [%s.%s] [%v:%v]", msg.MainType, msg.SubType, int32(m.Code), m.Data)
|
||||||
|
} else {
|
||||||
|
log.Printf("rsp [%s.%s] [%v]", msg.MainType, msg.SubType, rsp)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//方法参数跟踪
|
//方法参数跟踪
|
||||||
|
@ -45,7 +45,7 @@ func (r *Robot) CreateUser(NickName string) {
|
|||||||
SubType: user.User_SubType_Create,
|
SubType: user.User_SubType_Create,
|
||||||
}
|
}
|
||||||
|
|
||||||
defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req)
|
defer traceFunc(head.MainType, head.SubType, r.user.GetUId(), req)
|
||||||
err := r.SendToClient(head, req)
|
err := r.SendToClient(head, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -19,6 +19,7 @@ const (
|
|||||||
const (
|
const (
|
||||||
Service_Gateway = "gateway"
|
Service_Gateway = "gateway"
|
||||||
Service_Worker = "worker"
|
Service_Worker = "worker"
|
||||||
|
Service_DB = "dbservice"
|
||||||
)
|
)
|
||||||
|
|
||||||
//ERR
|
//ERR
|
||||||
|
@ -165,6 +165,7 @@ func (this *DB_Comp) Model_UpdateDBByLog(uid string) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 写入日志数据
|
||||||
func (this *DB_Comp) Model_InsertDBByLog(data *comm.Autogenerated) (err error) {
|
func (this *DB_Comp) Model_InsertDBByLog(data *comm.Autogenerated) (err error) {
|
||||||
|
|
||||||
_, err = this.DB.InsertOne(DB_ModelTable, data)
|
_, err = this.DB.InsertOne(DB_ModelTable, data)
|
||||||
@ -173,3 +174,13 @@ func (this *DB_Comp) Model_InsertDBByLog(data *comm.Autogenerated) (err error) {
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询 当前日志列表还有没有处理完条数
|
||||||
|
func (this *DB_Comp) Model_TotalCount() int {
|
||||||
|
|
||||||
|
_data, err := this.DB.Find("model_log", bson.M{})
|
||||||
|
if err == nil {
|
||||||
|
return _data.RemainingBatchLength()
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
@ -12,8 +12,8 @@ func (this *ApiComp) Addblack_Check(session comm.IUserSession, req *pb.Friend_Bl
|
|||||||
err error
|
err error
|
||||||
blackNumMax = 50 //TODO 从配置中读取
|
blackNumMax = 50 //TODO 从配置中读取
|
||||||
)
|
)
|
||||||
self := &pb.DB_FriendData{UserId: session.GetUserId()}
|
self := &pb.DB_FriendData{UId: session.GetUserId()}
|
||||||
target := &pb.DB_FriendData{UserId: req.FriendId}
|
target := &pb.DB_FriendData{UId: req.FriendId}
|
||||||
|
|
||||||
err = this.module.model_friend.Get(session.GetUserId(), self)
|
err = this.module.model_friend.Get(session.GetUserId(), self)
|
||||||
if self == nil || err != nil {
|
if self == nil || err != nil {
|
||||||
@ -29,12 +29,18 @@ func (this *ApiComp) Addblack_Check(session comm.IUserSession, req *pb.Friend_Bl
|
|||||||
|
|
||||||
//判断目标是否在好友列表里面
|
//判断目标是否在好友列表里面
|
||||||
if _, ok := utils.Find(self.FriendIds, req.FriendId); ok {
|
if _, ok := utils.Find(self.FriendIds, req.FriendId); ok {
|
||||||
|
code = comm.ErrorCode{Code: pb.ErrorCode_FriendYet}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断目标是否已经在黑名单中
|
||||||
|
if _, ok := utils.Find(self.BlackIds, req.FriendId); ok {
|
||||||
code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfBlackYet}
|
code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfBlackYet}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断自己是否在对方的黑名单中
|
// 判断自己是否在对方的黑名单中
|
||||||
if _, ok := utils.Find(target.BlackIds, self.UserId); ok {
|
if _, ok := utils.Find(target.BlackIds, self.UId); ok {
|
||||||
code = comm.ErrorCode{Code: pb.ErrorCode_FriendTargetBlackYet}
|
code = comm.ErrorCode{Code: pb.ErrorCode_FriendTargetBlackYet}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
func (this *ApiComp) Agree_Check(session comm.IUserSession, req *pb.Friend_Agree_Req) (chk map[string]interface{}, code comm.ErrorCode) {
|
func (this *ApiComp) Agree_Check(session comm.IUserSession, req *pb.Friend_Agree_Req) (chk map[string]interface{}, code comm.ErrorCode) {
|
||||||
chk = make(map[string]interface{})
|
chk = make(map[string]interface{})
|
||||||
var err error
|
var err error
|
||||||
self := &pb.DB_FriendData{UserId: session.GetUserId()}
|
self := &pb.DB_FriendData{UId: session.GetUserId()}
|
||||||
|
|
||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
err = this.module.model_friend.Get(session.GetUserId(), self)
|
err = this.module.model_friend.Get(session.GetUserId(), self)
|
||||||
@ -76,11 +76,11 @@ func (this *ApiComp) Agree(session comm.IUserSession, chk map[string]interface{}
|
|||||||
code = pb.ErrorCode_FriendTargetNoData
|
code = pb.ErrorCode_FriendTargetNoData
|
||||||
|
|
||||||
}
|
}
|
||||||
if _, ok := utils.Find(target.FriendIds, self.UserId); !ok {
|
if _, ok := utils.Find(target.FriendIds, self.UId); !ok {
|
||||||
if target.FriendIds == nil {
|
if target.FriendIds == nil {
|
||||||
target.FriendIds = []string{}
|
target.FriendIds = []string{}
|
||||||
}
|
}
|
||||||
target.FriendIds = append(target.FriendIds, self.UserId)
|
target.FriendIds = append(target.FriendIds, self.UId)
|
||||||
}
|
}
|
||||||
err = this.module.model_friend.Change(target.UserId, map[string]interface{}{
|
err = this.module.model_friend.Change(target.UserId, map[string]interface{}{
|
||||||
"friendIds": target.FriendIds,
|
"friendIds": target.FriendIds,
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
func (this *ApiComp) Apply_Check(session comm.IUserSession, req *pb.Friend_Apply_Req) (chk map[string]interface{}, code comm.ErrorCode) {
|
func (this *ApiComp) Apply_Check(session comm.IUserSession, req *pb.Friend_Apply_Req) (chk map[string]interface{}, code comm.ErrorCode) {
|
||||||
chk = make(map[string]interface{})
|
chk = make(map[string]interface{})
|
||||||
var err error
|
var err error
|
||||||
self := &pb.DB_FriendData{UserId: session.GetUserId()}
|
self := &pb.DB_FriendData{UId: session.GetUserId()}
|
||||||
target := &pb.DB_FriendData{UserId: req.FriendId}
|
target := &pb.DB_FriendData{UId: req.FriendId}
|
||||||
|
|
||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
err = this.module.model_friend.Get(session.GetUserId(), self)
|
err = this.module.model_friend.Get(session.GetUserId(), self)
|
||||||
@ -56,7 +56,7 @@ func (this *ApiComp) Apply_Check(session comm.IUserSession, req *pb.Friend_Apply
|
|||||||
}
|
}
|
||||||
|
|
||||||
//判断自己是否在目标用户的申请列表中
|
//判断自己是否在目标用户的申请列表中
|
||||||
if _, ok := utils.Find(target.ApplyIds, self.UserId); ok {
|
if _, ok := utils.Find(target.ApplyIds, self.UId); ok {
|
||||||
code = comm.ErrorCode{Code: pb.ErrorCode_FriendApplyYet}
|
code = comm.ErrorCode{Code: pb.ErrorCode_FriendApplyYet}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ func (this *ApiComp) Apply_Check(session comm.IUserSession, req *pb.Friend_Apply
|
|||||||
}
|
}
|
||||||
|
|
||||||
//判断是否在对方的黑名单中
|
//判断是否在对方的黑名单中
|
||||||
if _, ok := utils.Find(target.BlackIds, self.UserId); ok {
|
if _, ok := utils.Find(target.BlackIds, self.UId); ok {
|
||||||
code = comm.ErrorCode{Code: pb.ErrorCode_FriendTargetBlackYet}
|
code = comm.ErrorCode{Code: pb.ErrorCode_FriendTargetBlackYet}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ func (this *ApiComp) Delblack(session comm.IUserSession, chk map[string]interfac
|
|||||||
UserId: session.GetUserId(),
|
UserId: session.GetUserId(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err := session.SendMsg(string(this.module.GetType()), Friend_SubType_AddBlack, rsp)
|
err := session.SendMsg(string(this.module.GetType()), Friend_SubType_DelBlack, rsp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
func (this *ApiComp) Refuse_Check(session comm.IUserSession, req *pb.Friend_Refuse_Req) (chk map[string]interface{}, code comm.ErrorCode) {
|
func (this *ApiComp) Refuse_Check(session comm.IUserSession, req *pb.Friend_Refuse_Req) (chk map[string]interface{}, code comm.ErrorCode) {
|
||||||
chk = make(map[string]interface{})
|
chk = make(map[string]interface{})
|
||||||
var err error
|
var err error
|
||||||
self := &pb.DB_FriendData{UserId: session.GetUserId()}
|
self := &pb.DB_FriendData{UId: session.GetUserId()}
|
||||||
|
|
||||||
//获取玩家自己好友数据
|
//获取玩家自己好友数据
|
||||||
err = this.module.model_friend.Get(session.GetUserId(), self)
|
err = this.module.model_friend.Get(session.GetUserId(), self)
|
||||||
|
@ -31,7 +31,7 @@ func (this *ApiComp) Search(session comm.IUserSession, chk map[string]interface{
|
|||||||
user := this.module.model_friend.Frined_FindCond(req.NickName)
|
user := this.module.model_friend.Frined_FindCond(req.NickName)
|
||||||
if user != nil {
|
if user != nil {
|
||||||
friend = &pb.FriendBase{
|
friend = &pb.FriendBase{
|
||||||
UserId: user.Uid,
|
UserId: user.UId,
|
||||||
NickName: user.Name,
|
NickName: user.Name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,10 @@ func (this *ModelFriend) Init(service core.IService, module core.IModule, comp c
|
|||||||
}
|
}
|
||||||
|
|
||||||
//好友
|
//好友
|
||||||
|
// Deprecated
|
||||||
func (this *ModelFriend) Friend_SaveOrUpdate(data *pb.DB_FriendData) (err error) {
|
func (this *ModelFriend) Friend_SaveOrUpdate(data *pb.DB_FriendData) (err error) {
|
||||||
err = this.DB.FindOneAndUpdate(DB_FriendTable,
|
err = this.DB.FindOneAndUpdate(DB_FriendTable,
|
||||||
bson.M{"_id": data.UserId},
|
bson.M{"_id": data.UId},
|
||||||
bson.M{"$set": bson.M{
|
bson.M{"$set": bson.M{
|
||||||
"friendids": data.FriendIds,
|
"friendids": data.FriendIds,
|
||||||
"applyids": data.ApplyIds}},
|
"applyids": data.ApplyIds}},
|
||||||
|
@ -43,15 +43,15 @@ func newAgent(gateway IGateway, conn *websocket.Conn) *Agent {
|
|||||||
|
|
||||||
//用户代理
|
//用户代理
|
||||||
type Agent struct {
|
type Agent struct {
|
||||||
gateway IGateway
|
gateway IGateway
|
||||||
wsConn *websocket.Conn
|
wsConn *websocket.Conn
|
||||||
sessionId string
|
sessionId string
|
||||||
uId string
|
uId string
|
||||||
wId string
|
wId string
|
||||||
writeChan chan *pb.UserMessage
|
writeChan chan *pb.UserMessage
|
||||||
closeSignal chan bool
|
closeSignal chan bool
|
||||||
state int32 //状态 0 关闭 1 运行 2 关闭中
|
state int32 //状态 0 关闭 1 运行 2 关闭中
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Agent) readLoop() {
|
func (this *Agent) readLoop() {
|
||||||
@ -132,21 +132,23 @@ func (this *Agent) secAuth(msg *pb.UserMessage) error {
|
|||||||
|
|
||||||
//解码
|
//解码
|
||||||
func decodeUserData(msg *pb.UserMessage) error {
|
func decodeUserData(msg *pb.UserMessage) error {
|
||||||
//只有login的时候才需要解码
|
base64Str := msg.Sec
|
||||||
|
dec, err := base64.StdEncoding.DecodeString(base64Str[35:])
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("base64 decode err %v", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
now := time.Now().Unix()
|
||||||
|
jsonRet := gjson.Parse(string(dec))
|
||||||
|
timestamp := jsonRet.Get("timestamp").Int()
|
||||||
|
//秘钥30秒失效
|
||||||
|
if now-time.Unix(timestamp, 0).Unix() > 30 {
|
||||||
|
return fmt.Errorf("sec key expire")
|
||||||
|
}
|
||||||
|
|
||||||
|
//只有login的时候才需要设置Data
|
||||||
if msg.MainType == "user" && msg.SubType == "login" {
|
if msg.MainType == "user" && msg.SubType == "login" {
|
||||||
base64Str := msg.Sec
|
|
||||||
dec, err := base64.StdEncoding.DecodeString(base64Str[35:])
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("base64 decode err %v", err)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
now := time.Now().Unix()
|
|
||||||
jsonRet := gjson.Parse(string(dec))
|
|
||||||
serverId := jsonRet.Get("serverId").Int()
|
serverId := jsonRet.Get("serverId").Int()
|
||||||
timestamp := jsonRet.Get("timestamp").Int()
|
|
||||||
if now-time.Unix(timestamp, 0).Unix() > 100 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
account := jsonRet.Get("account").String()
|
account := jsonRet.Get("account").String()
|
||||||
req := &pb.UserLoginReq{
|
req := &pb.UserLoginReq{
|
||||||
Account: account,
|
Account: account,
|
||||||
@ -158,7 +160,6 @@ func decodeUserData(msg *pb.UserMessage) error {
|
|||||||
}
|
}
|
||||||
msg.Data = ad
|
msg.Data = ad
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +219,7 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if reply.Code != pb.ErrorCode_Success {
|
if reply.Code != pb.ErrorCode_Success {
|
||||||
data, _ := anypb.New(&pb.ErrorNotify{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: reply.Code})
|
data, _ := anypb.New(&pb.ErrorNotify{ReqMainType: msg.MainType, ReqSubType: msg.SubType, Code: pb.ErrorCode(reply.Code.Number())})
|
||||||
err := this.WriteMsg(&pb.UserMessage{
|
err := this.WriteMsg(&pb.UserMessage{
|
||||||
MainType: comm.MainType_Notify,
|
MainType: comm.MainType_Notify,
|
||||||
SubType: comm.SubType_ErrorNotify,
|
SubType: comm.SubType_ErrorNotify,
|
||||||
|
@ -35,7 +35,7 @@ func (this *Api_Comp) GetUserMailAttachment(session comm.IUserSession, agrs map[
|
|||||||
for _, v := range _data {
|
for _, v := range _data {
|
||||||
_items[int32(v.ItemId)] += int32(v.ItemCount)
|
_items[int32(v.ItemId)] += int32(v.ItemCount)
|
||||||
}
|
}
|
||||||
bRet := this.pack.AddItemsToUserPack(mail.UserId, _items)
|
bRet := this.pack.AddItemsToUserPack(mail.Uid, _items)
|
||||||
if bRet != nil {
|
if bRet != nil {
|
||||||
// 修改状态
|
// 修改状态
|
||||||
this.module.db_comp.Mail_UpdateMailAttachmentState(req.ObjID)
|
this.module.db_comp.Mail_UpdateMailAttachmentState(req.ObjID)
|
||||||
|
@ -43,7 +43,7 @@ func (this *Mail) OnInstallComp() {
|
|||||||
func (this *Mail) CreateNewMail(uId string) {
|
func (this *Mail) CreateNewMail(uId string) {
|
||||||
mail := &pb.DB_MailData{
|
mail := &pb.DB_MailData{
|
||||||
ObjId: primitive.NewObjectID().Hex(),
|
ObjId: primitive.NewObjectID().Hex(),
|
||||||
UserId: uId,
|
Uid: uId,
|
||||||
Title: "系统邮件",
|
Title: "系统邮件",
|
||||||
Contex: "恭喜获得专属礼包一份",
|
Contex: "恭喜获得专属礼包一份",
|
||||||
CreateTime: uint64(time.Now().Unix()),
|
CreateTime: uint64(time.Now().Unix()),
|
||||||
|
@ -57,7 +57,7 @@ var module = new(Pack)
|
|||||||
//测试环境下初始化db和cache 系统
|
//测试环境下初始化db和cache 系统
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
service = newService(
|
service = newService(
|
||||||
rpcx.SetConfPath("../../bin/conf/worker_1.yaml"),
|
rpcx.SetConfPath("../../bin/conf/worker_2.yaml"),
|
||||||
rpcx.SetVersion("1.0.0.0"),
|
rpcx.SetVersion("1.0.0.0"),
|
||||||
)
|
)
|
||||||
service.OnInstallComp( //装备组件
|
service.OnInstallComp( //装备组件
|
||||||
@ -156,3 +156,10 @@ func Pack_UpdateGridToUserPack(uId string, grids ...*pb.DB_UserItemData) (err er
|
|||||||
module.model_pack_comp.DB.InsertMany(DB_PackTable, data)
|
module.model_pack_comp.DB.InsertMany(DB_PackTable, data)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetHM(t *testing.T) {
|
||||||
|
d := make(map[string]interface{})
|
||||||
|
d["amount"] = 10
|
||||||
|
d["itemid"] = 1004
|
||||||
|
module.cache_comp.SetHM("pack:0_62a9afd994fe03b7aaee6773", d)
|
||||||
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package user
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
|
|
||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -25,3 +28,15 @@ func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core
|
|||||||
this.module = module.(*User)
|
this.module = module.(*User)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Api_Comp) Start() (err error) {
|
||||||
|
err = this.MComp_GateComp.Start()
|
||||||
|
_data, err := this.module.modelUser.DB.Find("model_log", bson.M{})
|
||||||
|
if err == nil {
|
||||||
|
if _data.RemainingBatchLength() > 0 {
|
||||||
|
return errors.New("")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -33,7 +33,7 @@ func (this *Api_Comp) Login(session comm.IUserSession, result map[string]interfa
|
|||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
event.TriggerEvent(comm.Event_UserLogin, user.Uid)
|
event.TriggerEvent(comm.Event_UserLogin, user.UId)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ func (this *Api_Comp) Login(session comm.IUserSession, result map[string]interfa
|
|||||||
}
|
}
|
||||||
|
|
||||||
//bind user
|
//bind user
|
||||||
err = session.Bind(user.Uid, this.service.GetId())
|
err = session.Bind(user.UId, this.service.GetId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_BindUser
|
code = pb.ErrorCode_BindUser
|
||||||
return
|
return
|
||||||
|
@ -51,7 +51,7 @@ func (this *ModelUser) User_FindById(id string) (*pb.DB_UserData, error) {
|
|||||||
func (this *ModelUser) User_Create(user *pb.DB_UserData) (err error) {
|
func (this *ModelUser) User_Create(user *pb.DB_UserData) (err error) {
|
||||||
_id := primitive.NewObjectID().Hex()
|
_id := primitive.NewObjectID().Hex()
|
||||||
user.Id = _id
|
user.Id = _id
|
||||||
user.Uid = fmt.Sprintf("%d_%s", user.Sid, _id)
|
user.UId = fmt.Sprintf("%d_%s", user.Sid, _id)
|
||||||
user.Uuid = uuid.NewV4().String()
|
user.Uuid = uuid.NewV4().String()
|
||||||
user.Ctime = time.Now().Unix()
|
user.Ctime = time.Now().Unix()
|
||||||
_, err = this.DB.InsertOne(DB_UserTable, user)
|
_, err = this.DB.InsertOne(DB_UserTable, user)
|
||||||
@ -62,7 +62,7 @@ func (this *ModelUser) User_Create(user *pb.DB_UserData) (err error) {
|
|||||||
func (this *ModelUser) User_Update(data *pb.DB_UserData) (err error) {
|
func (this *ModelUser) User_Update(data *pb.DB_UserData) (err error) {
|
||||||
err = this.DB.FindOneAndUpdate(
|
err = this.DB.FindOneAndUpdate(
|
||||||
DB_UserTable,
|
DB_UserTable,
|
||||||
bson.M{"uid": data.Uid},
|
bson.M{"uid": data.UId},
|
||||||
bson.M{"$set": bson.M{
|
bson.M{"$set": bson.M{
|
||||||
"name": data.Name,
|
"name": data.Name,
|
||||||
}},
|
}},
|
||||||
|
@ -38,7 +38,7 @@ func (this *Api_Comp) Register(c *engine.Context) {
|
|||||||
err := c.BindJSON(&req)
|
err := c.BindJSON(&req)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err := this.module.modelUser.User_Create(&pb.DB_UserData{
|
err := this.module.modelUser.User_Create(&pb.DB_UserData{
|
||||||
Binduid: req.Account,
|
BinduId: req.Account,
|
||||||
Sid: req.Sid,
|
Sid: req.Sid,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -25,10 +25,10 @@ type DB_FriendData struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
UserId string `protobuf:"bytes,1,opt,name=userId,proto3" json:"userId" bson:"_id"` // ID
|
UId string `protobuf:"bytes,1,opt,name=uId,proto3" json:"uId" bson:"uId"` //用户ID
|
||||||
FriendIds []string `protobuf:"bytes,2,rep,name=friendIds,proto3" json:"friendIds"` //好友ID
|
FriendIds []string `protobuf:"bytes,2,rep,name=friendIds,proto3" json:"friendIds" bson:"friendIds"` //好友ID
|
||||||
ApplyIds []string `protobuf:"bytes,3,rep,name=applyIds,proto3" json:"applyIds"` //申请用户ID
|
ApplyIds []string `protobuf:"bytes,3,rep,name=applyIds,proto3" json:"applyIds" bson:"applyIds"` //申请用户ID
|
||||||
BlackIds []string `protobuf:"bytes,4,rep,name=blackIds,proto3" json:"blackIds"` //黑名单ID
|
BlackIds []string `protobuf:"bytes,4,rep,name=blackIds,proto3" json:"blackIds" bson:"blackIds"` //黑名单ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DB_FriendData) Reset() {
|
func (x *DB_FriendData) Reset() {
|
||||||
@ -63,9 +63,9 @@ func (*DB_FriendData) Descriptor() ([]byte, []int) {
|
|||||||
return file_friend_friend_db_proto_rawDescGZIP(), []int{0}
|
return file_friend_friend_db_proto_rawDescGZIP(), []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DB_FriendData) GetUserId() string {
|
func (x *DB_FriendData) GetUId() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.UserId
|
return x.UId
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -95,16 +95,16 @@ var File_friend_friend_db_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
var file_friend_friend_db_proto_rawDesc = []byte{
|
var file_friend_friend_db_proto_rawDesc = []byte{
|
||||||
0x0a, 0x16, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f,
|
0x0a, 0x16, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x2f, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x5f,
|
||||||
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7d, 0x0a, 0x0d, 0x44, 0x42, 0x5f, 0x46,
|
0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x77, 0x0a, 0x0d, 0x44, 0x42, 0x5f, 0x46,
|
||||||
0x72, 0x69, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65,
|
0x72, 0x69, 0x65, 0x6e, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64,
|
||||||
0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x66,
|
||||||
0x64, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x02,
|
0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09,
|
||||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12,
|
0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70,
|
||||||
0x1a, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
|
0x6c, 0x79, 0x49, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x61, 0x70, 0x70,
|
||||||
0x09, 0x52, 0x08, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62,
|
0x6c, 0x79, 0x49, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64,
|
||||||
0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x62,
|
0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x62, 0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64,
|
||||||
0x6c, 0x61, 0x63, 0x6b, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
|
0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -81,7 +81,7 @@ type DB_MailData struct {
|
|||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
ObjId string `protobuf:"bytes,1,opt,name=ObjId,proto3" json:"ObjId" bson:"_id"` // ID
|
ObjId string `protobuf:"bytes,1,opt,name=ObjId,proto3" json:"ObjId" bson:"_id"` // ID
|
||||||
UserId string `protobuf:"bytes,2,opt,name=UserId,proto3" json:"UserId"`
|
Uid string `protobuf:"bytes,2,opt,name=Uid,proto3" json:"Uid"`
|
||||||
Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"Title"` // 邮件标题
|
Title string `protobuf:"bytes,3,opt,name=Title,proto3" json:"Title"` // 邮件标题
|
||||||
Contex string `protobuf:"bytes,4,opt,name=Contex,proto3" json:"Contex"` // 邮件内容
|
Contex string `protobuf:"bytes,4,opt,name=Contex,proto3" json:"Contex"` // 邮件内容
|
||||||
CreateTime uint64 `protobuf:"varint,5,opt,name=CreateTime,proto3" json:"CreateTime"` // 发送时间
|
CreateTime uint64 `protobuf:"varint,5,opt,name=CreateTime,proto3" json:"CreateTime"` // 发送时间
|
||||||
@ -130,9 +130,9 @@ func (x *DB_MailData) GetObjId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DB_MailData) GetUserId() string {
|
func (x *DB_MailData) GetUid() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.UserId
|
return x.Uid
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -194,24 +194,24 @@ var file_mail_mail_db_proto_rawDesc = []byte{
|
|||||||
0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64,
|
0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x1c,
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x1c,
|
||||||
0x0a, 0x09, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
|
0x0a, 0x09, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x0d, 0x52, 0x09, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf8, 0x01, 0x0a,
|
0x0d, 0x52, 0x09, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf2, 0x01, 0x0a,
|
||||||
0x0b, 0x44, 0x42, 0x5f, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05,
|
0x0b, 0x44, 0x42, 0x5f, 0x4d, 0x61, 0x69, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05,
|
||||||
0x4f, 0x62, 0x6a, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x4f, 0x62, 0x6a,
|
0x4f, 0x62, 0x6a, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x4f, 0x62, 0x6a,
|
||||||
0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01,
|
0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69,
|
0x03, 0x55, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20,
|
||||||
0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65,
|
0x01, 0x28, 0x09, 0x52, 0x05, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f,
|
||||||
0x12, 0x16, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
0x6e, 0x74, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43, 0x6f, 0x6e, 0x74,
|
||||||
0x52, 0x06, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61,
|
0x65, 0x78, 0x12, 0x1e, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65,
|
||||||
0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x43, 0x72,
|
0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69,
|
||||||
0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x44, 0x75, 0x65, 0x54,
|
0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20,
|
||||||
0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69,
|
0x01, 0x28, 0x04, 0x52, 0x07, 0x44, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
||||||
0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28,
|
0x43, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x43, 0x68, 0x65,
|
||||||
0x08, 0x52, 0x05, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x77, 0x61,
|
0x63, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x08, 0x20, 0x01,
|
||||||
0x72, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64,
|
0x28, 0x08, 0x52, 0x06, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x25, 0x0a, 0x05, 0x49, 0x74,
|
||||||
0x12, 0x25, 0x0a, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
0x65, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x4d, 0x61, 0x69, 0x6c,
|
||||||
0x0f, 0x2e, 0x4d, 0x61, 0x69, 0x6c, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74,
|
0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d,
|
||||||
0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
|
0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
option go_package = ".;pb";
|
option go_package = ".;pb";
|
||||||
|
|
||||||
|
|
||||||
message DB_FriendData {
|
message DB_FriendData {
|
||||||
string userId = 1;// @go_tags(`bson:"_id"`) ID
|
string uId = 1; //@go_tags(`bson:"uId"`) 用户ID
|
||||||
repeated string friendIds = 2; //好友ID
|
repeated string friendIds = 2; //@go_tags(`bson:"friendIds"`) 好友ID
|
||||||
repeated string applyIds = 3;//申请用户ID
|
repeated string applyIds = 3; //@go_tags(`bson:"applyIds"`) 申请用户ID
|
||||||
repeated string blackIds = 4;//黑名单ID
|
repeated string blackIds = 4; //@go_tags(`bson:"blackIds"`) 黑名单ID
|
||||||
|
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ message MailAttachment { // 附件
|
|||||||
|
|
||||||
message DB_MailData {
|
message DB_MailData {
|
||||||
string ObjId = 1; // @go_tags(`bson:"_id"`) ID
|
string ObjId = 1; // @go_tags(`bson:"_id"`) ID
|
||||||
string UserId = 2;
|
string Uid = 2;
|
||||||
string Title = 3; // 邮件标题
|
string Title = 3; // 邮件标题
|
||||||
string Contex = 4; // 邮件内容
|
string Contex = 4; // 邮件内容
|
||||||
uint64 CreateTime = 5; // 发送时间
|
uint64 CreateTime = 5; // 发送时间
|
||||||
|
@ -5,20 +5,20 @@ message Cache_UserData {
|
|||||||
string uid = 1;
|
string uid = 1;
|
||||||
string SessionId = 2;
|
string SessionId = 2;
|
||||||
string GatewayServiceId = 3;
|
string GatewayServiceId = 3;
|
||||||
// DB_UserData UserData = 4;
|
// DB_UserData UserData = 4; //@go_tags(`json:",inline"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
message DB_UserData {
|
message DB_UserData {
|
||||||
string id = 1; // @go_tags(`bson:"_id"`) ID
|
string id = 1; //@go_tags(`bson:"_id"`) ID
|
||||||
string uid = 2;
|
string uId = 2; //@go_tags(`bson:"uId"`) 用户ID
|
||||||
string uuid = 3; //玩家唯一uuid
|
string uuid = 3; //@go_tags(`bson:"uuid"`) 玩家唯一uuid
|
||||||
string binduid = 4; //玩家账号
|
string binduId = 4; //@go_tags(`bson:"binduId"`) 玩家账号
|
||||||
string name = 5; //玩家名
|
string name = 5; //@go_tags(`bson:"name"`) 玩家名
|
||||||
int32 sid = 6; //区服id
|
int32 sid = 6; //@go_tags(`bson:"sid"`) 区服id
|
||||||
string createip = 7; //创建账号时的ip
|
string createip = 7; //@go_tags(`bson:"createip"`) 创建账号时的ip
|
||||||
string lastloginip = 8; //最后一次登录时的ip
|
string lastloginip = 8; //@go_tags(`bson:"lastloginip"`) 最后一次登录时的ip
|
||||||
int64 ctime = 9; //玩家创号时间戳
|
int64 ctime = 9; //@go_tags(`bson:"ctime"`) 玩家创号时间戳
|
||||||
int64 logintime = 10; //最后一次登录时间
|
int64 logintime = 10; //@go_tags(`bson:"logintime"`) 最后一次登录时间
|
||||||
int32 FriendPoint = 11; //友情点
|
int32 friendPoint = 11; //@go_tags(`bson:"friendPoint"`) 友情点
|
||||||
int32 avatar = 12; //头像
|
int32 avatar = 12; //@go_tags(`bson:"avatar"`) 头像
|
||||||
}
|
}
|
@ -27,7 +27,7 @@ type Cache_UserData struct {
|
|||||||
|
|
||||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
|
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
|
||||||
SessionId string `protobuf:"bytes,2,opt,name=SessionId,proto3" json:"SessionId"`
|
SessionId string `protobuf:"bytes,2,opt,name=SessionId,proto3" json:"SessionId"`
|
||||||
GatewayServiceId string `protobuf:"bytes,3,opt,name=GatewayServiceId,proto3" json:"GatewayServiceId"` // DB_UserData UserData = 4;
|
GatewayServiceId string `protobuf:"bytes,3,opt,name=GatewayServiceId,proto3" json:",inline"` // DB_UserData UserData = 4; //
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Cache_UserData) Reset() {
|
func (x *Cache_UserData) Reset() {
|
||||||
@ -88,18 +88,18 @@ type DB_UserData struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` // ID
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"`
|
UId string `protobuf:"bytes,2,opt,name=uId,proto3" json:"uId" bson:"uId"` //用户ID
|
||||||
Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid"` //玩家唯一uuid
|
Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid" bson:"uuid"` //玩家唯一uuid
|
||||||
Binduid string `protobuf:"bytes,4,opt,name=binduid,proto3" json:"binduid"` //玩家账号
|
BinduId string `protobuf:"bytes,4,opt,name=binduId,proto3" json:"binduId" bson:"binduId"` //玩家账号
|
||||||
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name"` //玩家名
|
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name" bson:"name"` //玩家名
|
||||||
Sid int32 `protobuf:"varint,6,opt,name=sid,proto3" json:"sid"` //区服id
|
Sid int32 `protobuf:"varint,6,opt,name=sid,proto3" json:"sid" bson:"sid"` //区服id
|
||||||
Createip string `protobuf:"bytes,7,opt,name=createip,proto3" json:"createip"` //创建账号时的ip
|
Createip string `protobuf:"bytes,7,opt,name=createip,proto3" json:"createip" bson:"createip"` //创建账号时的ip
|
||||||
Lastloginip string `protobuf:"bytes,8,opt,name=lastloginip,proto3" json:"lastloginip"` //最后一次登录时的ip
|
Lastloginip string `protobuf:"bytes,8,opt,name=lastloginip,proto3" json:"lastloginip" bson:"lastloginip"` //最后一次登录时的ip
|
||||||
Ctime int64 `protobuf:"varint,9,opt,name=ctime,proto3" json:"ctime"` //玩家创号时间戳
|
Ctime int64 `protobuf:"varint,9,opt,name=ctime,proto3" json:"ctime" bson:"ctime"` //玩家创号时间戳
|
||||||
Logintime int64 `protobuf:"varint,10,opt,name=logintime,proto3" json:"logintime"` //最后一次登录时间
|
Logintime int64 `protobuf:"varint,10,opt,name=logintime,proto3" json:"logintime" bson:"logintime"` //最后一次登录时间
|
||||||
FriendPoint int32 `protobuf:"varint,11,opt,name=FriendPoint,proto3" json:"FriendPoint"` //友情点
|
FriendPoint int32 `protobuf:"varint,11,opt,name=friendPoint,proto3" json:"friendPoint" bson:"friendPoint"` //友情点
|
||||||
Avatar int32 `protobuf:"varint,12,opt,name=avatar,proto3" json:"avatar"` //头像
|
Avatar int32 `protobuf:"varint,12,opt,name=avatar,proto3" json:"avatar" bson:"avatar"` //头像
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DB_UserData) Reset() {
|
func (x *DB_UserData) Reset() {
|
||||||
@ -141,9 +141,9 @@ func (x *DB_UserData) GetId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DB_UserData) GetUid() string {
|
func (x *DB_UserData) GetUId() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Uid
|
return x.UId
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -155,9 +155,9 @@ func (x *DB_UserData) GetUuid() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DB_UserData) GetBinduid() string {
|
func (x *DB_UserData) GetBinduId() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Binduid
|
return x.BinduId
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -231,11 +231,11 @@ var file_user_user_db_proto_rawDesc = []byte{
|
|||||||
0x52, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
0x52, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||||
0x49, 0x64, 0x22, 0xaf, 0x02, 0x0a, 0x0b, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61,
|
0x49, 0x64, 0x22, 0xaf, 0x02, 0x0a, 0x0b, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61,
|
||||||
0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
||||||
0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
|
0x03, 0x75, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||||
0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x69, 0x6e, 0x64,
|
0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x69, 0x6e, 0x64,
|
||||||
0x75, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x69, 0x6e, 0x64, 0x75,
|
0x75, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x69, 0x6e, 0x64, 0x75,
|
||||||
0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x06, 0x20,
|
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x06, 0x20,
|
||||||
0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x72, 0x65, 0x61,
|
0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x72, 0x65, 0x61,
|
||||||
0x74, 0x65, 0x69, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x72, 0x65, 0x61,
|
0x74, 0x65, 0x69, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x72, 0x65, 0x61,
|
||||||
@ -244,9 +244,9 @@ var file_user_user_db_proto_rawDesc = []byte{
|
|||||||
0x6f, 0x67, 0x69, 0x6e, 0x69, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18,
|
0x6f, 0x67, 0x69, 0x6e, 0x69, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18,
|
||||||
0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09,
|
0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09,
|
||||||
0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52,
|
0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||||
0x09, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x46, 0x72,
|
0x09, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x66, 0x72,
|
||||||
0x69, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52,
|
0x69, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||||
0x0b, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06,
|
0x0b, 0x66, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06,
|
||||||
0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x76,
|
0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x76,
|
||||||
0x61, 0x74, 0x61, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
0x61, 0x74, 0x61, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
|
||||||
0x6f, 0x74, 0x6f, 0x33,
|
0x6f, 0x74, 0x6f, 0x33,
|
||||||
|
@ -59,7 +59,7 @@ func (this *SComp_GateRouteComp) Init(service core.IService, comp core.IServiceC
|
|||||||
this.msgcheck = make(map[string]*msghandle)
|
this.msgcheck = make(map[string]*msghandle)
|
||||||
this.msghandles = make(map[string]*msghandle)
|
this.msghandles = make(map[string]*msghandle)
|
||||||
return err
|
return err
|
||||||
}
|
} //
|
||||||
|
|
||||||
//组件启动时注册rpc服务监听
|
//组件启动时注册rpc服务监听
|
||||||
func (this *SComp_GateRouteComp) Start() (err error) {
|
func (this *SComp_GateRouteComp) Start() (err error) {
|
||||||
@ -76,6 +76,9 @@ func (this *SComp_GateRouteComp) Start() (err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
event.RegisterGO(core.Event_FindNewService, func() {
|
||||||
|
log.Debugf("find new service")
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
140
sys/cache/init_test.go
vendored
140
sys/cache/init_test.go
vendored
@ -2,19 +2,11 @@ package cache_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"go_dreamfactory/comm"
|
|
||||||
"go_dreamfactory/lego/sys/log"
|
|
||||||
"go_dreamfactory/pb"
|
|
||||||
"go_dreamfactory/sys/cache"
|
"go_dreamfactory/sys/cache"
|
||||||
"go_dreamfactory/sys/db"
|
"go_dreamfactory/sys/db"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go_dreamfactory/utils"
|
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//测试环境下初始化db和cache 系统
|
//测试环境下初始化db和cache 系统
|
||||||
@ -27,72 +19,72 @@ func TestMain(m *testing.M) {
|
|||||||
fmt.Printf("err:%v\n", err)
|
fmt.Printf("err:%v\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < 50000; i++ {
|
for i := 0; i < 50000; i++ {
|
||||||
//go func() {
|
//go func() {
|
||||||
_mail := &pb.DB_MailData{
|
// _mail := &pb.DB_MailData{
|
||||||
ObjId: primitive.NewObjectID().Hex(),
|
// ObjId: primitive.NewObjectID().Hex(),
|
||||||
UserId: "uid123",
|
// Uid: "uid123",
|
||||||
Title: "系统邮件",
|
// Title: "系统邮件",
|
||||||
|
// Contex: "恭喜获得专属礼包一份",
|
||||||
|
// CreateTime: uint64(time.Now().Unix()),
|
||||||
|
// DueTime: uint64(time.Now().Unix()) + 30*24*3600,
|
||||||
|
// Check: false,
|
||||||
|
// Reward: false,
|
||||||
|
// }
|
||||||
|
// //db.InsertModelLogs("mail", "uid123", _mail)
|
||||||
|
// db.Defsys.Mgo().InsertOne("mail", _mail)
|
||||||
|
// data := &comm.Autogenerated{
|
||||||
|
// ID: primitive.NewObjectID().Hex(),
|
||||||
|
// UID: "uid123",
|
||||||
|
// Act: string(comm.LogHandleType_Insert),
|
||||||
|
// }
|
||||||
|
// data.D = append(data.D, "mail") // D[0]
|
||||||
|
// data.D = append(data.D, _mail) // D[1]
|
||||||
|
|
||||||
Contex: "恭喜获得专属礼包一份",
|
// _, err1 := db.Defsys.Mgo().InsertOne("model_log", data)
|
||||||
CreateTime: uint64(time.Now().Unix()),
|
// if err1 != nil {
|
||||||
DueTime: uint64(time.Now().Unix()) + 30*24*3600,
|
// log.Errorf("insert model db err %v", err1)
|
||||||
Check: false,
|
// }
|
||||||
Reward: false,
|
// //}()
|
||||||
}
|
|
||||||
//db.InsertModelLogs("mail", "uid123", _mail)
|
|
||||||
db.Defsys.Mgo().InsertOne("mail", _mail)
|
|
||||||
data := &comm.Autogenerated{
|
|
||||||
ID: primitive.NewObjectID().Hex(),
|
|
||||||
UID: "uid123",
|
|
||||||
Act: string(comm.LogHandleType_Insert),
|
|
||||||
}
|
|
||||||
data.D = append(data.D, "mail") // D[0]
|
|
||||||
data.D = append(data.D, _mail) // D[1]
|
|
||||||
|
|
||||||
_, err1 := db.Defsys.Mgo().InsertOne("model_log", data)
|
// ///////////////////////////////////////
|
||||||
if err1 != nil {
|
// filter := bson.M{
|
||||||
log.Errorf("insert model db err %v", err1)
|
// "userid": "uid123",
|
||||||
}
|
// "title": "系统邮件",
|
||||||
//}()
|
// }
|
||||||
|
// var nd *pb.DB_MailData
|
||||||
|
// err := db.Defsys.Mgo().FindOne("mail", filter).Decode(&nd)
|
||||||
|
// if err == nil {
|
||||||
|
// nd.Check = true
|
||||||
|
// nd.Reward = true
|
||||||
|
|
||||||
///////////////////////////////////////
|
// data1 := &comm.Autogenerated{
|
||||||
filter := bson.M{
|
// ID: primitive.NewObjectID().Hex(),
|
||||||
"userid": "uid123",
|
// UID: "uid123",
|
||||||
"title": "系统邮件",
|
// Act: string(comm.LogHandleType_Update),
|
||||||
}
|
// }
|
||||||
var nd *pb.DB_MailData
|
// filter1 := bson.M{
|
||||||
err := db.Defsys.Mgo().FindOne("mail", filter).Decode(&nd)
|
// "userid": "uid123",
|
||||||
if err == nil {
|
// "title": "系统邮件",
|
||||||
nd.Check = true
|
// }
|
||||||
nd.Reward = true
|
// var ndmodify = &bson.M{
|
||||||
|
// "title": "xxxxx",
|
||||||
|
// "check": true,
|
||||||
|
// }
|
||||||
|
|
||||||
data1 := &comm.Autogenerated{
|
// data1.D = make([]interface{}, 0)
|
||||||
ID: primitive.NewObjectID().Hex(),
|
// data1.D = append(data1.D, "mail") // D[0]
|
||||||
UID: "uid123",
|
// data1.D = append(data1.D, &filter1) // D[1]
|
||||||
Act: string(comm.LogHandleType_Update),
|
// data1.D = append(data1.D, ndmodify) // D[2]
|
||||||
}
|
// nd.Title = "read"
|
||||||
filter1 := bson.M{
|
// //db.Defsys.Mgo().UpdateMany("mail", filter1, bson.M{"$set": nd})
|
||||||
"userid": "uid123",
|
// _, err = db.Defsys.Mgo().InsertOne("model_log", data1)
|
||||||
"title": "系统邮件",
|
// if err != nil {
|
||||||
}
|
// log.Errorf("insert model db err %v", err)
|
||||||
var ndmodify = &bson.M{
|
// }
|
||||||
"title": "xxxxx",
|
|
||||||
"check": true,
|
|
||||||
}
|
|
||||||
|
|
||||||
data1.D = make([]interface{}, 0)
|
// }
|
||||||
data1.D = append(data1.D, "mail") // D[0]
|
|
||||||
data1.D = append(data1.D, &filter1) // D[1]
|
|
||||||
data1.D = append(data1.D, ndmodify) // D[2]
|
|
||||||
nd.Title = "read"
|
|
||||||
//db.Defsys.Mgo().UpdateMany("mail", filter1, bson.M{"$set": nd})
|
|
||||||
_, err = db.Defsys.Mgo().InsertOne("model_log", data1)
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("insert model db err %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
time.Sleep(time.Second * 10)
|
time.Sleep(time.Second * 10)
|
||||||
|
|
||||||
@ -101,19 +93,5 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSet(t *testing.T) {
|
func TestSet(t *testing.T) {
|
||||||
friendDb := &pb.DB_FriendData{
|
|
||||||
UserId: "111",
|
|
||||||
FriendIds: []string{"222"},
|
|
||||||
ApplyIds: []string{"333"},
|
|
||||||
BlackIds: []string{"444"},
|
|
||||||
}
|
|
||||||
data := utils.Pb2Map(friendDb)
|
|
||||||
// data2 := map[string]interface{}{
|
|
||||||
// "userId": friendDb.UserId,
|
|
||||||
// "friendIds": friendDb.FriendIds,
|
|
||||||
// "applyIds": friendDb.ApplyIds,
|
|
||||||
// "blackIds": friendDb.BlackIds,
|
|
||||||
// }
|
|
||||||
|
|
||||||
cache.Redis().HMSet("friend:222", data)
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user