上传红点处理

This commit is contained in:
liwei 2023-08-01 11:36:06 +08:00
parent 898da1b0db
commit 32433c9c25
9 changed files with 172 additions and 41 deletions

View File

@ -521,8 +521,10 @@ const (
Reddot10 ReddotType = 10010 //英雄----共鸣红点 前端处理
Reddot20301 ReddotType = 20301 //英雄----升星红点 前端处理
//公会
Reddot15102 ReddotType = 15102 //公会----签到红点
Reddot15102 ReddotType = 15102 //公会----签到红点 今日剩余签到
Reddot15201 ReddotType = 15201 //公会----申请红点
Reddot15301 ReddotType = 15301 //公会----公会副本 今日剩余挑战次数x
Reddot15401 ReddotType = 15401 //公会----公会任务 今日剩余任务x
//主线关卡
//Reddot11100 ReddotType = 11100 //主线关卡----可挑战红点 -- 废弃
// 铁匠铺
@ -533,6 +535,7 @@ const (
//竞技场
Reddot22100 ReddotType = 22100 //当玩家竞技场可挑战次数到达最大时
Reddot22102 ReddotType = 22102 //当竞技场npc可以挑战时
Reddot22202 ReddotType = 22102 //今日剩余挑战券x
Reddot6 ReddotType = 10006 //爬塔----可挑战红点
Reddot7 ReddotType = 10007 //爬塔----奖励红点
@ -542,7 +545,8 @@ const (
Reddot20 ReddotType = 10020 //丛林美食馆----可挂机红点
Reddot21 ReddotType = 10021 //丛林美食馆----可升级红点
Reddot22 ReddotType = 10022 //丛林美食馆----可领取奖励红
Reddot23 ReddotType = 10023 //熊猫武馆----可挂机红点
// 武馆
Reddot23 ReddotType = 10023 //熊猫武馆----可挂机红点 今日剩余训练次数x
Reddot24 ReddotType = 10024 //熊猫武馆----可升级红点
Reddot25 ReddotType = 10025 //熊猫武馆----可领取奖励红点
Reddot33 ReddotType = 10033 //附魔副本 有挑战次数
@ -560,6 +564,17 @@ const (
//23101 烹饪
Reddot23101 ReddotType = 23101 // 烹饪奖励菜谱图鉴图标
//每日任务
Reddot25101 ReddotType = 25101 // 每日任务进度红点
//武馆
Reddot26101 ReddotType = 26101 // 每日一练
//云朵签到
Reddot27101 ReddotType = 27101 // 签到进度
//巨怪商队跑商
Reddot28101 ReddotType = 28101 // 剩余车票
//种族塔
Reddot29101 ReddotType = 29101 // 今日剩余可挑战关卡x
)
type TaskType int32

View File

@ -596,6 +596,7 @@ type (
}
//每日任务
IDailytask interface {
IGetReddot
//任务组完成
TaskGroupComplete(session IUserSession, group int32)
}
@ -606,4 +607,9 @@ type (
// bingo 关卡
BingoJumpLevel(session IUserSession, level int32) (errdata *pb.ErrorData)
}
//工会boos战
IGuildgve interface {
///红点
IGetReddot
}
)

View File

@ -132,3 +132,35 @@ func (this *Dailytask) TaskGroupComplete(session comm.IUserSession, group int32)
}
}
}
// 查询每日红点信息
func (this *Dailytask) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) {
var (
dtask *pb.DBDailytask
progress int32
err error
)
reddot = make(map[comm.ReddotType]*pb.ReddotItem)
if dtask, err = this.modelDailytask.getUserDTasks(session.GetUserId()); err != nil {
this.Errorln(err)
return
}
for _, v := range rid {
switch v {
case comm.Reddot25101:
for _, v := range dtask.Groups {
if !v.Complete {
progress++
}
}
reddot[comm.Reddot25101] = &pb.ReddotItem{
Rid: int32(comm.Reddot25101),
Activated: true,
Progress: progress,
Total: int32(len(dtask.Groups)),
}
break
}
}
return
}

View File

