物料订单一周内不能重复下单

This commit is contained in:
苏尹岚
2020-03-11 16:23:09 +08:00
parent afead85556
commit 8dd3a52ce3

View File

@@ -1180,6 +1180,22 @@ func GetMatterStoreOrderCount(ctx *jxcontext.Context, storeID int) (result *Orde
orderPay *model.OrderPay
orderCount = &OrderCount{}
)
sql2 := `
SELECT COUNT(*) count
FROM goods_order
WHERE IF(store_id = 0,jx_store_id,store_id) = ?
AND order_created_at <= NOW() AND order_created_at >= ?
AND status = ?
`
sqlParams2 := []interface{}{
storeID,
time.Now().AddDate(0, 0, -7),
model.OrderStatusFinished,
}
err = dao.GetRow(db, &orderCount, sql2, sqlParams2)
if err != nil {
return nil, err
}
sql := `
SELECT b.*
FROM goods_order a
@@ -1201,21 +1217,5 @@ func GetMatterStoreOrderCount(ctx *jxcontext.Context, storeID int) (result *Orde
} else {
orderCount.Flag = true
}
sql2 := `
SELECT COUNT(*) count
FROM goods_order
WHERE IF(store_id = 0,jx_store_id,store_id) = ?
AND order_created_at <= NOW() AND order_created_at >= ?
AND status = ?
`
sqlParams2 := []interface{}{
storeID,
time.Now().AddDate(0, 0, -7),
model.OrderStatusFinished,
}
err = dao.GetRow(db, &orderCount, sql2, sqlParams2)
if err != nil {
return nil, err
}
return orderCount, err
}