feat: 完善商品筛选、发布配置与优质号主流程
This commit is contained in:
@@ -52,7 +52,7 @@ func (r *Repository) prepareQualityOwnerPayment(ctx context.Context, userID uint
|
||||
Order("id DESC").
|
||||
First(&existing).Error
|
||||
if err == nil {
|
||||
if canReuseOrderPayment(existing, *runtimeConfig) {
|
||||
if canReuseQualityOwnerPayment(existing, *runtimeConfig) {
|
||||
existing.PayWay = firstNonEmpty(req.PayWay, existing.PayWay, runtimeConfig.PayWay, "ZFBZF")
|
||||
existing.JSPayFlag = firstNonEmpty(req.JSPayFlag, existing.JSPayFlag, runtimeConfig.JSPayFlag, "2")
|
||||
existing.AmountCent = amountCent
|
||||
@@ -87,6 +87,15 @@ func (r *Repository) prepareQualityOwnerPayment(ctx context.Context, userID uint
|
||||
return r.findPaymentByID(ctx, paymentID)
|
||||
}
|
||||
|
||||
// canReuseQualityOwnerPayment 仅复用尚未完成的有效支付单。
|
||||
// 已支付单属于上一轮开通周期,取消后必须重新创建支付单,避免“旧单已支付”被误当成新一轮开通。
|
||||
func canReuseQualityOwnerPayment(payment model.PaymentOrder, runtimeConfig runtimePaymentConfig) bool {
|
||||
if payment.Status == "paid" {
|
||||
return false
|
||||
}
|
||||
return canReuseOrderPayment(payment, runtimeConfig)
|
||||
}
|
||||
|
||||
func newQualityOwnerPayment(userID uint64, amountCent int64, req StartPaymentRequest, runtimeConfig runtimePaymentConfig) (model.PaymentOrder, error) {
|
||||
paymentNo, err := newPaymentNo()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user