38 lines
666 B
Go
38 lines
666 B
Go
package logic
|
|
|
|
import (
|
|
"product/product"
|
|
|
|
"pkg.local/utils"
|
|
)
|
|
|
|
func okResponse(data string) *product.Response {
|
|
return &product.Response{
|
|
Code: utils.Ok.Code,
|
|
Msg: utils.Ok.Msg,
|
|
Data: data,
|
|
}
|
|
}
|
|
|
|
func failResponse(status utils.Status) *product.Response {
|
|
return &product.Response{
|
|
Code: status.Code,
|
|
Msg: status.Msg,
|
|
}
|
|
}
|
|
|
|
func outResponse(status utils.Status, msg string) *product.Response {
|
|
return &product.Response{
|
|
Code: status.Code,
|
|
Msg: msg,
|
|
}
|
|
}
|
|
|
|
// failErr 兼容仍返回 utils.Error 的旧错误码
|
|
func failErr(err utils.Error) *product.Response {
|
|
return &product.Response{
|
|
Code: int32(err.GetCode()),
|
|
Msg: err.GetMsg(),
|
|
}
|
|
}
|