大转盘

This commit is contained in:
meixiongfeng 2023-08-02 16:57:56 +08:00
parent a1f533fa45
commit 6849c04075
7 changed files with 255 additions and 43 deletions

View File

@ -984,12 +984,13 @@ const (
)
const (
HdTypeWarorder = 1 // 圣桃战令类型
HdTypePay = 2 // 圣桃充值礼包
KFSevenTask = 3 //开服任务
XSFundPhysical = 4 //现时活动 体力基金
XSFundRecruit = 5 //现时活动 招募基金
XSFundExp = 6 //现时活动 经验基金
HdLevel = 7 //开服等级活动
HdTypeSign = 8 // 七日签到
HdTypeWarorder = 1 // 圣桃战令类型
HdTypePay = 2 // 圣桃充值礼包
KFSevenTask = 3 //开服任务
XSFundPhysical = 4 //现时活动 体力基金
XSFundRecruit = 5 //现时活动 招募基金
XSFundExp = 6 //现时活动 经验基金
HdLevel = 7 //开服等级活动
HdTypeSign = 8 // 七日签到
HdTypeTurntable = 9 // 大转盘
)

View File

@ -543,7 +543,6 @@ type (
ICaravan interface {
ITaskComplete
TestFunc(session IUserSession)
TaskGroupComplete(session IUserSession, group int32)
}
//埋点中心

View File

@ -38,6 +38,20 @@ func (this *apiComp) GetHdData(session comm.IUserSession, req *pb.ActivityGetHdD
update["val"] = list.Val
this.module.modelhdData.ModifyActivityList(session.GetUserId(), list.Id, update)
}
// 开服等级活动
if activity.Itype == comm.HdLevel {
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
if list.Val != user.Lv {
list.Val = user.Lv
list.Lasttime = curTime
update := make(map[string]interface{})
update["lasttime"] = list.Lasttime
update["val"] = list.Val
this.module.modelhdData.ModifyActivityList(session.GetUserId(), list.Id, update)
}
}
}
result = append(result, list)
}

View File

@ -48,7 +48,7 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.ActivityGetRew
}
return
}
if data.Val <= req.Val { //没达到领奖条件
if data.Val < req.Val { //没达到领奖条件
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ActivityCantReward,
Title: pb.ErrorCode_ActivityCantReward.ToString(),

View File

@ -0,0 +1,68 @@
package activity
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
)
//参数校验
func (this *apiComp) TurntableRewardCheck(session comm.IUserSession, req *pb.ActivityTurntableRewardReq) (errdata *pb.ErrorData) {
if req.Oid == "" {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(),
}
}
return
}
// 大转盘抽奖
func (this *apiComp) TurntableReward(session comm.IUserSession, req *pb.ActivityTurntableRewardReq) (errdata *pb.ErrorData) {
if errdata = this.TurntableRewardCheck(session, req); errdata != nil {
return
}
var (
activity *pb.DBHuodong // 活动数据
err error
atno []*pb.UserAtno
)
key := fmt.Sprintf("%s:%s", session.GetUserId(), req.Oid)
data, err := this.module.modelhdData.getHddataByOid(session.GetUserId(), key)
if err == nil {
if activity, err = this.module.modelhdList.getHdListByHdId(req.Oid); err == nil {
curTime := configure.Now().Unix()
if activity.Stime > curTime || curTime > activity.Etime { //不在活动时间范围内
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ActivityNotIntime,
Title: pb.ErrorCode_ActivityNotIntime.ToString(),
}
return
}
} else {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ActivityInvalid,
Title: pb.ErrorCode_ActivityInvalid.ToString(),
}
return
}
} else {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
}
return
}
// 发奖
update := make(map[string]interface{})
update["gotarr"] = data.Gotarr
this.module.modelhdData.ModifyActivityList(session.GetUserId(), data.Id, update)
session.SendMsg(string(this.module.GetType()), "turntablereward", &pb.ActivityTurntableRewardResp{
Data: data,
Atno: atno,
})
return
}

View File

@ -429,17 +429,6 @@ func (this *Caravan) CheckCaravavLvUp(data *pb.DBCaravan) (curLv int32) {
return curLv
}
func (this *Caravan) TestFunc(session comm.IUserSession) {
this.modelCaravan.module.api.GetList(session, &pb.CaravanGetListReq{})
this.modelCaravan.module.api.BuyOrSell(session, &pb.CaravanBuyOrSellReq{
City: 105,
Items: map[string]int32{
//6: 80,
},
IsBuy: true,
})
}
// 赛季结算
func (this *Caravan) Rpc_ModuleCaravanSettlement(ctx context.Context, args *pb.EmptyReq, reply *pb.EmptyResp) (err error) {
this.Debug("Rpc_ModuleCaravanSettlement",

View File

@ -314,6 +314,110 @@ func (x *ActivityGetRewardResp) GetAtno() []*UserAtno {
return nil
}
// 大转盘活动领奖
type ActivityTurntableRewardReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Oid string `protobuf:"bytes,1,opt,name=oid,proto3" json:"oid"`
}
func (x *ActivityTurntableRewardReq) Reset() {
*x = ActivityTurntableRewardReq{}
if protoimpl.UnsafeEnabled {
mi := &file_activity_activity_msg_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ActivityTurntableRewardReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ActivityTurntableRewardReq) ProtoMessage() {}
func (x *ActivityTurntableRewardReq) ProtoReflect() protoreflect.Message {
mi := &file_activity_activity_msg_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 ActivityTurntableRewardReq.ProtoReflect.Descriptor instead.
func (*ActivityTurntableRewardReq) Descriptor() ([]byte, []int) {
return file_activity_activity_msg_proto_rawDescGZIP(), []int{6}
}
func (x *ActivityTurntableRewardReq) GetOid() string {
if x != nil {
return x.Oid
}
return ""
}
// 领取奖励数据返回
type ActivityTurntableRewardResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Data *DBActivityData `protobuf:"bytes,1,opt,name=data,proto3" json:"data"`
Atno []*UserAtno `protobuf:"bytes,2,rep,name=atno,proto3" json:"atno"`
}
func (x *ActivityTurntableRewardResp) Reset() {
*x = ActivityTurntableRewardResp{}
if protoimpl.UnsafeEnabled {
mi := &file_activity_activity_msg_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ActivityTurntableRewardResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ActivityTurntableRewardResp) ProtoMessage() {}
func (x *ActivityTurntableRewardResp) ProtoReflect() protoreflect.Message {
mi := &file_activity_activity_msg_proto_msgTypes[7]
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 ActivityTurntableRewardResp.ProtoReflect.Descriptor instead.
func (*ActivityTurntableRewardResp) Descriptor() ([]byte, []int) {
return file_activity_activity_msg_proto_rawDescGZIP(), []int{7}
}
func (x *ActivityTurntableRewardResp) GetData() *DBActivityData {
if x != nil {
return x.Data
}
return nil
}
func (x *ActivityTurntableRewardResp) GetAtno() []*UserAtno {
if x != nil {
return x.Atno
}
return nil
}
var File_activity_activity_msg_proto protoreflect.FileDescriptor
var file_activity_activity_msg_proto_rawDesc = []byte{
@ -342,8 +446,17 @@ var file_activity_activity_msg_proto_rawDesc = []byte{
0x44, 0x42, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04,
0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x04, 0x61, 0x74, 0x6e, 0x6f, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f, 0x52, 0x04, 0x61,
0x74, 0x6e, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x74, 0x6e, 0x6f, 0x22, 0x2e, 0x0a, 0x1a, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x54,
0x75, 0x72, 0x6e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65,
0x71, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x6f, 0x69, 0x64, 0x22, 0x61, 0x0a, 0x1b, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x54,
0x75, 0x72, 0x6e, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65,
0x73, 0x70, 0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0f, 0x2e, 0x44, 0x42, 0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x44, 0x61, 0x74,
0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1d, 0x0a, 0x04, 0x61, 0x74, 0x6e, 0x6f, 0x18,
0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x74, 0x6e, 0x6f,
0x52, 0x04, 0x61, 0x74, 0x6e, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -358,28 +471,32 @@ func file_activity_activity_msg_proto_rawDescGZIP() []byte {
return file_activity_activity_msg_proto_rawDescData
}
var file_activity_activity_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_activity_activity_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_activity_activity_msg_proto_goTypes = []interface{}{
(*ActivityGetListReq)(nil), // 0: ActivityGetListReq
(*ActivityGetListResp)(nil), // 1: ActivityGetListResp
(*ActivityGetHdDataReq)(nil), // 2: ActivityGetHdDataReq
(*ActivityGetHdDataResp)(nil), // 3: ActivityGetHdDataResp
(*ActivityGetRewardReq)(nil), // 4: ActivityGetRewardReq
(*ActivityGetRewardResp)(nil), // 5: ActivityGetRewardResp
(*DBHuodong)(nil), // 6: DBHuodong
(*DBActivityData)(nil), // 7: DBActivityData
(*UserAtno)(nil), // 8: UserAtno
(*ActivityGetListReq)(nil), // 0: ActivityGetListReq
(*ActivityGetListResp)(nil), // 1: ActivityGetListResp
(*ActivityGetHdDataReq)(nil), // 2: ActivityGetHdDataReq
(*ActivityGetHdDataResp)(nil), // 3: ActivityGetHdDataResp
(*ActivityGetRewardReq)(nil), // 4: ActivityGetRewardReq
(*ActivityGetRewardResp)(nil), // 5: ActivityGetRewardResp
(*ActivityTurntableRewardReq)(nil), // 6: ActivityTurntableRewardReq
(*ActivityTurntableRewardResp)(nil), // 7: ActivityTurntableRewardResp
(*DBHuodong)(nil), // 8: DBHuodong
(*DBActivityData)(nil), // 9: DBActivityData
(*UserAtno)(nil), // 10: UserAtno
}
var file_activity_activity_msg_proto_depIdxs = []int32{
6, // 0: ActivityGetListResp.data:type_name -> DBHuodong
7, // 1: ActivityGetHdDataResp.data:type_name -> DBActivityData
7, // 2: ActivityGetRewardResp.data:type_name -> DBActivityData
8, // 3: ActivityGetRewardResp.atno:type_name -> UserAtno
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
8, // 0: ActivityGetListResp.data:type_name -> DBHuodong
9, // 1: ActivityGetHdDataResp.data:type_name -> DBActivityData
9, // 2: ActivityGetRewardResp.data:type_name -> DBActivityData
10, // 3: ActivityGetRewardResp.atno:type_name -> UserAtno
9, // 4: ActivityTurntableRewardResp.data:type_name -> DBActivityData
10, // 5: ActivityTurntableRewardResp.atno:type_name -> UserAtno
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_activity_activity_msg_proto_init() }
@ -462,6 +579,30 @@ func file_activity_activity_msg_proto_init() {
return nil
}
}
file_activity_activity_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ActivityTurntableRewardReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_activity_activity_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ActivityTurntableRewardResp); 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{
@ -469,7 +610,7 @@ func file_activity_activity_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_activity_activity_msg_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},