update
This commit is contained in:
parent
45317f13fc
commit
034c6c8aca
@ -8,17 +8,17 @@ import (
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) GetRewardCheck(session comm.IUserSession, req *pb.TrollNpcRewardReq) (code pb.ErrorCode) {
|
||||
func (this *apiComp) NpcRewardCheck(session comm.IUserSession, req *pb.TrollNpcRewardReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
///美食城领取奖励
|
||||
func (this *apiComp) GetReward(session comm.IUserSession, req *pb.TrollNpcRewardReq) (code pb.ErrorCode, data proto.Message) {
|
||||
func (this *apiComp) NpcReward(session comm.IUserSession, req *pb.TrollNpcRewardReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
update map[string]interface{}
|
||||
)
|
||||
code = this.GetRewardCheck(session, req)
|
||||
code = this.NpcRewardCheck(session, req)
|
||||
_troll, err := this.module.modelTroll.getTrollList(session.GetUserId())
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
@ -28,19 +28,24 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.TrollNpcReward
|
||||
if conf == nil {
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
if _, ok := _troll.NpcReward[req.RewardId]; !ok {
|
||||
this.module.ModifyTrollData(session.GetUserId(), update)
|
||||
if code = this.module.DispenseRes(session, conf.Reword, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
_troll.NpcReward[req.RewardId] = 1
|
||||
update = make(map[string]interface{}, 0)
|
||||
update["npcReward"] = _troll.NpcReward
|
||||
if confLv := this.configure.GetTrollLv(req.RewardId); confLv != nil {
|
||||
if _troll.TotalEarn >= int64(confLv.Money) {
|
||||
if _, ok := _troll.NpcReward[req.RewardId]; !ok {
|
||||
|
||||
} else {
|
||||
code = pb.ErrorCode_TrollRepeatedReward
|
||||
return
|
||||
if code = this.module.DispenseRes(session, conf.Reword, true); code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
_troll.NpcReward[req.RewardId] = 1
|
||||
update = make(map[string]interface{}, 0)
|
||||
update["npcReward"] = _troll.NpcReward
|
||||
this.module.ModifyTrollData(session.GetUserId(), update)
|
||||
} else {
|
||||
code = pb.ErrorCode_TrollRepeatedReward
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), TrollNpcRewardResp, &pb.TrollNpcRewardResp{Data: _troll})
|
||||
return
|
||||
}
|
||||
|
@ -92,10 +92,10 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq)
|
||||
if leftTime <= v {
|
||||
trolltrain.RefreshTime = time.Now().Unix() + int64(leftTime-v)
|
||||
trolltrain.TarinPos += index
|
||||
if trolltrain.RangeId != 0 {
|
||||
trolltrain.RangeId += index
|
||||
trolltrain.RangeId = (trolltrain.RangeId % maxCoefficient) + 1
|
||||
}
|
||||
//if trolltrain.RangeId != 0 {
|
||||
trolltrain.RangeId += index
|
||||
trolltrain.RangeId = (trolltrain.RangeId % maxCoefficient) + 1
|
||||
//}
|
||||
|
||||
trolltrain.TarinPos = (trolltrain.TarinPos % trainNum) + 1
|
||||
break
|
||||
|
20
modules/user/api_sign.go
Normal file
20
modules/user/api_sign.go
Normal file
@ -0,0 +1,20 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) SignCheck(session comm.IUserSession, req *pb.UserSignReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
//登录
|
||||
func (this *apiComp) Sign(session comm.IUserSession, req *pb.UserSignReq) (code pb.ErrorCode, data proto.Message) {
|
||||
this.module.modelSign.checkResetSignData(session)
|
||||
return
|
||||
}
|
@ -117,7 +117,7 @@ func (this *ModelSign) checkResetSignData(session comm.IUserSession) {
|
||||
if bReward && _data != nil { // 发奖
|
||||
this.module.DispenseRes(session, _data.Loopgift, true)
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "sign", &pb.UserSignPush{
|
||||
session.SendMsg(string(this.module.GetType()), "sign", &pb.UserSignResp{
|
||||
Data: sign,
|
||||
Reward: bReward,
|
||||
})
|
||||
|
@ -386,7 +386,7 @@ func (this *User) AddAttributeValue(session comm.IUserSession, attr string, add
|
||||
}
|
||||
|
||||
if bPush { //推送玩家账号信息变化消息
|
||||
session.SendMsg(string(this.GetType()), "reschange", _change)
|
||||
session.SendMsg(string(this.GetType()), "reschanged", _change)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -405,7 +405,7 @@ func (this *User) AddAttributeValues(session comm.IUserSession, attrs map[string
|
||||
}
|
||||
|
||||
if bPush { //推送玩家账号信息变化消息
|
||||
session.SendMsg(string(this.GetType()), "reschange", _change)
|
||||
session.SendMsg(string(this.GetType()), "reschanged", _change)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2183,18 +2183,14 @@ func (x *UserGetServerDataResp) GetData() *DBServerData {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 推送签到信息
|
||||
type UserSignPush struct {
|
||||
type UserSignReq struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data *DBSign `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
|
||||
Reward bool `protobuf:"varint,2,opt,name=reward,proto3" json:"reward"` // 是否领奖
|
||||
}
|
||||
|
||||
func (x *UserSignPush) Reset() {
|
||||
*x = UserSignPush{}
|
||||
func (x *UserSignReq) Reset() {
|
||||
*x = UserSignReq{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_user_user_msg_proto_msgTypes[43]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -2202,13 +2198,13 @@ func (x *UserSignPush) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UserSignPush) String() string {
|
||||
func (x *UserSignReq) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UserSignPush) ProtoMessage() {}
|
||||
func (*UserSignReq) ProtoMessage() {}
|
||||
|
||||
func (x *UserSignPush) ProtoReflect() protoreflect.Message {
|
||||
func (x *UserSignReq) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_user_msg_proto_msgTypes[43]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@ -2220,19 +2216,61 @@ func (x *UserSignPush) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use UserSignPush.ProtoReflect.Descriptor instead.
|
||||
func (*UserSignPush) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use UserSignReq.ProtoReflect.Descriptor instead.
|
||||
func (*UserSignReq) Descriptor() ([]byte, []int) {
|
||||
return file_user_user_msg_proto_rawDescGZIP(), []int{43}
|
||||
}
|
||||
|
||||
func (x *UserSignPush) GetData() *DBSign {
|
||||
// 推送签到信息
|
||||
type UserSignResp struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data *DBSign `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
|
||||
Reward bool `protobuf:"varint,2,opt,name=reward,proto3" json:"reward"` // 是否领奖
|
||||
}
|
||||
|
||||
func (x *UserSignResp) Reset() {
|
||||
*x = UserSignResp{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_user_user_msg_proto_msgTypes[44]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *UserSignResp) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*UserSignResp) ProtoMessage() {}
|
||||
|
||||
func (x *UserSignResp) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_user_user_msg_proto_msgTypes[44]
|
||||
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 UserSignResp.ProtoReflect.Descriptor instead.
|
||||
func (*UserSignResp) Descriptor() ([]byte, []int) {
|
||||
return file_user_user_msg_proto_rawDescGZIP(), []int{44}
|
||||
}
|
||||
|
||||
func (x *UserSignResp) GetData() *DBSign {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *UserSignPush) GetReward() bool {
|
||||
func (x *UserSignResp) GetReward() bool {
|
||||
if x != nil {
|
||||
return x.Reward
|
||||
}
|
||||
@ -2405,12 +2443,13 @@ var file_user_user_msg_proto_rawDesc = []byte{
|
||||
0x74, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x21, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e,
|
||||
0x44, 0x42, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61,
|
||||
0x74, 0x61, 0x22, 0x43, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x50, 0x75,
|
||||
0x73, 0x68, 0x12, 0x1b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x07, 0x2e, 0x44, 0x42, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||
0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x74, 0x61, 0x22, 0x0d, 0x0a, 0x0b, 0x55, 0x73, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65,
|
||||
0x71, 0x22, 0x43, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x12, 0x1b, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x07, 0x2e, 0x44, 0x42, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06,
|
||||
0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -2425,7 +2464,7 @@ func file_user_user_msg_proto_rawDescGZIP() []byte {
|
||||
return file_user_user_msg_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_user_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 44)
|
||||
var file_user_user_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 45)
|
||||
var file_user_user_msg_proto_goTypes = []interface{}{
|
||||
(*UserLoginReq)(nil), // 0: UserLoginReq
|
||||
(*UserLoginResp)(nil), // 1: UserLoginResp
|
||||
@ -2470,36 +2509,37 @@ var file_user_user_msg_proto_goTypes = []interface{}{
|
||||
(*UserDataListResp)(nil), // 40: UserDataListResp
|
||||
(*UserGetServerDataReq)(nil), // 41: UserGetServerDataReq
|
||||
(*UserGetServerDataResp)(nil), // 42: UserGetServerDataResp
|
||||
(*UserSignPush)(nil), // 43: UserSignPush
|
||||
(*DBUser)(nil), // 44: DBUser
|
||||
(*DBUserExpand)(nil), // 45: DBUserExpand
|
||||
(ErrorCode)(0), // 46: ErrorCode
|
||||
(*CacheUser)(nil), // 47: CacheUser
|
||||
(*DBUserSetting)(nil), // 48: DBUserSetting
|
||||
(*DBPagodaRecord)(nil), // 49: DBPagodaRecord
|
||||
(*DBHuntingRank)(nil), // 50: DBHuntingRank
|
||||
(*DBVikingRank)(nil), // 51: DBVikingRank
|
||||
(*DBServerData)(nil), // 52: DBServerData
|
||||
(*DBSign)(nil), // 53: DBSign
|
||||
(*UserSignReq)(nil), // 43: UserSignReq
|
||||
(*UserSignResp)(nil), // 44: UserSignResp
|
||||
(*DBUser)(nil), // 45: DBUser
|
||||
(*DBUserExpand)(nil), // 46: DBUserExpand
|
||||
(ErrorCode)(0), // 47: ErrorCode
|
||||
(*CacheUser)(nil), // 48: CacheUser
|
||||
(*DBUserSetting)(nil), // 49: DBUserSetting
|
||||
(*DBPagodaRecord)(nil), // 50: DBPagodaRecord
|
||||
(*DBHuntingRank)(nil), // 51: DBHuntingRank
|
||||
(*DBVikingRank)(nil), // 52: DBVikingRank
|
||||
(*DBServerData)(nil), // 53: DBServerData
|
||||
(*DBSign)(nil), // 54: DBSign
|
||||
}
|
||||
var file_user_user_msg_proto_depIdxs = []int32{
|
||||
44, // 0: UserLoginResp.data:type_name -> DBUser
|
||||
45, // 1: UserLoginResp.ex:type_name -> DBUserExpand
|
||||
44, // 2: UserInfoResp.data:type_name -> DBUser
|
||||
45, // 3: UserInfoResp.ex:type_name -> DBUserExpand
|
||||
46, // 4: UserRegisterResp.Code:type_name -> ErrorCode
|
||||
47, // 5: UserLoadResp.data:type_name -> CacheUser
|
||||
48, // 6: UserGetSettingResp.setting:type_name -> DBUserSetting
|
||||
48, // 7: UserUpdateSettingReq.setting:type_name -> DBUserSetting
|
||||
44, // 8: UserBattlerecordResp.data:type_name -> DBUser
|
||||
45, // 9: UserBattlerecordResp.ex:type_name -> DBUserExpand
|
||||
49, // 10: UserBattlerecordResp.pagodaRecord:type_name -> DBPagodaRecord
|
||||
50, // 11: UserBattlerecordResp.huntingRecord:type_name -> DBHuntingRank
|
||||
51, // 12: UserBattlerecordResp.vikingRecord:type_name -> DBVikingRank
|
||||
47, // 13: UserOnlineResp.users:type_name -> CacheUser
|
||||
44, // 14: UserDataListResp.users:type_name -> DBUser
|
||||
52, // 15: UserGetServerDataResp.data:type_name -> DBServerData
|
||||
53, // 16: UserSignPush.data:type_name -> DBSign
|
||||
45, // 0: UserLoginResp.data:type_name -> DBUser
|
||||
46, // 1: UserLoginResp.ex:type_name -> DBUserExpand
|
||||
45, // 2: UserInfoResp.data:type_name -> DBUser
|
||||
46, // 3: UserInfoResp.ex:type_name -> DBUserExpand
|
||||
47, // 4: UserRegisterResp.Code:type_name -> ErrorCode
|
||||
48, // 5: UserLoadResp.data:type_name -> CacheUser
|
||||
49, // 6: UserGetSettingResp.setting:type_name -> DBUserSetting
|
||||
49, // 7: UserUpdateSettingReq.setting:type_name -> DBUserSetting
|
||||
45, // 8: UserBattlerecordResp.data:type_name -> DBUser
|
||||
46, // 9: UserBattlerecordResp.ex:type_name -> DBUserExpand
|
||||
50, // 10: UserBattlerecordResp.pagodaRecord:type_name -> DBPagodaRecord
|
||||
51, // 11: UserBattlerecordResp.huntingRecord:type_name -> DBHuntingRank
|
||||
52, // 12: UserBattlerecordResp.vikingRecord:type_name -> DBVikingRank
|
||||
48, // 13: UserOnlineResp.users:type_name -> CacheUser
|
||||
45, // 14: UserDataListResp.users:type_name -> DBUser
|
||||
53, // 15: UserGetServerDataResp.data:type_name -> DBServerData
|
||||
54, // 16: UserSignResp.data:type_name -> DBSign
|
||||
17, // [17:17] is the sub-list for method output_type
|
||||
17, // [17:17] is the sub-list for method input_type
|
||||
17, // [17:17] is the sub-list for extension type_name
|
||||
@ -3037,7 +3077,19 @@ func file_user_user_msg_proto_init() {
|
||||
}
|
||||
}
|
||||
file_user_user_msg_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UserSignPush); i {
|
||||
switch v := v.(*UserSignReq); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_user_user_msg_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UserSignResp); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -3055,7 +3107,7 @@ func file_user_user_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_user_user_msg_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 44,
|
||||
NumMessages: 45,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user