feat: add manual fulfillment order creation

This commit is contained in:
yml2213
2026-08-11 11:49:58 +08:00
parent 2264851d5d
commit b686a82e60
12 changed files with 278 additions and 121 deletions
@@ -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