Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
db6fb51a8b
@ -89,8 +89,7 @@ locp:
|
||||
SubType: "heartbeat",
|
||||
Data: data,
|
||||
})
|
||||
|
||||
//this.wsConn.SetReadDeadline(configure.Now().Add(time.Second * 30))
|
||||
//this.wsConn.SetReadDeadline(time.Now().Add(time.Second * 30))
|
||||
continue
|
||||
}
|
||||
if err := this.messageDistribution(msg); err != nil {
|
||||
|
@ -95,7 +95,7 @@ func (this *AgentMgrComp) Bind(ctx context.Context, args *pb.AgentBuildReq, repl
|
||||
UserSessionId: agent.SessionId(),
|
||||
UserId: agent.UserId(),
|
||||
}, 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 {
|
||||
|
@ -132,6 +132,26 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
|
||||
update["stageId"] = curChapter.StageId
|
||||
|
||||
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 {
|
||||
this.module.Debugf("Mline first DispenseRes err:+%v", stageConf.Firstaward)
|
||||
}
|
||||
|
@ -5,6 +5,9 @@ import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
type ModelMline struct {
|
||||
@ -16,6 +19,10 @@ func (this *ModelMline) Init(service core.IService, module core.IModule, comp co
|
||||
this.TableName = comm.TableMline
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.module = module.(*Mline)
|
||||
//创建uid索引
|
||||
this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,8 @@ import (
|
||||
"go_dreamfactory/sys/configure"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
type ModelRecord struct {
|
||||
@ -19,6 +21,10 @@ func (this *ModelRecord) Init(service core.IService, module core.IModule, comp c
|
||||
this.TableName = comm.TableTrollRecord
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.module = module.(*Troll)
|
||||
//创建uid索引
|
||||
this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@ import (
|
||||
"go_dreamfactory/sys/db"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
type ModelRank struct {
|
||||
@ -21,6 +23,10 @@ func (this *ModelRank) Init(service core.IService, module core.IModule, comp cor
|
||||
this.TableName = comm.TableVikingRank
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.moduleViking = module.(*Viking)
|
||||
//创建uid索引
|
||||
this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
func (this *ModelRank) AddRankList(uId string, id string, data *pb.DBVikingRank) (err error) {
|
||||
|
@ -55,6 +55,7 @@ type DBUserExpand struct {
|
||||
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挑战券购买次数
|
||||
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() {
|
||||
@ -292,11 +293,18 @@ func (x *DBUserExpand) GetSociatyTicket() int32 {
|
||||
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_rawDesc = []byte{
|
||||
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,
|
||||
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,
|
||||
@ -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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x4d, 0x6c, 0x69,
|
||||
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 (
|
||||
@ -384,18 +399,20 @@ func file_userexpand_proto_rawDescGZIP() []byte {
|
||||
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{}{
|
||||
(*DBUserExpand)(nil), // 0: DBUserExpand
|
||||
nil, // 1: DBUserExpand.TujianEntry
|
||||
nil, // 2: DBUserExpand.MlineEntry
|
||||
}
|
||||
var file_userexpand_proto_depIdxs = []int32{
|
||||
1, // 0: DBUserExpand.tujian:type_name -> DBUserExpand.TujianEntry
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] 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
|
||||
2, // 1: DBUserExpand.mline:type_name -> DBUserExpand.MlineEntry
|
||||
2, // [2:2] is the sub-list for method output_type
|
||||
2, // [2:2] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension 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() }
|
||||
@ -423,7 +440,7 @@ func file_userexpand_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_userexpand_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -86,7 +86,7 @@ func init() {
|
||||
func main() {
|
||||
flag.Parse()
|
||||
if err := log.OnInit(nil,
|
||||
log.SetFileName("./log/cmd.log"),
|
||||
log.SetFileName("./s.log"),
|
||||
log.SetLoglevel(log.DebugLevel),
|
||||
log.SetIsDebug(true)); err != nil {
|
||||
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 {
|
||||
sseting.Sys["log"] = map[string]interface{}{
|
||||
"FileName": fmt.Sprintf("./log/%s.log", sseting.Id),
|
||||
"Loglevel": config.Loglevel,
|
||||
"MaxAgeTime": config.MaxAgeTime,
|
||||
"IsDebug": false,
|
||||
"Loglevel": log.InfoLevel,
|
||||
"MaxAgeTime": 7,
|
||||
}
|
||||
} else {
|
||||
sseting.Sys["log"] = map[string]interface{}{
|
||||
"Alias": sseting.Id,
|
||||
"FileName": "./log/s.log",
|
||||
"Loglevel": config.Loglevel,
|
||||
"MaxAgeTime": config.MaxAgeTime,
|
||||
"FileName": "./s.log",
|
||||
"IsDebug": false,
|
||||
"Loglevel": log.InfoLevel,
|
||||
"MaxAgeTime": 7,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -24,6 +25,7 @@ type (
|
||||
//过期数据
|
||||
ModelDataExpired struct {
|
||||
key string //主key
|
||||
mu sync.RWMutex //安全锁
|
||||
keys map[string]struct{} //数据集合
|
||||
expired time.Time //过期时间
|
||||
}
|
||||
|
@ -61,7 +61,9 @@ func (this *DBConn) UpDateModelExpired(key string, childs map[string]struct{}, e
|
||||
exp.keys = make(map[string]struct{})
|
||||
}
|
||||
for k, _ := range childs {
|
||||
exp.mu.Lock()
|
||||
exp.keys[k] = struct{}{}
|
||||
exp.mu.Unlock()
|
||||
}
|
||||
}
|
||||
exp.expired = time.Now().Add(expired)
|
||||
@ -107,9 +109,11 @@ func (this *DBConn) scanning() {
|
||||
for _, v := range temp {
|
||||
pipe.Del(ctx, v.key)
|
||||
if v.keys != nil {
|
||||
v.mu.RLock()
|
||||
for k1, _ := range v.keys {
|
||||
pipe.Del(ctx, k1)
|
||||
}
|
||||
v.mu.RUnlock()
|
||||
}
|
||||
}
|
||||
if _, err := pipe.Exec(ctx); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user