上传红点任务
This commit is contained in:
parent
5dbabf4432
commit
98e903573e
@ -446,7 +446,37 @@ func (this *modelArena) recoverTicket(session comm.IUserSession, info *pb.DBAren
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *modelArena) reddot(session comm.IUserSession) (info *pb.DBArenaUser, ticket int32, activated bool) {
|
// 更新埋点数据到db中
|
||||||
|
func (this *modelArena) getpandataModel() (model *arenaModel, err error) {
|
||||||
|
var m *db.DBModel
|
||||||
|
if !db.IsCross() {
|
||||||
|
if m, err = this.module.GetCrossDBModel(this.TableName); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
model = &arenaModel{module: this.module, model: m}
|
||||||
|
} else {
|
||||||
|
model = &arenaModel{module: this.module, model: this.DBModel}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 埋点专属模型 会封装特殊的数据转换接口
|
||||||
|
type arenaModel struct {
|
||||||
|
module *Arena
|
||||||
|
model *db.DBModel
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询用户装备数据
|
||||||
|
func (this *arenaModel) queryPlayerInfo(uId string) (result *pb.DBArenaUser, err error) {
|
||||||
|
result = &pb.DBArenaUser{}
|
||||||
|
if err = this.model.Get(uId, result); err != nil && err != mgo.MongodbNil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *arenaModel) reddot(session comm.IUserSession) (info *pb.DBArenaUser, ticket int32, activated bool) {
|
||||||
var (
|
var (
|
||||||
ticketitem *cfg.Gameatn
|
ticketitem *cfg.Gameatn
|
||||||
err error
|
err error
|
||||||
|
@ -98,11 +98,19 @@ func (this *Arena) Rpc_ModuleArenaModifyIntegral(ctx context.Context, args *pb.R
|
|||||||
// 红点需求
|
// 红点需求
|
||||||
func (this *Arena) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (result map[comm.ReddotType]*pb.ReddotItem) {
|
func (this *Arena) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (result map[comm.ReddotType]*pb.ReddotItem) {
|
||||||
var (
|
var (
|
||||||
|
model *arenaModel
|
||||||
info *pb.DBArenaUser = &pb.DBArenaUser{}
|
info *pb.DBArenaUser = &pb.DBArenaUser{}
|
||||||
activated bool
|
activated bool
|
||||||
ticket int32
|
ticket int32
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
if info, ticket, activated = this.modelArena.reddot(session); info == nil {
|
|
||||||
|
if model, err = this.modelArena.getpandataModel(); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if info, ticket, activated = model.reddot(session); info == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
result = make(map[comm.ReddotType]*pb.ReddotItem)
|
result = make(map[comm.ReddotType]*pb.ReddotItem)
|
||||||
|
@ -149,7 +149,7 @@ func (this *Dailytask) Reddot(session comm.IUserSession, rid ...comm.ReddotType)
|
|||||||
switch v {
|
switch v {
|
||||||
case comm.Reddot25101:
|
case comm.Reddot25101:
|
||||||
for _, v := range dtask.Groups {
|
for _, v := range dtask.Groups {
|
||||||
if !v.Complete {
|
if v.Complete {
|
||||||
progress++
|
progress++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,7 +529,7 @@ func (this *ModuleBase) GetDBNodule(session comm.IUserSession, tableName string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 跨服对象获取数据操作对象
|
// 跨服对象获取数据操作对象
|
||||||
func (this *ModuleBase) GetCrossDBModel(tableName string, expired time.Duration) (model *db.DBModel, err error) {
|
func (this *ModuleBase) GetCrossDBModel(tableName string) (model *db.DBModel, err error) {
|
||||||
var (
|
var (
|
||||||
conn *db.DBConn
|
conn *db.DBConn
|
||||||
)
|
)
|
||||||
@ -542,7 +542,7 @@ func (this *ModuleBase) GetCrossDBModel(tableName string, expired time.Duration)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model = db.NewDBModel(tableName, expired, conn)
|
model = db.NewDBModel(tableName, time.Hour, conn)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ func (this *ModelParkourComp) addUserMounts(uid string, mounts map[string]int32)
|
|||||||
model *db.DBModel
|
model *db.DBModel
|
||||||
)
|
)
|
||||||
if !this.module.IsCross() { //非跨服
|
if !this.module.IsCross() { //非跨服
|
||||||
if model, err = this.module.GetCrossDBModel(this.TableName, this.Expired); err != nil {
|
if model, err = this.module.GetCrossDBModel(this.TableName); err != nil {
|
||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
} else {
|
} else {
|
||||||
result = &pb.DBParkour{}
|
result = &pb.DBParkour{}
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
"go_dreamfactory/sys/db"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
@ -142,3 +143,101 @@ func (this *modelPandata) refreshnpc(room *pb.DBPracticeRoom) (err error) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 更新埋点数据到db中
|
||||||
|
func (this *modelPandata) getpandataModel() (model *pandataModel, err error) {
|
||||||
|
var m *db.DBModel
|
||||||
|
if !db.IsCross() {
|
||||||
|
if m, err = this.module.GetCrossDBModel(this.TableName); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
model = &pandataModel{module: this.module, model: m}
|
||||||
|
} else {
|
||||||
|
model = &pandataModel{module: this.module, model: this.DBModel}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 埋点专属模型 会封装特殊的数据转换接口
|
||||||
|
type pandataModel struct {
|
||||||
|
module *Practice
|
||||||
|
model *db.DBModel
|
||||||
|
}
|
||||||
|
|
||||||
|
// /询用户的练功房信息
|
||||||
|
func (this *pandataModel) queryUserMartialhall(uid string) (result *pb.DBPracticeRoom, err error) {
|
||||||
|
result = &pb.DBPracticeRoom{}
|
||||||
|
if err = this.model.Get(uid, result); err != nil && err != mgo.MongodbNil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err == mgo.MongodbNil {
|
||||||
|
result = &pb.DBPracticeRoom{
|
||||||
|
Id: primitive.NewObjectID().Hex(),
|
||||||
|
Uid: uid,
|
||||||
|
Full: make(map[int32]int32),
|
||||||
|
Knapsack: make(map[string]*pb.DBPracticeRes),
|
||||||
|
Gymaction: 0,
|
||||||
|
Gymrefresh: 0,
|
||||||
|
Pillar1: &pb.DBPracticePillar{Index: 1, Isunlock: 0, Lv: 1},
|
||||||
|
Pillar2: &pb.DBPracticePillar{Index: 2, Lv: 1},
|
||||||
|
Pillar3: &pb.DBPracticePillar{Index: 3, Lv: 1},
|
||||||
|
Pillarf: &pb.DBPracticePillar{Index: 4, Isunlock: 0, Lv: 1},
|
||||||
|
Statuers: make([]*pb.DBPracticeStatuer, 0),
|
||||||
|
Npcstate: -1,
|
||||||
|
Refresh: configure.Now().Unix(),
|
||||||
|
}
|
||||||
|
// if err = this.refreshnpc(result); err != nil {
|
||||||
|
// this.module.Errorln(err)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
if err = this.model.Add(uid, result); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err = this.module.atlas.CheckActivatePandaAtlasCollect(uid, "100001"); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = nil
|
||||||
|
return
|
||||||
|
}
|
||||||
|
func (this *pandataModel) queryrooms(uids []string) (results []*pb.DBPracticeRoom, err error) {
|
||||||
|
results = make([]*pb.DBPracticeRoom, 0)
|
||||||
|
var (
|
||||||
|
onfound []string
|
||||||
|
newdata map[string]interface{} = make(map[string]interface{})
|
||||||
|
)
|
||||||
|
if onfound, err = this.model.Gets(uids, &results); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(onfound) > 0 {
|
||||||
|
for _, v := range onfound {
|
||||||
|
temp := &pb.DBPracticeRoom{
|
||||||
|
Id: primitive.NewObjectID().Hex(),
|
||||||
|
Uid: v,
|
||||||
|
Full: make(map[int32]int32),
|
||||||
|
Knapsack: make(map[string]*pb.DBPracticeRes),
|
||||||
|
Gymaction: 0,
|
||||||
|
Gymrefresh: 0,
|
||||||
|
Pillar1: &pb.DBPracticePillar{Index: 1, Isunlock: 2, Lv: 1},
|
||||||
|
Pillar2: &pb.DBPracticePillar{Index: 2, Lv: 1},
|
||||||
|
Pillar3: &pb.DBPracticePillar{Index: 3, Lv: 1},
|
||||||
|
Pillarf: &pb.DBPracticePillar{Index: 4, Isunlock: 2, Lv: 1},
|
||||||
|
Statuers: make([]*pb.DBPracticeStatuer, 0),
|
||||||
|
Npcstate: 3,
|
||||||
|
Refresh: configure.Now().Unix(),
|
||||||
|
}
|
||||||
|
go this.module.atlas.CheckActivatePandaAtlasCollect(v, "100001")
|
||||||
|
newdata[v] = temp
|
||||||
|
results = append(results, temp)
|
||||||
|
}
|
||||||
|
if err = this.model.Adds(newdata); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -412,6 +412,7 @@ func (this *Practice) GetAllJxRes() (res []string, err error) {
|
|||||||
// 红点
|
// 红点
|
||||||
func (this *Practice) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) {
|
func (this *Practice) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) {
|
||||||
var (
|
var (
|
||||||
|
model *pandataModel
|
||||||
room *pb.DBPracticeRoom
|
room *pb.DBPracticeRoom
|
||||||
pconf *cfg.GamePandamasMzData
|
pconf *cfg.GamePandamasMzData
|
||||||
usenum int32
|
usenum int32
|
||||||
@ -419,7 +420,12 @@ func (this *Practice) Reddot(session comm.IUserSession, rid ...comm.ReddotType)
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
reddot = make(map[comm.ReddotType]*pb.ReddotItem)
|
reddot = make(map[comm.ReddotType]*pb.ReddotItem)
|
||||||
if room, err = this.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
|
if model, err = this.modelPandata.getpandataModel(); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if room, err = model.queryUserMartialhall(session.GetUserId()); err != nil {
|
||||||
this.Errorln(err)
|
this.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -452,8 +458,8 @@ func (this *Practice) Reddot(session comm.IUserSession, rid ...comm.ReddotType)
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case comm.Reddot26201:
|
case comm.Reddot26201:
|
||||||
reddot[comm.Reddot26101] = &pb.ReddotItem{
|
reddot[comm.Reddot26201] = &pb.ReddotItem{
|
||||||
Rid: int32(comm.Reddot26101),
|
Rid: int32(comm.Reddot26201),
|
||||||
Activated: true,
|
Activated: true,
|
||||||
Progress: usenum,
|
Progress: usenum,
|
||||||
Total: totalusenum,
|
Total: totalusenum,
|
||||||
|
@ -141,18 +141,18 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WTaskFinishReq) (
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err = this.module.ModuleBuried.ActiveCondition(session.GetUserId(), afterconf.Completetask...); err != nil {
|
// if err = this.module.ModuleBuried.ActiveCondition(session.GetUserId(), afterconf.Completetask...); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
// errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ExternalModule,
|
// Code: pb.ErrorCode_ExternalModule,
|
||||||
Title: pb.ErrorCode_ExternalModule.ToString(),
|
// Title: pb.ErrorCode_ExternalModule.ToString(),
|
||||||
Message: fmt.Sprintf("ModuleBuried.ActiveCondition uid:%s condiIds:%v", session.GetUserId(), conf.Completetask),
|
// Message: fmt.Sprintf("ModuleBuried.ActiveCondition uid:%s condiIds:%v", session.GetUserId(), conf.Completetask),
|
||||||
}
|
// }
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
wtask.Accepts = append(wtask.Accepts, afterconf.Key)
|
wtask.Activations = append(wtask.Activations, afterconf.Key)
|
||||||
if _, errdata = this.module.pushtaskprogress(session, wtask, true); errdata != nil {
|
// if _, errdata = this.module.pushtaskprogress(session, wtask, true); errdata != nil {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
this.module.checkgroupState(session, wtask, conf.Group)
|
this.module.checkgroupState(session, wtask, conf.Group)
|
||||||
|
@ -322,7 +322,7 @@ func (this *WTask) ResetDailytaskTask(session comm.IUserSession, dailytaskid int
|
|||||||
for _, task := range tasks {
|
for _, task := range tasks {
|
||||||
if task.Ontxe == 0 {
|
if task.Ontxe == 0 {
|
||||||
condiIds = append(condiIds, task.Completetask...)
|
condiIds = append(condiIds, task.Completetask...)
|
||||||
accepts = append(accepts, task.Key)
|
activations = append(activations, task.Key)
|
||||||
if _, ok = results[v]; !ok {
|
if _, ok = results[v]; !ok {
|
||||||
results[v] = make([]int32, 0)
|
results[v] = make([]int32, 0)
|
||||||
}
|
}
|
||||||
@ -351,14 +351,14 @@ func (this *WTask) ResetDailytaskTask(session comm.IUserSession, dailytaskid int
|
|||||||
wtask.Exchange = make(map[int32]int32)
|
wtask.Exchange = make(map[int32]int32)
|
||||||
wtask.Events = make(map[int32]int32)
|
wtask.Events = make(map[int32]int32)
|
||||||
if len(condiIds) > 0 {
|
if len(condiIds) > 0 {
|
||||||
if err = this.ModuleBuried.ActiveCondition(session.GetUserId(), condiIds...); err != nil {
|
// if err = this.ModuleBuried.ActiveCondition(session.GetUserId(), condiIds...); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
// errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ExternalModule,
|
// Code: pb.ErrorCode_ExternalModule,
|
||||||
Title: pb.ErrorCode_ExternalModule.ToString(),
|
// Title: pb.ErrorCode_ExternalModule.ToString(),
|
||||||
Message: fmt.Sprintf("ModuleBuried.ActiveCondition uid:%s condiIds:%v", session.GetUserId(), condiIds),
|
// Message: fmt.Sprintf("ModuleBuried.ActiveCondition uid:%s condiIds:%v", session.GetUserId(), condiIds),
|
||||||
}
|
// }
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//有新任务接取
|
//有新任务接取
|
||||||
@ -749,7 +749,7 @@ func (this *WTask) inquireActivations(session comm.IUserSession, wtask *pb.DBWTa
|
|||||||
if _, ok = completeMap[v.Ontxe]; v.Ontxe != 0 && !ok { //前置任务判断
|
if _, ok = completeMap[v.Ontxe]; v.Ontxe != 0 && !ok { //前置任务判断
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if v.Des == 5 || v.Des == 1 { //商队任务不主动触发 日常任务直接接取不进入可接取列表中
|
if v.Des == 5 { //商队任务不主动触发 日常任务直接接取不进入可接取列表中
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
wtask.Activations = append(wtask.Activations, v.Key)
|
wtask.Activations = append(wtask.Activations, v.Key)
|
||||||
|
Loading…
Reference in New Issue
Block a user