奖励类型转换
This commit is contained in:
parent
4953b4e545
commit
4333089c6a
@ -5,6 +5,7 @@ import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@ -42,12 +43,14 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceive
|
||||
}
|
||||
|
||||
//发奖
|
||||
if code := this.moduleLinestory.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success {
|
||||
if code = this.moduleLinestory.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success {
|
||||
this.moduleLinestory.Error("奖励发放失败", log.Fields{"uid": uid, "chapterId": req.ChapterId, "reward": conf.Reward})
|
||||
return
|
||||
}
|
||||
|
||||
rsp := &pb.LinestoryReceiveResp{
|
||||
ChapterId: req.ChapterId,
|
||||
ChapterId: req.ChapterId,
|
||||
UserAssets: utils.ConvertReward(conf.Reward...),
|
||||
}
|
||||
if err := session.SendMsg(string(this.moduleLinestory.GetType()), LinestorySubTypeReceive, rsp); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
|
@ -254,7 +254,8 @@ type LinestoryReceiveResp struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ChapterId int32 `protobuf:"varint,1,opt,name=chapterId,proto3" json:"chapterId"`
|
||||
ChapterId int32 `protobuf:"varint,1,opt,name=chapterId,proto3" json:"chapterId"`
|
||||
UserAssets []*UserAssets `protobuf:"bytes,2,rep,name=userAssets,proto3" json:"userAssets"`
|
||||
}
|
||||
|
||||
func (x *LinestoryReceiveResp) Reset() {
|
||||
@ -296,40 +297,51 @@ func (x *LinestoryReceiveResp) GetChapterId() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *LinestoryReceiveResp) GetUserAssets() []*UserAssets {
|
||||
if x != nil {
|
||||
return x.UserAssets
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_linestory_linestory_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_linestory_linestory_msg_proto_rawDesc = []byte{
|
||||
0x0a, 0x1d, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6c, 0x69, 0x6e, 0x65,
|
||||
0x73, 0x74, 0x6f, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
|
||||
0x1c, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2f, 0x6c, 0x69, 0x6e, 0x65, 0x73,
|
||||
0x74, 0x6f, 0x72, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x15, 0x0a,
|
||||
0x13, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65,
|
||||
0x72, 0x52, 0x65, 0x71, 0x22, 0xae, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f,
|
||||
0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x48, 0x0a,
|
||||
0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x26, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68,
|
||||
0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68,
|
||||
0x61, 0x70, 0x74, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x1a, 0x4c, 0x0a, 0x10, 0x54, 0x61, 0x73, 0x6b, 0x43,
|
||||
0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x34, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f,
|
||||
0x72, 0x79, 0x4d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a,
|
||||
0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x15, 0x4c,
|
||||
0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4d, 0x61, 0x69, 0x6e, 0x52, 0x04, 0x6c,
|
||||
0x69, 0x73, 0x74, 0x22, 0x33, 0x0a, 0x13, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79,
|
||||
0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68,
|
||||
0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63,
|
||||
0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x34, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65,
|
||||
0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70,
|
||||
0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x42, 0x06,
|
||||
0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x74, 0x6f, 0x72, 0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63,
|
||||
0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x15, 0x0a, 0x13, 0x4c, 0x69, 0x6e,
|
||||
0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71,
|
||||
0x22, 0xae, 0x01, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68,
|
||||
0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x48, 0x0a, 0x0b, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26,
|
||||
0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65,
|
||||
0x72, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65,
|
||||
0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70,
|
||||
0x74, 0x65, 0x72, 0x1a, 0x4c, 0x0a, 0x10, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x61, 0x70, 0x74,
|
||||
0x65, 0x72, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x22, 0x0a, 0x05, 0x76, 0x61, 0x6c,
|
||||
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43,
|
||||
0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38,
|
||||
0x01, 0x22, 0x34, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61,
|
||||
0x69, 0x6e, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61,
|
||||
0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68,
|
||||
0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x22, 0x36, 0x0a, 0x15, 0x4c, 0x69, 0x6e, 0x65, 0x73,
|
||||
0x74, 0x6f, 0x72, 0x79, 0x4d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70,
|
||||
0x12, 0x1d, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09,
|
||||
0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4d, 0x61, 0x69, 0x6e, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22,
|
||||
0x33, 0x0a, 0x13, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x63, 0x65,
|
||||
0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65,
|
||||
0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x70, 0x74,
|
||||
0x65, 0x72, 0x49, 0x64, 0x22, 0x61, 0x0a, 0x14, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x74, 0x6f, 0x72,
|
||||
0x79, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1c, 0x0a, 0x09,
|
||||
0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x09, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x0a, 0x75, 0x73,
|
||||
0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b,
|
||||
0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x0a, 0x75, 0x73, 0x65,
|
||||
0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -354,17 +366,19 @@ var file_linestory_linestory_msg_proto_goTypes = []interface{}{
|
||||
(*LinestoryReceiveResp)(nil), // 5: LinestoryReceiveResp
|
||||
nil, // 6: LinestoryChapterResp.TaskChapterEntry
|
||||
(*TaskMain)(nil), // 7: TaskMain
|
||||
(*TaskChapter)(nil), // 8: TaskChapter
|
||||
(*UserAssets)(nil), // 8: UserAssets
|
||||
(*TaskChapter)(nil), // 9: TaskChapter
|
||||
}
|
||||
var file_linestory_linestory_msg_proto_depIdxs = []int32{
|
||||
6, // 0: LinestoryChapterResp.taskChapter:type_name -> LinestoryChapterResp.TaskChapterEntry
|
||||
7, // 1: LinestoryMaintaskResp.list:type_name -> TaskMain
|
||||
8, // 2: LinestoryChapterResp.TaskChapterEntry.value:type_name -> TaskChapter
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
8, // 2: LinestoryReceiveResp.userAssets:type_name -> UserAssets
|
||||
9, // 3: LinestoryChapterResp.TaskChapterEntry.value:type_name -> TaskChapter
|
||||
4, // [4:4] is the sub-list for method output_type
|
||||
4, // [4:4] is the sub-list for method input_type
|
||||
4, // [4:4] is the sub-list for extension type_name
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_linestory_linestory_msg_proto_init() }
|
||||
@ -373,6 +387,7 @@ func file_linestory_linestory_msg_proto_init() {
|
||||
return
|
||||
}
|
||||
file_linestory_linestory_db_proto_init()
|
||||
file_comm_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_linestory_linestory_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*LinestoryChapterReq); i {
|
||||
|
17
utils/trans.go
Normal file
17
utils/trans.go
Normal file
@ -0,0 +1,17 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
func ConvertReward(data ...*cfg.Gameatn) (res []*pb.UserAssets) {
|
||||
for _, v := range data {
|
||||
res = append(res, &pb.UserAssets{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue
Block a user