57 lines
1.5 KiB
Go
57 lines
1.5 KiB
Go
package buried
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/sys/log"
|
|
"go_dreamfactory/pb"
|
|
cfg "go_dreamfactory/sys/configure/structs"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) InfoCheck(session comm.IUserSession, req *pb.BuriedInfoReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
///查询任务进度接口
|
|
func (this *apiComp) Info(session comm.IUserSession, req *pb.BuriedInfoReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
buried *pb.DBBuried
|
|
conf *cfg.GameBuriedCondiData
|
|
conditions []*pb.ConIProgress
|
|
err error
|
|
)
|
|
if errdata = this.InfoCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
|
|
if buried, err = this.module.modelBuried.getUserBurieds(session.GetUserId()); err != nil {
|
|
this.module.Error("查询埋点进度错误!", log.Field{Key: "err", Value: err.Error()})
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
conditions = make([]*pb.ConIProgress, 0)
|
|
for _, items := range buried.Items {
|
|
for _, v := range items.Condi {
|
|
if conf, err = this.module.configure.getburiedcondidata(v.Conid); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_ConfigNoFound,
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
conditions = append(conditions, comm.GetBuriedConIProgress(conf, v))
|
|
}
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), "info", &pb.BuriedInfoResp{Conitems: conditions})
|
|
//回收
|
|
for _, v := range conditions {
|
|
comm.PutburiedConIProgress(v)
|
|
}
|
|
return
|
|
}
|