| | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String createMemberMiniProgramCode(Integer memberId) throws Exception { |
| | | InputStream inputStream = Constants.generateWxMiniImgStream( |
| | | "uid_"+memberId, |
| | | "/pages/index/index", |
| | | true); |
| | | if (inputStream == null) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "小程序分享码生成失败"); |
| | | } |
| | | ALiYunUtil obs = new ALiYunUtil( |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ENDPOINT).getCode() |
| | | ,systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_ID).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.OSS,Constants.ACCESS_KEY).getCode()); |
| | | |
| | | String shareFolder = systemDictDataBiz.queryByCode(Constants.OSS, Constants.SHARES_FILE).getCode(); |
| | | String key = DateUtil.getNowShortDate() + "/" + UUID.randomUUID().toString() + ".jpg"; |
| | | String fileName = shareFolder + key; |
| | | if (obs.uploadOnlineObject(inputStream,systemDictDataBiz.queryByCode(Constants.OSS, Constants.BUCKETNAME).getCode(), fileName,null)) { |
| | | return key; |
| | | } |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "小程序分享码上传失败"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |