产品套餐状态管理
This commit is contained in:
@@ -78,6 +78,9 @@ func (s *productSkuService) Update(update UpdateProductSkuData) (err error) {
|
||||
if update.Name != nil {
|
||||
do = append(do, q.ProductSku.Name.Value(*update.Name))
|
||||
}
|
||||
if update.Status != nil {
|
||||
do = append(do, q.ProductSku.Status.Value(*update.Status))
|
||||
}
|
||||
|
||||
_, err = q.ProductSku.Where(q.ProductSku.ID.Eq(update.ID)).UpdateSimple(do...)
|
||||
return err
|
||||
@@ -89,6 +92,7 @@ type UpdateProductSkuData struct {
|
||||
Code *string `json:"code"`
|
||||
Name *string `json:"name"`
|
||||
Price *string `json:"price"`
|
||||
Status *int32 `json:"status"`
|
||||
}
|
||||
|
||||
func (s *productSkuService) Delete(id int32) (err error) {
|
||||
|
||||
@@ -148,7 +148,7 @@ func (s *resourceService) CalcPrice(skuCode string, count int32, user *m.User, c
|
||||
|
||||
sku, err := q.ProductSku.
|
||||
Joins(q.ProductSku.Discount).
|
||||
Where(q.ProductSku.Code.Eq(skuCode)).
|
||||
Where(q.ProductSku.Code.Eq(skuCode), q.ProductSku.Status.Eq(int32(m.SkuStatusEnabled))).
|
||||
Take()
|
||||
if err != nil {
|
||||
return nil, nil, nil, decimal.Zero, decimal.Zero, core.NewServErr("产品不可用", err)
|
||||
|
||||
Reference in New Issue
Block a user