Skip to content

Commit

Permalink
feat(recon): 独立的对账模块 (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
longyue0521 authored May 3, 2024
1 parent cd7f351 commit 4ffd84b
Show file tree
Hide file tree
Showing 23 changed files with 2,059 additions and 71 deletions.
8 changes: 6 additions & 2 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ kafka:
- kafka:9092

cron:
# 超时关闭订单
# 超时关闭订单
closeTimeoutOrder:
enableSeconds: true # 是否使用秒作解析器,默认否
spec: "* * * * *" # 每分钟执行一次
# 超时释放积分
unlockTimeoutCredit:
enableSeconds: true # 是否使用秒作解析器,默认否
spec: "* * * * *" # 每分钟执行一次
# 微信订单对账
# 微信订单对账
syncWechatOrder:
enableSeconds: true # 是否使用秒作解析器,默认否
spec: "* * * * *" # 每分钟执行一次
# 独立对账
syncPaymentAndOrder:
enableSeconds: true # 是否使用秒作解析器,默认否
spec: "* * * * *" # 每分钟执行一次
12 changes: 7 additions & 5 deletions internal/credit/wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ import (
"github.com/google/wire"
)

type Credit = domain.Credit
type CreditLog = domain.CreditLog
type Service = service.Service
type Handler = web.Handler
type CloseTimeoutLockedCreditsJob = job.CloseTimeoutLockedCreditsJob
type (
Credit = domain.Credit
CreditLog = domain.CreditLog
Service = service.Service
Handler = web.Handler
CloseTimeoutLockedCreditsJob = job.CloseTimeoutLockedCreditsJob
)

func InitModule(db *egorm.Component, q mq.MQ, e ecache.Cache) (*Module, error) {
wire.Build(wire.Struct(
Expand Down
16 changes: 7 additions & 9 deletions internal/credit/wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/order/internal/event/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (c *PaymentConsumer) Consume(ctx context.Context) error {
if evt.Status == uint8(payment.StatusPaidSuccess) {
err = c.svc.SucceedOrder(ctx, evt.PayerID, evt.OrderSN)
warnMessage = "设置订单'支付成功'状态失败"
} else if evt.Status == uint8(payment.StatusFailed) {
} else if evt.Status == uint8(payment.StatusPaidFailed) {
err = c.svc.FailOrder(ctx, evt.PayerID, evt.OrderSN)
warnMessage = "设置订单'支付失败'状态失败"
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/order/internal/integration/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,7 @@ func (s *OrderModuleTestSuite) TestPaymentConsumer_Consume() {
evt: event.PaymentEvent{
OrderSN: "orderSN-23",
PayerID: testUID,
Status: uint8(payment.StatusFailed),
Status: uint8(payment.StatusPaidFailed),
},
after: func(t *testing.T, orderSN string) {
t.Helper()
Expand Down
1 change: 1 addition & 0 deletions internal/order/internal/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"golang.org/x/sync/errgroup"
)

//go:generate mockgen -source=./service.go -package=ordermocks -destination=../../mocks/order.mock.go -typed Service
type Service interface {
// CreateOrder 创建订单 web调用
CreateOrder(ctx context.Context, order domain.Order) (domain.Order, error)
Expand Down
Loading

0 comments on commit 4ffd84b

Please sign in to comment.