This commit is contained in:
liwei1dao 2022-11-10 20:05:39 +08:00
commit 35c83f3feb
8 changed files with 119 additions and 14 deletions

View File

@ -1,6 +1,7 @@
[
{
"id": "yueka_lv1",
"pType": 1,
"name": "经典月卡",
"assert_day": 30,
"renew_day": 3,
@ -26,6 +27,7 @@
},
{
"id": "yueka_lv2",
"pType": 2,
"name": "典藏月卡",
"assert_day": 30,
"renew_day": 3,
@ -51,6 +53,7 @@
},
{
"id": "passcheck_1",
"pType": 3,
"name": "爬塔战令",
"assert_day": 30,
"renew_day": 0,

View File

@ -469,3 +469,9 @@ const (
TrollSurprise //惊喜货物售价系数
)
// 邮件ID
const (
Yueka_1 string = "Activity_PrivilegeCardDailyReward_lv1"
Yueka_2 string = "Activity_PrivilegeCardDailyReward_lv2"
)

View File

@ -120,6 +120,8 @@ type (
ModifyMainlineData(uid string, id int32) (code pb.ErrorCode)
/// 查询章节ID
GetUsermainLineData(uid string) (mainlineId int32)
Reddot(uid string, rid ...ReddotType) map[ReddotType]bool
}
//任务
ITask interface {
@ -199,6 +201,8 @@ type (
IPagoda interface {
ModifyPagodaFloor(session IUserSession, level int32) (code pb.ErrorCode)
CheckUserBasePagodaInfo(uid string) (data *pb.DBPagodaRecord) // 查询玩家最佳通关记录
Reddot(uid string, rid ...ReddotType) map[ReddotType]bool
}
IHeroFetter interface {

View File

@ -98,3 +98,42 @@ func (this *Mainline) Start() (err error) {
this.battle = module.(comm.IBattle)
return
}
//红点查询
func (this *Mainline) Reddot(uid string, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
reddot = make(map[comm.ReddotType]bool)
for _, v := range rid {
if v == comm.Reddot5 {
reddot[comm.Reddot5] = this.CheckPoint(uid)
break
}
}
return
}
// 红点检测
func (this *Mainline) CheckPoint(uid string) bool {
list, err := this.modelMainline.getMainlineList(uid)
if err != nil {
return false
}
for _, v := range list {
conf := this.configure.GetMainlineChapter(v.ChapterId)
if conf == nil {
continue
}
bFind := false
for _, v1 := range conf.Episode {
for _, banch := range v.BranchID {
if banch == v1 {
bFind = true
break
}
}
}
if !bFind { // 没找到 显示红点
return false
}
}
return true
}

View File

@ -139,3 +139,33 @@ func (this *Pagoda) SetPagodaRankList(tableName string, score int32, uid string)
}
}
}
//红点查询
func (this *Pagoda) Reddot(uid string, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
reddot = make(map[comm.ReddotType]bool)
return
}
// 红点检测
func (this *Pagoda) CheckPoint(uid string) bool {
list, err := this.modelPagoda.getPagodaList(uid)
if err != nil {
return false
}
maxFloor := this.configure.GetPagodaFloor(list.Type)
if list.PagodaId < maxFloor { // 层数不够 显示红点
return true
}
// 检测赛季塔
season, err := this.modelSeasonPagoda.getSeasonPagodaList(uid)
if err != nil {
return false
}
maxFloor = this.configure.GetPagodaFloor(list.Type)
if season.PagodaId < maxFloor { // 层数不够 显示红点
return true
}
return true
}

View File

@ -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,
@ -105,6 +112,7 @@ func (this *Privilege) CreatePrivilegeCard(session comm.IUserSession, cId string
}
}
if !bFind {
data = &pb.DBPrivilege{
Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(),
@ -119,7 +127,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, conf.PType)
}
if code = this.DispenseRes(session, conf.DisposableReward, true); code != pb.ErrorCode_Success {
@ -225,7 +233,10 @@ func (this *Privilege) QueryPrivilege(session comm.IUserSession) (privilegeID []
this.Errorf("delete privilege failed:%v", err)
}
} else {
conf, err := this.configure.GetPrivilegeCard(v.CId)
if err != nil {
return nil
}
privilegeID = append(privilegeID, v.PrivilegeID...)
// 检查 每日奖励是否发放
if !utils.IsToday(v.RewardTime) {
@ -239,14 +250,14 @@ 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), conf.PType)
}
}
}
return
}
func (this *Privilege) SendDailyMail(session comm.IUserSession, cId string, count int32) {
func (this *Privilege) SendDailyMail(session comm.IUserSession, cId string, count int32, pType int32) {
conf, err := this.configure.GetPrivilegeCard(cId)
if err != nil {
return
@ -266,8 +277,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,
@ -276,6 +287,11 @@ func (this *Privilege) SendDailyMail(session comm.IUserSession, cId string, coun
Cid: "",
Param: []string{},
}
if pType == 1 {
mail.Cid = comm.Yueka_1
} else if pType == 2 {
mail.Cid = comm.Yueka_2
}
for i := 0; i < int(count); i++ {
mail.ObjId = primitive.NewObjectID().Hex()
this.mail.CreateNewMail(session, mail)

View File

@ -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 (

View File

@ -12,6 +12,7 @@ import "errors"
type GamePrivilegeCardData struct {
Id string
PType int32
Name string
AssertDay int32
RenewDay int32
@ -28,6 +29,7 @@ func (*GamePrivilegeCardData) GetTypeId() int32 {
func (_v *GamePrivilegeCardData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pType"].(float64); !_ok_ { err = errors.New("pType error"); return }; _v.PType = int32(_tempNum_) }
{ var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["assert_day"].(float64); !_ok_ { err = errors.New("assert_day error"); return }; _v.AssertDay = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["renew_day"].(float64); !_ok_ { err = errors.New("renew_day error"); return }; _v.RenewDay = int32(_tempNum_) }