feat: product store
This commit is contained in:
Binary file not shown.
@@ -54,6 +54,7 @@ func Wrap(next http.HandlerFunc) http.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// unwrapJSONData 将 RPC Response.data(proto string)里的 JSON 文本还原为对象/数组/数字。
|
||||||
func unwrapJSONData(v any) any {
|
func unwrapJSONData(v any) any {
|
||||||
s, ok := v.(string)
|
s, ok := v.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -63,9 +64,6 @@ func unwrapJSONData(v any) any {
|
|||||||
if s == "" {
|
if s == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if s[0] != '{' && s[0] != '[' {
|
|
||||||
return v
|
|
||||||
}
|
|
||||||
var parsed any
|
var parsed any
|
||||||
if err := json.Unmarshal([]byte(s), &parsed); err != nil {
|
if err := json.Unmarshal([]byte(s), &parsed); err != nil {
|
||||||
return v
|
return v
|
||||||
|
|||||||
Reference in New Issue
Block a user