上传竞技场修改积分接口
This commit is contained in:
parent
5fcb43d233
commit
7801e5c6da
@ -228,6 +228,7 @@ const ( //Rpc
|
||||
|
||||
// arena
|
||||
Rpc_ModuleArenaRaceSettlement core.Rpc_Key = "Rpc_ModuleArenaRaceSettlement" //竞技场比赛结算信息
|
||||
Rpc_ModuleArenaModifyIntegral core.Rpc_Key = "Rpc_ModuleArenaModifyIntegral" //竞技场修改积分
|
||||
|
||||
// 充值发货
|
||||
Rpc_ModulePayDelivery core.Rpc_Key = "Rpc_ModulePayDelivery" //充值发货
|
||||
|
@ -295,6 +295,8 @@ type (
|
||||
IArena interface {
|
||||
///红点
|
||||
IReddot
|
||||
//设置用户积分
|
||||
SetUserIntegral(session IUserSession, Integral int32) (err error)
|
||||
}
|
||||
IGourmet interface {
|
||||
///红点
|
||||
|
@ -131,6 +131,27 @@ func (this *modelArena) updateArenaUserInfo(info *pb.DBArenaUser) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (this *modelArena) modifyIntegral(uid string, integral int32) (err error) {
|
||||
var (
|
||||
dan int32
|
||||
player *pb.ArenaPlayer
|
||||
)
|
||||
if dan, err = this.computedan(integral); err != nil {
|
||||
return
|
||||
}
|
||||
player = &pb.ArenaPlayer{Uid: uid, Integral: integral}
|
||||
if err = this.module.modelRank.updateArenaRank(player); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
this.Change(uid, map[string]interface{}{
|
||||
"integral": integral,
|
||||
"dan": dan,
|
||||
"rank": player.Rank,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (this *modelArena) computedan(integral int32) (dan int32, err error) {
|
||||
var (
|
||||
active *cfg.GameArenaActiveRewardData
|
||||
|
@ -54,6 +54,7 @@ func (this *Arena) Start() (err error) {
|
||||
}
|
||||
this.mail = module.(comm.Imail)
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleArenaRaceSettlement), this.Rpc_ModuleArenaRaceSettlement)
|
||||
this.service.RegisterFunctionName(string(comm.Rpc_ModuleArenaModifyIntegral), this.Rpc_ModuleArenaModifyIntegral)
|
||||
return
|
||||
}
|
||||
|
||||
@ -67,9 +68,17 @@ func (this *Arena) OnInstallComp() {
|
||||
}
|
||||
|
||||
//比赛结算
|
||||
func (this *Arena) Rpc_ModuleArenaRaceSettlement(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) {
|
||||
func (this *Arena) Rpc_ModuleArenaRaceSettlement(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) (err error) {
|
||||
this.Debug("Rpc_ModuleArenaRaceSettlement", log.Fields{"args": args.String()})
|
||||
this.modelRank.raceSettlement()
|
||||
return
|
||||
}
|
||||
|
||||
//修改用户积分
|
||||
func (this *Arena) Rpc_ModuleArenaModifyIntegral(ctx context.Context, args *pb.RPCModifyIntegralReq, reply *pb.EmptyResp) (err error) {
|
||||
this.Debug("Rpc_ModuleArenaModifyIntegral", log.Fields{"args": args.String()})
|
||||
err = this.modelArena.modifyIntegral(args.Uid, args.Integral)
|
||||
return
|
||||
}
|
||||
|
||||
//红点需求
|
||||
@ -84,3 +93,20 @@ func (this *Arena) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (re
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *Arena) SetUserIntegral(session comm.IUserSession, Integral int32) (err error) {
|
||||
if this.IsCross() {
|
||||
err = this.modelArena.modifyIntegral(session.GetUserId(), Integral)
|
||||
} else {
|
||||
if _, err = this.service.AcrossClusterRpcGo(
|
||||
context.Background(),
|
||||
this.GetCrossTag(),
|
||||
comm.Service_Worker,
|
||||
string(comm.Rpc_ModuleChatPushChat),
|
||||
&pb.RPCModifyIntegralReq{Uid: session.GetUserId(), Integral: Integral},
|
||||
nil); err != nil {
|
||||
this.Errorln(err)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -748,6 +748,62 @@ func (x *DBNpc) GetIndex() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
//修改用户积分
|
||||
type RPCModifyIntegralReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
|
||||
Integral int32 `protobuf:"varint,2,opt,name=integral,proto3" json:"integral"`
|
||||
}
|
||||
|
||||
func (x *RPCModifyIntegralReq) Reset() {
|
||||
*x = RPCModifyIntegralReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_arena_arena_db_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RPCModifyIntegralReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RPCModifyIntegralReq) ProtoMessage() {}
|
||||
|
||||
func (x *RPCModifyIntegralReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_arena_arena_db_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RPCModifyIntegralReq.ProtoReflect.Descriptor instead.
|
||||
func (*RPCModifyIntegralReq) Descriptor() ([]byte, []int) {
|
||||
return file_arena_arena_db_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *RPCModifyIntegralReq) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RPCModifyIntegralReq) GetIntegral() int32 {
|
||||
if x != nil {
|
||||
return x.Integral
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_arena_arena_db_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_arena_arena_db_proto_rawDesc = []byte{
|
||||
@ -854,18 +910,23 @@ var file_arena_arena_db_proto_rawDesc = []byte{
|
||||
0x4e, 0x70, 0x63, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x02, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x63, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x02, 0x63, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2a, 0x9f, 0x01, 0x0a, 0x11, 0x42, 0x61,
|
||||
0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
|
||||
0x0d, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x57, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x0e,
|
||||
0x0a, 0x0a, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x01, 0x12, 0x0e,
|
||||
0x0a, 0x0a, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x6b, 0x57, 0x69, 0x6e, 0x10, 0x02, 0x12, 0x0e,
|
||||
0x0a, 0x0a, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x4c, 0x6f, 0x73, 0x74, 0x10, 0x03, 0x12, 0x12,
|
||||
0x0a, 0x0e, 0x57, 0x61, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65,
|
||||
0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x46, 0x61, 0x69,
|
||||
0x6c, 0x65, 0x64, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65,
|
||||
0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x10, 0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x52,
|
||||
0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x45, 0x6e, 0x64, 0x10, 0x07, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x44, 0x0a, 0x14, 0x52, 0x50, 0x43,
|
||||
0x4d, 0x6f, 0x64, 0x69, 0x66, 0x79, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x52, 0x65,
|
||||
0x71, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
|
||||
0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x2a,
|
||||
0x9f, 0x01, 0x0a, 0x11, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64,
|
||||
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x57,
|
||||
0x69, 0x6e, 0x10, 0x00, 0x12, 0x0e, 0x0a, 0x0a, 0x41, 0x74, 0x74, 0x61, 0x63, 0x6b, 0x4c, 0x6f,
|
||||
0x73, 0x74, 0x10, 0x01, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x6b, 0x57,
|
||||
0x69, 0x6e, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x65, 0x66, 0x65, 0x6e, 0x64, 0x4c, 0x6f,
|
||||
0x73, 0x74, 0x10, 0x03, 0x12, 0x12, 0x0a, 0x0e, 0x57, 0x61, 0x69, 0x74, 0x69, 0x6e, 0x67, 0x52,
|
||||
0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x10, 0x04, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x65, 0x76, 0x65,
|
||||
0x6e, 0x67, 0x65, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x05, 0x12, 0x14, 0x0a, 0x10, 0x52,
|
||||
0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x10,
|
||||
0x06, 0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x65, 0x76, 0x65, 0x6e, 0x67, 0x65, 0x45, 0x6e, 0x64, 0x10,
|
||||
0x07, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -881,7 +942,7 @@ func file_arena_arena_db_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_arena_arena_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_arena_arena_db_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||
var file_arena_arena_db_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_arena_arena_db_proto_goTypes = []interface{}{
|
||||
(BattleRecordState)(0), // 0: BattleRecordState
|
||||
(*DBPlayerBattleFormt)(nil), // 1: DBPlayerBattleFormt
|
||||
@ -890,18 +951,19 @@ var file_arena_arena_db_proto_goTypes = []interface{}{
|
||||
(*DBArenaBattleRecord)(nil), // 4: DBArenaBattleRecord
|
||||
(*DBArenaUser)(nil), // 5: DBArenaUser
|
||||
(*DBNpc)(nil), // 6: DBNpc
|
||||
nil, // 7: DBArenaUser.NpcEntry
|
||||
(*DBHero)(nil), // 8: DBHero
|
||||
(*RPCModifyIntegralReq)(nil), // 7: RPCModifyIntegralReq
|
||||
nil, // 8: DBArenaUser.NpcEntry
|
||||
(*DBHero)(nil), // 9: DBHero
|
||||
}
|
||||
var file_arena_arena_db_proto_depIdxs = []int32{
|
||||
8, // 0: DBPlayerBattleFormt.formt:type_name -> DBHero
|
||||
9, // 0: DBPlayerBattleFormt.formt:type_name -> DBHero
|
||||
1, // 1: ArenaPlayer.defend:type_name -> DBPlayerBattleFormt
|
||||
3, // 2: DBArenaBattleRecord.formt:type_name -> DBHeroBase
|
||||
0, // 3: DBArenaBattleRecord.State:type_name -> BattleRecordState
|
||||
1, // 4: DBArenaUser.attack:type_name -> DBPlayerBattleFormt
|
||||
1, // 5: DBArenaUser.defend:type_name -> DBPlayerBattleFormt
|
||||
4, // 6: DBArenaUser.record:type_name -> DBArenaBattleRecord
|
||||
7, // 7: DBArenaUser.npc:type_name -> DBArenaUser.NpcEntry
|
||||
8, // 7: DBArenaUser.npc:type_name -> DBArenaUser.NpcEntry
|
||||
6, // 8: DBArenaUser.NpcEntry.value:type_name -> DBNpc
|
||||
9, // [9:9] is the sub-list for method output_type
|
||||
9, // [9:9] is the sub-list for method input_type
|
||||
@ -989,6 +1051,18 @@ func file_arena_arena_db_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_arena_arena_db_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RPCModifyIntegralReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@ -996,7 +1070,7 @@ func file_arena_arena_db_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_arena_arena_db_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 7,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user