上传远征红点
This commit is contained in:
parent
424ee73fb5
commit
1769a0bd56
@ -686,8 +686,11 @@ const (
|
|||||||
//公会
|
//公会
|
||||||
Reddot15102 ReddotType = 15102 //公会----签到红点 今日剩余签到
|
Reddot15102 ReddotType = 15102 //公会----签到红点 今日剩余签到
|
||||||
Reddot15201 ReddotType = 15201 //公会----申请红点
|
Reddot15201 ReddotType = 15201 //公会----申请红点
|
||||||
Reddot15301 ReddotType = 15301 //公会----公会副本 今日剩余挑战次数:x
|
Reddot15301 ReddotType = 15301 //公会----任务待领取
|
||||||
Reddot15401 ReddotType = 15401 //公会----公会任务 今日剩余任务:x
|
Reddot15302 ReddotType = 15302 //公会----活跃度待领取
|
||||||
|
Reddot15400 ReddotType = 15400 //公会----公会远征 可挑战
|
||||||
|
//工会boos
|
||||||
|
|
||||||
//主线关卡
|
//主线关卡
|
||||||
//Reddot11100 ReddotType = 11100 //主线关卡----可挑战红点 -- 废弃
|
//Reddot11100 ReddotType = 11100 //主线关卡----可挑战红点 -- 废弃
|
||||||
// 铁匠铺
|
// 铁匠铺
|
||||||
|
@ -639,7 +639,11 @@ type (
|
|||||||
IGetReddot
|
IGetReddot
|
||||||
ModifyBooslv(session IUserSession, lv int32) (errdata *pb.ErrorData)
|
ModifyBooslv(session IUserSession, lv int32) (errdata *pb.ErrorData)
|
||||||
}
|
}
|
||||||
|
//远征
|
||||||
|
IExpedition interface {
|
||||||
|
///红点
|
||||||
|
IGetReddot
|
||||||
|
}
|
||||||
//购物中心
|
//购物中心
|
||||||
IShopcenter interface {
|
IShopcenter interface {
|
||||||
IActivityNotice
|
IActivityNotice
|
||||||
|
@ -212,15 +212,35 @@ func (this *guildgveModel) userlock(id string) (result *redis.RedisMutex, err er
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取用户全部的埋点数据
|
// 获取用户全部的埋点数据
|
||||||
func (this *guildgveModel) getGuildGve(guildid string) (results *pb.DBGuildGve, err error) {
|
func (this *guildgveModel) getInfo(guildid string) (result *pb.DBExpedition, err error) {
|
||||||
|
var (
|
||||||
results = &pb.DBGuildGve{
|
confs []*cfg.GameExpeditionBossData
|
||||||
Boos: make([]*pb.DBGuildGveBoss, 0),
|
)
|
||||||
}
|
result = &pb.DBExpedition{}
|
||||||
if err = this.model.GetByID(guildid, results); err != nil {
|
if err = this.model.GetByID(guildid, result); err != nil && err != mgo.MongodbNil {
|
||||||
this.module.Errorln(err)
|
this.module.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if err == mgo.MongodbNil {
|
||||||
|
if confs, err = this.module.configure.getGameExpeditionBoosDatas(1); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
result = &pb.DBExpedition{
|
||||||
|
Guildid: guildid,
|
||||||
|
Lv: 1,
|
||||||
|
Refresh: configure.Now().Unix(),
|
||||||
|
Indexboos: 0,
|
||||||
|
Boos: make([]*pb.DBExpeditionBoos, 0),
|
||||||
|
}
|
||||||
|
for _, v := range confs {
|
||||||
|
result.Boos = append(result.Boos, &pb.DBExpeditionBoos{
|
||||||
|
Boosid: v.BossId,
|
||||||
|
Hp: v.Fighting,
|
||||||
|
Members: make(map[string]*pb.DBExpeditionMember),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
err = this.model.Add(guildid, result)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,16 +64,52 @@ func (this *Expedition) OnInstallComp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 红点
|
// 红点
|
||||||
func (this *Expedition) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]*pb.ReddotItem) {
|
// 红点需求
|
||||||
var ()
|
func (this *Expedition) Reddot(session comm.IUserSession, rid map[comm.ReddotType]struct{}) (items map[comm.ReddotType]*pb.ReddotItem) {
|
||||||
reddot = make(map[comm.ReddotType]*pb.ReddotItem)
|
var (
|
||||||
|
selfrid []comm.ReddotType = []comm.ReddotType{comm.Reddot15400}
|
||||||
for _, v := range rid {
|
model *guildgveModel
|
||||||
switch v {
|
user *pb.DBUserExpand
|
||||||
case comm.Reddot15301:
|
info *pb.DBExpedition
|
||||||
|
member *pb.DBExpeditionMember
|
||||||
|
err error
|
||||||
|
ok bool
|
||||||
|
)
|
||||||
|
items = make(map[comm.ReddotType]*pb.ReddotItem)
|
||||||
|
for _, v := range selfrid {
|
||||||
|
if _, ok = rid[v]; ok {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range selfrid {
|
||||||
|
if _, ok = rid[v]; ok {
|
||||||
|
switch v {
|
||||||
|
case comm.Reddot15400:
|
||||||
|
state := getSysDayTimeState()
|
||||||
|
if state == 1 {
|
||||||
|
if user, err = this.GetUserExpandForSession(session); user.SociatyId != "" {
|
||||||
|
if model, err = this.model.guildgveModel(); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if info, err = model.getInfo(user.SociatyId); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if member, ok = info.Boos[info.Indexboos].Members[session.GetUserId()]; !ok || member.State == 0 {
|
||||||
|
items[comm.Reddot17] = &pb.ReddotItem{
|
||||||
|
Rid: int32(comm.Reddot17),
|
||||||
|
Activated: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -22,23 +22,23 @@ type Reddot struct {
|
|||||||
modules.ModuleBase
|
modules.ModuleBase
|
||||||
service base.IRPCXService
|
service base.IRPCXService
|
||||||
|
|
||||||
smithy comm.ISmithy //铁匠铺
|
smithy comm.ISmithy //铁匠铺
|
||||||
library comm.ILibrary //羁绊
|
library comm.ILibrary //羁绊
|
||||||
mail comm.Imail //邮件
|
mail comm.Imail //邮件
|
||||||
sociaty comm.ISociaty //工会
|
sociaty comm.ISociaty //工会
|
||||||
pagoda comm.IPagoda
|
pagoda comm.IPagoda
|
||||||
horoscope comm.IHoroscope
|
horoscope comm.IHoroscope
|
||||||
arena comm.IArena //竞技场
|
arena comm.IArena //竞技场
|
||||||
practice comm.IPractice //武馆
|
practice comm.IPractice //武馆
|
||||||
dailytask comm.IDailytask //每日任务
|
dailytask comm.IDailytask //每日任务
|
||||||
friend comm.IFriend
|
friend comm.IFriend
|
||||||
gourmet comm.IGourmet
|
gourmet comm.IGourmet
|
||||||
viking comm.IViking
|
viking comm.IViking
|
||||||
hunting comm.IHunting
|
hunting comm.IHunting
|
||||||
guildgve comm.IGuildgve //工会boos战
|
guildgve comm.IGuildgve //工会boos战
|
||||||
|
expedition comm.IExpedition //工会远征
|
||||||
api_comp *apiComp
|
api_comp *apiComp
|
||||||
mainline comm.IMainline
|
mainline comm.IMainline
|
||||||
}
|
}
|
||||||
|
|
||||||
// 模块名
|
// 模块名
|
||||||
|
@ -178,15 +178,16 @@ func (this *Sociaty) GetSociatys(sociatyIds []string) (result []*pb.DBSociaty, e
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 公会
|
// 公会红点
|
||||||
func (this *Sociaty) Reddot(session comm.IUserSession, rid map[comm.ReddotType]struct{}) (items map[comm.ReddotType]*pb.ReddotItem) {
|
func (this *Sociaty) Reddot(session comm.IUserSession, rid map[comm.ReddotType]struct{}) (items map[comm.ReddotType]*pb.ReddotItem) {
|
||||||
var (
|
var (
|
||||||
selfrid []comm.ReddotType = []comm.ReddotType{comm.Reddot15102, comm.Reddot15201, comm.Reddot15401}
|
selfrid []comm.ReddotType = []comm.ReddotType{comm.Reddot15102, comm.Reddot15201, comm.Reddot15301}
|
||||||
applyReddot bool
|
applyReddot bool
|
||||||
tasks *pb.DBSociatyTask
|
tasks *pb.DBSociatyTask
|
||||||
nocomplete int32
|
comdi []int32
|
||||||
err error
|
condisProgress []*pb.ConIProgress
|
||||||
ok bool
|
err error
|
||||||
|
ok bool
|
||||||
)
|
)
|
||||||
|
|
||||||
items = make(map[comm.ReddotType]*pb.ReddotItem)
|
items = make(map[comm.ReddotType]*pb.ReddotItem)
|
||||||
@ -202,15 +203,7 @@ func (this *Sociaty) Reddot(session comm.IUserSession, rid map[comm.ReddotType]s
|
|||||||
if sociaty == nil || sociaty.Id == "" {
|
if sociaty == nil || sociaty.Id == "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if this.modelSociaty.isRight(session.GetUserId(), sociaty,
|
|
||||||
pb.SociatyJob_PRESIDENT,
|
|
||||||
pb.SociatyJob_VICEPRESIDENT,
|
|
||||||
pb.SociatyJob_ADMIN) {
|
|
||||||
|
|
||||||
if len(sociaty.ApplyRecord) > 0 {
|
|
||||||
applyReddot = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, v := range selfrid {
|
for _, v := range selfrid {
|
||||||
if _, ok = rid[v]; ok {
|
if _, ok = rid[v]; ok {
|
||||||
switch v {
|
switch v {
|
||||||
@ -229,26 +222,52 @@ func (this *Sociaty) Reddot(session comm.IUserSession, rid map[comm.ReddotType]s
|
|||||||
Total: 1,
|
Total: 1,
|
||||||
}
|
}
|
||||||
case comm.Reddot15201:
|
case comm.Reddot15201:
|
||||||
|
if this.modelSociaty.isRight(session.GetUserId(), sociaty,
|
||||||
|
pb.SociatyJob_PRESIDENT,
|
||||||
|
pb.SociatyJob_VICEPRESIDENT,
|
||||||
|
pb.SociatyJob_ADMIN) {
|
||||||
|
if len(sociaty.ApplyRecord) > 0 {
|
||||||
|
applyReddot = true
|
||||||
|
}
|
||||||
|
}
|
||||||
items[comm.Reddot15201] = &pb.ReddotItem{
|
items[comm.Reddot15201] = &pb.ReddotItem{
|
||||||
Rid: int32(comm.Reddot15201),
|
Rid: int32(comm.Reddot15201),
|
||||||
Activated: applyReddot,
|
Activated: applyReddot,
|
||||||
Nextchanagetime: 0,
|
Nextchanagetime: 0,
|
||||||
}
|
}
|
||||||
case comm.Reddot15401:
|
case comm.Reddot15301:
|
||||||
if tasks, err = this.modelSociatyTask.getUserTask(session.GetUserId(), sociaty.Id); err != nil {
|
if tasks, err = this.modelSociatyTask.getUserTask(session.GetUserId(), sociaty.Id); err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, v := range tasks.TaskList {
|
for k, _ := range tasks.TaskList {
|
||||||
if v != 1 {
|
comdi = append(comdi, k)
|
||||||
nocomplete++
|
}
|
||||||
|
if _, condisProgress, err = this.ModuleBuried.CheckCondition(session, comdi...); err != nil {
|
||||||
|
this.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, v := range condisProgress {
|
||||||
|
if v.State == pb.BuriedItemFinishState_buried_finish {
|
||||||
|
if value, ok := tasks.TaskList[v.Conid]; !ok || value == 0 {
|
||||||
|
items[comm.Reddot15301] = &pb.ReddotItem{
|
||||||
|
Rid: int32(comm.Reddot15301),
|
||||||
|
Activated: true,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
items[comm.Reddot15401] = &pb.ReddotItem{
|
case comm.Reddot15400:
|
||||||
Rid: int32(comm.Reddot15401),
|
for _, v := range this.sociatyActivityConf.GetDataMap() {
|
||||||
Activated: true,
|
if sociaty.Activity >= v.Activity {
|
||||||
Nextchanagetime: 0,
|
if value, ok := tasks.ActivityList[v.Id]; !ok || value == 0 {
|
||||||
Progress: nocomplete,
|
items[comm.Reddot15301] = &pb.ReddotItem{
|
||||||
Total: int32(len(tasks.TaskList)),
|
Rid: int32(comm.Reddot15400),
|
||||||
|
Activated: true,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,47 +357,16 @@ type TaskParams struct {
|
|||||||
// 任务条件达成通知
|
// 任务条件达成通知
|
||||||
// 废弃 不需要主动推送任务变化 前端主动刷新页面即可
|
// 废弃 不需要主动推送任务变化 前端主动刷新页面即可
|
||||||
func (this *Sociaty) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIProgress) {
|
func (this *Sociaty) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIProgress) {
|
||||||
// log.Debug("公会任务通知",
|
log.Debug("公会任务通知",
|
||||||
// log.Field{Key: "uid", Value: session.GetUserId()},
|
log.Field{Key: "uid", Value: session.GetUserId()},
|
||||||
// log.Field{Key: "condIds", Value: conds})
|
log.Field{Key: "condIds", Value: conds})
|
||||||
|
|
||||||
// sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
|
session.SendMsg(string(comm.ModuleReddot), "change", &pb.ReddotChangePush{Rids: []*pb.ReddotItem{
|
||||||
// if sociaty == nil {
|
{
|
||||||
// return
|
Rid: int32(comm.Reddot15301),
|
||||||
// }
|
Activated: true,
|
||||||
|
},
|
||||||
// sociatyId := sociaty.Id
|
}})
|
||||||
|
|
||||||
// dt := &pb.DBSociatyTask{}
|
|
||||||
// err := this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
|
||||||
// comm.Service_Worker, string(comm.Rpc_ModuleSociatyGetTask),
|
|
||||||
// &pb.RPCGeneralReqA2{Param1: sociatyId, Param2: session.GetUserId()}, dt)
|
|
||||||
|
|
||||||
// var flag bool
|
|
||||||
// for _, v := range dt.TaskList {
|
|
||||||
// for _, cond := range conds {
|
|
||||||
// if v.TaskId == cond.Conid && cond.State == pb.BuriedItemFinishState_buried_finish {
|
|
||||||
// v.Status = 1
|
|
||||||
// flag = true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if !flag {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// update := map[string]interface{}{
|
|
||||||
// "taskList": dt.TaskList,
|
|
||||||
// "lastUpdateTime": configure.Now().Unix(),
|
|
||||||
// }
|
|
||||||
|
|
||||||
// err = this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
|
||||||
// comm.Service_Worker, string(comm.Rpc_ModuleSociatyTask),
|
|
||||||
// &TaskParams{SociatyId: sociatyId, Uid: session.GetUserId(), Data: update}, &pb.EmptyResp{})
|
|
||||||
// if err != nil {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Sociaty) RpcUpdateUserTask(ctx context.Context, p *TaskParams, reply *pb.EmptyResp) error {
|
func (this *Sociaty) RpcUpdateUserTask(ctx context.Context, p *TaskParams, reply *pb.EmptyResp) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user