Toggle navigation
Toggle navigation
This project
Loading...
Sign in
YOHOBUY
/
yohobuy-union
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
ping
8 years ago
Commit
6270fd6c86f3a8a995679e0f753bb661dffa700a
1 parent
cb19d4a7
点击时候,把ip也作为key,保存到redis
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
server/src/main/java/com/yoho/unions/server/service/impl/UnionServiceImpl.java
server/src/main/java/com/yoho/unions/server/service/impl/UnionServiceImpl.java
View file @
6270fd6
...
...
@@ -9,9 +9,6 @@ import java.util.concurrent.TimeUnit;
import
javax.annotation.Resource
;
import
com.yoho.unions.common.redis.RedisValueCache
;
import
com.yoho.unions.dal.IUnionTypeDAO
;
import
com.yoho.unions.dal.model.UnionType
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.tuple.Pair
;
...
...
@@ -32,15 +29,17 @@ import com.yoho.service.model.union.UnionTypeModel;
import
com.yoho.service.model.union.request.ActivateUnionRequestBO
;
import
com.yoho.service.model.union.request.ClickUnionRequestBO
;
import
com.yoho.service.model.union.response.UnionResponse
;
import
com.yoho.unions.common.constant.UnionConstant
;
import
com.yoho.unions.common.enums.ClientTypeEnum
;
import
com.yoho.unions.common.redis.RedisValueCache
;
import
com.yoho.unions.common.utils.DateUtil
;
import
com.yoho.unions.common.utils.HttpUtils
;
import
com.yoho.unions.common.utils.SpringContextUtil
;
import
com.yoho.unions.dal.IAppActivateIdfaListDAO
;
import
com.yoho.unions.dal.IUnionLogsDAO
;
import
com.yoho.unions.dal.IUnionTypeDAO
;
import
com.yoho.unions.dal.model.AppActivateIdfaList
;
import
com.yoho.unions.dal.model.UnionLogs
;
import
com.yoho.unions.dal.model.UnionType
;
import
com.yoho.unions.server.service.IUnionService
;
/**
...
...
@@ -151,14 +150,24 @@ public class UnionServiceImpl implements IUnionService {
// }
//保存到缓存中,根据不同的厂商,设置不同的有效期,3:
log
.
info
(
"clickUnion set redis with key={}, value={}"
,
key
,
JSON
.
toJSONString
(
request
));
yhValueOperations
.
set
(
key
,
JSON
.
toJSONString
(
request
));
log
.
info
(
"clickUnion set redis with key={}, value={}"
,
key
,
JSON
.
toJSONString
(
request
));
String
invalidTime
=
"activeTime"
+
"_"
+
request
.
getUnion_type
();
DynamicIntProperty
activeTime
=
DynamicPropertyFactory
.
getInstance
().
getIntProperty
(
invalidTime
,
3
);
yHRedisTemplate
.
longExpire
(
key
,
activeTime
.
get
(),
TimeUnit
.
HOURS
);
log
.
info
(
"clickUnion set redis success with request={}"
,
request
);
//把IP作为key,也保存到redis
key
=
UNION_KEY
+
"_"
+
request
.
getClientIp
()
+
"_"
+
request
.
getAppkey
();
yhValueOperations
.
set
(
key
,
JSON
.
toJSONString
(
request
));
yHRedisTemplate
.
longExpire
(
key
,
activeTime
.
get
(),
TimeUnit
.
HOURS
);
log
.
info
(
"clickUnion set redis second success. with key={}, value={}"
,
key
,
JSON
.
toJSONString
(
request
));
log
.
info
(
"clickUnion set redis success with request={}"
,
request
);
// if (union != null) {
// //如果90天以内,已经存在点击记录,则不需要插入或更新数据库
// log.info("clickUnion have click in 90 days with request={}", request);
...
...
Please
register
or
login
to post a comment