提交 42c2cb60 作者: 沈振路

复用时替换获客链接的查询接口调整

上级 cffdb210
......@@ -66,11 +66,10 @@ public interface MaterialCommonMapper {
/**
* 获取指定公众号的指定获客链接数量
* @param appointAuthId 指定公众号Id
* @param appointReferral 指定获客链接
* @return 数量
*/
Integer getAppointAuthIdAndAppointReferralCount(@Param("appointAuthId") Long appointAuthId, @Param("appointReferral") String appointReferral);
Integer getAppointAuthIdAndAppointReferralCount(@Param("appointReferral") String appointReferral);
/**
......
......@@ -5,10 +5,9 @@ public interface CompanyAcquisitionLinkService {
/**
* 校验链接是否是源公众号的获客链接,如果是的,查找目标公众号的链接,并返回(如果不是获客链接,则会返回原链接,如果是,但找不到目标公众号的获客链接,则返回空)
* @param sourceReferral 原链接
* @param sourceAuthId 原公众号
* @param targetAuthId 目标公众号
* @return 链接
*/
String checkAndSearchTargetReferral(String sourceReferral, Long sourceAuthId, Long targetAuthId);
String checkAndSearchTargetReferral(String sourceReferral, Long targetAuthId);
}
......@@ -17,16 +17,19 @@ public class CompanyAcquisitionLinkServiceImpl implements CompanyAcquisitionLink
private MaterialCommonMapper materialCommonMapper;
@Override
public String checkAndSearchTargetReferral(String sourceReferral, Long sourceAuthId, Long targetAuthId) {
public String checkAndSearchTargetReferral(String sourceReferral, Long targetAuthId) {
// 查询 sourceReferral 这个链接是不是获客链接,如果不是,直接返回原链接
Integer count = materialCommonMapper.getAppointAuthIdAndAppointReferralCount(sourceAuthId, sourceReferral);
Integer count = materialCommonMapper.getAppointAuthIdAndAppointReferralCount(sourceReferral);
if (count == null || count == 0) {
return sourceReferral;
}
// 原链接是获客链接,查询目标公众号的获客链接
List<String> acquisitionLinkList = materialCommonMapper.getAcquisitionLinkList(targetAuthId);
if (CollectionUtil.isEmpty(acquisitionLinkList) || acquisitionLinkList.size() > 1) {
return null;
if (CollectionUtil.isEmpty(acquisitionLinkList)) {
throw new RuntimeException("目标公众号无法获取获客链接");
}
if (acquisitionLinkList.size() > 1) {
throw new RuntimeException("目标公众号存在多个有效获客链接");
}
return acquisitionLinkList.get(0);
}
......
......@@ -82,7 +82,7 @@
LEFT JOIN authorizer_info ai ON a.auth_app_id = ai.appid
WHERE a.link_url = #{appointReferral} AND ai.id = #{appointAuthId}
WHERE a.link_url = #{appointReferral}
</select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论