订单相关以及佣金相关修复
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m57s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m57s
This commit is contained in:
@@ -477,6 +477,28 @@ func (s *Service) fetchBuyerSnapshot(ctx context.Context, customerID uint) (phon
|
||||
return phone, nickname
|
||||
}
|
||||
|
||||
func (s *Service) buildPersonalCustomerOperatorSnapshot(ctx context.Context, customerID uint, nickname *string) (*uint, string, string) {
|
||||
if customerID == 0 {
|
||||
return nil, "", ""
|
||||
}
|
||||
|
||||
name := ""
|
||||
if nickname != nil {
|
||||
name = strings.TrimSpace(*nickname)
|
||||
}
|
||||
if name == "" {
|
||||
customer, err := s.personalCustomerStore.GetByID(ctx, customerID)
|
||||
if err != nil {
|
||||
s.logger.Warn("buildPersonalCustomerOperatorSnapshot: 查询个人客户失败", zap.Uint("customer_id", customerID), zap.Error(err))
|
||||
} else if customer != nil {
|
||||
name = strings.TrimSpace(customer.Nickname)
|
||||
}
|
||||
}
|
||||
|
||||
id := customerID
|
||||
return &id, model.OperatorAccountTypePersonalCustomer, name
|
||||
}
|
||||
|
||||
func (s *Service) buildPendingOrder(ctx context.Context, customerID uint, result *purchase_validation.PurchaseValidationResult, sellerCostPrice int64) (*model.Order, error) {
|
||||
orderType := resolveOrderType(result)
|
||||
if orderType == "" {
|
||||
@@ -515,6 +537,7 @@ func (s *Service) buildPendingOrder(ctx context.Context, customerID uint, result
|
||||
}
|
||||
|
||||
order.BuyerPhone, order.BuyerNickname = s.fetchBuyerSnapshot(ctx, customerID)
|
||||
order.OperatorAccountID, order.OperatorAccountType, order.OperatorAccountName = s.buildPersonalCustomerOperatorSnapshot(ctx, customerID, order.BuyerNickname)
|
||||
|
||||
return order, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user