go_dreamfactory/modules/practice/api_friendromm.go
2023-08-17 16:53:19 +08:00

41 lines
1.0 KiB
Go

package practice
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
//参数校验
func (this *apiComp) FriendRommCheck(session comm.IUserSession, req *pb.PracticeFriendRommReq) (errdata *pb.ErrorData) {
return
}
///练功请求
func (this *apiComp) FriendRomm(session comm.IUserSession, req *pb.PracticeFriendRommReq) (errdata *pb.ErrorData) {
var (
err error
rooms []*pb.DBPracticeRoom
Infos map[string]*pb.DBPracticeRoom
)
if rooms, err = this.module.modelPandata.queryrooms(req.Fuid); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return
}
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
}