mirror of
https://wiilab.wiimart.org/wiimart/WiiSOAP
synced 2025-09-06 05:21:04 +02:00
Avoid redundant field struct usage
This commit is contained in:
parent
f32e2a5f2e
commit
7c7ac06509
@ -72,8 +72,6 @@ type Response struct {
|
|||||||
ErrorCode int
|
ErrorCode int
|
||||||
ServiceStandbyMode bool `xml:"ServiceStandbyMode"`
|
ServiceStandbyMode bool `xml:"ServiceStandbyMode"`
|
||||||
|
|
||||||
// Allows a simple <name>value</name> node to be inserted.
|
|
||||||
KVFields []KVField
|
|
||||||
// Allows for <name>[dynamic content]</name> situations.
|
// Allows for <name>[dynamic content]</name> situations.
|
||||||
CustomFields []interface{}
|
CustomFields []interface{}
|
||||||
}
|
}
|
||||||
|
5
utils.go
5
utils.go
@ -96,9 +96,9 @@ func (e *Envelope) ObtainCommon(doc *xmlquery.Node) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddKVNode adds a given key by name to a specified value.
|
// AddKVNode adds a given key by name to a specified value, such as <key>value</key>.
|
||||||
func (e *Envelope) AddKVNode(key string, value string) {
|
func (e *Envelope) AddKVNode(key string, value string) {
|
||||||
e.Body.Response.KVFields = append(e.Body.Response.KVFields, KVField{
|
e.Body.Response.CustomFields = append(e.Body.Response.CustomFields, KVField{
|
||||||
XMLName: xml.Name{Local: key},
|
XMLName: xml.Name{Local: key},
|
||||||
Value: value,
|
Value: value,
|
||||||
})
|
})
|
||||||
@ -135,7 +135,6 @@ func (e *Envelope) ReturnError(errorCode int, reason string, err error) (bool, s
|
|||||||
e.Body.Response.ErrorCode = errorCode
|
e.Body.Response.ErrorCode = errorCode
|
||||||
|
|
||||||
// Ensure all additional fields are empty to avoid conflict.
|
// Ensure all additional fields are empty to avoid conflict.
|
||||||
e.Body.Response.KVFields = []KVField{}
|
|
||||||
e.Body.Response.CustomFields = nil
|
e.Body.Response.CustomFields = nil
|
||||||
|
|
||||||
e.AddKVNode("UserReason", reason)
|
e.AddKVNode("UserReason", reason)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user