feat: add manual fulfillment order creation
This commit is contained in:
@@ -23,12 +23,20 @@ func (s *FulfillmentService) GetOrder(merchantID uint, orderNo string) (*model.F
|
||||
return &order, nil
|
||||
}
|
||||
|
||||
func (s *FulfillmentService) ListOrders(merchantID uint, page, size int, orderStatus string) ([]model.FulfillmentOrder, int64, error) {
|
||||
func (s *FulfillmentService) ListOrders(merchantID uint, page, size int, orderStatus, orderSource string) ([]model.FulfillmentOrder, int64, error) {
|
||||
page, size = normalizePage(page, size)
|
||||
tx := s.db.Model(&model.FulfillmentOrder{}).Where("merchant_id = ?", merchantID)
|
||||
if orderStatus != "" {
|
||||
tx = tx.Where("order_status = ?", orderStatus)
|
||||
}
|
||||
if orderSource != "" {
|
||||
switch orderSource {
|
||||
case model.OrderSourceAPI, model.OrderSourceManual, model.OrderSourceTest:
|
||||
tx = tx.Where("order_source = ?", orderSource)
|
||||
default:
|
||||
return nil, 0, errors.New("无效的订单来源")
|
||||
}
|
||||
}
|
||||
var total int64
|
||||
if err := tx.Count(&total).Error; err != nil {
|
||||
return nil, 0, err
|
||||
|
||||
Reference in New Issue
Block a user