@ -66,12 +66,21 @@ func (this *ModelGuildMember) getGuildMember(guild, uid string) (results *pb.DBG
}
err = this.Add(uid, results)
}
if results.Guild != guild {
if guild != "" && results.Guild != guild {
results.Guild = guild
}
return
}
// 查询红会成员
func (this *ModelGuildMember) inquireGuildMember(uid string) (results *pb.DBGuildMember, err error) {
results = &pb.DBGuildMember{}
if err = this.Get(uid, results); err != nil {
return
}
return
}
func (this *ModelGuildMember) updateGuildMember(data *pb.DBGuildMember) (err error) {
if err = this.Change(data.Uid, map[string]interface{}{
"guild": data.Guild,

View File

@ -76,3 +76,27 @@ func (this *GuildGve) Rpc_ModuleGuildBossSettlement(ctx context.Context, req *pb
this.modelRank.raceSettlement()
return
}
// 红点
func (this *GuildGve) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) {
var (
member *pb.DBGuildMember
err error
)
reddot = make(map[comm.ReddotType]*pb.ReddotItem)
if member, err = this.modelGuildMember.inquireGuildMember(session.GetUserId()); err != nil {
return
}
for _, v := range rid {
switch v {
case comm.Reddot15301:
reddot[comm.Reddot26101] = &pb.ReddotItem{
Rid: int32(comm.Reddot26101),
Activated: true,
Progress: member.Boosticket,
}
break
}
}
return
}

View File

@ -407,3 +407,29 @@ func (this *Practice) CleanUpNpc(uid string) {
func (this *Practice) GetAllJxRes() (res []string, err error) {
return this.configure.getAllGamePandamasJx()
}
// 红点
func (this *Practice) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) {
var (
room *pb.DBPracticeRoom
err error
)
reddot = make(map[comm.ReddotType]*pb.ReddotItem)
if room, err = this.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
this.Errorln(err)
return
}
for _, v := range rid {
switch v {
case comm.Reddot26101:
reddot[comm.Reddot26101] = &pb.ReddotItem{
Rid: int32(comm.Reddot26101),
Activated: true,
Progress: room.Gymrefresh,
Total: 1,
}
break
}
}
return
}

View File

@ -5,13 +5,13 @@ import (
"go_dreamfactory/pb"
)
//参数校验
// 参数校验
func (this *apiComp) GetCheck(session comm.IUserSession, req *pb.ReddotGetReq) (errdata *pb.ErrorData) {
return
}
///获取系统公告
// /获取系统公告
func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (errdata *pb.ErrorData) {
var (
reddot map[int32]*pb.ReddotItem = make(map[int32]*pb.ReddotItem)
@ -38,7 +38,7 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (errda
reddot[int32(k)] = v
}
//工会
case comm.Reddot15102, comm.Reddot15201:
case comm.Reddot15102, comm.Reddot15201, comm.Reddot15401:
for k, v := range this.module.ModuleSociaty.Reddot(session, _rid) {
reddot[int32(k)] = v
}
@ -57,6 +57,16 @@ func (this *apiComp) Get(session comm.IUserSession, req *pb.ReddotGetReq) (errda
for k, v := range this.module.library.Reddot(session, _rid) {
reddot[int32(k)] = v
}
//每日任务
case comm.Reddot25101:
for k, v := range this.module.library.Reddot(session, _rid) {
reddot[int32(k)] = v
}
//工会boos战
case comm.Reddot15301:
for k, v := range this.module.guildgve.Reddot(session, _rid) {
reddot[int32(k)] = v
}
case comm.Reddot17:
for k, v := range this.module.horoscope.Reddot(session, _rid) {
reddot[int32(k)] = v

View File

@ -28,22 +28,24 @@ type Reddot struct {
sociaty comm.ISociaty //工会
pagoda comm.IPagoda
horoscope comm.IHoroscope
arena comm.IArena //竞技场
arena comm.IArena //竞技场
dailytask comm.IDailytask //每日任务
friend comm.IFriend
gourmet comm.IGourmet
viking comm.IViking
hunting comm.IHunting
guildgve comm.IGuildgve //工会boos战
api_comp *apiComp
mline comm.IMline
}
//模块名
// 模块名
func (this *Reddot) GetType() core.M_Modules {
return comm.ModuleReddot
}
//模块初始化接口 注册用户创建角色事件
// 模块初始化接口 注册用户创建角色事件
func (this *Reddot) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
this.service = service.(base.IRPCXService)
@ -107,16 +109,24 @@ func (this *Reddot) Start() (err error) {
}
this.library = module.(comm.ILibrary)
if module, err = this.service.GetModule(comm.ModuleDailytask); err != nil {
return
}
this.dailytask = module.(comm.IDailytask)
if module, err = this.service.GetModule(comm.ModuleGuildGve); err != nil {
return
}
this.guildgve = module.(comm.IGuildgve)
return
}
//装备组件
// 装备组件
func (this *Reddot) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
}
//推送红点
// 推送红点
func (this *Reddot) PushReddot(session comm.IUserSession, reddot ...*pb.ReddotItem) (errdata *pb.ErrorData) {
if len(reddot) <= 0 {
return

View File

@ -178,40 +178,39 @@ func (this *Sociaty) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (
reddot = make(map[comm.ReddotType]*pb.ReddotItem)
sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
if sociaty == nil || sociaty.Id == "" {
for _, v := range rid {
reddot[v] = &pb.ReddotItem{
Rid: int32(v),
Activated: false,
Nextchanagetime: 0,
}
}
} else {
var applyReddot bool
if this.modelSociaty.isRight(session.GetUserId(), sociaty,
pb.SociatyJob_PRESIDENT,
pb.SociatyJob_VICEPRESIDENT,
pb.SociatyJob_ADMIN) {
return
}
var applyReddot bool
if this.modelSociaty.isRight(session.GetUserId(), sociaty,
pb.SociatyJob_PRESIDENT,
pb.SociatyJob_VICEPRESIDENT,
pb.SociatyJob_ADMIN) {
if len(sociaty.ApplyRecord) > 0 {
applyReddot = true
}
if len(sociaty.ApplyRecord) > 0 {
applyReddot = true
}
for _, v := range rid {
switch v {
case comm.Reddot15102:
tf := this.modelSociaty.IsSign(session.GetUserId(), sociaty)
reddot[comm.Reddot15102] =
&pb.ReddotItem{
Rid: int32(comm.Reddot15102),
Activated: !tf,
Nextchanagetime: 0,
}
case comm.Reddot15201:
reddot[comm.Reddot15201] = &pb.ReddotItem{
Rid: int32(comm.Reddot15201),
Activated: applyReddot,
}
for _, v := range rid {
switch v {
case comm.Reddot15102:
progress := int32(0)
tf := this.modelSociaty.IsSign(session.GetUserId(), sociaty)
if tf {
progress = 1
}
reddot[comm.Reddot15102] =
&pb.ReddotItem{
Rid: int32(comm.Reddot15102),
Activated: !tf,
Nextchanagetime: 0,
Progress: progress,
Total: 1,
}
case comm.Reddot15201:
reddot[comm.Reddot15201] = &pb.ReddotItem{
Rid: int32(comm.Reddot15201),
Activated: applyReddot,
Nextchanagetime: 0,
}
}
}