Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
marketing
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dingjy
marketing
Commits
79cf2fba
Commit
79cf2fba
authored
Apr 17, 2024
by
宋新宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
884fbee6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
ClickbackService.java
.../java/com/lwby/marketing/controller/ClickbackService.java
+51
-0
No files found.
src/main/java/com/lwby/marketing/controller/ClickbackService.java
View file @
79cf2fba
...
...
@@ -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
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment