领取奖励
This commit is contained in:
parent
302e85dc59
commit
96c421265d
@ -22,6 +22,35 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.PagodaGetRewar
|
||||
if code != pb.ErrorCode_Success {
|
||||
return // 参数校验失败直接返回
|
||||
}
|
||||
|
||||
// 获取 奖励信息
|
||||
list, err := this.module.modelPagoda.getPagodaList(session.GetUserId())
|
||||
if err != nil || list == nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
_cfg := this.module.configure.GetPagodaRewardconfig(req.Id)
|
||||
if _cfg == nil {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
return
|
||||
}
|
||||
// 校验是否能领取
|
||||
if _cfg.LayerNum >= list.PagodaId {
|
||||
code = pb.ErrorCode_PagodaConditionErr
|
||||
return
|
||||
}
|
||||
|
||||
if _, ok := list.Reward[req.GetId()]; ok { // 校验是否重复领取
|
||||
code = pb.ErrorCode_PagodaGetRewardErr
|
||||
return
|
||||
}
|
||||
if list.Reward == nil {
|
||||
list.Reward = make(map[int32]bool, 0)
|
||||
}
|
||||
|
||||
list.Reward[req.Id] = true
|
||||
mapData := make(map[string]interface{}, 0)
|
||||
mapData["reward"] = list.Reward
|
||||
code = this.module.ModifyPagodaData(session.GetUserId(), mapData)
|
||||
session.SendMsg(string(this.module.GetType()), PagodaGetRewardResp, &pb.PagodaGetRewardResp{Data: list})
|
||||
return
|
||||
}
|
||||
|
@ -93,3 +93,25 @@ func (this *configureComp) GetPagodaconfig(id int32) (data *cfg.GamepagodaData)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 爬塔奖励
|
||||
func (this *configureComp) GetPagodaRewardconfig(id int32) (data *cfg.GamepagodaTaskRewardData) {
|
||||
if v, err := this.GetConfigure(game_pagodataskreward); err == nil {
|
||||
var (
|
||||
configure *cfg.GamepagodaTaskReward
|
||||
ok bool
|
||||
)
|
||||
if configure, ok = v.(*cfg.GamepagodaTaskReward); !ok {
|
||||
log.Errorf("%T no is *cfg.Game_pagodaData", v)
|
||||
return
|
||||
}
|
||||
|
||||
if data, ok = configure.GetDataMap()[id]; ok {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Errorf("get game_pagodataskreward conf err:%v", err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -139,7 +139,9 @@ const (
|
||||
ErrorCode_MailErr ErrorCode = 1800 // 邮件不存在
|
||||
// pagoda
|
||||
ErrorCode_PagodaNotFound ErrorCode = 1900 // 找不到塔数据
|
||||
ErrorCode_PagodaLevlErr ErrorCode = 19001 // 挑战关卡数据不匹配
|
||||
ErrorCode_PagodaLevlErr ErrorCode = 1901 // 挑战关卡数据不匹配
|
||||
ErrorCode_PagodaGetRewardErr ErrorCode = 1902 // 重复领取
|
||||
ErrorCode_PagodaConditionErr ErrorCode = 1903 // 条件不足
|
||||
)
|
||||
|
||||
// Enum value maps for ErrorCode.
|
||||
@ -251,7 +253,9 @@ var (
|
||||
1701: "ShopNoSurplusRefreshNum",
|
||||
1800: "MailErr",
|
||||
1900: "PagodaNotFound",
|
||||
19001: "PagodaLevlErr",
|
||||
1901: "PagodaLevlErr",
|
||||
1902: "PagodaGetRewardErr",
|
||||
1903: "PagodaConditionErr",
|
||||
}
|
||||
ErrorCode_value = map[string]int32{
|
||||
"Success": 0,
|
||||
@ -360,7 +364,9 @@ var (
|
||||
"ShopNoSurplusRefreshNum": 1701,
|
||||
"MailErr": 1800,
|
||||
"PagodaNotFound": 1900,
|
||||
"PagodaLevlErr": 19001,
|
||||
"PagodaLevlErr": 1901,
|
||||
"PagodaGetRewardErr": 1902,
|
||||
"PagodaConditionErr": 1903,
|
||||
}
|
||||
)
|
||||
|
||||
@ -395,7 +401,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_errorcode_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2a, 0xda, 0x11, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x6f, 0x2a, 0x8b, 0x12, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
|
||||
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
|
||||
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
|
||||
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
@ -535,9 +541,12 @@ var file_errorcode_proto_rawDesc = []byte{
|
||||
0x4e, 0x6f, 0x53, 0x75, 0x72, 0x70, 0x6c, 0x75, 0x73, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68,
|
||||
0x4e, 0x75, 0x6d, 0x10, 0xa5, 0x0d, 0x12, 0x0c, 0x0a, 0x07, 0x4d, 0x61, 0x69, 0x6c, 0x45, 0x72,
|
||||
0x72, 0x10, 0x88, 0x0e, 0x12, 0x13, 0x0a, 0x0e, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x4e, 0x6f,
|
||||
0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xec, 0x0e, 0x12, 0x13, 0x0a, 0x0d, 0x50, 0x61, 0x67,
|
||||
0x6f, 0x64, 0x61, 0x4c, 0x65, 0x76, 0x6c, 0x45, 0x72, 0x72, 0x10, 0xb9, 0x94, 0x01, 0x42, 0x06,
|
||||
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0xec, 0x0e, 0x12, 0x12, 0x0a, 0x0d, 0x50, 0x61, 0x67,
|
||||
0x6f, 0x64, 0x61, 0x4c, 0x65, 0x76, 0x6c, 0x45, 0x72, 0x72, 0x10, 0xed, 0x0e, 0x12, 0x17, 0x0a,
|
||||
0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64,
|
||||
0x45, 0x72, 0x72, 0x10, 0xee, 0x0e, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61,
|
||||
0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x72, 0x72, 0x10, 0xef, 0x0e, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user