修改是否叠加的判断

This commit is contained in:
zhaocy 2022-07-18 15:02:48 +08:00
parent 62c05813e3
commit aa253f24ec
6 changed files with 51 additions and 35 deletions

View File

@ -28,7 +28,7 @@ var (
fmt.Printf("%v \n", v) fmt.Printf("%v \n", v)
} }
}, },
enabled: true, // enabled: true,
next: func(robot *Robot, rsp proto.Message) { next: func(robot *Robot, rsp proto.Message) {
tcs := []*TestCase{} tcs := []*TestCase{}
if v, ok := rsp.(*pb.TaskListResp); ok { if v, ok := rsp.(*pb.TaskListResp); ok {
@ -57,7 +57,13 @@ var (
TaskTag: int32(comm.TASK_DAILY), TaskTag: int32(comm.TASK_DAILY),
}, },
rsp: &pb.TaskActiveListResp{}, rsp: &pb.TaskActiveListResp{},
// enabled: true, print: func(rsp proto.Message) {
out := rsp.(*pb.TaskActiveListResp)
for _, v := range out.List {
fmt.Printf("%v 活跃值:%v\n", v, out.Active)
}
},
enabled: true,
}, { }, {
desc: "活跃度领取", desc: "活跃度领取",
mainType: string(comm.ModuleTask), mainType: string(comm.ModuleTask),

View File

@ -129,12 +129,9 @@ func (this *ModelHero) createMultiHero(uid string, bPush bool, heroCfgIds ...int
if len(heroes) == 0 { if len(heroes) == 0 {
for _, v := range heroCfgIds { for _, v := range heroCfgIds {
if err := this.createOneHero(uid, v, bPush); err != nil { return this.createOneHero(uid, v, bPush)
return err
}
} }
} else { } else {
findHero := func(heroId int32) (*pb.DBHero, bool) { findHero := func(heroId int32) (*pb.DBHero, bool) {
for _, h := range heroes { for _, h := range heroes {
if h.HeroID == heroId { if h.HeroID == heroId {
@ -145,17 +142,19 @@ func (this *ModelHero) createMultiHero(uid string, bPush bool, heroCfgIds ...int
} }
for _, v := range heroCfgIds { for _, v := range heroCfgIds {
if h, ok := findHero(v); ok { if h, ok := findHero(v); ok {
h.SameCount++ //允许叠加
data := map[string]interface{}{ if h.IsOverlying {
"sameCount": h.SameCount, //叠加数 h.SameCount++
} data := map[string]interface{}{
if err := this.modifyHeroData(uid, h.Id, data); err != nil { "sameCount": h.SameCount, //叠加数
return err }
return this.modifyHeroData(uid, h.Id, data)
} else {
return this.createOneHero(uid, v, bPush)
} }
} else { } else {
if err := this.createOneHero(uid, v, bPush); err != nil { return this.createOneHero(uid, v, bPush)
return err
}
} }
} }
} }

View File

@ -31,6 +31,7 @@ func (this *apiComp) ActiveList(session comm.IUserSession, req *pb.TaskActiveLis
utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveList, req, resp) utils.TraceFunc(session.GetUserId(), string(this.moduleTask.GetType()), TaskSubTypeActiveList, req, resp)
}() }()
resp.Active = this.moduleTask.modelTask.countActive(session.GetUserId(), comm.TaskTag(req.TaskTag))
//遍历活跃度奖励表 //遍历活跃度奖励表
resp.List = this.moduleTask.modelTaskActive.getUserActiveList(session.GetUserId(), comm.TaskTag(req.TaskTag)) resp.List = this.moduleTask.modelTaskActive.getUserActiveList(session.GetUserId(), comm.TaskTag(req.TaskTag))

View File

@ -90,14 +90,12 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
return return
} }
//不是新账号
if !isNewUser { if !isNewUser {
//set user other info //set user other info
update := map[string]interface{}{ user.Logintime = time.Now().Unix()
"logintime": time.Now().Unix(), user.Lastloginip = session.GetIP()
"lastloginip": session.GetIP(), update := utils.StructToMap(user)
}
//缓存user
err = this.module.modelUser.Change(user.Uid, update) err = this.module.modelUser.Change(user.Uid, update)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError

View File

@ -21,7 +21,10 @@ message TaskListResp { repeated DBTask list = 1; }
// //
message TaskActiveListReq { int32 taskTag = 1; } message TaskActiveListReq { int32 taskTag = 1; }
message TaskActiveListResp { repeated DBTaskActive list = 1; } message TaskActiveListResp {
repeated DBTaskActive list = 1; //
int32 active = 2; //
}
// //
message TaskActiveReceiveReq { message TaskActiveReceiveReq {

View File

@ -271,7 +271,8 @@ type TaskActiveListResp struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
List []*DBTaskActive `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` List []*DBTaskActive `protobuf:"bytes,1,rep,name=list,proto3" json:"list"` //活跃度列表
Active int32 `protobuf:"varint,2,opt,name=active,proto3" json:"active"` //活跃度值
} }
func (x *TaskActiveListResp) Reset() { func (x *TaskActiveListResp) Reset() {
@ -313,6 +314,13 @@ func (x *TaskActiveListResp) GetList() []*DBTaskActive {
return nil return nil
} }
func (x *TaskActiveListResp) GetActive() int32 {
if x != nil {
return x.Active
}
return 0
}
//活跃度领取 //活跃度领取
type TaskActiveReceiveReq struct { type TaskActiveReceiveReq struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -444,20 +452,21 @@ var file_task_task_msg_proto_rawDesc = []byte{
0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x2d, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x2d, 0x0a, 0x11, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63,
0x74, 0x69, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x74, 0x69, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x74,
0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61,
0x73, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x37, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x22, 0x4f, 0x0a, 0x12, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74,
0x69, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, 0x6c, 0x69, 0x76, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x21, 0x0a, 0x04, 0x6c,
0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x54, 0x61, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x54, 0x61,
0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x40, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x16,
0x0a, 0x14, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x40, 0x0a, 0x14, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63,
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x22, 0x41, 0x0a, 0x15, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02,
0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x41, 0x0a, 0x15, 0x54, 0x61, 0x73, 0x6b,
0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73,
0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01,
0x02, 0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x74, 0x6f, 0x33, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (