32 lines
789 B
Go
32 lines
789 B
Go
package logic
|
|
|
|
import (
|
|
"admin/admin"
|
|
|
|
"pkg.local/utils"
|
|
validateService "pkg.local/validate"
|
|
)
|
|
|
|
type BaseLogic struct {
|
|
}
|
|
|
|
func (l *BaseLogic) checkParams(in *admin.AdminEditRequest, v validateService.IValidator) *admin.Response {
|
|
|
|
if resp := validateService.ValidateFromProto(in, v); resp != utils.StringEmpty {
|
|
return &admin.Response{Code: utils.ErrorParams.Code, Msg: resp}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (l *AdminAddLogic) fail(status utils.Status) *admin.Response {
|
|
return &admin.Response{Code: status.Code, Msg: status.Msg}
|
|
}
|
|
|
|
func (l *AdminAddLogic) out(status utils.Status, msg string) *admin.Response {
|
|
return &admin.Response{Code: status.Code, Msg: msg}
|
|
}
|
|
|
|
func (l *AdminAddLogic) ok(data any) *admin.Response {
|
|
return &admin.Response{Code: utils.Ok.Code, Msg: utils.Ok.Msg}
|
|
}
|