Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop
This commit is contained in:
@@ -95,12 +95,12 @@ type OrderStatus struct {
|
||||
|
||||
// 订单商品
|
||||
type OrderProduct struct {
|
||||
TotalPrice AmountInfo `json:"amount"` // 商品总价
|
||||
TotalPrice AmountInfo `json:"total_price"` // 商品总价
|
||||
ExpectedDeliveryTime *time.Time `json:"expected_delivery_time"` // 预计到货时间
|
||||
PurchaseQuantity PurchaseQuantity `json:"purchase_quantity"` // 购买数量
|
||||
ProductID int64 `json:"product_id"` // 商品ID
|
||||
ProductName string `json:"product_name"` // 商品名称
|
||||
ItemPrice AmountInfo `json:"product_price"` // 商品单价
|
||||
ItemPrice AmountInfo `json:"item_price"` // 商品单价
|
||||
ProductSnapshot interface{} `json:"product_snapshot"` // 商品快照
|
||||
ShoppingCartSnapshot *FsShoppingCartData `json:"shopping_cart_snapshot"` // 购物车快照
|
||||
ProductCover string `json:"product_cover"` // 商品封面
|
||||
|
||||
@@ -4,7 +4,7 @@ import "context"
|
||||
|
||||
type RelaFsProduct struct {
|
||||
FsProduct
|
||||
CoverResource *FsResource `json:"cover_resource" gorm:"foreignkey:cover;references:resource_id"`
|
||||
CoverResource *FsResource `json:"cover_resource" gorm:"foreignkey:cover;references:resource_url"`
|
||||
}
|
||||
|
||||
func (m *FsProductModel) TableName() string {
|
||||
|
||||
@@ -152,3 +152,17 @@ func (d *FsProductModel3dModel) FindOneByProductIdSizeIdTag(ctx context.Context,
|
||||
err = db.Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (d *FsProductModel3dModel) GetAllByProductIdsTags(ctx context.Context, productIds []int64, tags []int, fields ...string) (resp []FsProductModel3d, err error) {
|
||||
if len(productIds) == 0 || len(tags) == 0 {
|
||||
return
|
||||
}
|
||||
db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).
|
||||
Where("`product_id` in (?) and `tag` in (?) and `status` = ?", productIds, tags, 1).
|
||||
Order("sort DESC")
|
||||
if len(fields) != 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
err = db.Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user