Files
lone-services/services/chore/internal/logic/response.go
T
2026-09-16 10:36:59 +08:00

32 lines
567 B
Go

package logic
import (
"lone-services/pkg/utils"
chore "lone-services/rpc/chore/pb"
jsoniter "github.com/json-iterator/go"
)
func okResponse(data any) *chore.Response {
buf, _ := jsoniter.Marshal(data)
return &chore.Response{
Code: utils.Ok.Code,
Msg: utils.Ok.Msg,
Data: string(buf),
}
}
func failResponse(status utils.Status) *chore.Response {
return &chore.Response{
Code: status.Code,
Msg: status.Msg,
}
}
func outResponse(status utils.Status, msg string) *chore.Response {
return &chore.Response{
Code: status.Code,
Msg: msg,
}
}