修改是否叠加的判断

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)
}
},
enabled: true,
// enabled: true,
next: func(robot *Robot, rsp proto.Message) {
tcs := []*TestCase{}
if v, ok := rsp.(*pb.TaskListResp); ok {
@ -57,7 +57,13 @@ var (
TaskTag: int32(comm.TASK_DAILY),
},
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: "活跃度领取",
mainType: string(comm.ModuleTask),

View File

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

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)
}()
resp.Active = this.moduleTask.modelTask.countActive(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
}
//不是新账号
if !isNewUser {
//set user other info
update := map[string]interface{}{
"logintime": time.Now().Unix(),
"lastloginip": session.GetIP(),
}
//缓存user
user.Logintime = time.Now().Unix()
user.Lastloginip = session.GetIP()
update := utils.StructToMap(user)
err = this.module.modelUser.Change(user.Uid, update)
if err != nil {
code = pb.ErrorCode_DBError

View File

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

View File

@ -271,7 +271,8 @@ type TaskActiveListResp struct {
sizeCache protoimpl.SizeCache
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() {
@ -313,6 +314,13 @@ func (x *TaskActiveListResp) GetList() []*DBTaskActive {
return nil
}
func (x *TaskActiveListResp) GetActive() int32 {
if x != nil {
return x.Active
}
return 0
}
//活跃度领取
type TaskActiveReceiveReq struct {
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,
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,
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, 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,
0x0a, 0x14, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65,
0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61,
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
0x22, 0x41, 0x0a, 0x15, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65,
0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73,
0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b,
0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 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,
0x73, 0x6b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x12, 0x16,
0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06,
0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x40, 0x0a, 0x14, 0x54, 0x61, 0x73, 0x6b, 0x41, 0x63,
0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18,
0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x41, 0x0a, 0x15, 0x54, 0x61, 0x73, 0x6b,
0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73,
0x70, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x61, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69,
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 (