Commit 79cf2fba authored by 宋新宇's avatar 宋新宇

修改

parent 884fbee6
......@@ -95,6 +95,9 @@ public class ClickbackService extends ServiceHelper{
for(DeviceType type: DeviceType.values()){
String deviceIdKey = type.getDeviceId(action.getClientInfo());
if (type==DeviceType.IP_MODEL) {
log.info("ipmodel,device={}",deviceIdKey);
}
if(null != deviceIdKey){
DeliveryDeviceInfo ddi = action.getDeliveryDeviceInfo();
......@@ -318,4 +321,52 @@ public class ClickbackService extends ServiceHelper{
return StringUtils.isNotEmpty(str) && !"null".equals(str);
}
}
public static void main(String[] args) {
String json = "{\"adgroup_id\":\"15559122058\",\"ad_type\":\"11\",\"billing_event\":\"4\",\"channel\":\"220605870\","
+ "\"source\":\"2\",\"media\":\"gdt\",\"hash_oaid\":\"36d7f0dcdba566fd4cf4775372302f32\",\"process_time\":\"1713339657\","
+ "\"promoted_object_id\":\"1109849597\",\"click_time\":\"1713339698\","
+ "\"hash_android_id\":\"c6098b0524291a98633d0f67f7e84555\",\"model\":\"\",\"part_id\":\"1\",\"agcrycy_id\":\"14731783\","
+ "\"campaign_id\":\"15455482127\",\"oaid\":\"C8A752559EBB4D20992DA25295B71770edf45536a4126fd1a6bda0ff4c2a86ef\","
+ "\"user_agent\":\"Mozilla/5.0 (Linux; Android 14; PHW110 Build/UKQ1.230924.001; wv) AppleWebKit/537.36 (KHTML, like "
+ "Gecko) Version/4.0 Chrome/117.0.5938.60 Mobile Safari/537.36\",\"impression_id\":\"wx0e4e3enptdabdi02\",\"ip\":\"117"
+ ".136.73.227\",\"deeplink_url\":\"\",\"platformId\":\"6\",\"ad_platform_type\":\"1\","
+ "\"muid\":\"0924aa8b5262b4e499badcb465c54a27\",\"device_os_type\":\"android\",\"ad_id\":\"15559122968\","
+ "\"account_id\":\"39369307\",\"books\":\"4264277\",\"click_id\":\"wxadclickmjt7d7ppq7loy\","
+ "\"promoted_object_type\":\"12\",\"callback\":\"http://tracking.e.qq"
+ ".com/conv?cb=8Vi3l97GT09y6swCAmoS2jxWwesCA3RFdloqWbslnfr7rRn2qQGqogWHeVOy6ZNF&conv_id=39378482\","
+ "\"request_id\":\"wx0e4e3enptdabdi\",\"click_sku_id\":\"4264277\"}";
Map<String,String> map = JSONObject.parseObject(json,Map.class);
ClientInfo clientInfo = new ClientInfo();
clientInfo.setUa("Mozilla/5.0 (Linux; Android 14; PHW110 Build/UKQ1.230924.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/117.0.5938.60 Mobile Safari/537.36");
clientInfo.setPhoneModel(StringUtils.defaultIfEmpty(encode1(map.get("model")), getModelByUa1(clientInfo.getUa())));
System.out.println(clientInfo.getPhoneModel());
}
public static String encode1(String params){
try {
return URLEncoder.encode(params,"utf-8");
} catch (UnsupportedEncodingException e) {
return null;
}
}
public static String getModelByUa1(String ua) {
String uasplit = ua.split("Build")[0];
String model = null;
try {
if (ua.startsWith("com.")) {
String[] split = uasplit.split(";");
model = split[4].trim();
} else {
if (uasplit.split(";").length >= 3 && StringUtils.isNotEmpty(uasplit.split(";")[2].trim())) {
model = uasplit.substring(uasplit.lastIndexOf(";") + 2, uasplit.length() - 1);
model = URLEncoder.encode(model, "utf-8");
}
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return model;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment