From 05b5b2ede976c3b9b3432908b5b090c668a00bab Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 10 Nov 2022 17:40:09 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=AD=E8=B4=B9=E6=97=B6=E9=97=B4=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/privilege/module.go | 17 ++++++++++++----- pb/errorcode.pb.go | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/modules/privilege/module.go b/modules/privilege/module.go index 260e6f8d8..5e3b22763 100644 --- a/modules/privilege/module.go +++ b/modules/privilege/module.go @@ -91,7 +91,14 @@ func (this *Privilege) CreatePrivilegeCard(session comm.IUserSession, cId string if v.ETime > configure.Now().Unix() { // 加时间 v.ETime += int64(conf.AssertDay) * 24 * 3600 } else { - v.ETime = configure.Now().Unix() + int64(conf.AssertDay)*24*3600 + // 检测能否续费 + if configure.Now().Unix()-v.ETime <= int64(conf.RenewDay)*24*3600 { + v.ETime = configure.Now().Unix() + int64(conf.AssertDay)*24*3600 + } else { + code = pb.ErrorCode_PayRenewTimeErr + return + } + } if err = this.modelPrivilege.Change(session.GetUserId(), map[string]interface{}{ "eTime": v.ETime, @@ -119,7 +126,7 @@ func (this *Privilege) CreatePrivilegeCard(session comm.IUserSession, cId string data.PrivilegeID = append(data.PrivilegeID, v) } this.modelPrivilege.addNewPrivilegeData(session.GetUserId(), data) - this.SendDailyMail(session, session.GetUserId(), 1) + this.SendDailyMail(session, cId, 1) } if code = this.DispenseRes(session, conf.DisposableReward, true); code != pb.ErrorCode_Success { @@ -239,7 +246,7 @@ func (this *Privilege) QueryPrivilege(session comm.IUserSession) (privilegeID [] // 检查离上次领奖过去几天 dt := configure.Now().Unix() - utils.GetZeroTime(v.RewardTime) count := dt / (24 * 3600) - this.SendDailyMail(session, v.Id, int32(count+1)) + this.SendDailyMail(session, v.CId, int32(count+1)) } } } @@ -266,8 +273,8 @@ func (this *Privilege) SendDailyMail(session comm.IUserSession, cId string, coun mail := &pb.DBMailData{ ObjId: "", Uid: session.GetUserId(), - Title: "", - Contex: "", + Title: "Everyday Rewards", + Contex: "Everyday Rewards", CreateTime: uint64(configure.Now().Unix()), DueTime: uint64(configure.Now().Unix() + 30*24*3600), Check: false, diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index ef3c4d2a0..321b2971f 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -259,6 +259,7 @@ const ( ErrorCode_GrowtaskAdvReceive ErrorCode = 3602 //进阶奖励领取失败 // pay ErrorCode_PayBuyNumNotEnough ErrorCode = 3701 //支付次数不足 + ErrorCode_PayRenewTimeErr ErrorCode = 3702 // 续费时间没达到要求 // worldtask ErrorCode_WorldtaskFinish ErrorCode = 3801 //任务完成失败 ErrorCode_WorldtaskLvNotEnough ErrorCode = 3802 //等级不满足 @@ -478,6 +479,7 @@ var ( 3601: "GrowtaskReceive", 3602: "GrowtaskAdvReceive", 3701: "PayBuyNumNotEnough", + 3702: "PayRenewTimeErr", 3801: "WorldtaskFinish", 3802: "WorldtaskLvNotEnough", 3803: "WorldtaskNoAccept", @@ -693,6 +695,7 @@ var ( "GrowtaskReceive": 3601, "GrowtaskAdvReceive": 3602, "PayBuyNumNotEnough": 3701, + "PayRenewTimeErr": 3702, "WorldtaskFinish": 3801, "WorldtaskLvNotEnough": 3802, "WorldtaskNoAccept": 3803, @@ -730,7 +733,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, 0xec, 0x25, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0x82, 0x26, 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, @@ -1028,12 +1031,14 @@ var file_errorcode_proto_rawDesc = []byte{ 0x76, 0x65, 0x10, 0x91, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x47, 0x72, 0x6f, 0x77, 0x74, 0x61, 0x73, 0x6b, 0x41, 0x64, 0x76, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x10, 0x92, 0x1c, 0x12, 0x17, 0x0a, 0x12, 0x50, 0x61, 0x79, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x4e, 0x6f, 0x74, 0x45, 0x6e, - 0x6f, 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6c, 0x64, - 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x10, 0xd9, 0x1d, 0x12, 0x19, 0x0a, - 0x14, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x76, 0x4e, 0x6f, 0x74, 0x45, - 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, 0x12, 0x16, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6c, - 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x10, 0xdb, 0x1d, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x75, 0x67, 0x68, 0x10, 0xf5, 0x1c, 0x12, 0x14, 0x0a, 0x0f, 0x50, 0x61, 0x79, 0x52, 0x65, + 0x6e, 0x65, 0x77, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x72, 0x72, 0x10, 0xf6, 0x1c, 0x12, 0x14, 0x0a, + 0x0f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, + 0x10, 0xd9, 0x1d, 0x12, 0x19, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, + 0x4c, 0x76, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xda, 0x1d, 0x12, 0x16, + 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x41, 0x63, 0x63, + 0x65, 0x70, 0x74, 0x10, 0xdb, 0x1d, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (