package manage import ( "github.com/golangkit/formatime" "github.com/shopspring/decimal" "log" "recook/internal/v2/lib/db" ) type RecookThirdPartyDetailModel struct { db.BaseModel Id uint `gorm:"column:id;primary_key" json:"id"` LastModify formatime.Second `json:"lastModify"` CatId uint `json:"catId"` CatName string `json:"catName"` BrandId uint `json:"brandId"` BrandName string `json:"brandName"` Price decimal.Decimal `json:"price"` Bn string `json:"bn"` Name string `json:"name"` Weight decimal.Decimal `json:"weight"` Store uint `json:"store"` Score int `json:"score"` Uptime formatime.Second `json:"uptime"` GoodsLink string `json:"goodsLink"` Unit string `json:"unit"` GoodsId uint `json:"goodsId"` Type string `json:"type"` IsShipping int `json:"isShipping"` DutyFree int `json:"dutyFree"` WarehouseId uint `json:"warehouseId"` CountryId uint `json:"countryId"` CountryAbbreviation string `json:"countryAbbreviation"` Warehouse string `json:"warehouse"` DetailPrice decimal.Decimal `json:"detailPrice"` DetailStore uint `json:"detailStore"` DetailIsShipping int `json:"detailIsShipping"` DetailMarketPrice decimal.Decimal `json:"detailMarketPrice"` } // TableName sets the insert table name for this struct type func (r *RecookThirdPartyDetailModel) TableName() string { return "recook_third_party_detail" } func (r *RecookThirdPartyDetailModel) Create(data *RecookThirdPartyDetailModel) { err := r.GetDb().Create(data).Error log.Println(err.Error()) } func (r *RecookThirdPartyDetailModel) UpdateByGoodsId(goodsId uint, data *RecookThirdPartyDetailModel) int64 { return r.GetDb().Model(&RecookThirdPartyDetailModel{}).Where("goods_id = ?", goodsId).Update(data).RowsAffected }