34 lines
819 B
Go
34 lines
819 B
Go
package pack
|
|
|
|
import (
|
|
"context"
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/sys/log"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/cache"
|
|
)
|
|
|
|
///获取用户道具
|
|
func (this *Api_Comp) Getlist(ctx context.Context, session comm.IUserSession, req *pb.GetlistReq) (err error) {
|
|
var (
|
|
code pb.ErrorCode
|
|
pack *pb.DB_UserPackData
|
|
grids []*pb.DB_GridData
|
|
)
|
|
defer func() {
|
|
session.SendMsg(string(this.module.GetType()), GetlistResp, code, &pb.GetlistResp{Grids: grids})
|
|
}()
|
|
if !session.IsLogin() {
|
|
code = pb.ErrorCode_NoLogin
|
|
return
|
|
}
|
|
if pack, err = cache.Defsys.Pack_QueryUserPack(session.GetUserId()); err != nil {
|
|
log.Errorf("QueryUserPackReq err:%v", err)
|
|
code = pb.ErrorCode_CacheReadError
|
|
return
|
|
} else {
|
|
grids = this.module.configure_comp.GetPackItemByType(pack, req.IType)
|
|
}
|
|
return
|
|
}
|