提交 d34ae129 作者: 沈振路

阳光小程序链接获取

上级 3652f3f4
......@@ -9,6 +9,7 @@ import com.yaoyaozw.customer.constants.ApiResultConstant;
import com.yaoyaozw.customer.entity.AuthorizerExpandInfo;
import com.yaoyaozw.customer.entity.AuthorizerInfo;
import com.yaoyaozw.customer.entity.ReferralEntity;
import com.yaoyaozw.customer.exception.BaseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
......@@ -23,6 +24,11 @@ public class YgMpReferralHandler extends MpReferralHandler {
@Override
public ReferralEntity queryMpReferral(ReferralEntity referralEntity, AuthorizerInfo authorizerInfo) {
referralEntity.setMiniProgramQuery(Boolean.TRUE);
AuthorizerExpandInfo authorizerExpandInfo = getAuthorizerExpandInfo(authorizerInfo.getAppid());
if (authorizerExpandInfo == null) {
throw new BaseException("无法获取公众号:" + authorizerInfo.getNickName() + " 的小程序配置信息");
}
referralEntity.setAccountId(authorizerExpandInfo.getFlagId());
// 调用接口获取原生链接
R r = referralFeignClient.productReferral(referralEntity);
if (!r.getCode().equals(ApiResultConstant.SUCCESS_CODE)) {
......@@ -32,7 +38,7 @@ public class YgMpReferralHandler extends MpReferralHandler {
JSONObject jsonObject = JSON.parseObject(res);
// 处理链接
constructMpReferral(referralEntity, authorizerInfo, null, jsonObject);
constructMpReferral(referralEntity, authorizerInfo, authorizerExpandInfo, jsonObject);
return referralEntity;
}
......@@ -47,8 +53,7 @@ public class YgMpReferralHandler extends MpReferralHandler {
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());
if (StringUtils.isBlank(referralEntity.getMpAppId()) && authorizerExpandInfo != null) {
referralEntity.setMpAppId(authorizerExpandInfo.getMpAppid());
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论