上传捕羊代码

This commit is contained in:
liwei1dao 2024-03-07 11:46:18 +08:00
parent c9f6ea826b
commit f76a63fa3e
3 changed files with 66 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import (
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/sys/db"
"math/rand"
"sync"
"time"
@ -155,8 +156,14 @@ func (this *ModelParkourComp) refreshlist() {
}
func (this *ModelParkourComp) queryinfo(uid string) (result *pb.DBParkour, err error) {
var (
model *db.DBModel
)
result = &pb.DBParkour{}
if err = this.Get(uid, result); err != nil && err != mgo.MongodbNil {
if model, err = this.module.GetCrossDBModel(this.TableName); err != nil {
return
}
if err = model.Get(uid, result); err != nil && err != mgo.MongodbNil {
this.module.Errorln(err)
return
}
@ -175,7 +182,7 @@ func (this *ModelParkourComp) queryinfo(uid string) (result *pb.DBParkour, err e
Property: make(map[string]int32),
Weekreward: make(map[int32]bool),
}
if err = this.Add(uid, result); err != nil {
if err = model.Add(uid, result); err != nil {
this.module.Errorln(err)
return
}

View File

@ -8,6 +8,7 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/lego/sys/mgo"
"go_dreamfactory/lego/sys/timewheel"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
@ -835,3 +836,57 @@ func (this *Parkour) resurrectiontimer(task *timewheel.Task, args ...interface{}
this.Error("战斗结束 复活失效", log.Field{Key: "bid", Value: battleid})
}
}
// 红点需求
func (this *Parkour) Reddot(session comm.IUserSession, rid map[comm.ReddotType]struct{}) (items map[comm.ReddotType]*pb.ReddotItem) {
var (
selfrid []comm.ReddotType = []comm.ReddotType{comm.Reddot38102}
confs []*cfg.GameDragonWeeklyrewardData
info *pb.DBParkour
err error
ok bool
)
items = make(map[comm.ReddotType]*pb.ReddotItem)
for _, v := range selfrid {
if _, ok = rid[v]; ok {
break
}
}
if !ok {
return
}
if confs, err = this.configure.getGameDragonWeeklyrewards(); err != nil {
return
}
if info, err = this.parkourComp.queryinfo(session.GetUserId()); err != nil && err != mgo.MongodbNil {
return
}
for _, v := range selfrid {
if _, ok = rid[v]; ok {
switch v {
case comm.Reddot38102:
for _, v := range confs {
if ok = info.Weekreward[v.Id]; ok {
continue
}
if info.Weekintegral < v.Point {
continue
}
items[comm.Reddot38102] = &pb.ReddotItem{
Rid: int32(comm.Reddot38102),
Activated: true,
}
break
}
break
}
}
}
return
}

View File

@ -215,6 +215,7 @@ func (this *Warorder) Reddot(session comm.IUserSession, rid map[comm.ReddotType]
Rid: int32(comm.Reddot31104),
Activated: true,
}
break
}
if dwarorder.Vip > 0 {
if dwarorder.Payprogress < v.Parameter {
@ -222,6 +223,7 @@ func (this *Warorder) Reddot(session comm.IUserSession, rid map[comm.ReddotType]
Rid: int32(comm.Reddot31104),
Activated: true,
}
break
}
}
}