app上报的参数如下:
{
"clientId": "8517895440514039afcf6d3e5d7832ae",
"dua": "SN=DOCKCJPH90_GA&VN=900042418&BN=0&VC=Xiaomi&MO=M2012K11AC&RL=1080_2239&CHID=unknown_unknown&LCID=&RV=&OS=Android13&DV=V1",
"phone": "15071343418",
"proxyNode": [
{
"channelCode": "kuaifenxiao",
"clientId": "8517895440514039afcf6d3e5d7832ae",
"cookie": "did=web_xwaap1nt5xdqr60axnls5reb9u0amfb3; userId=247914626; sid=kuaishou.shop.b; kuaishou.shop.b_st=ChJrdWFpc2hvdS5zaG9wLmIuc3QSoAFJS2UrZiuakO75bVK3FJQq8SQ9C6ztcMNfyd_m7biZQyfMuZ6Lhn6YYEu8YCagfGi4LzAD58G3DHnf8yZGwbLaNuGK286yUxWSydlfwf23Lw4kLR33GPmkN-6fiszeJBQ-U8FvihnbpF4k1uZPnDjBstbNduCCxyKlHH5B5uUCMy3YkCW3t4UE533HGhgDyj0LwqnQjtOjTV9awG7f2vIcGhKd_ML3fWEjTvpP6f9oisfIpAIiILrfmxjQ7acolLSEaaNOXIfcp0ITOpSFhJNSBYQut2NHKAUwAQ; kuaishou.shop.b_ph=8682d98ae1291dacdcdbba835f0794f31e5f",
"other": "{\"userId\":247914626,\"userNick\":\"duzzi\",\"promotionAbility\":false}",
"phone": "15071343418",
"uniqueId": ""
},
{
"channelCode": "douyin",
"clientId": "8517895440514039afcf6d3e5d7832ae",
"cookie": "_tea_utm_cache_2906=undefined; ttwid=1%7CnWBixC4hbDtwqjIz8ph7PTjSA_06-mIFxsjfKOzsuWI%7C1715738511%7C3b728a1109088f7357acb27710208586cf89fd55d5f10a7cdff04c425b941260; bd_ticket_guard_client_data=eyJiZC10aWNrZXQtZ3VhcmQtdmVyc2lvbiI6MiwiYmQtdGlja2V0LWd1YXJkLWl0ZXJhdGlvbi12ZXJzaW9uIjoxLCJiZC10aWNrZXQtZ3VhcmQtcmVlLXB1YmxpYy1rZXkiOiJCTUptc2tmK1E2K3RIbmZ3VTY3QjUvZ3pLTVUxdmJQRXBYTk4rRHhNZDdLSTFOWVkwc2Evc2xnbVhtSjJETXNVSXBZaFRqYmFKSGpUeHM0Qit1clhNTXc9IiwiYmQtdGlja2V0LWd1YXJkLXdlYi12ZXJzaW9uIjoxfQ%3D%3D; bd_ticket_guard_client_web_domain=2; passport_csrf_token=d3fda2e10c9f6722cd9f7e2c40bf3751; passport_csrf_token_default=d3fda2e10c9f6722cd9f7e2c40bf3751; msToken=59BiDkrxFVqIzIonFt7gvhaa5HmX_0ncHpFvHWFclvjlhzM7fMRVqWgBySOvEyLGMz1RDdZMpaStjpZGWqKN9Xkb12DwQPfucQPyylPKIyEGLO764l_mluunQnm3; tt_scid=DD4adatc6sh6zwZxLMMSqbglPqMPgJx8YqZY.HTSXV9RdfVnMIthNLOCB6My3xP13264; passport_assist_user=CjxOP0DkL7yqSHt3RyAzf1RwfdcgXq7G3JDw3RIIcdnq0IqfWLF-67XFwq7Dct1GyhVokCunTs7Ebc9959caSgo8YRyhb2oFn0wrhWlp-awSs5oH6XIFR-wEAeADN5FddWNSIo3adrgTeJqYcKEoYBSRJKB9CXwdFhtHGw1QEICq0Q0Yia_WVCABIgED8pgI6w%3D%3D; n_mh=FzeIA2bdW3iCBvrz1qr1PcdgQMqdsPt-UXF2W7RNLF8; sso_uid_tt=c16a5e7f16cfd256313a4a8c9e655b1a; sso_uid_tt_ss=c16a5e7f16cfd256313a4a8c9e655b1a; toutiao_sso_user=1684f0da2dd53ed3b328f9d402b91aff; toutiao_sso_user_ss=1684f0da2dd53ed3b328f9d402b91aff; sid_ucp_sso_v1=1.0.0-KDY4OGVlMjFjZTIzNGIxODAyM2FhNjc1OWQ4MTQwNmYxNWU4OTc3MjgKHQjUw8nrvQEQpq-QsgYY2hYgDDCF6Pq-BTgGQPQHGgJsZiIgMTY4NGYwZGEyZGQ1M2VkM2IzMjhmOWQ0MDJiOTFhZmY; ssid_ucp_sso_v1=1.0.0-KDY4OGVlMjFjZTIzNGIxODAyM2FhNjc1OWQ4MTQwNmYxNWU4OTc3MjgKHQjUw8nrvQEQpq-QsgYY2hYgDDCF6Pq-BTgGQPQHGgJsZiIgMTY4NGYwZGEyZGQ1M2VkM2IzMjhmOWQ0MDJiOTFhZmY; msToken=rTpCZ4RO1QbkQXIfs-Wrk7xGyCvImv6NOQewVFu4zIVm5Um8IAfjuhEtXjjfSZO9noN9mbXFBD1awSJ-N2pa8Petu6Oz3bo9-awUINoTM_YEx6Gp_DvJCcxKpjw5; odin_tt=7e1e5fac28232bed75e2ce3ecbf70cc87e80c1b34bc56312de4aa05dc02e6e4f990aca679b59e5be079e6fa347525de1; passport_auth_status=d533947c6fbc84f49ae246acf1cd3066%2C; passport_auth_status_ss=d533947c6fbc84f49ae246acf1cd3066%2C; bd_ticket_guard_server_data=eyJ0aWNrZXQiOiI2ZTQ2ZDNkMTQ4NTQ2ZWRjMDZiYTMyMGQ0NDg1ODEyYiIsInRzX3NpZ24iOiJ0cy4xLjAwODA4MWViMGEyYmIwYjMzZjc2NWQ2MTA5MmNlY2M1ZWZjMTNmNzcwODM0ZjU2OTY3YWQ3M2FmMTkwNWJmZTljNGZiZTg3ZDIzMTljZjA1MzE4NjI0Y2VkYTE0OTExY2E0MDZkZWRiZWJlZGRiMmUzMGZjZThkNGZhMDI1NzVkIiwiY2xpZW50X2NlcnQiOiJwdWIuQk1KbXNrZitRNit0SG5md1U2N0I1L2d6S01VMXZiUEVwWE5OK0R4TWQ3S0kxTllZMHNhL3NsZ21YbUoyRE1zVUlwWWhUamJhSkhqVHhzNEIrdXJYTU13PSJ9; bd_ticket_guard_web_domain=2; sid_guard=6e46d3d148546edc06ba320d4485812b%7C1715738536%7C5184000%7CSun%2C+14-Jul-2024+02%3A02%3A16+GMT; uid_tt=9419f8f75cb08d26cd22dda8547af9d3; uid_tt_ss=9419f8f75cb08d26cd22dda8547af9d3; sid_tt=6e46d3d148546edc06ba320d4485812b; sessionid=6e46d3d148546edc06ba320d4485812b; sessionid_ss=6e46d3d148546edc06ba320d4485812b; sid_ucp_v1=1.0.0-KDM5NDg2NGEyNTQ1NmE4ZGU0M2YxZDJjMDE4MjEyODAxNTBlMmNiNGEKGQjUw8nrvQEQqK-QsgYY2hYgDDgGQPQHSAQaAmxmIiA2ZTQ2ZDNkMTQ4NTQ2ZWRjMDZiYTMyMGQ0NDg1ODEyYg; ssid_ucp_v1=1.0.0-KDM5NDg2NGEyNTQ1NmE4ZGU0M2YxZDJjMDE4MjEyODAxNTBlMmNiNGEKGQjUw8nrvQEQqK-QsgYY2hYgDDgGQPQHSAQaAmxmIiA2ZTQ2ZDNkMTQ4NTQ2ZWRjMDZiYTMyMGQ0NDg1ODEyYg; csrf_session_id=fbeac00e4e14f1eef5c0ca3f2bb7b9c7",
"other": "{\"uid\":\"50959901140\",\"nickname\":\"duzzi\",\"with_fusion_shop_entry\":false,\"localStorage\":{\"security-sdk\\/s_sdk_crypt_sdk\":\"{\\\"data\\\":\\\"{\\\\\\\"ec_privateKey\\\\\\\":\\\\\\\"-----BEGIN PRIVATE KEY-----\\\\\\\\r\\\\\\\\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQggReMEBDyckfHliYY\\\\\\\\r\\\\\\\\nLI6fsK8ajep\\/MLxPGhDBfWpeboahRANCAATCZrJH\\/kOvrR538FOuwef4MyjFNb2z\\\\\\\\r\\\\\\\\nxKVzTfg8THeyiNTWGNLGv7JYJl5idgzLFCKWIU422iR408bOAfrq1zDM\\\\\\\\r\\\\\\\\n-----END PRIVATE KEY-----\\\\\\\\r\\\\\\\\n\\\\\\\",\\\\\\\"ec_publicKey\\\\\\\":\\\\\\\"-----BEGIN PUBLIC KEY-----\\\\\\\\r\\\\\\\\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEwmayR\\/5Dr60ed\\/BTrsHn+DMoxTW9\\\\\\\\r\\\\\\\\ns8Slc034PEx3sojU1hjSxr+yWCZeYnYMyxQiliFONtokeNPGzgH66tcwzA==\\\\\\\\r\\\\\\\\n-----END PUBLIC KEY-----\\\\\\\\r\\\\\\\\n\\\\\\\",\\\\\\\"ec_csr\\\\\\\":\\\\\\\"-----BEGIN CERTIFICATE REQUEST-----\\\\\\\\r\\\\\\\\nMIIBEjCBuQIBADAnMQswCQYDVQQGEwJDTjEYMBYGA1UEAwwPYmRfdGlja2V0X2d1\\\\\\\\r\\\\\\\\nYXJkMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEwmayR\\/5Dr60ed\\/BTrsHn+DMo\\\\\\\\r\\\\\\\\nxTW9s8Slc034PEx3sojU1hjSxr+yWCZeYnYMyxQiliFONtokeNPGzgH66tcwzKAw\\\\\\\\r\\\\\\\\nMC4GCSqGSIb3DQEJDjEhMB8wHQYDVR0RBBYwFIISY3JlYXRvci5kb3V5aW4uY29t\\\\\\\\r\\\\\\\\nMAoGCCqGSM49BAMCA0gAMEUCIQCXOKAEftf3wSvYHQziKj\\/MEwxTQ5WIKSLzBm7f\\\\\\\\r\\\\\\\\nX\\/kLAgIgQXsACAB69Crnl6ETSQXZMvoMEh79EG7WGK2A9Un84Lk=\\\\\\\\r\\\\\\\\n-----END CERTIFICATE REQUEST-----\\\\\\\\r\\\\\\\\n\\\\\\\"}\\\"}\"}}",
"phone": "15071343418",
"uniqueId": ""
},
{
"channelCode": "juliangbaiying",
"clientId": "8517895440514039afcf6d3e5d7832ae",
"cookie": "",
"other": "",
"phone": "",
"uniqueId": ""
},
{
"channelCode": "shipinhao",
"clientId": "8517895440514039afcf6d3e5d7832ae",
"cookie": "",
"other": "",
"phone": "",
"uniqueId": ""
},
{
"channelCode": "kuaishou",
"clientId": "8517895440514039afcf6d3e5d7832ae",
"cookie": "",
"other": "",
"phone": "",
"uniqueId": ""
}
],
"sUserId": "100005",
"version": "900042418"
}
其中other本身是一个字符串,而这个字符串的内容是JSON格式的。
上报接口:
我要获取other key中的localStorage key的中所有键值对:
正确做法:
JsonObject jsonObject = GsonUtil.toBean(proxyNodeInfo.getOther(), JsonElement.class).getAsJsonObject();
JsonObject localStorage = jsonObject.get("localStorage").getAsJsonObject();
Map<String, String> hashMap = new HashMap<String, String>() {{
for (Entry<String, JsonElement> entry : localStorage.entrySet()) {
put(entry.getKey(), entry.getValue().getAsString());
}
}};
原来的错误做法:
Map<String,Object> otherInfo= GsonUtil.toBean(StringEscapeUtils.unescapeJson(proxyNodeInfo.getOther()),new TypeToken<Map<String,Object>>(){}.getType());