package response type ThreeElementsResp struct { Data ThreeElementsRespData `json:"data"` // 使用指针和omitempty处理可能缺失的字段 Resp ThreeElementsRespResp `json:"resp"` } type ThreeElementsRespData struct { AreaCode string `json:"areacode"` ISP string `json:"isp"` ID string `json:"id"` City string `json:"city"` Mobile string `json:"Mobile"` Name string `json:"Name"` Postcode string `json:"postcode"` } type ThreeElementsRespResp struct { Code string `json:"code"` Desc string `json:"desc"` } // Data 结构体表示响应中的数据部分 type TwoElementsData struct { Birthday string `json:"birthday"` Result int `json:"result"` Address string `json:"address"` OrderNo string `json:"orderNo"` Sex string `json:"sex"` Desc string `json:"desc"` } // Response 结构体表示整个响应 type TwoElementsResp struct { Msg string `json:"msg"` Success bool `json:"success"` Code int `json:"code"` Data *TwoElementsData `json:"data"` // 使用指针类型,以便在失败响应时处理为 nil }