| | |
| | | HttpUtil.getAsInputStream(dto.getWx_qrcode_url()), 500, 500, 295, 908);
|
| | |
|
| | | if (elmeShareImg != null) {
|
| | | String filePath = FilePathEnum.banLiShopClass.getPath() + "-" + uid + "-"
|
| | | String filePath = FilePathEnum.elmeShare.getPath() + "-" + uid + "-"
|
| | | + UUID.randomUUID().toString().replace("-", "") + ".png";
|
| | | FileUploadResult uploadResult = COSManager.getInstance().uploadFile(elmeShareImg, filePath);
|
| | | if (uploadResult != null)
|
| | |
| | | else
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | | |
| | | |
| | | @RequestMapping(value = "getKouBeiLink")
|
| | | public void getKouBeiLink(AcceptData acceptData, Long uid, String activityId, boolean share, boolean shareImg,
|
| | | String callback, PrintWriter out) {
|
| | |
|
| | | UserExtraTaoBaoInfo userInfoExtra = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getRelationId())) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "请绑定淘宝")));
|
| | | return;
|
| | | }
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.kouBeiLink, uid + "-" + activityId + "-" + share);
|
| | | String elmeResult = redisManager.getCommonString(key);
|
| | | JSONObject data = new JSONObject();
|
| | | TaoKeOfficialActivityConvertResultDTO dto = null;
|
| | | if (StringUtil.isNullOrEmpty(elmeResult)) {
|
| | | if (share) {
|
| | | dto = TaoKeApiUtil.officialActivityConvert(TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT.split("_")[3],
|
| | | activityId, userInfoExtra.getRelationId());
|
| | | } else {
|
| | | dto = TaoKeApiUtil.officialActivityConvert(TaoBaoConstant.TAOBAO_KOUBEI_PID.split("_")[3], activityId,
|
| | | userInfoExtra.getRelationId());
|
| | | }
|
| | |
|
| | | if (dto != null) {
|
| | | if (share) {// 生成口令
|
| | | String token = TaoKeApiUtil.getTKToken("http://", "口碑",dto.getClick_url() );
|
| | | dto.setToken(TaoBaoUtil.filterTaoToken(token));
|
| | | }
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(dto), 60 * 60);// 缓存1个小时
|
| | | }
|
| | | } else {
|
| | | dto = JsonUtil.getSimpleGson().fromJson(elmeResult, TaoKeOfficialActivityConvertResultDTO.class);
|
| | |
|
| | | if (share && StringUtil.isNullOrEmpty(dto.getToken())) {
|
| | | // 保存口令
|
| | | String token = TaoKeApiUtil.getTKToken("http://", "口碑", dto.getClick_url());
|
| | | dto.setToken(TaoBaoUtil.filterTaoToken(token));
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(dto), 60 * 60);// 缓存1个小时
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | ElemeConvertInfoResultVO info = new ElemeConvertInfoResultVO(null, dto.getToken(), dto.getClick_url());
|
| | | if (share && shareImg) {
|
| | | InputStream elmeShareImg = ImageUtil.drawSimpleImage(
|
| | | this.getClass().getClassLoader().getResourceAsStream("image/elme_bg.png"), 1080, 1646,
|
| | | HttpUtil.getAsInputStream(dto.getWx_qrcode_url()), 500, 500, 295, 908);
|
| | |
|
| | | if (elmeShareImg != null) {
|
| | | String filePath = FilePathEnum.elmeShare.getPath() + "-" + uid + "-"
|
| | | + UUID.randomUUID().toString().replace("-", "") + ".png";
|
| | | FileUploadResult uploadResult = COSManager.getInstance().uploadFile(elmeShareImg, filePath);
|
| | | if (uploadResult != null)
|
| | | info.setQrCodeImg(uploadResult.getUrl());
|
| | | }
|
| | |
|
| | | if (info.getQrCodeImg() == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("分享图生成失败"));
|
| | | return;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | data.put("info", info);
|
| | |
|
| | | ClientTBPid clientTBPid1 = new ClientTBPid(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | share ? TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT : TaoBaoConstant.TAOBAO_KOUBEI_PID, null,
|
| | | TaoBaoConstant.TAOBAO_KOUBEI_PID.split("_")[3]);
|
| | | clientTBPid1.setAdZoneId(clientTBPid1.getPid().split("_")[3]);
|
| | | data.put("taoKeParams", clientTBPid1);
|
| | | if (StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | else
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取饿了么的推广链接
|