Commit ea7f923072bc1879fa1b825f270d7cfb204eaa9f

Authored by puhui999
1 parent 3025bff6

SYSTEM:完善微信小程序码

yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/social/AppSocialUserController.java
... ... @@ -67,8 +67,8 @@ public class AppSocialUserController {
67 67  
68 68 @PostMapping("/wxa-qrcode")
69 69 @Operation(summary = "获得微信小程序码(base64 image)")
70   - public CommonResult<String> getWxQrcode(@RequestBody @Valid AppSocialWxQrcodeReqVO reqVO) {
71   - byte[] wxQrcode = socialClientApi.getWxaQrcode(new SocialWxQrcodeReqDTO().setPath(reqVO.getPath()));
  70 + public CommonResult<String> getWxaQrcode(@RequestBody @Valid AppSocialWxQrcodeReqVO reqVO) {
  71 + byte[] wxQrcode = socialClientApi.getWxaQrcode(BeanUtils.toBean(reqVO, SocialWxQrcodeReqDTO.class));
72 72 return success(Base64.encode(wxQrcode));
73 73 }
74 74  
... ...
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/social/dto/SocialWxQrcodeReqDTO.java
... ... @@ -13,12 +13,6 @@ import lombok.Data;
13 13 public class SocialWxQrcodeReqDTO {
14 14  
15 15 /**
16   - * 小程序版本
17   - *
18   - * 正式版为 "release";体验版为 "trial";开发版为 "develop"
19   - */
20   - public static final String ENV_VERSION = "release";
21   - /**
22 16 * 页面路径不能携带参数(参数请放在scene字段里)
23 17 */
24 18 public static final String SCENE = "";
... ... @@ -52,10 +46,6 @@ public class SocialWxQrcodeReqDTO {
52 46 @NotEmpty(message = "页面路径不能为空")
53 47 private String path;
54 48 /**
55   - * 要打开的小程序版本
56   - */
57   - private String envVersion;
58   - /**
59 49 * 二维码宽度
60 50 */
61 51 private Integer width;
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java
... ... @@ -41,6 +41,7 @@ import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
41 41 import me.chanjar.weixin.mp.api.WxMpService;
42 42 import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
43 43 import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl;
  44 +import org.springframework.beans.factory.annotation.Value;
44 45 import org.springframework.data.redis.core.StringRedisTemplate;
45 46 import org.springframework.stereotype.Service;
46 47  
... ... @@ -60,6 +61,12 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
60 61 @Slf4j
61 62 public class SocialClientServiceImpl implements SocialClientService {
62 63  
  64 + /**
  65 + * 小程序版本
  66 + */
  67 + @Value("${yudao.wxa-code.env-version}")
  68 + public String envVersion;
  69 +
63 70 @Resource
64 71 private AuthRequestFactory authRequestFactory;
65 72  
... ... @@ -237,7 +244,7 @@ public class SocialClientServiceImpl implements SocialClientService {
237 244 ObjUtil.defaultIfEmpty(reqVO.getScene(), SocialWxQrcodeReqDTO.SCENE),
238 245 reqVO.getPath(),
239 246 ObjUtil.defaultIfNull(reqVO.getCheckPath(), SocialWxQrcodeReqDTO.CHECK_PATH),
240   - ObjUtil.defaultIfBlank(reqVO.getEnvVersion(), SocialWxQrcodeReqDTO.ENV_VERSION),
  247 + envVersion,
241 248 ObjUtil.defaultIfNull(reqVO.getWidth(), SocialWxQrcodeReqDTO.WIDTH),
242 249 ObjUtil.defaultIfNull(reqVO.getAutoColor(), SocialWxQrcodeReqDTO.AUTO_COLOR),
243 250 null,
... ...
yudao-server/src/main/resources/application-dev.yaml
... ... @@ -171,6 +171,8 @@ yudao:
171 171 order-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/order # 支付渠道的【支付】回调地址
172 172 refund-notify-url: http://yunai.natapp1.cc/admin-api/pay/notify/refund # 支付渠道的【退款】回调地址
173 173 demo: true # 开启演示模式
  174 + wxa-code:
  175 + env-version: release # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"
174 176 tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
175 177  
176 178 justauth:
... ...
yudao-server/src/main/resources/application-local.yaml
... ... @@ -220,6 +220,8 @@ yudao:
220 220 access-log: # 访问日志的配置项
221 221 enable: false
222 222 demo: false # 关闭演示模式
  223 + wxa-code:
  224 + env-version: develop # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"
223 225 tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
224 226  
225 227 justauth:
... ...
yudao-server/src/main/resources/application.yaml
... ... @@ -177,6 +177,8 @@ yudao:
177 177 license-url: https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/master/LICENSE
178 178 captcha:
179 179 enable: true # 验证码的开关,默认为 true
  180 + wxa-code:
  181 + env-version: release # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"。默认为 release
180 182 codegen:
181 183 base-package: ${yudao.info.base-package}
182 184 db-schemas: ${spring.datasource.dynamic.datasource.master.name}
... ...