初始化
This commit is contained in:
9
internal/controller/payment/payment.go
Normal file
9
internal/controller/payment/payment.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package payment
|
||||
|
||||
// ControllerV1 是支付回调控制器。
|
||||
type ControllerV1 struct{}
|
||||
|
||||
// NewV1 创建支付回调控制器实例。
|
||||
func NewV1() *ControllerV1 {
|
||||
return &ControllerV1{}
|
||||
}
|
||||
21
internal/controller/payment/payment_v1.go
Normal file
21
internal/controller/payment/payment_v1.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package payment
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
"xk-of-api/api/payment/v1"
|
||||
"xk-of-api/internal/response"
|
||||
"xk-of-api/internal/service"
|
||||
)
|
||||
|
||||
// Notify 接收支付渠道回调,后续在 service 中扩展验签和状态流转。
|
||||
func (c *ControllerV1) Notify(ctx context.Context, req *v1.NotifyReq) (res *v1.NotifyRes, err error) {
|
||||
if req.Channel == "" {
|
||||
response.Error(ctx, 400, "支付渠道不能为空")
|
||||
return nil, nil
|
||||
}
|
||||
response.Success(ctx, service.Order.Notify(req.Channel, g.RequestFromCtx(ctx).GetMap()))
|
||||
return nil, nil
|
||||
}
|
||||
Reference in New Issue
Block a user