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
8cb6e6d1
Commit
8cb6e6d1
authored
Apr 24, 2024
by
宋新宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点击
parent
ef8a9996
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
127 additions
and
10 deletions
+127
-10
ClickbackService.java
.../java/com/lwby/marketing/controller/ClickbackService.java
+127
-10
No files found.
src/main/java/com/lwby/marketing/controller/ClickbackService.java
View file @
8cb6e6d1
...
...
@@ -23,12 +23,10 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.Arrays
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.UUID
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -54,10 +52,15 @@ public class ClickbackService extends ServiceHelper{
private
static
final
String
UASUF
=
" like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148"
;
@RequestMapping
(
"/jrtt"
)
@ResponseBody
public
Object
jrttClick
(
@RequestParam
Map
<
String
,
String
>
params
){
public
Object
jrttClick
(
HttpServletRequest
request
){
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
Enumeration
<
String
>
en
=
request
.
getParameterNames
();
while
(
en
.
hasMoreElements
()){
String
key
=
en
.
nextElement
();
params
.
put
(
key
,
request
.
getParameter
(
key
));
}
NovelAction
action
=
fullJrtt
(
params
);
for
(
DeviceType
type:
DeviceType
.
values
()){
...
...
@@ -83,14 +86,21 @@ public class ClickbackService extends ServiceHelper{
}
}
log
.
info
(
"jrttClick param,params={}"
,
JSON
.
toJSONString
(
params
));
log
.
info
(
"jrttClick param
succ
,params={}"
,
JSON
.
toJSONString
(
params
));
return
RESULT_SUCCESS
;
}
@RequestMapping
(
"/weChat"
)
@ResponseBody
public
Object
wechatClick
(
@RequestParam
Map
<
String
,
String
>
params
){
public
Object
weChatClick
(
HttpServletRequest
request
){
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
Enumeration
<
String
>
en
=
request
.
getParameterNames
();
while
(
en
.
hasMoreElements
()){
String
key
=
en
.
nextElement
();
params
.
put
(
key
,
request
.
getParameter
(
key
));
}
NovelAction
action
=
fullWeChat
(
params
);
for
(
DeviceType
type:
DeviceType
.
values
()){
...
...
@@ -115,14 +125,121 @@ public class ClickbackService extends ServiceHelper{
}
}
}
log
.
info
(
"wechatClick param,params={}"
,
JSON
.
toJSONString
(
params
));
log
.
info
(
"wechatClick param
succ
,params={}"
,
JSON
.
toJSONString
(
params
));
return
RESULT_SUCCESS
;
}
@RequestMapping
(
"/jrttFreeVideo"
)
@ResponseBody
public
Object
jrttFreeVideoClick
(
@RequestParam
Map
<
String
,
String
>
params
){
public
Object
jrttFreeVideoClick
(
HttpServletRequest
request
){
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
Enumeration
<
String
>
en
=
request
.
getParameterNames
();
while
(
en
.
hasMoreElements
()){
String
key
=
en
.
nextElement
();
params
.
put
(
key
,
request
.
getParameter
(
key
));
}
NovelAction
action
=
fullJrttFreeVideo
(
params
);
for
(
DeviceVideoType
type:
DeviceVideoType
.
values
()){
String
deviceIdKey
=
type
.
getDeviceId
(
action
.
getClientInfo
());
if
(
null
!=
deviceIdKey
){
DeliveryDeviceInfo
ddi
=
action
.
getDeliveryDeviceInfo
();
if
(
StringUtils
.
isNotEmpty
(
ddi
.
getDj_channel
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getChannelByDeviceIdKeyAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
Integer
.
parseInt
(
ddi
.
getDj_channel
())),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getVideoResourceId
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryVRIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getVideoResourceId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getVideoId
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryVIIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getVideoId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
if
(
type
==
DeviceVideoType
.
IDFA
)
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKeyByIdfaAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
log
.
info
(
"jrttFreeVideoClick param succ,params={}"
,
JSON
.
toJSONString
(
params
));
return
RESULT_SUCCESS
;
}
@RequestMapping
(
"/mediaJrtt"
)
@ResponseBody
public
Object
jrttMediaClick
(
@RequestParam
Map
<
String
,
String
>
params
){
NovelAction
action
=
fullJrtt
(
params
);
for
(
DeviceType
type:
DeviceType
.
values
()){
String
deviceIdKey
=
type
.
getDeviceId
(
action
.
getClientInfo
());
if
(
null
!=
deviceIdKey
){
DeliveryDeviceInfo
ddi
=
action
.
getDeliveryDeviceInfo
();
if
(
StringUtils
.
isNotEmpty
(
ddi
.
getDj_channel
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getChannelByDeviceIdKeyAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
Integer
.
parseInt
(
ddi
.
getDj_channel
())),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getBook_id
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryBookIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getBook_id
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getPartId
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryPartIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getPartId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
if
(
type
==
DeviceType
.
IP
)
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKeyByIdfaAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
log
.
info
(
"jrttClick param,params={}"
,
JSON
.
toJSONString
(
params
));
return
RESULT_SUCCESS
;
}
@RequestMapping
(
"/mediaWeChat"
)
@ResponseBody
public
Object
wechatMediaClick
(
@RequestParam
Map
<
String
,
String
>
params
){
NovelAction
action
=
fullWeChat
(
params
);
for
(
DeviceType
type:
DeviceType
.
values
()){
String
deviceIdKey
=
type
.
getDeviceId
(
action
.
getClientInfo
());
if
(
null
!=
deviceIdKey
){
DeliveryDeviceInfo
ddi
=
action
.
getDeliveryDeviceInfo
();
if
(
StringUtils
.
isNotEmpty
(
ddi
.
getDj_channel
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getChannelByDeviceIdKeyAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
Integer
.
parseInt
(
ddi
.
getDj_channel
())),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getBook_id
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryBookIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getBook_id
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
if
(
StringUtils
.
isNumeric
(
ddi
.
getPartId
()))
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getDeliveryPartIdCacheKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
.
getPartId
()),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
if
(
type
==
DeviceType
.
IP
)
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKey
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
CacheKeyUtils
.
getClickKeyByIdfaAndPlatformId
(
deviceIdKey
,
ddi
.
getPlatform_id
()),
JSON
.
toJSONString
(
ddi
),
bookIdExpireTime
,
TimeUnit
.
SECONDS
);
}
}
}
log
.
info
(
"wechatClick param,params={}"
,
JSON
.
toJSONString
(
params
));
return
RESULT_SUCCESS
;
}
@RequestMapping
(
"/mediaJrttFreeVideo"
)
@ResponseBody
public
Object
jrttFreeVideoMediaClick
(
@RequestParam
Map
<
String
,
String
>
params
){
NovelAction
action
=
fullJrttFreeVideo
(
params
);
for
(
DeviceVideoType
type:
DeviceVideoType
.
values
()){
...
...
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