StringUtils.overlay()

public static String overlay(String str,
                             String overlay,
                             int start,
                             int end)

用overlay覆盖str的start开始end-1结束的字符。

@PostMapping("/appUpdate") @ApiOperation(value = "获取版本更新") public Response<AppUpdateResponseVO> appUpdate(@RequestBody @Valid Request<AppUpdateRequestVO> request) { AppUpdateRequestDTO appUpdateRequestDto = WalletVoMapper.INSTANCE.toDto(request.getParam()); // todo 因为 app 版本定义错误现在应该是1.xx.xx 变为了 3.xx.xx 需要将3开头的改为1开头, 如果版本更新到了3.xx.xx 需要将代码删掉 String appVersion = request.getAppVersion(); if (request.getAppVersion() != null && request.getAppVersion().startsWith("3") && Boolean.TRUE.toString().equalsIgnoreCase(SpringUtil.getProperty("app-update-fix-switch","true"))) { appVersion = StringUtils.overlay(appVersion, "1", 0, 1); } AppUpdateResponseDTO appUpdateByVersion = appUpdateService.getAppUpdateByVersion(appUpdateRequestDto, appVersion, request.getAppType(), request.getPlatform(), request.getClientIp()); AppUpdateResponseVO appUpdateResponseVo = WalletVoMapper.INSTANCE.toVo(appUpdateByVersion); PlatformEnum platform = request.getPlatform() == PlatformEnum.WEB_H5 ? request.getParam().getPlatform() : request.getPlatform(); boolean downloadUrlStatus = SpringUtil.getProperty("s3.download.status", boolean.class, true); if (downloadUrlStatus) { String downloadUrlS3 = SpringUtil.getProperty(MessageFormat.format("{0}.s3.download.url", platform.name().toLowerCase())); log.info("appUpdate downloadUrlS3 {}", downloadUrlS3); appUpdateResponseVo.setDownloadUrl(downloadUrlS3); appUpdateResponseVo.setDownloadUrls(List.of(downloadUrlS3)); } if (appUpdateResponseVo != null && appUpdateResponseVo.getVersion() != null && appUpdateResponseVo.getVersion().startsWith("3") && Boolean.TRUE.toString().equalsIgnoreCase(SpringUtil.getProperty("app-update-fix-switch","true"))) { log.info("appUpdate response {}", appUpdateResponseVo); appUpdateResponseVo = new AppUpdateResponseVO(); } if(log.isInfoEnabled()){ log.info("appUpdate request {} response {}", JacksonUtils.toJson(request),JacksonUtils.toJson(appUpdateResponseVo)); } return Response.succeed(appUpdateResponseVo); }在这段代码中加入一个下载次数限制每天下载2000次 用代码展示
06-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值