|
|
@@ -1,16 +1,20 @@
|
|
|
package reply
|
|
|
|
|
|
+import (
|
|
|
+ "github.com/go-kratos/kratos/v2/transport/http"
|
|
|
+)
|
|
|
+
|
|
|
type SuccessReply struct {
|
|
|
Code int32 `json:"code"`
|
|
|
Message string `json:"message"`
|
|
|
Data interface{} `json:"data"`
|
|
|
}
|
|
|
|
|
|
-type ReplyFunc func(req any) (any, error)
|
|
|
+type ReplyFunc func(ctx http.Context, req any) (any, error)
|
|
|
|
|
|
var reply = DefaultFunc
|
|
|
|
|
|
-func DefaultFunc(out any) (any, error) {
|
|
|
+func DefaultFunc(ctx http.Context, out any) (any, error) {
|
|
|
success := &SuccessReply{
|
|
|
Code: 0,
|
|
|
}
|