This commit is contained in:
李子铭 2025-03-14 14:36:27 +08:00
parent 7b927290bb
commit 107ed2cae0
4 changed files with 11 additions and 4 deletions

View File

@ -262,10 +262,15 @@ func (v *VoucherBiz) Query(ctx context.Context, order *bo.OrderBo) error {
func (v *VoucherBiz) UpdateOrderStatus(ctx context.Context, orderId uint64, status vo.OrderStatus) error { func (v *VoucherBiz) UpdateOrderStatus(ctx context.Context, orderId uint64, status vo.OrderStatus) error {
if status.IsSuccess() { if status.IsSuccess() {
return v.OrderRepo.Available(ctx, orderId) return v.OrderRepo.Available(ctx, orderId)
} else if status.IsUse() { } else if status.IsUse() {
return v.OrderRepo.Used(ctx, orderId) return v.OrderRepo.Used(ctx, orderId)
} else if status.IsExpired() { } else if status.IsExpired() {
return v.OrderRepo.Expired(ctx, orderId) return v.OrderRepo.Expired(ctx, orderId)
} }

View File

@ -2,7 +2,6 @@ package biz
import ( import (
"context" "context"
"encoding/json"
"fmt" "fmt"
"github.com/go-kratos/kratos/v2/log" "github.com/go-kratos/kratos/v2/log"
"github.com/redis/go-redis/v9" "github.com/redis/go-redis/v9"
@ -40,9 +39,12 @@ func (v *VoucherBiz) OrderNotice(ctx context.Context) error {
for _, order := range rows { for _, order := range rows {
if order.Type.IsCmb() { if order.Type.IsCmb() {
if err := v.cmbOrderNotice(ctx, order); err != nil { if err := v.cmbOrderNotice(ctx, order); err != nil {
log.Errorf("cmbOrderNotice err:%v", err)
return err return err
} }
} }
} }
@ -133,8 +135,7 @@ func (v *VoucherBiz) cmbOrderNotice(ctx context.Context, order *bo.OrderBo) erro
} }
if reply.RespCode != vo.CmbResponseStatusSuccess.GetValue() { if reply.RespCode != vo.CmbResponseStatusSuccess.GetValue() {
replyJson, _ := json.Marshal(reply) return fmt.Errorf(reply.RespMsg)
return fmt.Errorf("callback notify cmb error,orderNo:%s,resp:%s", order.OrderNo, string(replyJson))
} }
return nil return nil

View File

@ -33,8 +33,8 @@ func (p *OrderRepoImpl) FindInBatches(ctx context.Context, w *bo.FindInBatchesUs
db := p.db.DB(ctx) db := p.db.DB(ctx)
db.Where("status = ?", vo.OrderStatusUse)
db.Where("type = ?", w.Type) db.Where("type = ?", w.Type)
db.Where("status = ?", vo.OrderStatusUse)
db.Where("last_use_time >= ?", w.StartTime) db.Where("last_use_time >= ?", w.StartTime)
db.Where("last_use_time <= ?", w.EndTime) db.Where("last_use_time <= ?", w.EndTime)

View File

@ -111,6 +111,7 @@ func (c *CpnRepoImpl) Query(ctx context.Context, orderWechat *bo.OrderBo) (vo.Or
} }
if result.Response.StatusCode != CodeSuccess { if result.Response.StatusCode != CodeSuccess {
return 0, fmt.Errorf("微信返回错误 Response StatusCode[%s]", result.Response.StatusCode) return 0, fmt.Errorf("微信返回错误 Response StatusCode[%s]", result.Response.StatusCode)
} }