You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
2.2 KiB
54 lines
2.2 KiB
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
|
|
}
|