46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package warorder
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
// 参数校验
|
|
func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.WarorderReceiveReq) (errdata *pb.ErrorData) {
|
|
|
|
return
|
|
}
|
|
|
|
// /获取系统公告
|
|
func (this *apiComp) Receive(session comm.IUserSession, req *pb.WarorderReceiveReq) (errdata *pb.ErrorData) {
|
|
var (
|
|
warorders *pb.DBWarorders
|
|
info *pb.Warorder
|
|
err error
|
|
ok bool
|
|
)
|
|
if errdata = this.ReceiveCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
if warorders, err = this.module.modelWarorder.getUserWarorders(session.GetUserId()); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Title: pb.ErrorCode_DBError.ToString(),
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if info, ok = warorders.Items[req.Rtype]; !ok {
|
|
info = &pb.Warorder{
|
|
Vip: false,
|
|
Free: make([]int32, 0),
|
|
Pay: make([]int32, 0),
|
|
Progress: 0,
|
|
}
|
|
warorders.Items[req.Rtype] = info
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), "receive", &pb.WarorderReceiveResp{Info: info})
|
|
return
|
|
}
|