This commit is contained in:
aozhiwei 2024-08-01 14:06:01 +08:00
parent ee7707286f
commit 2bc17d7a2e
7 changed files with 20 additions and 3 deletions

View File

@ -45,7 +45,7 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) {
func (this *RechargeApi) Pay(c *gin.Context) {
reqJson := struct {
NetId int32 `json:"net_id"`
GoodsId string `json:"goods_id"`
GoodsId int32 `json:"goods_id"`
AccountAddress string `json:"account_address"`
} {}
if err := c.ShouldBindJSON(&reqJson); err != nil {
@ -55,6 +55,11 @@ func (this *RechargeApi) Pay(c *gin.Context) {
})
return
}
goodsMeta := mt.Table.Recharge.GetById(q5.ToInt64(reqJson.GoodsId))
if goodsMeta == nil {
f5.RspErr(c, 2, "goods id param error")
return
}
orderId := q5.ToString(f5.GetApp().NewLockNodeUuid())
params := map[string]string{
"c" : "BcService",

View File

@ -10,5 +10,5 @@ type Recharge struct {
}
type RechargeTable struct {
f5.NameMetaTable[Recharge]
f5.IdMetaTable[Recharge]
}

View File

@ -2,6 +2,7 @@ package recharge
import (
"f5"
"main/middleware"
v1 "main/api/v1"
)
@ -11,5 +12,5 @@ func (er *RechargeRouter) InitRouter() {
api := v1.ApiGroupApp.RechargeApiGroup
f5.GetApp().GetGinEngine().GET("/api/recharge/history/:account_address", api.RechargeApi.RechargeQuery)
f5.GetApp().GetGinEngine().GET("/api/recharge/goods", api.RechargeApi.RechargeList)
f5.GetApp().GetGinEngine().GET("/api/recharge/pay", api.RechargeApi.Pay)
f5.GetApp().GetGinEngine().POST("/api/recharge/pay", middleware.JwtAuth, api.RechargeApi.Pay)
}

View File

@ -34,6 +34,7 @@ type LoginRsp struct {
ValidLefttime interface{} `json:"valid_lefttime"`
CurrentTimes interface{} `json:"current_times"`
TotalTimes interface{} `json:"total_times"`
SkinId interface{} `json:"skin_id"`
} `json:"hero_info"`
MapInfo *MapInfoRsp `json:"map_info"`
} `json:"info"`
@ -63,6 +64,7 @@ type UserRsp struct {
ValidLefttime interface{} `json:"valid_lefttime"`
CurrentTimes interface{} `json:"current_times"`
TotalTimes interface{} `json:"total_times"`
SkinId interface{} `json:"skin_id"`
} `json:"hero_info"`
} `json:"info"`
}
@ -110,6 +112,7 @@ type UpdateBattleInfoRsp struct {
ValidLefttime interface{} `json:"valid_lefttime"`
CurrentTimes interface{} `json:"current_times"`
TotalTimes interface{} `json:"total_times"`
SkinId interface{} `json:"skin_id"`
} `json:"hero_info"`
} `json:"info"`
}

View File

@ -21,6 +21,7 @@ type hero struct {
validLeftTime int32
currentTimes int32
totalTimes int32
skinId int32
}
type player struct {
@ -70,6 +71,7 @@ func (this *player) init(req *pendingLoginRequest, rsp *common.LoginRsp){
q5.DuckToSimple(rsp.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
q5.DuckToSimple(rsp.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
q5.DuckToSimple(rsp.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
q5.DuckToSimple(rsp.Info.HeroInfo.SkinId, &this.hero.skinId)
}
}
@ -93,6 +95,7 @@ func (this *player) againInit(req *pendingLoginRequest, rsp *common.LoginRsp){
q5.DuckToSimple(rsp.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
q5.DuckToSimple(rsp.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
q5.DuckToSimple(rsp.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
q5.DuckToSimple(rsp.Info.HeroInfo.SkinId, &this.hero.skinId)
}
}
@ -217,6 +220,7 @@ func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) {
member_pb.Hero.Quality = proto.Int32(this.hero.quality)
member_pb.Hero.CurrentTimes = proto.Int32(this.hero.currentTimes)
member_pb.Hero.TotalTimes = proto.Int32(this.hero.totalTimes)
member_pb.Hero.SkinId = proto.Int32(this.hero.skinId)
}
member_pb.State = proto.Int32(this.state)
if this.IsOnline() {
@ -434,6 +438,7 @@ func (this *player) CMRefreshUser(hdr *f5.MsgHdr, msg *cs.CMRefreshUser) {
q5.DuckToSimple(rspObj.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
q5.DuckToSimple(rspObj.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
q5.DuckToSimple(rspObj.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
q5.DuckToSimple(rspObj.Info.HeroInfo.SkinId, &this.hero.skinId)
}
if this.GetTeam() != nil {
this.GetTeam().SendUpdateNotify()
@ -486,6 +491,7 @@ func (this *player) updateChoose(skillId int32, heroUniId string,
q5.DuckToSimple(rspObj.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
q5.DuckToSimple(rspObj.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
q5.DuckToSimple(rspObj.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
q5.DuckToSimple(rspObj.Info.HeroInfo.SkinId, &this.hero.skinId)
}
cb(0, "")

View File

@ -112,6 +112,7 @@ message MFHero
optional int32 quality = 2; //
optional int32 current_times = 3; //
optional int32 total_times = 4; //
optional int32 skin_id = 5; //id
}
//

View File

@ -56,6 +56,7 @@ func (this* robot) FillMFTeamMember(member_pb *cs.MFTeamMember) {
member_pb.Hero.Quality = proto.Int32(0)
member_pb.Hero.CurrentTimes = proto.Int32(0)
member_pb.Hero.TotalTimes = proto.Int32(0)
member_pb.Hero.SkinId = proto.Int32(0)
}
member_pb.State = proto.Int32(0)
member_pb.Online = proto.Int32(1)