SYSTEM:完善微信小程序码

This commit is contained in:
puhui999 2024-05-27 16:18:52 +08:00
parent 3025bff631
commit ea7f923072
6 changed files with 16 additions and 13 deletions

View File

@ -67,8 +67,8 @@ public class AppSocialUserController {
@PostMapping("/wxa-qrcode")
@Operation(summary = "获得微信小程序码(base64 image)")
public CommonResult<String> getWxQrcode(@RequestBody @Valid AppSocialWxQrcodeReqVO reqVO) {
byte[] wxQrcode = socialClientApi.getWxaQrcode(new SocialWxQrcodeReqDTO().setPath(reqVO.getPath()));
public CommonResult<String> getWxaQrcode(@RequestBody @Valid AppSocialWxQrcodeReqVO reqVO) {
byte[] wxQrcode = socialClientApi.getWxaQrcode(BeanUtils.toBean(reqVO, SocialWxQrcodeReqDTO.class));
return success(Base64.encode(wxQrcode));
}

View File

@ -12,12 +12,6 @@ import lombok.Data;
@Data
public class SocialWxQrcodeReqDTO {
/**
* 小程序版本
*
* 正式版为 "release"体验版为 "trial"开发版为 "develop"
*/
public static final String ENV_VERSION = "release";
/**
* 页面路径不能携带参数参数请放在scene字段里
*/
@ -51,10 +45,6 @@ public class SocialWxQrcodeReqDTO {
*/
@NotEmpty(message = "页面路径不能为空")
private String path;
/**
* 要打开的小程序版本
*/
private String envVersion;
/**
* 二维码宽度
*/

View File

@ -41,6 +41,7 @@ import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
@ -60,6 +61,12 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
@Slf4j
public class SocialClientServiceImpl implements SocialClientService {
/**
* 小程序版本
*/
@Value("${yudao.wxa-code.env-version}")
public String envVersion;
@Resource
private AuthRequestFactory authRequestFactory;
@ -237,7 +244,7 @@ public class SocialClientServiceImpl implements SocialClientService {
ObjUtil.defaultIfEmpty(reqVO.getScene(), SocialWxQrcodeReqDTO.SCENE),
reqVO.getPath(),
ObjUtil.defaultIfNull(reqVO.getCheckPath(), SocialWxQrcodeReqDTO.CHECK_PATH),
ObjUtil.defaultIfBlank(reqVO.getEnvVersion(), SocialWxQrcodeReqDTO.ENV_VERSION),
envVersion,
ObjUtil.defaultIfNull(reqVO.getWidth(), SocialWxQrcodeReqDTO.WIDTH),
ObjUtil.defaultIfNull(reqVO.getAutoColor(), SocialWxQrcodeReqDTO.AUTO_COLOR),
null,

View File

@ -171,6 +171,8 @@ yudao:
order-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/order # 支付渠道的【支付】回调地址
refund-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/refund # 支付渠道的【退款】回调地址
demo: true # 开启演示模式
wxa-code:
env-version: release # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"
tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
justauth:

View File

@ -220,6 +220,8 @@ yudao:
access-log: # 访问日志的配置项
enable: false
demo: false # 关闭演示模式
wxa-code:
env-version: develop # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"
tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
justauth:

View File

@ -177,6 +177,8 @@ yudao:
license-url: https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/master/LICENSE
captcha:
enable: true # 验证码的开关,默认为 true
wxa-code:
env-version: release # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"。默认为 release
codegen:
base-package: ${yudao.info.base-package}
db-schemas: ${spring.datasource.dynamic.datasource.master.name}