Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
徐少华
midjourney-proxy
Commits
aede00e7
Commit
aede00e7
authored
Jul 07, 2022
by
李传峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request rays/pcloud-book!1627
parents
cfec5133
3bbe92ed
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
7 deletions
+102
-7
BookGroupService.java
.../java/com/pcloud/book/group/service/BookGroupService.java
+6
-0
ResourcePageBiz.java
.../main/java/com/pcloud/book/group/biz/ResourcePageBiz.java
+10
-1
ResourcePageBizImpl.java
...a/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
+74
-4
ResourcePageFacade.java
...com/pcloud/book/group/facade/impl/ResourcePageFacade.java
+3
-2
BookGroupServiceImpl.java
.../pcloud/book/group/service/impl/BookGroupServiceImpl.java
+9
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/group/service/BookGroupService.java
View file @
aede00e7
...
...
@@ -316,4 +316,10 @@ public interface BookGroupService {
@GetMapping
(
"getQrcodeOneServe"
)
public
ResponseEntity
<
ResponseDto
<
String
>>
getQrcodeOneServe
(
@RequestParam
(
value
=
"bookGroupId"
,
required
=
false
)
Long
bookGroupId
,
@RequestParam
(
value
=
"sceneId"
,
required
=
false
)
Long
sceneId
);
@ApiOperation
(
"删除斗罗首页缓存"
)
@PostMapping
(
"deleteDouluoCache"
)
void
deleteDouluoCache
(
@RequestParam
(
"sceneId"
)
Long
sceneId
,
@RequestParam
(
"wechatUserId"
)
Long
wechatUserId
,
@RequestBody
List
<
Long
>
mapSceneIds
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/ResourcePageBiz.java
View file @
aede00e7
...
...
@@ -575,9 +575,10 @@ public interface ResourcePageBiz {
* 客户端-斗罗大陆获取配置资源
* @param wechatUserId
* @param sceneId
* @param mapSceneId
* @return
*/
List
<
ResourcePageItemVO
>
getServerList4Wechat
(
Long
wechatUserId
,
Long
sceneId
);
List
<
ResourcePageItemVO
>
getServerList4Wechat
(
Long
wechatUserId
,
Long
sceneId
,
Long
mapSceneId
);
/**
* @Description 一码一资源,素材列表
* @Author zhuyajie
...
...
@@ -598,4 +599,12 @@ public interface ResourcePageBiz {
* 根据rays码id查资源页菜单栏数量
*/
Integer
getNavigationCount
(
Long
bookGroupId
,
Long
wechatUserId
,
Long
sceneId
);
/**
* 删除斗罗首页缓存
* @param sceneId
* @param mapSceneIds
* @param wechatUserId
*/
void
deleteDouluoCache
(
Long
sceneId
,
List
<
Long
>
mapSceneIds
,
Long
wechatUserId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
View file @
aede00e7
...
...
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ReUtil
;
import
cn.hutool.core.util.StrUtil
;
...
...
@@ -11,6 +12,7 @@ import cn.hutool.extra.qrcode.QrCodeException;
import
cn.hutool.extra.qrcode.QrCodeUtil
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Lists
;
import
com.pcloud.advertising.advertising.dto.AdvertisingSpaceDTO
;
import
com.pcloud.advertising.advertising.dto.AdvertisingSpaceItemDTO
;
...
...
@@ -4536,14 +4538,22 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
@Override
public
List
<
ResourcePageItemVO
>
getServerList4Wechat
(
Long
wechatUserId
,
Long
sceneId
)
{
List
<
ResourcePageItemVO
>
itemVOList
=
JedisClusterUtils
.
getJsonList
(
StrUtil
.
join
(
":"
,
DL_BOOK_SERVES_CACHE
,
sceneId
,
wechatUserId
),
ResourcePageItemVO
.
class
);
if
(
CollUtil
.
isEmpty
(
itemVOList
))
{
public
List
<
ResourcePageItemVO
>
getServerList4Wechat
(
Long
wechatUserId
,
Long
sceneId
,
Long
mapSceneId
)
{
String
redisKey
=
StrUtil
.
join
(
":"
,
DL_BOOK_SERVES_CACHE
,
sceneId
);
String
redisField
=
StrUtil
.
join
(
":"
,
wechatUserId
,
mapSceneId
);
List
<
ResourcePageItemVO
>
itemVOList
=
JedisClusterUtils
.
hgetJson2List
(
redisKey
,
redisField
,
ResourcePageItemVO
.
class
);
if
(
CollUtil
.
isEmpty
(
itemVOList
))
{
ResourcePage
bySceneId
=
resourcePageDao
.
getBySceneId
(
sceneId
);
if
(
null
==
bySceneId
)
{
return
new
ArrayList
<>();
}
itemVOList
=
resourcePageItemDao
.
getResourcePageItemByPageId
(
bySceneId
.
getId
(),
true
);
//如果mapSceneId 不为null 则直接替换其中的精品文章
try
{
replaceArticle
(
itemVOList
,
mapSceneId
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"斗罗更换精品文章失败sceneId:{}"
,
sceneId
);
}
if
(
CollUtil
.
isEmpty
(
itemVOList
))
{
return
new
ArrayList
<>();
}
...
...
@@ -4572,14 +4582,59 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
setChannel
(
itemVOList
);
fillTaskType
(
itemVOList
,
wechatUserId
);
fillPageType
(
sceneId
,
itemVOList
,
mapSceneId
,
bySceneId
.
getBookId
());
}
if
(
CollUtil
.
isNotEmpty
(
itemVOList
))
{
JedisClusterUtils
.
setJsonList
(
StrUtil
.
join
(
":"
,
DL_BOOK_SERVES_CACHE
,
sceneId
,
wechatUserId
),
itemVOList
,
3600
*
24
);
JedisClusterUtils
.
hset2Json
(
redisKey
,
redisField
,
itemVOList
);
JedisClusterUtils
.
expire
(
redisKey
,
3600
*
14
);
}
return
itemVOList
;
}
private
void
fillPageType
(
Long
sceneId
,
List
<
ResourcePageItemVO
>
itemVOList
,
Long
mapSceneId
,
Long
bookId
)
{
// 处理斗罗系列书二维码映射
//添加页面版本
String
pageType
=
JedisClusterUtils
.
hget
(
"FUNCTION:DOULUO_BOOK_MAP"
,
bookId
.
toString
());
itemVOList
.
forEach
(
e
->
{
if
(
null
!=
e
.
getResultUrl
()
&&
null
!=
mapSceneId
)
{
e
.
setResultUrl
(
e
.
getResultUrl
()
+
"&mapSceneId="
+
mapSceneId
);
}
if
(
null
!=
e
.
getResultUrl
()
&&
StrUtil
.
isNotBlank
(
pageType
))
{
e
.
setResultUrl
(
e
.
getResultUrl
()
+
"&pageType="
+
pageType
);
}
});
}
private
void
replaceArticle
(
List
<
ResourcePageItemVO
>
itemVOList
,
Long
mapSceneId
)
{
if
(
CollUtil
.
isEmpty
(
itemVOList
)
||
null
==
mapSceneId
)
{
return
;
}
ResourcePage
bySceneId
=
resourcePageDao
.
getBySceneId
(
mapSceneId
);
if
(
null
==
bySceneId
)
{
return
;
}
List
<
ResourcePageItemVO
>
itemVOList4Map
=
resourcePageItemDao
.
getResourcePageItemByPageId
(
bySceneId
.
getId
(),
true
);
if
(
CollUtil
.
isEmpty
(
itemVOList4Map
))
{
return
;
}
Optional
<
ResourcePageItemVO
>
first
=
itemVOList4Map
.
stream
().
filter
(
e
->
AppTypeEnum
.
ARTICLE
.
value
.
equals
(
e
.
getTypeCode
())).
findFirst
();
if
(!
first
.
isPresent
())
{
return
;
}
itemVOList
.
forEach
(
e
->
{
if
(
AppTypeEnum
.
ARTICLE
.
value
.
equals
(
e
.
getTypeCode
()))
{
BeanUtil
.
copyProperties
(
first
.
get
(),
e
);
}
});
}
private
void
setChannel
(
List
<
ResourcePageItemVO
>
itemVOList
)
{
String
key
=
"BOOK:DOULUO:SET:CHANNEL:STATE"
;
if
(
JedisClusterUtils
.
exists
(
key
))
{
return
;
}
if
(
CollUtil
.
isEmpty
(
itemVOList
))
{
return
;
}
...
...
@@ -4711,4 +4766,19 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
return
count
;
}
@Override
public
void
deleteDouluoCache
(
Long
sceneId
,
List
<
Long
>
mapSceneIds
,
Long
wechatUserId
)
{
if
(
null
==
sceneId
)
{
return
;
}
String
redisKey
=
StrUtil
.
join
(
":"
,
DL_BOOK_SERVES_CACHE
,
sceneId
);
if
(
CollUtil
.
isEmpty
(
mapSceneIds
))
{
JedisClusterUtils
.
del
(
redisKey
);
}
else
{
String
[]
fields
=
mapSceneIds
.
stream
().
map
(
e
->
StrUtil
.
join
(
":"
,
wechatUserId
,
e
.
toString
())).
collect
(
Collectors
.
toList
()).
stream
().
toArray
(
String
[]::
new
);
JedisClusterUtils
.
hdel
(
redisKey
,
fields
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/ResourcePageFacade.java
View file @
aede00e7
...
...
@@ -479,9 +479,10 @@ public class ResourcePageFacade {
@ApiOperation
(
"客户端-斗罗大陆获取配置资源"
)
@GetMapping
(
"getServerList4Wechat"
)
public
ResponseDto
<?>
getServerList4Wechat
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"sceneId"
)
Long
sceneId
){
@RequestParam
(
value
=
"sceneId"
)
Long
sceneId
,
@RequestParam
(
value
=
"mapSceneId"
,
required
=
false
)
Long
mapSceneId
){
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
resourcePageBiz
.
getServerList4Wechat
(
wechatUserId
,
sceneId
));
return
new
ResponseDto
<>(
resourcePageBiz
.
getServerList4Wechat
(
wechatUserId
,
sceneId
,
mapSceneId
));
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/service/impl/BookGroupServiceImpl.java
View file @
aede00e7
...
...
@@ -535,4 +535,13 @@ public class BookGroupServiceImpl implements BookGroupService {
@RequestParam
(
value
=
"sceneId"
,
required
=
false
)
Long
sceneId
)
{
return
ResponseHandleUtil
.
toResponse
(
resourcePageBiz
.
getQrcodeOneServe
(
bookGroupId
,
sceneId
,
null
));
}
@ApiOperation
(
"删除斗罗首页缓存"
)
@PostMapping
(
"deleteDouluoCache"
)
@Override
public
void
deleteDouluoCache
(
@RequestParam
(
"sceneId"
)
Long
sceneId
,
@RequestParam
(
"wechatUserId"
)
Long
wechatUserId
,
@RequestBody
List
<
Long
>
mapSceneIds
){
resourcePageBiz
.
deleteDouluoCache
(
sceneId
,
mapSceneIds
,
wechatUserId
);
}
}
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