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
e6a972e8
Commit
e6a972e8
authored
Mar 27, 2024
by
宋新宇
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '3-抖音短剧及短剧app归因接入' into 'release_20240327_01'
短剧APP归因 See merge request
!16
parents
c77b32ab
e2c3a4ca
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
168 additions
and
3 deletions
+168
-3
DyVideoUniversalProcess.java
...m/lwby/marketing/att/dyvideo/DyVideoUniversalProcess.java
+1
-1
VideoAppJRTTNotify.java
.../lwby/marketing/notify/media/jrtt/VideoAppJRTTNotify.java
+106
-2
Signature.java
src/main/java/com/lwby/marketing/util/Signature.java
+58
-0
DeliveryDeviceInfo.java
src/main/java/com/lwby/marketing/vo/DeliveryDeviceInfo.java
+3
-0
No files found.
src/main/java/com/lwby/marketing/att/dyvideo/DyVideoUniversalProcess.java
View file @
e6a972e8
...
...
@@ -64,7 +64,7 @@ public class DyVideoUniversalProcess extends UniversalProcess {
ddi
.
setDevice_id
(
String
.
valueOf
(
action
.
getUserId
()));
ddi
.
setActive_time
(
System
.
currentTimeMillis
());
ddi
.
setChannel
(
String
.
valueOf
(
action
.
getChannelId
()));
ddi
.
set
UserId
(
action
.
getUser
Id
());
ddi
.
set
OpenId
(
action
.
getOpen
Id
());
String
jsonString
=
JSONObject
.
toJSONString
(
ddi
);
ListenableFuture
<
SendResult
<
String
,
String
>>
active_result
=
novelKafkaTemplate
.
send
(
topic
,
jsonString
);
...
...
src/main/java/com/lwby/marketing/notify/media/jrtt/VideoAppJRTTNotify.java
View file @
e6a972e8
package
com
.
lwby
.
marketing
.
notify
.
media
.
jrtt
;
import
cn.hutool.crypto.SecureUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.lwby.marketing.notify.MobileNotify
;
import
com.lwby.marketing.notify.media.jrtt.dto.JrttAttributeRequest
;
import
com.lwby.marketing.util.HttpUtil
;
import
com.lwby.marketing.util.Signature
;
import
com.lwby.marketing.vo.ClientInfo
;
import
com.lwby.marketing.vo.DeliveryDeviceInfo
;
import
com.lwby.marketing.vo.NovelAction
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Objects
;
@Slf4j
public
class
VideoAppJRTTNotify
extends
MobileNotify
{
public
static
final
String
ATTRIBUTE_URL
=
"https://analytics.oceanengine.com/api/v2/conversion"
;
public
static
final
String
uploadAndroidUrl
=
"https://www.csjplatform.com/growth_dispatcher/api/attribution_callback_self_built/276cbd93-aae4-9b66-68be-b086f7a419d1/android?pg_site_id=5385181&signature="
;
public
static
final
String
uploadIosUrl
=
"https://www.csjplatform.com/growth_dispatcher/api/attribution_callback_self_built/155005fb-6940-4134-8729-f7eb9fb993d6/ios?pg_site_id=5443881&signature="
;
@Override
public
boolean
android
(
NovelAction
na
)
{
return
na
.
getType
()
==
0
?
android
(
na
,
"active"
)
:
android
(
na
,
"game_addiction"
);
return
Objects
.
equals
(
na
.
getType
(),
0
)
?
android
(
na
,
"active"
)
:
android
(
na
,
"game_addiction"
);
}
@Override
public
boolean
ios
(
NovelAction
na
)
{
return
na
.
getType
()
==
0
?
android
(
na
,
"active"
)
:
android
(
na
,
"game_addiction"
);
return
Objects
.
equals
(
na
.
getType
(),
0
)
?
ios
(
na
,
"active"
)
:
ios
(
na
,
"game_addiction"
);
}
public
boolean
android
(
NovelAction
na
,
String
eventType
){
...
...
@@ -48,6 +62,9 @@ public class VideoAppJRTTNotify extends MobileNotify {
// Integer resultCode = (Integer) JSON.parseObject(result).get("code");
// return resultCode == 0;
log
.
info
(
"VideoAppJRTTNotify android Callback info:{}"
,
userJson
);
//if (Objects.equals(na.getType(),0)) {
// sendAutoAttribute(ci,ddi,uploadAndroidUrl);
//}
return
true
;
}
catch
(
Exception
e
)
{
return
false
;
...
...
@@ -79,9 +96,96 @@ public class VideoAppJRTTNotify extends MobileNotify {
// Integer resultCode = (Integer) JSON.parseObject(result).get("code");
// return resultCode == 0;
log
.
info
(
"VideoAppJRTTNotify ios Callback info:{}"
,
userJson
);
//if (Objects.equals(na.getType(),0)) {
// sendAutoAttribute(ci,ddi,uploadIosUrl);
//}
return
true
;
}
catch
(
Exception
e
)
{
return
false
;
}
}
private
void
sendAutoAttribute
(
ClientInfo
clientInfo
,
DeliveryDeviceInfo
deliveryDeviceInfo
,
String
url
)
{
try
{
String
clientIp
=
clientInfo
.
getClientIp
();
String
ua
=
clientInfo
.
getUa
();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"time_ts"
,
System
.
currentTimeMillis
());
map
.
put
(
"ad_platform"
,
"toutiao_v2"
);
if
(
"0"
.
equals
(
clientInfo
.
getOs
()))
{
if
(
StringUtils
.
isNotEmpty
(
clientInfo
.
getImei
()))
{
map
.
put
(
"imei"
,
clientInfo
.
getImei
());
map
.
put
(
"imei_md5"
,
SecureUtil
.
md5
(
clientInfo
.
getImei
()));
}
if
(
StringUtils
.
isNotEmpty
(
clientInfo
.
getOaid
()))
{
map
.
put
(
"oaid"
,
clientInfo
.
getOaid
());
map
.
put
(
"oaid_md5"
,
SecureUtil
.
md5
(
clientInfo
.
getOaid
()));
}
if
(
StringUtils
.
isNotEmpty
(
clientInfo
.
getDID
()))
{
map
.
put
(
"android_id"
,
clientInfo
.
getDID
());
map
.
put
(
"android_id_md5"
,
SecureUtil
.
md5
(
clientInfo
.
getDID
()));
}
}
else
if
(
"1"
.
equals
(
clientInfo
.
getOs
())){
if
(
StringUtils
.
isNotEmpty
(
clientInfo
.
getIdfa
())
&&
!
"00000000-0000-0000-0000-000000000000"
.
equals
(
clientInfo
.
getIdfa
()))
{
map
.
put
(
"idfa"
,
clientInfo
.
getIdfa
());
map
.
put
(
"idfa_md5"
,
SecureUtil
.
md5
(
clientInfo
.
getIdfa
()));
}
else
{
map
.
put
(
"idfa"
,
clientInfo
.
getDID
());
map
.
put
(
"idfa_md5"
,
SecureUtil
.
md5
(
clientInfo
.
getDID
()));
}
if
(
StringUtils
.
isNotEmpty
(
clientIp
)
&&
StringUtils
.
isNotEmpty
(
ua
))
{
map
.
put
(
"ip"
,
clientIp
);
map
.
put
(
"ua"
,
ua
);
}
}
map
.
put
(
"ad_id"
,
deliveryDeviceInfo
.
getPromotion_id
());
map
.
put
(
"ad_name"
,
deliveryDeviceInfo
.
getPromotion_name
());
map
.
put
(
"campaign_id"
,
deliveryDeviceInfo
.
getProject_id
());
map
.
put
(
"campaign_name"
,
deliveryDeviceInfo
.
getProject_name
());
map
.
put
(
"ad_account_id"
,
deliveryDeviceInfo
.
getAdvertiser_id
());
if
(
StringUtils
.
isNotBlank
(
deliveryDeviceInfo
.
getMid1
()))
{
map
.
put
(
"mid1"
,
deliveryDeviceInfo
.
getMid1
());
}
if
(
StringUtils
.
isNotBlank
(
deliveryDeviceInfo
.
getMid2
()))
{
map
.
put
(
"mid2"
,
deliveryDeviceInfo
.
getMid2
());
}
if
(
StringUtils
.
isNotBlank
(
deliveryDeviceInfo
.
getMid3
()))
{
map
.
put
(
"mid3"
,
deliveryDeviceInfo
.
getMid3
());
}
if
(
StringUtils
.
isNotBlank
(
deliveryDeviceInfo
.
getMid4
()))
{
map
.
put
(
"mid4"
,
deliveryDeviceInfo
.
getMid4
());
}
if
(
StringUtils
.
isNotBlank
(
deliveryDeviceInfo
.
getMid5
()))
{
map
.
put
(
"mid5"
,
deliveryDeviceInfo
.
getMid5
());
}
if
(
StringUtils
.
isNotBlank
(
deliveryDeviceInfo
.
getMid6
()))
{
map
.
put
(
"mid6"
,
deliveryDeviceInfo
.
getMid6
());
}
String
signature
=
Signature
.
getSignature
(
map
);
String
mapAction
=
JSONObject
.
toJSONString
(
map
);
try
{
String
result
=
HttpUtil
.
post
(
url
+
signature
,
mapAction
);
JSONObject
bresp
=
(
JSONObject
)
JSON
.
parseObject
(
result
).
get
(
"base_resp"
);
Integer
resultCode
=
(
Integer
)
bresp
.
get
(
"status"
);
if
(
resultCode
==
0
)
{
log
.
info
(
"JrttFreeVideoActiveImpl.sendAutoAttribute success, clientInfo = {}, deliveryDeviceInfo = {}"
,
JSON
.
toJSONString
(
clientInfo
),
JSON
.
toJSONString
(
deliveryDeviceInfo
));
}
else
{
log
.
info
(
"JrttFreeVideoActiveImpl.sendAutoAttribute fail, result={}, clientInfo = {} , deliveryDeviceInfo = {}"
,
result
,
JSON
.
toJSONString
(
clientInfo
),
JSON
.
toJSONString
(
deliveryDeviceInfo
));
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
catch
(
Throwable
e
)
{
log
.
info
(
"JrttFreeVideoActiveImpl.sendAutoAttribute error,clientInfo={}"
,
JSON
.
toJSONString
(
clientInfo
),
e
);
}
}
}
src/main/java/com/lwby/marketing/util/Signature.java
0 → 100644
View file @
e6a972e8
package
com
.
lwby
.
marketing
.
util
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.TreeMap
;
/**
* @author songxinyu
* @version Signature.java, v 0.1 2023年06月28日 11:28 songxinyu Exp $
*/
public
class
Signature
{
private
static
final
String
apiKey
=
"436a49808b0ed157"
;
private
static
final
String
apiKeyIos
=
"1749844bed13f705"
;
public
static
String
getSignature
(
Map
<
String
,
Object
>
data
)
{
TreeMap
<
String
,
Object
>
sorted
=
new
TreeMap
<>();
sorted
.
putAll
(
data
);
String
dataBeforeMD5
=
""
;
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
sorted
.
entrySet
())
{
if
(!
""
.
equals
(
entry
.
getValue
()))
{
dataBeforeMD5
+=
entry
.
getKey
()
+
"="
+
entry
.
getValue
()
+
"&"
;
}
}
dataBeforeMD5
+=
"secretKey="
+
apiKey
;
String
signature
=
DigestUtils
.
md5Hex
(
dataBeforeMD5
.
getBytes
());
System
.
out
.
println
(
dataBeforeMD5
);
return
signature
;
}
public
static
String
getSignatureIos
(
Map
<
String
,
Object
>
data
)
{
TreeMap
<
String
,
Object
>
sorted
=
new
TreeMap
<>();
sorted
.
putAll
(
data
);
String
dataBeforeMD5
=
""
;
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
sorted
.
entrySet
())
{
if
(!
""
.
equals
(
entry
.
getValue
()))
{
dataBeforeMD5
+=
entry
.
getKey
()
+
"="
+
entry
.
getValue
()
+
"&"
;
}
}
dataBeforeMD5
+=
"secretKey="
+
apiKeyIos
;
String
signature
=
DigestUtils
.
md5Hex
(
dataBeforeMD5
.
getBytes
());
System
.
out
.
println
(
dataBeforeMD5
);
return
signature
;
}
public
static
void
main
(
String
[]
args
)
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"paramC"
,
"c"
);
data
.
put
(
"paramD"
,
""
);
data
.
put
(
"paramE"
,
"e"
);
data
.
put
(
"paramA"
,
"a"
);
data
.
put
(
"paramB"
,
"b"
);
System
.
out
.
println
(
data
);
System
.
out
.
println
(
getSignature
(
data
));
}
}
src/main/java/com/lwby/marketing/vo/DeliveryDeviceInfo.java
View file @
e6a972e8
...
...
@@ -122,4 +122,7 @@ public class DeliveryDeviceInfo {
private
String
mid4
;
private
String
mid5
;
private
String
mid6
;
private
String
openId
;
}
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