This commit is contained in:
wh_zcy 2023-01-31 15:05:04 +08:00
commit db6fb51a8b
10 changed files with 112 additions and 49 deletions

View File

@ -89,8 +89,7 @@ locp:
SubType: "heartbeat", SubType: "heartbeat",
Data: data, Data: data,
}) })
//this.wsConn.SetReadDeadline(time.Now().Add(time.Second * 30))
//this.wsConn.SetReadDeadline(configure.Now().Add(time.Second * 30))
continue continue
} }
if err := this.messageDistribution(msg); err != nil { if err := this.messageDistribution(msg); err != nil {

View File

@ -95,7 +95,7 @@ func (this *AgentMgrComp) Bind(ctx context.Context, args *pb.AgentBuildReq, repl
UserSessionId: agent.SessionId(), UserSessionId: agent.SessionId(),
UserId: agent.UserId(), UserId: agent.UserId(),
}, nil); err != nil { }, nil); err != nil {
log.Errorf("uId:%s Rpc_NoticeUserLogin err:%v", agent.UserId(), err) log.Errorf("uId:%s clusterTag:%s Rpc_NoticeUserLogin err:%v", agent.UserId(), db.CrossTag(), err)
} }
// } // }
} else { } else {

View File

@ -132,6 +132,26 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
update["stageId"] = curChapter.StageId update["stageId"] = curChapter.StageId
if first { // 发奖 if first { // 发奖
if rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度
_mp := rst.Mline
if _mp == nil {
_mp = make(map[int32]int32, 1)
_mp[curChapter.CType] = req.StageId
} else {
if v, ok := _mp[curChapter.CType]; ok {
if v <= req.StageId {
_mp[curChapter.CType] = req.StageId
}
} else {
_mp[curChapter.CType] = req.StageId
}
}
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
"mline": _mp,
})
}
if code = this.module.DispenseRes(session, stageConf.Firstaward, true); code != pb.ErrorCode_Success { if code = this.module.DispenseRes(session, stageConf.Firstaward, true); code != pb.ErrorCode_Success {
this.module.Debugf("Mline first DispenseRes err:+%v", stageConf.Firstaward) this.module.Debugf("Mline first DispenseRes err:+%v", stageConf.Firstaward)
} }

View File

@ -5,6 +5,9 @@ import (
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
) )
type ModelMline struct { type ModelMline struct {
@ -16,6 +19,10 @@ func (this *ModelMline) Init(service core.IService, module core.IModule, comp co
this.TableName = comm.TableMline this.TableName = comm.TableMline
err = this.MCompModel.Init(service, module, comp, options) err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Mline) this.module = module.(*Mline)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return return
} }

View File

@ -8,6 +8,8 @@ import (
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
"go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
) )
type ModelRecord struct { type ModelRecord struct {
@ -19,6 +21,10 @@ func (this *ModelRecord) Init(service core.IService, module core.IModule, comp c
this.TableName = comm.TableTrollRecord this.TableName = comm.TableTrollRecord
err = this.MCompModel.Init(service, module, comp, options) err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Troll) this.module = module.(*Troll)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return return
} }

View File

@ -10,6 +10,8 @@ import (
"go_dreamfactory/sys/db" "go_dreamfactory/sys/db"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
) )
type ModelRank struct { type ModelRank struct {
@ -21,6 +23,10 @@ func (this *ModelRank) Init(service core.IService, module core.IModule, comp cor
this.TableName = comm.TableVikingRank this.TableName = comm.TableVikingRank
err = this.MCompModel.Init(service, module, comp, options) err = this.MCompModel.Init(service, module, comp, options)
this.moduleViking = module.(*Viking) this.moduleViking = module.(*Viking)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return return
} }
func (this *ModelRank) AddRankList(uId string, id string, data *pb.DBVikingRank) (err error) { func (this *ModelRank) AddRankList(uId string, id string, data *pb.DBVikingRank) (err error) {

View File

@ -26,35 +26,36 @@ type DBUserExpand struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //主键id Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` //主键id
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //用户id Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` //用户id
Lastreadnotiftime int64 `protobuf:"varint,3,opt,name=lastreadnotiftime,proto3" json:"lastreadnotiftime"` //最后阅读公告时间 Lastreadnotiftime int64 `protobuf:"varint,3,opt,name=lastreadnotiftime,proto3" json:"lastreadnotiftime"` //最后阅读公告时间
LastInitdataTime int64 `protobuf:"varint,4,opt,name=lastInitdataTime,proto3" json:"lastInitdataTime"` //上次初始数据时间 LastInitdataTime int64 `protobuf:"varint,4,opt,name=lastInitdataTime,proto3" json:"lastInitdataTime"` //上次初始数据时间
InitdataCount uint32 `protobuf:"varint,5,opt,name=initdataCount,proto3" json:"initdataCount"` //今日初始累计次数 InitdataCount uint32 `protobuf:"varint,5,opt,name=initdataCount,proto3" json:"initdataCount"` //今日初始累计次数
Chatchannel int32 `protobuf:"varint,6,opt,name=chatchannel,proto3" json:"chatchannel"` //跨服聊天频道 Chatchannel int32 `protobuf:"varint,6,opt,name=chatchannel,proto3" json:"chatchannel"` //跨服聊天频道
ModifynameCount int32 `protobuf:"varint,7,opt,name=modifynameCount,proto3" json:"modifynameCount"` //修改昵称次数 ModifynameCount int32 `protobuf:"varint,7,opt,name=modifynameCount,proto3" json:"modifynameCount"` //修改昵称次数
Tujian map[string]int32 `protobuf:"bytes,8,rep,name=tujian,proto3" json:"tujian" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //图鉴 Tujian map[string]int32 `protobuf:"bytes,8,rep,name=tujian,proto3" json:"tujian" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //图鉴
Activeday int32 `protobuf:"varint,11,opt,name=activeday,proto3" json:"activeday"` //日活跃度 Activeday int32 `protobuf:"varint,11,opt,name=activeday,proto3" json:"activeday"` //日活跃度
Activeweek int32 `protobuf:"varint,12,opt,name=activeweek,proto3" json:"activeweek"` //周活跃度 Activeweek int32 `protobuf:"varint,12,opt,name=activeweek,proto3" json:"activeweek"` //周活跃度
Sign string `protobuf:"bytes,13,opt,name=sign,proto3" json:"sign"` //用户签名 Sign string `protobuf:"bytes,13,opt,name=sign,proto3" json:"sign"` //用户签名
FriendPoint int32 `protobuf:"varint,14,opt,name=friendPoint,proto3" json:"friendPoint" bson:"friendPoint"` //友情点 FriendPoint int32 `protobuf:"varint,14,opt,name=friendPoint,proto3" json:"friendPoint" bson:"friendPoint"` //友情点
FriendPointID int32 `protobuf:"varint,15,opt,name=friendPointID,proto3" json:"friendPointID" bson:"friendPointID"` //每日获赠友情点 FriendPointID int32 `protobuf:"varint,15,opt,name=friendPointID,proto3" json:"friendPointID" bson:"friendPointID"` //每日获赠友情点
FriendPointOD int32 `protobuf:"varint,16,opt,name=friendPointOD,proto3" json:"friendPointOD" bson:"friendPointOD"` //每日送出友情点 FriendPointOD int32 `protobuf:"varint,16,opt,name=friendPointOD,proto3" json:"friendPointOD" bson:"friendPointOD"` //每日送出友情点
LoginAddCount int32 `protobuf:"varint,19,opt,name=loginAddCount,proto3" json:"loginAddCount"` //@go_tasgs(`bson:"loginAddCount"`) 累计登录天数 LoginAddCount int32 `protobuf:"varint,19,opt,name=loginAddCount,proto3" json:"loginAddCount"` //@go_tasgs(`bson:"loginAddCount"`) 累计登录天数
LoginContinueCount int32 `protobuf:"varint,20,opt,name=loginContinueCount,proto3" json:"loginContinueCount"` //@go_tasgs(`bson:"loginContinueCount"`) 连续登录天数 LoginContinueCount int32 `protobuf:"varint,20,opt,name=loginContinueCount,proto3" json:"loginContinueCount"` //@go_tasgs(`bson:"loginContinueCount"`) 连续登录天数
RtaskId int32 `protobuf:"varint,21,opt,name=rtaskId,proto3" json:"rtaskId" bson:"rtaskId"` // 当前完成的随机任务ID RtaskId int32 `protobuf:"varint,21,opt,name=rtaskId,proto3" json:"rtaskId" bson:"rtaskId"` // 当前完成的随机任务ID
TeamHeroIds []string `protobuf:"bytes,22,rep,name=teamHeroIds,proto3" json:"teamHeroIds" bson:"teamHeroIds"` //阵容英雄IDs TeamHeroIds []string `protobuf:"bytes,22,rep,name=teamHeroIds,proto3" json:"teamHeroIds" bson:"teamHeroIds"` //阵容英雄IDs
SociatyId string `protobuf:"bytes,23,opt,name=sociatyId,proto3" json:"sociatyId" bson:"sociatyId"` //公会ID SociatyId string `protobuf:"bytes,23,opt,name=sociatyId,proto3" json:"sociatyId" bson:"sociatyId"` //公会ID
SociatyCd int64 `protobuf:"varint,24,opt,name=sociatyCd,proto3" json:"sociatyCd" bson:"sociatyCd"` //主动退出CD SociatyCd int64 `protobuf:"varint,24,opt,name=sociatyCd,proto3" json:"sociatyCd" bson:"sociatyCd"` //主动退出CD
Guildcoin int32 `protobuf:"varint,25,opt,name=guildcoin,proto3" json:"guildcoin" bson:"guildcoin"` //公会币 Guildcoin int32 `protobuf:"varint,25,opt,name=guildcoin,proto3" json:"guildcoin" bson:"guildcoin"` //公会币
Arenacoin int32 `protobuf:"varint,26,opt,name=arenacoin,proto3" json:"arenacoin" bson:"arenacoin"` //竞技场币 Arenacoin int32 `protobuf:"varint,26,opt,name=arenacoin,proto3" json:"arenacoin" bson:"arenacoin"` //竞技场币
Physicalbuynum int32 `protobuf:"varint,27,opt,name=physicalbuynum,proto3" json:"physicalbuynum"` //@go_tags(`bson:"physicalbuynum"`)体力购买次数 Physicalbuynum int32 `protobuf:"varint,27,opt,name=physicalbuynum,proto3" json:"physicalbuynum"` //@go_tags(`bson:"physicalbuynum"`)体力购买次数
PhysicalbuyLasttime int64 `protobuf:"varint,28,opt,name=physicalbuyLasttime,proto3" json:"physicalbuyLasttime"` //@go_tags(`bson:"physicalbuyLasttime"`)最后购买体力事件 PhysicalbuyLasttime int64 `protobuf:"varint,28,opt,name=physicalbuyLasttime,proto3" json:"physicalbuyLasttime"` //@go_tags(`bson:"physicalbuyLasttime"`)最后购买体力事件
Buyunifiedticket int32 `protobuf:"varint,29,opt,name=buyunifiedticket,proto3" json:"buyunifiedticket"` //@go_tags(`bson:"buyunifiedticket"`)购买统一入场门票次数 Buyunifiedticket int32 `protobuf:"varint,29,opt,name=buyunifiedticket,proto3" json:"buyunifiedticket"` //@go_tags(`bson:"buyunifiedticket"`)购买统一入场门票次数
Lasttimeunifiedticket int64 `protobuf:"varint,30,opt,name=lasttimeunifiedticket,proto3" json:"lasttimeunifiedticket"` //@go_tags(`bson:"lasttimeunifiedticket"`)最后购买统一入场门票时间 Lasttimeunifiedticket int64 `protobuf:"varint,30,opt,name=lasttimeunifiedticket,proto3" json:"lasttimeunifiedticket"` //@go_tags(`bson:"lasttimeunifiedticket"`)最后购买统一入场门票时间
Recovertimeunifiedticket int64 `protobuf:"varint,31,opt,name=recovertimeunifiedticket,proto3" json:"recovertimeunifiedticket"` //@go_tags(`bson:"recovertimeunifiedticket"`)同意门票恢复时间 Recovertimeunifiedticket int64 `protobuf:"varint,31,opt,name=recovertimeunifiedticket,proto3" json:"recovertimeunifiedticket"` //@go_tags(`bson:"recovertimeunifiedticket"`)同意门票恢复时间
SociatyTicketBuyNum int32 `protobuf:"varint,32,opt,name=sociatyTicketBuyNum,proto3" json:"sociatyTicketBuyNum" bson:"sociatyTicketBuyNum"` //公会boss挑战券购买次数 SociatyTicketBuyNum int32 `protobuf:"varint,32,opt,name=sociatyTicketBuyNum,proto3" json:"sociatyTicketBuyNum" bson:"sociatyTicketBuyNum"` //公会boss挑战券购买次数
SociatyTicket int32 `protobuf:"varint,33,opt,name=sociatyTicket,proto3" json:"sociatyTicket" bson:"sociatyTicket"` //公会boss挑战券数量 SociatyTicket int32 `protobuf:"varint,33,opt,name=sociatyTicket,proto3" json:"sociatyTicket" bson:"sociatyTicket"` //公会boss挑战券数量
Mline map[int32]int32 `protobuf:"bytes,34,rep,name=mline,proto3" json:"mline" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"mline"` //主线关卡最大进度
} }
func (x *DBUserExpand) Reset() { func (x *DBUserExpand) Reset() {
@ -292,11 +293,18 @@ func (x *DBUserExpand) GetSociatyTicket() int32 {
return 0 return 0
} }
func (x *DBUserExpand) GetMline() map[int32]int32 {
if x != nil {
return x.Mline
}
return nil
}
var File_userexpand_proto protoreflect.FileDescriptor var File_userexpand_proto protoreflect.FileDescriptor
var file_userexpand_proto_rawDesc = []byte{ var file_userexpand_proto_rawDesc = []byte{
0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0x84, 0x09, 0x0a, 0x0c, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70, 0x74, 0x6f, 0x22, 0xee, 0x09, 0x0a, 0x0c, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70,
0x61, 0x6e, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x61, 0x6e, 0x64, 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, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x2c, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61,
@ -364,12 +372,19 @@ var file_userexpand_proto_rawDesc = []byte{
0x01, 0x28, 0x05, 0x52, 0x13, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x69, 0x63, 0x6b, 0x01, 0x28, 0x05, 0x52, 0x13, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x69, 0x63, 0x6b,
0x65, 0x74, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x6f, 0x63, 0x69, 0x65, 0x74, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x24, 0x0a, 0x0d, 0x73, 0x6f, 0x63, 0x69,
0x61, 0x74, 0x79, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x05, 0x52, 0x61, 0x74, 0x79, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x05, 0x52,
0x0d, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x39, 0x0d, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x2e,
0x0a, 0x05, 0x6d, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x22, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e,
0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x2e, 0x4d, 0x6c, 0x69,
0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x6d, 0x6c, 0x69, 0x6e, 0x65, 0x1a, 0x39,
0x0a, 0x0b, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x0a, 0x0b, 0x54, 0x75, 0x6a, 0x69, 0x61, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x4d, 0x6c, 0x69,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
} }
var ( var (
@ -384,18 +399,20 @@ func file_userexpand_proto_rawDescGZIP() []byte {
return file_userexpand_proto_rawDescData return file_userexpand_proto_rawDescData
} }
var file_userexpand_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_userexpand_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_userexpand_proto_goTypes = []interface{}{ var file_userexpand_proto_goTypes = []interface{}{
(*DBUserExpand)(nil), // 0: DBUserExpand (*DBUserExpand)(nil), // 0: DBUserExpand
nil, // 1: DBUserExpand.TujianEntry nil, // 1: DBUserExpand.TujianEntry
nil, // 2: DBUserExpand.MlineEntry
} }
var file_userexpand_proto_depIdxs = []int32{ var file_userexpand_proto_depIdxs = []int32{
1, // 0: DBUserExpand.tujian:type_name -> DBUserExpand.TujianEntry 1, // 0: DBUserExpand.tujian:type_name -> DBUserExpand.TujianEntry
1, // [1:1] is the sub-list for method output_type 2, // 1: DBUserExpand.mline:type_name -> DBUserExpand.MlineEntry
1, // [1:1] is the sub-list for method input_type 2, // [2:2] is the sub-list for method output_type
1, // [1:1] is the sub-list for extension type_name 2, // [2:2] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension extendee 2, // [2:2] is the sub-list for extension type_name
0, // [0:1] is the sub-list for field type_name 2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
} }
func init() { file_userexpand_proto_init() } func init() { file_userexpand_proto_init() }
@ -423,7 +440,7 @@ func file_userexpand_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_userexpand_proto_rawDesc, RawDescriptor: file_userexpand_proto_rawDesc,
NumEnums: 0, NumEnums: 0,
NumMessages: 2, NumMessages: 3,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -86,7 +86,7 @@ func init() {
func main() { func main() {
flag.Parse() flag.Parse()
if err := log.OnInit(nil, if err := log.OnInit(nil,
log.SetFileName("./log/cmd.log"), log.SetFileName("./s.log"),
log.SetLoglevel(log.DebugLevel), log.SetLoglevel(log.DebugLevel),
log.SetIsDebug(true)); err != nil { log.SetIsDebug(true)); err != nil {
panic(fmt.Sprintf("Sys log Init err:%v", err)) panic(fmt.Sprintf("Sys log Init err:%v", err))
@ -330,15 +330,17 @@ func convertServiceSttings(config *comm.GameConfig, id int, stype string, ip str
if !onelog { if !onelog {
sseting.Sys["log"] = map[string]interface{}{ sseting.Sys["log"] = map[string]interface{}{
"FileName": fmt.Sprintf("./log/%s.log", sseting.Id), "FileName": fmt.Sprintf("./log/%s.log", sseting.Id),
"Loglevel": config.Loglevel, "IsDebug": false,
"MaxAgeTime": config.MaxAgeTime, "Loglevel": log.InfoLevel,
"MaxAgeTime": 7,
} }
} else { } else {
sseting.Sys["log"] = map[string]interface{}{ sseting.Sys["log"] = map[string]interface{}{
"Alias": sseting.Id, "Alias": sseting.Id,
"FileName": "./log/s.log", "FileName": "./s.log",
"Loglevel": config.Loglevel, "IsDebug": false,
"MaxAgeTime": config.MaxAgeTime, "Loglevel": log.InfoLevel,
"MaxAgeTime": 7,
} }
} }

View File

@ -1,6 +1,7 @@
package db package db
import ( import (
"sync"
"time" "time"
) )
@ -24,6 +25,7 @@ type (
//过期数据 //过期数据
ModelDataExpired struct { ModelDataExpired struct {
key string //主key key string //主key
mu sync.RWMutex //安全锁
keys map[string]struct{} //数据集合 keys map[string]struct{} //数据集合
expired time.Time //过期时间 expired time.Time //过期时间
} }

View File

@ -61,7 +61,9 @@ func (this *DBConn) UpDateModelExpired(key string, childs map[string]struct{}, e
exp.keys = make(map[string]struct{}) exp.keys = make(map[string]struct{})
} }
for k, _ := range childs { for k, _ := range childs {
exp.mu.Lock()
exp.keys[k] = struct{}{} exp.keys[k] = struct{}{}
exp.mu.Unlock()
} }
} }
exp.expired = time.Now().Add(expired) exp.expired = time.Now().Add(expired)
@ -107,9 +109,11 @@ func (this *DBConn) scanning() {
for _, v := range temp { for _, v := range temp {
pipe.Del(ctx, v.key) pipe.Del(ctx, v.key)
if v.keys != nil { if v.keys != nil {
v.mu.RLock()
for k1, _ := range v.keys { for k1, _ := range v.keys {
pipe.Del(ctx, k1) pipe.Del(ctx, k1)
} }
v.mu.RUnlock()
} }
} }
if _, err := pipe.Exec(ctx); err != nil { if _, err := pipe.Exec(ctx); err != nil {