提交 5266853d 作者: 沈振路

客服消息适配”阅文1小程序“【未测试】

上级 6db036f6
...@@ -713,6 +713,10 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -713,6 +713,10 @@ public class CustomerServiceCommonAsyncComponent {
referralEntity.setMediaSource("2"); referralEntity.setMediaSource("2");
} }
} }
referralEntity.setMiniProgramQuery(Boolean.TRUE);
}
if (STORE_NAME_YUE_WEN_1.equals(authInfoVo.getStoreType()) && CUSTOMER_TYPE_VALUE_MINI_PROGRAM.equals(referralEntity.getCustomerMsgType())) {
referralEntity.setMiniProgramQuery(Boolean.TRUE);
} }
// LOCAL_LOG.info("获取链接, 参数: {}", referralEntity); // LOCAL_LOG.info("获取链接, 参数: {}", referralEntity);
R r = referralFeignClient.productReferral(referralEntity); R r = referralFeignClient.productReferral(referralEntity);
...@@ -732,13 +736,18 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -732,13 +736,18 @@ public class CustomerServiceCommonAsyncComponent {
String referral = jsonObject1.getString("referral"); String referral = jsonObject1.getString("referral");
referralEntity.setPromoteId(jsonObject1.getString("promoteId")); referralEntity.setPromoteId(jsonObject1.getString("promoteId"));
referralEntity.setReferral(referral); referralEntity.setReferral(referral);
if (CustomerCommonConstant.STORE_NAME_TOMATO.equals(authInfoVo.getStoreType()) && CUSTOMER_TYPE_VALUE_MINI_PROGRAM.equals(referralEntity.getCustomerMsgType())) {
// 取链接成功之后,后置处理番茄小程序 // 取链接成功之后,后置处理番茄小程序
suffixHandleTomatoMiniProgram(authInfoVo, referralEntity); suffixHandleTomatoMiniProgram(authInfoVo, referralEntity);
} }
if (STORE_NAME_YUE_WEN_1.equals(authInfoVo.getStoreType()) && CUSTOMER_TYPE_VALUE_MINI_PROGRAM.equals(referralEntity.getCustomerMsgType())) {
// 取链接成功之后,后置处理阅文1小程序
suffixHandleYwMiniProgram(authInfoVo, referralEntity, jsonObject1);
}
}
private void suffixHandleTomatoMiniProgram(AuthInfoVO authInfoVo, ReferralEntity referralEntity) { private void suffixHandleTomatoMiniProgram(AuthInfoVO authInfoVo, ReferralEntity referralEntity) {
if (CustomerCommonConstant.STORE_NAME_TOMATO.equals(authInfoVo.getStoreType()) && CUSTOMER_TYPE_VALUE_MINI_PROGRAM.equals(referralEntity.getCustomerMsgType())) {
String referral = referralEntity.getReferral(); String referral = referralEntity.getReferral();
// 番茄小程序 // 番茄小程序
if (CustomerCommonConstant.ACTIVITY_NEWS_TYPE.equals(referralEntity.getNewsType())) { if (CustomerCommonConstant.ACTIVITY_NEWS_TYPE.equals(referralEntity.getNewsType())) {
...@@ -776,7 +785,29 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -776,7 +785,29 @@ public class CustomerServiceCommonAsyncComponent {
referralEntity.setMpPath(referral); referralEntity.setMpPath(referral);
// 暂时将小程序地址也赋值到跳转链接地址上 // 暂时将小程序地址也赋值到跳转链接地址上
referralEntity.setReferral(referral); referralEntity.setReferral(referral);
// 上传腾讯图片素材
TencentMediaResponseVO uploadResult = tencentCustomerUtil.uploadTencentMedia(authInfoVo.getAppId(), referralEntity.getMediaOriginUrl(), referralEntity.getCustomerMsgType());
if (StringUtils.isNotEmpty(uploadResult.getErrmsg())) {
LOCAL_LOG.warn("公众号: {} 上传素材失败 {}", authInfoVo.getAppId(), uploadResult.getErrmsg());
}
referralEntity.setMediaId(uploadResult.getMedia_id());
}
/**
* 阅文小程序链接后置处理
* @param referralEntity 链接
* @param responseJson 响应
*/
private void suffixHandleYwMiniProgram(AuthInfoVO authInfoVo, ReferralEntity referralEntity, JSONObject responseJson) {
// 原始字段
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"));
// 上传腾讯图片素材 // 上传腾讯图片素材
TencentMediaResponseVO uploadResult = tencentCustomerUtil.uploadTencentMedia(authInfoVo.getAppId(), referralEntity.getMediaOriginUrl(), referralEntity.getCustomerMsgType()); TencentMediaResponseVO uploadResult = tencentCustomerUtil.uploadTencentMedia(authInfoVo.getAppId(), referralEntity.getMediaOriginUrl(), referralEntity.getCustomerMsgType());
...@@ -785,7 +816,7 @@ public class CustomerServiceCommonAsyncComponent { ...@@ -785,7 +816,7 @@ public class CustomerServiceCommonAsyncComponent {
} }
referralEntity.setMediaId(uploadResult.getMedia_id()); referralEntity.setMediaId(uploadResult.getMedia_id());
} }
}
private Boolean isMiniProgramPath(String path) { private Boolean isMiniProgramPath(String path) {
return StringUtils.isNotBlank(path) && (path.startsWith("page") || path.startsWith("/page")); return StringUtils.isNotBlank(path) && (path.startsWith("page") || path.startsWith("/page"));
} }
......
...@@ -30,6 +30,7 @@ public class CustomerCommonConstant { ...@@ -30,6 +30,7 @@ public class CustomerCommonConstant {
public final static String STORE_NAME_YANG_GUANG = "YANG_GUANG"; public final static String STORE_NAME_YANG_GUANG = "YANG_GUANG";
public final static String STORE_NAME_ZHANG_ZHONG_YUN = "ZHANG_ZHONG_YUN"; public final static String STORE_NAME_ZHANG_ZHONG_YUN = "ZHANG_ZHONG_YUN";
public final static String STORE_NAME_YUE_WEN = "YUE_WEN"; public final static String STORE_NAME_YUE_WEN = "YUE_WEN";
public final static String STORE_NAME_YUE_WEN_1 = "YUE_WEN_1";
public final static String STORE_NAME_TOMATO = "TOMATO"; public final static String STORE_NAME_TOMATO = "TOMATO";
public final static String ERROR_LABEL = "error"; public final static String ERROR_LABEL = "error";
......
...@@ -246,6 +246,11 @@ public class ReferralEntity implements Serializable { ...@@ -246,6 +246,11 @@ public class ReferralEntity implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String mediaSource; private String mediaSource;
/**
* 是否小程序相关请求
*/
@TableField(exist = false)
private Boolean miniProgramQuery;
public static final String COL_ID = "id"; public static final String COL_ID = "id";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论