上传好友木桩解锁条件
This commit is contained in:
parent
5a7e972350
commit
fc8695732a
@ -29,6 +29,11 @@ func (this *apiComp) FriendRomm(session comm.IUserSession, req *pb.PracticeFrien
|
||||
Infos = make(map[string]*pb.DBPracticeRoom)
|
||||
for _, v := range rooms {
|
||||
Infos[v.Uid] = v
|
||||
if this.module.modelPandata.checkFriendPillar(v) {
|
||||
this.module.modelPandata.Change(session.GetUserId(), map[string]interface{}{
|
||||
"pillarf": v.Pillarf,
|
||||
})
|
||||
}
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), "friendromm", &pb.PracticeFriendRommResp{Infos: Infos})
|
||||
return
|
||||
|
@ -30,6 +30,11 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.PracticeInfoReq) (e
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if this.module.modelPandata.checkFriendPillar(room) {
|
||||
update["pillarf"] = room.Pillarf
|
||||
}
|
||||
|
||||
if !utils.IsToday(room.Pillar1.Lastusetime) { //上一次训练不是今天
|
||||
room.Pillar1.Usenum = 0
|
||||
}
|
||||
|
@ -158,6 +158,31 @@ func (this *modelPandata) getpandataModel() (model *pandataModel, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
//校验好友木桩解锁
|
||||
func (this *modelPandata) checkFriendPillar(room *pb.DBPracticeRoom) bool {
|
||||
if room.Pillarf.Isunlock == 2 {
|
||||
return false
|
||||
}
|
||||
|
||||
if room.Pillar1.Isunlock != 2 && room.Pillar2.Isunlock != 2 && room.Pillar3.Isunlock != 2 {
|
||||
return false
|
||||
}
|
||||
|
||||
friendnum := this.module.ModuleFriend.GetFriendCount(room.Uid)
|
||||
if friendnum > 10 {
|
||||
room.Pillarf.Isunlock = 2
|
||||
room.Pillarf.Lv = room.Pillar1.Lv
|
||||
if room.Pillarf.Lv < room.Pillar2.Lv {
|
||||
room.Pillarf.Lv = room.Pillar2.Lv
|
||||
}
|
||||
if room.Pillarf.Lv < room.Pillar3.Lv {
|
||||
room.Pillarf.Lv = room.Pillar3.Lv
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 埋点专属模型 会封装特殊的数据转换接口
|
||||
type pandataModel struct {
|
||||
module *Practice
|
||||
@ -241,3 +266,28 @@ func (this *pandataModel) queryrooms(uids []string) (results []*pb.DBPracticeRoo
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//校验好友木桩解锁
|
||||
func (this *pandataModel) checkFriendPillar(room *pb.DBPracticeRoom) bool {
|
||||
if room.Pillarf.Isunlock == 2 {
|
||||
return false
|
||||
}
|
||||
|
||||
if room.Pillar1.Isunlock != 2 && room.Pillar2.Isunlock != 2 && room.Pillar3.Isunlock != 2 {
|
||||
return false
|
||||
}
|
||||
|
||||
friendnum := this.module.ModuleFriend.GetFriendCount(room.Uid)
|
||||
if friendnum > 10 {
|
||||
room.Pillarf.Isunlock = 2
|
||||
room.Pillarf.Lv = room.Pillar1.Lv
|
||||
if room.Pillarf.Lv < room.Pillar2.Lv {
|
||||
room.Pillarf.Lv = room.Pillar2.Lv
|
||||
}
|
||||
if room.Pillarf.Lv < room.Pillar3.Lv {
|
||||
room.Pillarf.Lv = room.Pillar3.Lv
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user