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
907a6790
Commit
907a6790
authored
Sep 24, 2019
by
阮思源
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://begitlab.chubanyun.me/rays/pcloud-book
into feat-1001733
parents
9559320d
7add7d77
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
51 deletions
+99
-51
AdvertisingSpaceBizImpl.java
...ud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
+46
-31
AdvertisingCpaDao.java
...va/com/pcloud/book/advertising/dao/AdvertisingCpaDao.java
+7
-0
AdvertisingCpaDaoImpl.java
...loud/book/advertising/dao/impl/AdvertisingCpaDaoImpl.java
+6
-0
BookBizImpl.java
.../main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
+12
-8
SendWeixinRequestTools.java
...a/com/pcloud/book/group/tools/SendWeixinRequestTools.java
+17
-12
AdvertisingCpaMapper.xml
...ain/resources/mapper/advertising/AdvertisingCpaMapper.xml
+11
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/advertising/biz/impl/AdvertisingSpaceBizImpl.java
View file @
907a6790
...
...
@@ -760,18 +760,22 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
* @return
*/
private
List
<
String
>
getLinkList
(
String
title
,
Boolean
isNew
)
{
//标题正则表达式
Pattern
pa
;
List
<
String
>
list
=
new
ArrayList
<>();
if
(
isNew
)
{
title
=
title
.
replaceAll
(
" "
,
" "
);
pa
=
Pattern
.
compile
(
UrlConstant
.
OWN_SHORT_URL
+
"[0-9A-Za-z]+\\s"
);
String
regex
=
"(https?|ftp|file)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]"
;
Matcher
matcher
=
Pattern
.
compile
(
regex
,
Pattern
.
DOTALL
).
matcher
(
title
);
while
(
matcher
.
find
())
{
String
url
=
matcher
.
group
();
if
(
url
.
startsWith
(
UrlConstant
.
OWN_SHORT_URL
))
{
list
.
add
(
matcher
.
group
());
}
}
}
else
{
pa
=
Pattern
.
compile
(
"<link>.*?</link>"
);
}
List
<
String
>
list
=
new
ArrayList
<>();
Matcher
ma
=
pa
.
matcher
(
title
);
while
(
ma
.
find
())
{
list
.
add
(
ma
.
group
());
Pattern
pa
=
Pattern
.
compile
(
"<link>.*?</link>"
);
Matcher
ma
=
pa
.
matcher
(
title
);
while
(
ma
.
find
())
{
list
.
add
(
ma
.
group
());
}
}
return
list
;
}
...
...
@@ -3195,27 +3199,38 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
@Override
public
void
dealOldCPAContent
()
{
List
<
AdvertisingSpace
>
spaceList
=
advertisingSpaceDao
.
getCPASpaceList
();
if
(
ListUtils
.
isEmpty
(
spaceList
))
{
return
;
}
for
(
AdvertisingSpace
space
:
spaceList
)
{
Long
adId
=
space
.
getId
();
AdvertisingCpa
cpa
=
new
AdvertisingCpa
();
cpa
.
setDetailMode
(
space
.
getAdDetailMode
());
cpa
.
setDetailName
(
space
.
getAdName
());
cpa
.
setCoverPic
(
space
.
getAdDetailCoverPic
());
cpa
.
setWelfarePic
(
space
.
getAdDetailWelfarePic
());
cpa
.
setDetailInfo
(
space
.
getAdDetailInfo
());
cpa
.
setFormMobileCheck
(
space
.
getAdFormMobileCheck
());
cpa
.
setFormRemark
(
space
.
getAdFormRemark
());
cpa
.
setFormButton
(
space
.
getAdFormButton
());
cpa
.
setFormLink
(
space
.
getAdFormLink
());
advertisingCpaDao
.
insert
(
cpa
);
Long
cpaId
=
cpa
.
getId
();
//更新到广告位、报名信息、广告详情
advertisingSpaceDao
.
updateCPAId
(
adId
,
cpaId
);
bmOptionDao
.
updateCPAId
(
adId
,
cpaId
);
detailFileDao
.
updateCPAId
(
adId
,
cpaId
);
if
(!
ListUtils
.
isEmpty
(
spaceList
))
{
for
(
AdvertisingSpace
space
:
spaceList
)
{
Long
adId
=
space
.
getId
();
AdvertisingCpa
cpa
=
new
AdvertisingCpa
();
cpa
.
setDetailMode
(
space
.
getAdDetailMode
());
cpa
.
setDetailName
(
space
.
getAdName
());
cpa
.
setCoverPic
(
space
.
getAdDetailCoverPic
());
cpa
.
setWelfarePic
(
space
.
getAdDetailWelfarePic
());
cpa
.
setDetailInfo
(
space
.
getAdDetailInfo
());
cpa
.
setFormMobileCheck
(
space
.
getAdFormMobileCheck
());
cpa
.
setFormRemark
(
space
.
getAdFormRemark
());
cpa
.
setFormButton
(
space
.
getAdFormButton
());
cpa
.
setFormLink
(
space
.
getAdFormLink
());
advertisingCpaDao
.
insert
(
cpa
);
Long
cpaId
=
cpa
.
getId
();
//更新到广告位、报名信息、广告详情
advertisingSpaceDao
.
updateCPAId
(
adId
,
cpaId
);
bmOptionDao
.
updateCPAId
(
adId
,
cpaId
);
detailFileDao
.
updateCPAId
(
adId
,
cpaId
);
}
}
List
<
Long
>
linkCpaIds
=
advertisingCpaDao
.
getNoPreviewLinkCPAList
();
if
(!
ListUtils
.
isEmpty
(
linkCpaIds
))
{
for
(
Long
cpaId
:
linkCpaIds
)
{
//预览链接
String
previewLink
=
wechatGroupLinkPrefix
+
"/ad?cpa_id="
+
cpaId
;
previewLink
=
UrlUtils
.
getShortUrl4Own
(
wechatGroupLinkPrefix
+
"/link?url="
+
URLEncoder
.
encode
(
previewLink
));
AdvertisingCpa
cpaUpdate
=
new
AdvertisingCpa
();
cpaUpdate
.
setId
(
cpaId
);
cpaUpdate
.
setPreviewLink
(
previewLink
);
advertisingCpaDao
.
update
(
cpaUpdate
);
}
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/AdvertisingCpaDao.java
View file @
907a6790
...
...
@@ -3,6 +3,8 @@ package com.pcloud.book.advertising.dao;
import
com.pcloud.book.advertising.entity.AdvertisingCpa
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* @描述:cpa内容
* @作者:zhuyajie
...
...
@@ -10,4 +12,9 @@ import com.pcloud.common.core.dao.BaseDao;
* @版本:1.0
*/
public
interface
AdvertisingCpaDao
extends
BaseDao
<
AdvertisingCpa
>
{
/**
* 要更新预览链接的cpa
* @return
*/
List
<
Long
>
getNoPreviewLinkCPAList
();
}
pcloud-service-book/src/main/java/com/pcloud/book/advertising/dao/impl/AdvertisingCpaDaoImpl.java
View file @
907a6790
...
...
@@ -6,6 +6,8 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @描述:cpa内容
* @作者:zhuyajie
...
...
@@ -14,4 +16,8 @@ import org.springframework.stereotype.Component;
*/
@Component
(
"advertisingCpaDao"
)
public
class
AdvertisingCpaDaoImpl
extends
BaseDaoImpl
<
AdvertisingCpa
>
implements
AdvertisingCpaDao
{
@Override
public
List
<
Long
>
getNoPreviewLinkCPAList
()
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getNoPreviewLinkCPAList"
));
}
}
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
View file @
907a6790
...
...
@@ -1450,14 +1450,18 @@ public class BookBizImpl implements BookBiz {
// 书籍总数缓存加1
bookCache
.
incrObject
(
BookConstant
.
BOOK_CACHE
+
"PLATFORM_BOOK_COUNT"
);
}
else
{
checkIsUpdateCoverImgAndSendTopic
(
bookDto
,
book
.
getCoverImg
());
checkIsUpdateBookNameAndSendTopic
(
bookDto
,
book
.
getBookName
());
// 修改图书基本信息
bookDao
.
updateByAdviser
(
book
);
// 周任务书刊埋点
mainLineConsr
.
sendAddBookTask
(
bookDto
.
getBookId
(),
book
.
getCreatedUser
());
// 清除redis中数据
bookCache
.
clearRedisByBook
(
book
.
getBookId
(),
book
.
getIsbn
(),
book
.
getSerialNumber
());
// 主编辑才能修改书刊信息
Long
mainAdviserId
=
bookAdviserBiz
.
getMainAdviserId
(
book
.
getBookId
(),
book
.
getChannelId
());
if
(
book
.
getCreatedUser
().
equals
(
mainAdviserId
))
{
checkIsUpdateCoverImgAndSendTopic
(
bookDto
,
book
.
getCoverImg
());
checkIsUpdateBookNameAndSendTopic
(
bookDto
,
book
.
getBookName
());
// 修改图书基本信息
bookDao
.
updateByAdviser
(
book
);
// 周任务书刊埋点
mainLineConsr
.
sendAddBookTask
(
bookDto
.
getBookId
(),
book
.
getCreatedUser
());
// 清除redis中数据
bookCache
.
clearRedisByBook
(
book
.
getBookId
(),
book
.
getIsbn
(),
book
.
getSerialNumber
());
}
}
bookDto
=
bookDao
.
getByIsbnAndSnum
(
book
.
getIsbn
(),
book
.
getSerialNumber
());
bookDto
.
setChannelId
(
book
.
getChannelId
());
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/tools/SendWeixinRequestTools.java
View file @
907a6790
...
...
@@ -312,14 +312,6 @@ public class SendWeixinRequestTools {
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
public
static
void
main
(
String
[]
args
)
{
// SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
// sendTextMessageVO.setContent("关键词1:a" + "\n" + "换行换行换行" + "\n");
// sendTextMessageVO.setAltId("wxid_qj200bf0key022");
// sendTextMessageVO.setWxGroupId("14108963419@chatroom");
// WxGroupSDK.sendTextMessage(sendTextMessageVO);
}
/**
* 发送默认欢迎语
*/
...
...
@@ -355,7 +347,7 @@ public class SendWeixinRequestTools {
isOld
=
false
;
sb
.
append
(
"\n\n本群配有以下资源服务,戳链接立即获取:\n"
);
for
(
KeywordDTO
keyword
:
keywords
)
{
if
(
sb
.
length
()
+
(
keyword
.
getKeywords
()
+
"\n"
).
length
()
>=
8
30
)
{
if
(
sb
.
length
()
+
(
keyword
.
getKeywords
()
+
"\n"
).
length
()
>=
7
30
)
{
break
;
}
sb
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】\n"
);
...
...
@@ -367,7 +359,7 @@ public class SendWeixinRequestTools {
}
else
{
sb
.
append
(
"\n\n在群内回复以下关键词,领取任务或资源:\n"
);
for
(
KeywordDTO
keyword
:
keywords
)
{
if
((
content
.
length
()
+
sb
.
length
())
>=
1000
&&
(
sb
.
length
()
+
(
keyword
.
getKeywords
()
+
"\n"
).
length
())
>=
92
2
)
{
if
((
content
.
length
()
+
sb
.
length
())
>=
1000
&&
(
sb
.
length
()
+
(
keyword
.
getKeywords
()
+
"\n"
).
length
())
>=
89
2
)
{
break
;
}
sb
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】"
);
...
...
@@ -379,6 +371,12 @@ public class SendWeixinRequestTools {
if
(
haveKeyword
&&
!
isOld
)
{
groupKeyword
.
append
(
"后续也可以回复【】里的关键词,再次领取"
);
}
// 拼接反馈链接
AccountSettingDto
accountSettingDto
=
dto
.
getAccountSettingDto
();
String
feedbackUrl
=
"*common/C"
+
classifyQrcodeInfo
.
getChannelId
()+
"/A0/feedback/suggest?groupQrcodeId="
+
classifyQrcodeInfo
.
getGroupQrcodeId
();
String
url
=
splitUrl
(
accountSettingDto
,
feedbackUrl
);
LOGGER
.
info
(
"发送欢迎语反馈链接feedbackUrl:{}, url:{}"
,
feedbackUrl
,
url
);
groupKeyword
.
append
(
"\n\n群资源与书上介绍不符?点这里反馈\n->"
).
append
(
UrlUtils
.
getShortUrl4Own
(
url
));
// 1001692 自定义欢迎语+关键词文案,如果超过300字,关键词拆分出来发
if
((
content
.
length
()
+
sb
.
length
())
>=
1000
)
{
sendTextMessage
(
content
.
toString
(),
robotId
,
weixinGroupId
,
ip
);
...
...
@@ -388,6 +386,7 @@ public class SendWeixinRequestTools {
}
}
@ParamLog
(
"发送欢迎语消息"
)
public
static
void
sendGuideMessage
(
SendGuideMessageDTO
dto
)
{
if
(
Objects
.
isNull
(
dto
)
||
CollectionUtils
.
isEmpty
(
dto
.
getReplyMessages
()))
{
...
...
@@ -424,7 +423,7 @@ public class SendWeixinRequestTools {
isOld
=
false
;
sb
.
append
(
"\n\n本群配有以下资源服务,戳链接立即获取:\n"
);
for
(
KeywordDTO
keyword
:
keywords
)
{
if
(
sb
.
length
()
+
(
keyword
.
getKeywords
()
+
"\n"
).
length
()
>=
85
0
)
{
if
(
sb
.
length
()
+
(
keyword
.
getKeywords
()
+
"\n"
).
length
()
>=
73
0
)
{
break
;
}
sb
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】\n"
);
...
...
@@ -436,7 +435,7 @@ public class SendWeixinRequestTools {
}
else
{
sb
.
append
(
"\n\n在群内回复以下关键词,领取任务或资源:\n"
);
for
(
KeywordDTO
keyword
:
keywords
)
{
if
((
s
.
length
()
+
sb
.
length
())
>=
1000
&&
(
sb
.
length
()
+
(
keyword
.
getKeywords
()
+
"\n"
).
length
())
>=
92
2
)
{
if
((
s
.
length
()
+
sb
.
length
())
>=
1000
&&
(
sb
.
length
()
+
(
keyword
.
getKeywords
()
+
"\n"
).
length
())
>=
89
2
)
{
break
;
}
sb
.
append
(
"【"
).
append
(
keyword
.
getKeywords
()).
append
(
"】"
);
...
...
@@ -447,6 +446,12 @@ public class SendWeixinRequestTools {
if
(
haveKeyword
&&
!
isOld
)
{
groupKeyword
.
append
(
"后续也可以回复【】里的关键词,再次领取"
);
}
// 拼接反馈链接
AccountSettingDto
accountSettingDto
=
dto
.
getAccountSettingDto
();
String
feedbackUrl
=
"*common/C"
+
classifyQrcodeInfo
.
getChannelId
()+
"/A0/feedback/suggest?groupQrcodeId="
+
classifyQrcodeInfo
.
getGroupQrcodeId
();
String
url
=
splitUrl
(
accountSettingDto
,
feedbackUrl
);
LOGGER
.
info
(
"发送欢迎语反馈链接feedbackUrl:{}, url:{}"
,
feedbackUrl
,
url
);
groupKeyword
.
append
(
"\n\n群资源与书上介绍不符?点这里反馈\n->"
).
append
(
UrlUtils
.
getShortUrl4Own
(
url
));
// 1001692 自定义欢迎语+关键词文案,如果超过300字,关键词拆分出来发
if
(
s
.
length
()
+
groupKeyword
.
length
()
>=
1000
)
{
sendMessageDTO
.
setContent
(
s
);
...
...
pcloud-service-book/src/main/resources/mapper/advertising/AdvertisingCpaMapper.xml
View file @
907a6790
...
...
@@ -115,4 +115,14 @@
update_time DESC
</select>
<select
id=
"getNoPreviewLinkCPAList"
resultType=
"long"
>
SELECT
id
FROM
advertising_cpa
WHERE
preview_link IS NULL
AND detail_mode IS NOT NULL
</select>
</mapper>
\ 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