This commit is contained in:
aozhiwei 2024-11-11 17:12:31 +08:00
parent e3be6c82f7
commit 7697c74c54
3 changed files with 15 additions and 0 deletions

View File

@ -68,5 +68,9 @@ func (this *ShopApi) Buy(c *gin.Context) {
f5.RspErr(c, 500, "item_id error2")
return
}
if itemMeta.GetPrice() < 0 {
f5.RspErr(c, 500, "config error")
return
}
c.JSON(200, rspObj)
}

View File

@ -40,6 +40,7 @@ type Item struct {
produce int32
accelerate_type int32
accelerate_price int32
price int32
_flags1_ uint64
_flags2_ uint64
@ -228,6 +229,14 @@ func (this *Item) HasAcceleratePrice() bool {
return (this._flags1_ & (uint64(1) << 8)) > 0
}
func (this *Item) GetPrice() int32 {
return this.price
}
func (this *Item) HasPrice() bool {
return (this._flags1_ & (uint64(1) << 10)) > 0
}
func (this *Friend) GetId() int32 {
return this.id
}
@ -392,6 +401,7 @@ func (this *Item) LoadFromKv(kv map[string]interface{}) {
f5.ReadMetaTableField(&this.produce, "produce", &this._flags1_, 6, kv)
f5.ReadMetaTableField(&this.accelerate_type, "accelerate_type", &this._flags1_, 7, kv)
f5.ReadMetaTableField(&this.accelerate_price, "accelerate_price", &this._flags1_, 8, kv)
f5.ReadMetaTableField(&this.price, "price", &this._flags1_, 10, kv)
}
func (this *Friend) LoadFromKv(kv map[string]interface{}) {

View File

@ -33,6 +33,7 @@ message Item
optional int32 produce = 6;
optional int32 accelerate_type = 7;
optional int32 accelerate_price = 8;
optional int32 price = 10;
}
message Friend