update
This commit is contained in:
parent
755693518a
commit
21800d3fd9
@ -567,18 +567,22 @@
|
||||
"t": "gold",
|
||||
"n": 1000
|
||||
},
|
||||
"dispatch_Refreshtimes": 6,
|
||||
"dispatch_numoftimes": 6,
|
||||
"dispatch_numtools": 10012,
|
||||
"dispatch_Refreshtimes": 100,
|
||||
"dispatch_numoftimes": 60,
|
||||
"dispatch_numtools": {
|
||||
"a": "item",
|
||||
"t": "10012",
|
||||
"n": 1
|
||||
},
|
||||
"dispatch_npctimes": 2,
|
||||
"dispatch_weektaskreward": [
|
||||
{
|
||||
"n": 4,
|
||||
"g": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 9999
|
||||
"a": "item",
|
||||
"t": "10006",
|
||||
"n": 1
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
@ -591,9 +595,9 @@
|
||||
"n": 8,
|
||||
"g": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 99
|
||||
"a": "item",
|
||||
"t": "10006",
|
||||
"n": 2
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
@ -606,9 +610,9 @@
|
||||
"n": 10,
|
||||
"g": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "gold",
|
||||
"n": 500
|
||||
"a": "item",
|
||||
"t": "10006",
|
||||
"n": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@ -53,7 +54,8 @@ func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.
|
||||
}
|
||||
|
||||
//校验门票
|
||||
if d.Ticket <= 0 {
|
||||
ticketAtn := a.module.configure.GetGlobalConf().DispatchNumtools
|
||||
if code = a.module.CheckRes(session, []*cfg.Gameatn{ticketAtn}); code != pb.ErrorCode_Success {
|
||||
code = pb.ErrorCode_DispatchTicketNoEnough
|
||||
return
|
||||
}
|
||||
@ -70,6 +72,9 @@ func (a *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (code pb.
|
||||
return
|
||||
}
|
||||
|
||||
//扣除门票
|
||||
a.module.ConsumeRes(session, []*cfg.Gameatn{ticketAtn}, true)
|
||||
|
||||
rsp.IsSucc = true
|
||||
session.SendMsg(string(a.module.GetType()), "do", rsp)
|
||||
return
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"go_dreamfactory/utils"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
@ -35,8 +36,6 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
|
||||
}
|
||||
|
||||
freeCount := a.module.configure.GetGlobalConf().DispatchFreecheck
|
||||
ticketCount := a.module.configure.GetGlobalConf().DispatchNumoftimes
|
||||
|
||||
nb := &pb.Noticeboard{
|
||||
Lv: 1, //公告初始升级
|
||||
FreeCount: freeCount,
|
||||
@ -45,16 +44,26 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
|
||||
}
|
||||
|
||||
update := map[string]interface{}{
|
||||
"nb": nb,
|
||||
"ticket": ticketCount,
|
||||
"nb": nb,
|
||||
}
|
||||
if err := a.module.modelDispatch.Change(uid, update); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
d.Nb = nb
|
||||
rsp.Ticket = ticketCount
|
||||
} else {
|
||||
//恢复门票
|
||||
one := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix())
|
||||
if one >= 1 {
|
||||
itemId := a.module.configure.GetGlobalConf().DispatchNumtools.T
|
||||
left := a.module.ModuleItems.QueryItemAmount(uid, itemId)
|
||||
limit := a.module.configure.GetGlobalConf().DispatchNumoftimes
|
||||
if int32(left) < limit {
|
||||
add := limit - int32(left)
|
||||
atn := &cfg.Gameatn{A: "item", T: itemId, N: add}
|
||||
a.module.DispenseRes(session, []*cfg.Gameatn{atn}, true)
|
||||
}
|
||||
}
|
||||
//周任务重置
|
||||
n := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix())
|
||||
day := a.module.configure.GetGlobalConf().DispatchWeektaskcheck
|
||||
@ -63,13 +72,6 @@ func (a *apiComp) Notice(session comm.IUserSession, req *pb.DispatchNoticeReq) (
|
||||
d.Nb.WeekReceived = []int32{}
|
||||
d.Nb.UpdateTime = configure.Now().Unix()
|
||||
}
|
||||
|
||||
one := utils.DiffDays(d.Nb.UpdateTime, configure.Now().Unix())
|
||||
if one >= 1 {
|
||||
d.Ticket = a.module.configure.GetGlobalConf().DispatchNumoftimes
|
||||
}
|
||||
|
||||
rsp.Ticket = d.Ticket
|
||||
a.module.modelDispatch.updateNotice(session.GetUserId(), d)
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,6 @@ func (this *modelDispatch) dispatch(uid string, taskId int32, heroIds []string,
|
||||
|
||||
update := map[string]interface{}{
|
||||
"nb": disp.Nb,
|
||||
"ticket": disp.Ticket - 1,
|
||||
}
|
||||
if err := this.Change(uid, update); err != nil {
|
||||
return err
|
||||
|
@ -185,7 +185,7 @@ type GameGlobalData struct {
|
||||
DispatchCheckmoney *Gameatn
|
||||
DispatchRefreshtimes int32
|
||||
DispatchNumoftimes int32
|
||||
DispatchNumtools int32
|
||||
DispatchNumtools *Gameatn
|
||||
DispatchNpctimes int32
|
||||
DispatchWeektaskreward []*Gamedispatch
|
||||
DispatchWeektaskcheck int32
|
||||
@ -781,7 +781,7 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["dispatch_checkmoney"].(map[string]interface{}); !_ok_ { err = errors.New("dispatch_checkmoney error"); return }; if _v.DispatchCheckmoney, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_Refreshtimes"].(float64); !_ok_ { err = errors.New("dispatch_Refreshtimes error"); return }; _v.DispatchRefreshtimes = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_numoftimes"].(float64); !_ok_ { err = errors.New("dispatch_numoftimes error"); return }; _v.DispatchNumoftimes = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_numtools"].(float64); !_ok_ { err = errors.New("dispatch_numtools error"); return }; _v.DispatchNumtools = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["dispatch_numtools"].(map[string]interface{}); !_ok_ { err = errors.New("dispatch_numtools error"); return }; if _v.DispatchNumtools, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["dispatch_npctimes"].(float64); !_ok_ { err = errors.New("dispatch_npctimes error"); return }; _v.DispatchNpctimes = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
|
Loading…
Reference in New Issue
Block a user