This commit is contained in:
aozhiwei 2024-11-11 17:58:27 +08:00
parent f771cc440e
commit 942919e670
2 changed files with 16 additions and 1 deletions

View File

@ -80,5 +80,11 @@ func (this *ShopApi) Buy(c *gin.Context) {
f5.RspErr(c, 500, "server internal error5")
return
}
chip := new(model.Chip)
chip.AccountId = s.GetAccountId()
chip.ItemId = itemMeta.GetId()
chip.ItemNum = 1
chip.CreateTime = int32(nowTime)
chip.ModifyTime = int32(nowTime)
c.JSON(200, rspObj)
}

View File

@ -1,12 +1,14 @@
package model
import (
"f5"
"main/constant"
)
type Chip struct {
Idx int64 `gorm:"column:idx;AUTO_INCREMENT"`
AccountId string `gorm:"column:account_id;primaryKey"`
ItemId int64 `gorm:"column:item_id"`
ItemId int32 `gorm:"column:item_id"`
ItemNum int32 `gorm:"column:item_num"`
CreateTime int32 `gorm:"column:createtime;<-:create"`
ModifyTime int32 `gorm:"column:modifytime"`
@ -15,3 +17,10 @@ type Chip struct {
func (this *Chip) TableName() string {
return "t_chip"
}
func (this *Chip) Create() error {
if result := f5.GetApp().GetOrmDb(constant.WHEEL_DB).Create(this); result.Error != nil {
return result.Error
}
return nil
}