发放资源改用gm 发送
This commit is contained in:
parent
70935119a4
commit
7666dc70d3
@ -1,44 +0,0 @@
|
|||||||
package user
|
|
||||||
|
|
||||||
import (
|
|
||||||
"go_dreamfactory/comm"
|
|
||||||
"go_dreamfactory/pb"
|
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (this *apiComp) AddResCheck(session comm.IUserSession, req *pb.UserAddResReq) (code pb.ErrorCode) {
|
|
||||||
if req.Res.A == "" || req.Res.T == "" || req.Res.N <= 0 {
|
|
||||||
code = pb.ErrorCode_ReqParameterError
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *apiComp) AddRes(session comm.IUserSession, req *pb.UserAddResReq) (code pb.ErrorCode, data proto.Message) {
|
|
||||||
if code = this.AddResCheck(session, req); code != pb.ErrorCode_Success {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
user := this.module.modelUser.GetUser(session.GetUserId())
|
|
||||||
if user == nil {
|
|
||||||
code = pb.ErrorCode_UserSessionNobeing
|
|
||||||
return
|
|
||||||
}
|
|
||||||
res := make([]*cfg.Gameatn, 0)
|
|
||||||
atn := &cfg.Gameatn{
|
|
||||||
A: req.Res.A,
|
|
||||||
T: req.Res.T,
|
|
||||||
N: req.Res.N,
|
|
||||||
}
|
|
||||||
res = append(res, atn)
|
|
||||||
code = this.module.DispenseRes(session, res, true)
|
|
||||||
if code == pb.ErrorCode_Success {
|
|
||||||
rsp := &pb.UserAddResResp{
|
|
||||||
Res: req.Res,
|
|
||||||
}
|
|
||||||
session.SendMsg(string(this.module.GetType()), UserSubTypeAddRes, rsp)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user