notice
This commit is contained in:
parent
7b927290bb
commit
107ed2cae0
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue