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
5d65517d
Commit
5d65517d
authored
Apr 11, 2024
by
宋新宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抖小更改及监测
parent
ccfedbac
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
970 additions
and
145 deletions
+970
-145
UniversalProcess.java
src/main/java/com/lwby/marketing/att/UniversalProcess.java
+3
-1
DyVideoUniversalProcess.java
...m/lwby/marketing/att/dyvideo/DyVideoUniversalProcess.java
+136
-3
CheckerDyVideoFirstFlow.java
...marketing/att/dyvideo/handle/CheckerDyVideoFirstFlow.java
+1
-1
DyvideoBehaviorFlow.java
...wby/marketing/att/dyvideo/handle/DyvideoBehaviorFlow.java
+155
-124
StoreDyVideoAttributionFlow.java
...eting/att/dyvideo/handle/StoreDyVideoAttributionFlow.java
+1
-1
UploadDyVideoCallFlow.java
...y/marketing/att/dyvideo/handle/UploadDyVideoCallFlow.java
+6
-1
DyVideoActiveKafkaConsumerConfig.java
...arketing/conf/kafka/DyVideoActiveKafkaConsumerConfig.java
+4
-4
DyVideoBehavoirKafkaConsumerConfig.java
...keting/conf/kafka/DyVideoBehavoirKafkaConsumerConfig.java
+4
-4
DyVideoController.java
...java/com/lwby/marketing/controller/DyVideoController.java
+87
-0
MediaClickController.java
...a/com/lwby/marketing/controller/MediaClickController.java
+47
-0
MediaClickFactory.java
...in/java/com/lwby/marketing/factory/MediaClickFactory.java
+51
-0
Media.java
src/main/java/com/lwby/marketing/notify/Media.java
+1
-1
DyVideoJRTTNotify.java
...m/lwby/marketing/notify/media/jrtt/DyVideoJRTTNotify.java
+3
-5
DyVideoUpload.java
src/main/java/com/lwby/marketing/po/DyVideoUpload.java
+15
-0
VideoUpload.java
src/main/java/com/lwby/marketing/po/VideoUpload.java
+5
-0
MediaClick.java
src/main/java/com/lwby/marketing/service/MediaClick.java
+16
-0
JrttClickImpl.java
...n/java/com/lwby/marketing/service/impl/JrttClickImpl.java
+321
-0
CacheKeyUtils.java
src/main/java/com/lwby/marketing/util/CacheKeyUtils.java
+50
-0
DateTimUtils.java
src/main/java/com/lwby/marketing/util/DateTimUtils.java
+8
-0
ResultConstant.java
src/main/java/com/lwby/marketing/util/ResultConstant.java
+14
-0
Stats.java
src/main/java/com/lwby/marketing/util/Stats.java
+42
-0
No files found.
src/main/java/com/lwby/marketing/att/UniversalProcess.java
View file @
5d65517d
...
...
@@ -78,7 +78,9 @@ public class UniversalProcess {
public
long
incrby
(
String
key
,
int
increment
)
{
return
redisTemplate
.
opsForValue
().
increment
(
key
,
increment
);
}
public
void
del
(
String
key
)
{
redisTemplate
.
delete
(
key
);
}
/******************************************** INNER CLASS ******************************************************/
...
...
src/main/java/com/lwby/marketing/att/dyvideo/DyVideoUniversalProcess.java
View file @
5d65517d
This diff is collapsed.
Click to expand it.
src/main/java/com/lwby/marketing/att/dyvideo/handle/CheckerDyVideoFirstFlow.java
View file @
5d65517d
...
...
@@ -14,7 +14,7 @@ public class CheckerDyVideoFirstFlow extends NodeFlow<StoryNovelAction> {
@Override
public
void
process
(
StoryNovelAction
action
)
{
if
(
up
.
exists
(
up
.
getFirstCheckerKey
(
action
))){
if
(
up
.
exists
(
up
.
getFirstCheckerKey
(
action
))
&&
!
"lotto"
.
equals
(
action
.
getVideoUpload
().
getSource
())
){
action
.
stop
(
true
);
}
}
...
...
src/main/java/com/lwby/marketing/att/dyvideo/handle/DyvideoBehaviorFlow.java
View file @
5d65517d
This diff is collapsed.
Click to expand it.
src/main/java/com/lwby/marketing/att/dyvideo/handle/StoreDyVideoAttributionFlow.java
View file @
5d65517d
...
...
@@ -20,7 +20,7 @@ public class StoreDyVideoAttributionFlow extends NodeFlow<StoryNovelAction> {
//商店归因通知
if
(
Objects
.
isNull
(
action
.
getDeliveryDeviceInfo
())){
if
(
action
.
getType
().
equals
(
CallBackType
.
active
.
getType
()))
{
up
.
notifyResult
(
action
,
"ocpc_result
_test
"
,
AttributionStatus
.
STORE_CALLBACK
);
up
.
notifyResult
(
action
,
"ocpc_result"
,
AttributionStatus
.
STORE_CALLBACK
);
}
action
.
stop
(
true
);
//结束后面所有执行流程
}
...
...
src/main/java/com/lwby/marketing/att/dyvideo/handle/UploadDyVideoCallFlow.java
View file @
5d65517d
...
...
@@ -7,6 +7,7 @@ import com.lwby.marketing.vo.StoryNovelAction;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.Objects
;
/**
* @author songxinyu
...
...
@@ -24,8 +25,12 @@ public class UploadDyVideoCallFlow extends NodeFlow<StoryNovelAction> {
boolean
success
=
action
.
getMedia
().
notify
(
action
);
if
(
success
)
{
//根据source判断是否给指定外包上报
if
(
Objects
.
equals
(
action
.
getVideoUpload
().
getSource
(),
"lotto"
))
{
up
.
uploadCallbackUserInfo
(
action
);
}
action
.
getVideoUpload
().
setActiveTime
(
System
.
currentTimeMillis
());
up
.
notifyResult
(
action
,
type
.
getTopic
()
+
"_test"
,
type
.
getStatus
());
up
.
notifyResult
(
action
,
type
.
getTopic
(),
type
.
getStatus
());
up
.
set
(
up
.
getFirstCheckerKey
(
action
),
up
.
getExpire
(
action
),
"1"
);
}
}
...
...
src/main/java/com/lwby/marketing/conf/kafka/DyVideoActiveKafkaConsumerConfig.java
View file @
5d65517d
...
...
@@ -25,19 +25,19 @@ import java.util.Map;
@EnableKafka
public
class
DyVideoActiveKafkaConsumerConfig
{
@Value
(
"${spring.kafka
2
.bootstrap-servers}"
)
@Value
(
"${spring.kafka.bootstrap-servers}"
)
private
String
servers
;
@Value
(
"${spring.kafka
2
.consumer.enable-auto-commit}"
)
@Value
(
"${spring.kafka.consumer.enable-auto-commit}"
)
private
boolean
enableAutoCommit
;
@Value
(
"${spring.kafka
2
.consumer.auto-offset-reset}"
)
@Value
(
"${spring.kafka.consumer.auto-offset-reset}"
)
private
String
autoOffsetReset
;
@Value
(
"${system.consumer.dyvideo.active.group_id}"
)
private
String
groupId
;
@Value
(
"${spring.kafka
2
.consumer.max-poll-records}"
)
@Value
(
"${spring.kafka.consumer.max-poll-records}"
)
private
int
maxPollRecordsConfig
;
...
...
src/main/java/com/lwby/marketing/conf/kafka/DyVideoBehavoirKafkaConsumerConfig.java
View file @
5d65517d
...
...
@@ -24,19 +24,19 @@ import java.util.Map;
@EnableKafka
public
class
DyVideoBehavoirKafkaConsumerConfig
{
@Value
(
"${spring.kafka
2
.bootstrap-servers}"
)
@Value
(
"${spring.kafka.bootstrap-servers}"
)
private
String
servers
;
@Value
(
"${spring.kafka
2
.consumer.enable-auto-commit}"
)
@Value
(
"${spring.kafka.consumer.enable-auto-commit}"
)
private
boolean
enableAutoCommit
;
@Value
(
"${spring.kafka
2
.consumer.auto-offset-reset}"
)
@Value
(
"${spring.kafka.consumer.auto-offset-reset}"
)
private
String
autoOffsetReset
;
@Value
(
"${system.consumer.dyvideo.behavoir.group_id}"
)
private
String
groupId
;
@Value
(
"${spring.kafka
2
.consumer.max-poll-records}"
)
@Value
(
"${spring.kafka.consumer.max-poll-records}"
)
private
int
maxPollRecordsConfig
;
...
...
src/main/java/com/lwby/marketing/controller/DyVideoController.java
0 → 100644
View file @
5d65517d
package
com
.
lwby
.
marketing
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.lwby.marketing.att.dyvideo.DyVideoUniversalProcess
;
import
com.lwby.marketing.notify.media.jrtt.dto.JrttAttributeRequest
;
import
com.lwby.marketing.po.DyVideoUpload
;
import
com.lwby.marketing.po.VideoUpload
;
import
com.lwby.marketing.util.HttpUtil
;
import
com.lwby.marketing.util.ResultConstant
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author songxinyu
* @version DyVideoController.java, v 0.1 2024年04月10日 11:27 songxinyu Exp $
*/
@RestController
@Slf4j
@RequestMapping
(
value
=
"/market_attr"
)
public
class
DyVideoController
{
public
static
final
String
ATTRIBUTE_URL
=
"https://analytics.oceanengine.com/api/v2/conversion"
;
@Resource
DyVideoUniversalProcess
up
;
@RequestMapping
(
"uploadBehavoir"
)
public
String
uploadBehavoirByDyVideo
(
@RequestParam
(
"openId"
)
String
openId
)
{
Map
map
=
new
HashMap
();
String
result
=
""
;
VideoUpload
videoUpload
=
up
.
get
(
VideoUpload
.
class
,
assembleKey
(
openId
));
Integer
platformId
=
videoUpload
.
getPlatformId
();
String
uploadKey
=
String
.
format
(
"dv_%s_%d_%s"
,
openId
,
platformId
,
videoUpload
.
getMedia
());
if
(
up
.
exists
(
uploadKey
))
{
map
.
put
(
"code"
,
ResultConstant
.
CALL_BACK_UPED_FAIL
);
map
.
put
(
"message"
,
ResultConstant
.
CALL_BACK_UPED_MESSAGE
);
result
=
JSONObject
.
toJSONString
(
map
);
return
result
;
}
JrttAttributeRequest
.
Ad
ad
=
new
JrttAttributeRequest
.
Ad
();
ad
.
setCallback
(
videoUpload
.
getClickId
());
JrttAttributeRequest
.
Context
context
=
new
JrttAttributeRequest
.
Context
();
context
.
setAd
(
ad
);
JrttAttributeRequest
request
=
JrttAttributeRequest
.
builder
().
context
(
context
).
event_type
(
"game_addiction"
).
timestamp
(
System
.
currentTimeMillis
()).
build
();
String
userJson
=
JSONObject
.
toJSONString
(
request
);
try
{
String
ret
=
HttpUtil
.
post
(
ATTRIBUTE_URL
,
userJson
);
Integer
resultCode
=
(
Integer
)
JSON
.
parseObject
(
ret
).
get
(
"code"
);
if
(
resultCode
==
0
)
{
map
.
put
(
"code"
,
ResultConstant
.
CALL_BACK_SUCCESS
);
map
.
put
(
"message"
,
ResultConstant
.
CALL_BACK_SUCCESS_MESSAGE
);
result
=
JSONObject
.
toJSONString
(
map
)
;
//给bi发消息
up
.
notifyResult
(
openId
,
videoUpload
);
up
.
set
(
uploadKey
,
60
*
60
*
24
*
7
,
"1"
);
}
else
{
map
.
put
(
"code"
,
ResultConstant
.
CALL_BACK_FAIL
);
map
.
put
(
"message"
,
ResultConstant
.
CALL_BACK_FAIL_MESSAGE
);
result
=
JSONObject
.
toJSONString
(
map
)
;
}
return
result
;
}
catch
(
Exception
e
)
{
map
.
put
(
"code"
,
ResultConstant
.
CALL_BACK_FAIL
);
map
.
put
(
"message"
,
ResultConstant
.
CALL_BACK_FAIL_MESSAGE
);
result
=
JSONObject
.
toJSONString
(
map
)
;
return
result
;
}
}
public
String
assembleKey
(
String
openId
)
{
return
String
.
format
(
"video:upload:%s"
,
openId
);
}
}
src/main/java/com/lwby/marketing/controller/MediaClickController.java
0 → 100644
View file @
5d65517d
package
com
.
lwby
.
marketing
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.lwby.marketing.factory.MediaClickFactory
;
import
com.lwby.marketing.notify.Media
;
import
com.lwby.marketing.service.MediaClick
;
import
com.lwby.marketing.util.Stats
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author songxinyu
* @version MediaClickController.java, v 0.1 2024年04月10日 13:48 songxinyu Exp $
*/
@RestController
@Slf4j
@RequestMapping
(
value
=
"/market_growth"
)
public
class
MediaClickController
{
@Resource
MediaClickFactory
mediaClickFactory
;
@RequestMapping
(
"/jrtt"
)
public
Object
jrttClick
(
HttpServletRequest
request
,
HttpServletResponse
res
){
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
));
}
log
.
info
(
"JrttClick params:{}"
,
JSON
.
toJSONString
(
params
));
MediaClick
mediaClickFacade
=
mediaClickFactory
.
getMediaClickFacade
(
Media
.
NOVEL_JRTT
);
String
result
=
mediaClickFacade
.
click
(
""
,
params
);
log
.
info
(
"JrttClick , {}"
,
result
);
Stats
.
HTTP_MG_JRTT
.
add
();
return
result
;
}
}
src/main/java/com/lwby/marketing/factory/MediaClickFactory.java
0 → 100644
View file @
5d65517d
package
com
.
lwby
.
marketing
.
factory
;
import
com.google.common.collect.ArrayListMultimap
;
import
com.lwby.marketing.notify.Media
;
import
com.lwby.marketing.service.MediaClick
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
java.util.List
;
import
java.util.Map
;
@Service
@Slf4j
public
class
MediaClickFactory
{
@Autowired
ApplicationContext
applicationContext
;
ArrayListMultimap
<
Media
,
MediaClick
>
multimap
=
ArrayListMultimap
.
create
();
/**
* @return
*/
/**
*
* @return
*/
public
MediaClick
getMediaClickFacade
(
Media
mediaEnum
)
{
List
<
MediaClick
>
mediaClickFacade
=
multimap
.
get
(
mediaEnum
);
return
mediaClickFacade
.
get
(
0
);
}
/**
*
*/
@PostConstruct
public
void
init
()
{
Map
<
String
,
MediaClick
>
type
=
applicationContext
.
getBeansOfType
(
MediaClick
.
class
);
for
(
Map
.
Entry
<
String
,
MediaClick
>
item
:
type
.
entrySet
())
{
multimap
.
put
(
item
.
getValue
().
getMedia
(),
item
.
getValue
());
}
}
}
src/main/java/com/lwby/marketing/notify/Media.java
View file @
5d65517d
...
...
@@ -21,7 +21,7 @@ public enum Media {
DY_VIDEO_JRTT
(
"jrtt"
,
Platform
.
DY_VIDEO
,
"今日头条"
,
new
DyVideoJRTTNotify
()),
VIDEOAPP_JRTT
(
"jrtt_freevideo"
,
Platform
.
VIDEO
,
"今日头条"
,
new
VideoAppJRTTNotify
());
final
String
name
;
public
final
String
name
;
final
Platform
platform
;
final
String
desc
;
final
BaseNotiry
baseNotify
;
...
...
src/main/java/com/lwby/marketing/notify/media/jrtt/DyVideoJRTTNotify.java
View file @
5d65517d
...
...
@@ -46,12 +46,10 @@ public class DyVideoJRTTNotify extends DYNotify {
String
userJson
=
JSONObject
.
toJSONString
(
request
);
try
{
//TODO;测试不执行
//String result = HttpUtil.post(ATTRIBUTE_URL, userJson);
//Integer resultCode = (Integer) JSON.parseObject(result).get("code");
//return resultCode == 0;
String
result
=
HttpUtil
.
post
(
ATTRIBUTE_URL
,
userJson
);
Integer
resultCode
=
(
Integer
)
JSON
.
parseObject
(
result
).
get
(
"code"
);
DYVIDEO_SYS_LOG
.
info
(
"DyVideoJRTTNotify.video.{}.upload,userId={},channel={},platform={}"
,
eventType
,
na
.
getUserId
(),
na
.
getChannelId
(),
na
.
getPlatformId
());
return
true
;
return
resultCode
==
0
;
}
catch
(
Exception
e
)
{
return
false
;
}
...
...
src/main/java/com/lwby/marketing/po/DyVideoUpload.java
0 → 100644
View file @
5d65517d
package
com
.
lwby
.
marketing
.
po
;
import
lombok.Data
;
/**
* @author songxinyu
* @version DyVideoUpload.java, v 0.1 2024年04月10日 17:06 songxinyu Exp $
*/
@Data
public
class
DyVideoUpload
{
String
openId
;
Integer
platformId
;
}
src/main/java/com/lwby/marketing/po/VideoUpload.java
View file @
5d65517d
...
...
@@ -25,4 +25,9 @@ public class VideoUpload {
private
String
perecpmSize
;
private
long
activeTime
;
private
long
clickTime
;
private
Integer
platformId
;
private
Long
userId
;
//来源
private
String
source
;
}
src/main/java/com/lwby/marketing/service/MediaClick.java
0 → 100644
View file @
5d65517d
package
com
.
lwby
.
marketing
.
service
;
import
com.lwby.marketing.notify.Media
;
import
java.util.Map
;
/**
* @author songxinyu
* @version MediaClick.java, v 0.1 2024年04月10日 14:11 songxinyu Exp $
*/
public
interface
MediaClick
{
String
click
(
String
s
,
Map
<
String
,
String
>
params
);
Media
getMedia
();
}
src/main/java/com/lwby/marketing/service/impl/JrttClickImpl.java
0 → 100644
View file @
5d65517d
This diff is collapsed.
Click to expand it.
src/main/java/com/lwby/marketing/util/CacheKeyUtils.java
View file @
5d65517d
package
com
.
lwby
.
marketing
.
util
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
...
...
@@ -13,6 +17,13 @@ public class CacheKeyUtils {
static
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"MMdd"
);
//设置日期格式
private
static
final
String
CACHE_BOOK_PREFIX
=
"getBookId"
;
private
static
final
String
CACHE_PART_PREFIX
=
"getPartId"
;
private
static
final
String
CHANNEL_PREFIX_KEY
=
"getChannelBy"
;
public
static
String
getBehavoirKey
(
Long
userId
)
{
return
CACHE_BEHAVIOR_PREFIX
+
userId
+
"_"
+
df
.
format
(
new
Date
())
+
"_fv"
;
}
...
...
@@ -20,4 +31,43 @@ public class CacheKeyUtils {
public
static
String
getVideoBehavoirKey
(
Long
userId
)
{
return
CACHE_BEHAVIOR_PREFIX
+
userId
+
"_fv"
;
}
public
static
String
getClickKeyByIdfaAndPlatformId
(
String
idfa
,
String
platformId
)
{
return
"getClickByIdfaAndPlatformId"
+
"_"
+
idfa
+
"_"
+
platformId
;
}
public
static
String
getClickKey
(
String
idfa
,
String
platformId
)
{
return
"mck"
+
":"
+
idfa
+
":"
+
platformId
;
}
public
static
String
getDeliveryBookIdCacheKey
(
String
deviceKey
,
String
platformId
)
{
return
CACHE_BOOK_PREFIX
+
"_"
+
deviceKey
+
"_"
+
platformId
;
}
public
static
String
getDeliveryPartIdCacheKey
(
String
deviceKey
,
String
platformId
)
{
return
CACHE_PART_PREFIX
+
"_"
+
deviceKey
+
"_"
+
platformId
;
}
public
static
String
getChannelByDeviceIdKeyAndPlatformId
(
String
deviceIdKey
,
String
platformId
)
{
return
CHANNEL_PREFIX_KEY
+
deviceIdKey
+
platformId
;
}
public
static
String
getModelByUa
(
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
;
}
}
src/main/java/com/lwby/marketing/util/DateTimUtils.java
View file @
5d65517d
...
...
@@ -28,6 +28,14 @@ public class DateTimUtils {
return
DATE_BOTTOM_FORMAT
.
format
(
new
Date
());
}
public
static
String
getCurrentTimeString
(){
return
DATE_TIME_FORMAT
.
format
(
new
Date
());
}
public
static
String
getCurrentTimeString
(
Date
date
){
return
DATE_TIME_FORMAT
.
format
(
date
);
}
/**
* 时间是否大于7天
*
...
...
src/main/java/com/lwby/marketing/util/ResultConstant.java
0 → 100644
View file @
5d65517d
package
com
.
lwby
.
marketing
.
util
;
public
class
ResultConstant
{
public
final
static
Integer
CALL_BACK_SUCCESS
=
0
;
public
final
static
Integer
CALL_BACK_FAIL
=
1
;
public
final
static
Integer
CALL_BACK_UPED_FAIL
=
2
;
public
final
static
String
CALL_BACK_SUCCESS_MESSAGE
=
"上报成功"
;
public
final
static
String
CALL_BACK_FAIL_MESSAGE
=
"上报失败"
;
public
final
static
String
CALL_BACK_UPED_MESSAGE
=
"已上报一次"
;
}
src/main/java/com/lwby/marketing/util/Stats.java
0 → 100644
View file @
5d65517d
package
com
.
lwby
.
marketing
.
util
;
import
io.micrometer.core.instrument.Counter
;
import
io.micrometer.core.instrument.MeterRegistry
;
public
enum
Stats
{
HTTP_MG_JRTT
(
"HTTP接口jrtt"
,
"http_mg_jrtt"
),
HTTP_MG_WECHAT
(
"HTTP接口jrtt"
,
"http_mg_wechat"
),
HTTP_MG_KUAISHOU
(
"HTTP接口jrtt"
,
"http_mg_kuaishou"
),
HTTP_MG_YOUDAO
(
"HTTP接口jrtt"
,
"http_mg_kuaishou"
),
HTTP_MG_XIAOMI
(
"HTTP接口jrtt"
,
"http_mg_xiaomi"
);
private
String
name
;
private
Counter
counter
;
private
String
indicator
;
Stats
(
String
name
,
String
indicator
)
{
this
.
name
=
name
;
this
.
indicator
=
indicator
;
}
public
void
add
()
{
counter
.
increment
();
}
public
void
add
(
long
count
)
{
counter
.
increment
(
count
);
}
public
String
getName
()
{
return
this
.
name
;
}
public
long
getCount
()
{
return
(
long
)
counter
.
count
();
}
public
void
bind
(
MeterRegistry
registry
)
{
this
.
counter
=
registry
.
counter
(
indicator
);
}
}
\ No newline at end of file
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