This commit is contained in:
laodaming
2023-07-03 17:33:59 +08:00
parent 5934017dbf
commit 22b27141a4
10 changed files with 332 additions and 11 deletions

View File

@@ -79,3 +79,11 @@ func (c *FsCartModel) GetAllByUserId(ctx context.Context, userId int64, sort str
}
return
}
func (c *FsCartModel) GetUserCartsByIds(ctx context.Context, userId int64, ids []int64) (resp []FsCart, err error) {
if userId <= 0 || len(ids) == 0 {
return
}
err = c.db.WithContext(ctx).Model(&FsCart{}).Where("`id` in (?) and `user_id` = ?", ids, userId).Find(&resp).Error
return resp, err
}

View File

@@ -102,3 +102,14 @@ func (c *FsProductPriceModel) GetAllSelectBySizeId(ctx context.Context, sizeIds
}
return prices, err
}
func (p *FsProductPriceModel) GetPriceListByIds(ctx context.Context, Ids []int64) (resp []FsProductPrice, err error) {
if len(Ids) == 0 {
return nil, nil
}
db := p.db.WithContext(ctx).Model(&FsProductPrice{}).
Where("`id` in (?)", Ids)
if err = db.Find(&resp).Error; err != nil {
return nil, err
}
return
}