修复自定义Marshal序列化的BUG

This commit is contained in:
2025-01-22 15:55:39 +08:00
parent c00354fe46
commit 10759d9c5e
8 changed files with 48 additions and 29 deletions

View File

@ -38,17 +38,17 @@ func (rdl RequestDataLocation) IsValid() bool {
// Date : 14:41 2024/11/25
type ResponseDataLocation string
func (rdl ResponseDataLocation) String() string {
return string(rdl)
func (rdl *ResponseDataLocation) String() string {
return string(*rdl)
}
func (rdl ResponseDataLocation) MarshalJSON() ([]byte, error) {
func (rdl *ResponseDataLocation) MarshalJSON() ([]byte, error) {
return []byte(rdl.String()), nil
}
func (rdl ResponseDataLocation) IsValid() bool {
func (rdl *ResponseDataLocation) IsValid() bool {
for _, item := range ResponseDataLocationList {
if item.Value == rdl {
if item.Value == *rdl {
return true
}
}