Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
operate-customer-service
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
沈振路
operate-customer-service
Commits
3652f3f4
提交
3652f3f4
authored
11月 21, 2025
作者:
沈振路
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
阳光小程序链接获取
上级
ac4c9879
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
50 行增加
和
9 行删除
+50
-9
MpReferralHandler.java
...java/com/yaoyaozw/customer/handler/MpReferralHandler.java
+14
-0
TomatoMpReferralHandler.java
...om/yaoyaozw/customer/handler/TomatoMpReferralHandler.java
+1
-7
YgMpReferralHandler.java
...va/com/yaoyaozw/customer/handler/YgMpReferralHandler.java
+30
-2
YwMpReferralHandler.java
...va/com/yaoyaozw/customer/handler/YwMpReferralHandler.java
+5
-0
没有找到文件。
src/main/java/com/yaoyaozw/customer/handler/MpReferralHandler.java
浏览文件 @
3652f3f4
...
@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.handler;
...
@@ -2,6 +2,7 @@ package com.yaoyaozw.customer.handler;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yaoyaozw.customer.entity.AuthorizerExpandInfo
;
import
com.yaoyaozw.customer.entity.AuthorizerExpandInfo
;
import
com.yaoyaozw.customer.entity.AuthorizerInfo
;
import
com.yaoyaozw.customer.entity.AuthorizerInfo
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
...
@@ -84,5 +85,18 @@ public abstract class MpReferralHandler {
...
@@ -84,5 +85,18 @@ public abstract class MpReferralHandler {
protected
Boolean
isHttpPath
(
String
path
)
{
protected
Boolean
isHttpPath
(
String
path
)
{
return
StringUtils
.
isNotBlank
(
path
)
&&
(
path
.
startsWith
(
"http"
));
return
StringUtils
.
isNotBlank
(
path
)
&&
(
path
.
startsWith
(
"http"
));
}
}
protected
AuthorizerExpandInfo
getAuthorizerExpandInfo
(
String
appId
)
{
// 根据appid查询authorizer_expand_info表(1条)
LambdaQueryWrapper
<
AuthorizerExpandInfo
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
AuthorizerExpandInfo:
:
getAuthorizerAppid
,
appId
);
queryWrapper
.
last
(
"LIMIT 1"
);
AuthorizerExpandInfo
authorizerExpandInfo
=
authorizerExpandInfoService
.
getOne
(
queryWrapper
);
if
(
authorizerExpandInfo
==
null
)
{
throw
new
IllegalArgumentException
(
"未找到对应的公众号扩展信息,appid: "
+
appId
);
}
return
authorizerExpandInfo
;
}
}
}
src/main/java/com/yaoyaozw/customer/handler/TomatoMpReferralHandler.java
浏览文件 @
3652f3f4
...
@@ -35,13 +35,7 @@ public class TomatoMpReferralHandler extends MpReferralHandler {
...
@@ -35,13 +35,7 @@ public class TomatoMpReferralHandler extends MpReferralHandler {
public
ReferralEntity
queryMpReferral
(
ReferralEntity
referralEntity
,
AuthorizerInfo
authorizerInfo
)
{
public
ReferralEntity
queryMpReferral
(
ReferralEntity
referralEntity
,
AuthorizerInfo
authorizerInfo
)
{
// 根据appid查询authorizer_expand_info表(1条)
// 根据appid查询authorizer_expand_info表(1条)
String
appid
=
authorizerInfo
.
getAppid
();
String
appid
=
authorizerInfo
.
getAppid
();
LambdaQueryWrapper
<
AuthorizerExpandInfo
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
AuthorizerExpandInfo
authorizerExpandInfo
=
getAuthorizerExpandInfo
(
appid
);
queryWrapper
.
eq
(
AuthorizerExpandInfo:
:
getAuthorizerAppid
,
appid
);
queryWrapper
.
last
(
"LIMIT 1"
);
AuthorizerExpandInfo
authorizerExpandInfo
=
authorizerExpandInfoService
.
getOne
(
queryWrapper
);
if
(
authorizerExpandInfo
==
null
)
{
throw
new
IllegalArgumentException
(
"未找到对应的公众号扩展信息,appid: "
+
appid
);
}
referralEntity
.
setMpAppId
(
authorizerExpandInfo
.
getMpAppid
());
referralEntity
.
setMpAppId
(
authorizerExpandInfo
.
getMpAppid
());
// 处理参数:设置accountId为mpDistributorId
// 处理参数:设置accountId为mpDistributorId
...
...
src/main/java/com/yaoyaozw/customer/handler/YgMpReferralHandler.java
浏览文件 @
3652f3f4
package
com
.
yaoyaozw
.
customer
.
handler
;
package
com
.
yaoyaozw
.
customer
.
handler
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.TypeReference
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yaoyaozw.customer.common.R
;
import
com.yaoyaozw.customer.constants.ApiResultConstant
;
import
com.yaoyaozw.customer.entity.AuthorizerExpandInfo
;
import
com.yaoyaozw.customer.entity.AuthorizerExpandInfo
;
import
com.yaoyaozw.customer.entity.AuthorizerInfo
;
import
com.yaoyaozw.customer.entity.AuthorizerInfo
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
com.yaoyaozw.customer.entity.ReferralEntity
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
/**
/**
...
@@ -16,13 +22,35 @@ public class YgMpReferralHandler extends MpReferralHandler {
...
@@ -16,13 +22,35 @@ public class YgMpReferralHandler extends MpReferralHandler {
@Override
@Override
public
ReferralEntity
queryMpReferral
(
ReferralEntity
referralEntity
,
AuthorizerInfo
authorizerInfo
)
{
public
ReferralEntity
queryMpReferral
(
ReferralEntity
referralEntity
,
AuthorizerInfo
authorizerInfo
)
{
// TODO: 实现阳光书城的具体查询逻辑
referralEntity
.
setMiniProgramQuery
(
Boolean
.
TRUE
);
// 调用接口获取原生链接
R
r
=
referralFeignClient
.
productReferral
(
referralEntity
);
if
(!
r
.
getCode
().
equals
(
ApiResultConstant
.
SUCCESS_CODE
))
{
throw
new
RuntimeException
(
"获取链接失败: "
+
r
.
getMessage
());
}
String
res
=
r
.
getData
(
"storeReferral"
,
new
TypeReference
<
String
>()
{});
JSONObject
jsonObject
=
JSON
.
parseObject
(
res
);
// 处理链接
constructMpReferral
(
referralEntity
,
authorizerInfo
,
null
,
jsonObject
);
return
referralEntity
;
return
referralEntity
;
}
}
@Override
@Override
public
void
constructMpReferral
(
ReferralEntity
referralEntity
,
AuthorizerInfo
authorizerInfo
,
AuthorizerExpandInfo
authorizerExpandInfo
,
JSONObject
responseJson
)
{
public
void
constructMpReferral
(
ReferralEntity
referralEntity
,
AuthorizerInfo
authorizerInfo
,
AuthorizerExpandInfo
authorizerExpandInfo
,
JSONObject
responseJson
)
{
return
;
// 原始字段
referralEntity
.
setPromoteId
(
responseJson
.
getString
(
"promoteId"
));
String
referral
=
responseJson
.
getString
(
"referral"
);
referralEntity
.
setReferral
(
referral
);
// 小程序字段
String
mpPath
=
responseJson
.
getString
(
"mpPath"
);
referralEntity
.
setMpPath
(
StringUtils
.
isNotBlank
(
mpPath
)
?
mpPath
:
(
isMiniProgramPath
(
referral
)
?
referral
:
null
));
referralEntity
.
setMpAppId
(
responseJson
.
getString
(
"mpAppId"
));
referralEntity
.
setExtraHttpUrl
(
responseJson
.
getString
(
"extraHttpUrl"
));
if
(
StringUtils
.
isBlank
(
referralEntity
.
getMpAppId
()))
{
authorizerExpandInfo
=
getAuthorizerExpandInfo
(
authorizerInfo
.
getAppid
());
referralEntity
.
setMpAppId
(
authorizerExpandInfo
.
getMpAppid
());
}
}
}
}
}
src/main/java/com/yaoyaozw/customer/handler/YwMpReferralHandler.java
浏览文件 @
3652f3f4
...
@@ -70,6 +70,11 @@ public class YwMpReferralHandler extends MpReferralHandler {
...
@@ -70,6 +70,11 @@ public class YwMpReferralHandler extends MpReferralHandler {
referralEntity
.
setMpPath
(
StringUtils
.
isNotBlank
(
mpPath
)
?
mpPath
:
(
isMiniProgramPath
(
referral
)
?
referral
:
null
));
referralEntity
.
setMpPath
(
StringUtils
.
isNotBlank
(
mpPath
)
?
mpPath
:
(
isMiniProgramPath
(
referral
)
?
referral
:
null
));
referralEntity
.
setMpAppId
(
responseJson
.
getString
(
"mpAppId"
));
referralEntity
.
setMpAppId
(
responseJson
.
getString
(
"mpAppId"
));
referralEntity
.
setExtraHttpUrl
(
responseJson
.
getString
(
"extraHttpUrl"
));
referralEntity
.
setExtraHttpUrl
(
responseJson
.
getString
(
"extraHttpUrl"
));
if
(
StringUtils
.
isBlank
(
referralEntity
.
getMpAppId
()))
{
authorizerExpandInfo
=
getAuthorizerExpandInfo
(
authorizerInfo
.
getAppid
());
referralEntity
.
setMpAppId
(
authorizerExpandInfo
.
getMpAppid
());
}
}
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论