| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | /** |
| | | * s 首页配置信息 |
| | |
| | | */ |
| | | @RequestMapping(value = "getElemeLink") |
| | | public void getElemeLink(AcceptData acceptData, Long uid, 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 elmePid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_ELME, SystemPIDInfo.PidType.fanli); |
| | | |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.elmeLink, uid + ""); |
| | | String elmeLink = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(elmeLink)) { |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert( |
| | | TaoBaoConstant.TAOBAO_ELEME_PID.split("_")[3], "1571715733668", userInfoExtra.getRelationId()); |
| | | elmePid.split("_")[3], "1571715733668", userInfoExtra.getRelationId()); |
| | | if (dto != null) |
| | | elmeLink = dto.getShort_click_url(); |
| | | if (!StringUtil.isNullOrEmpty(elmeLink)) { |
| | |
| | | data.put("hongBao", elmeLink); |
| | | data.put("goods", elmeLink); |
| | | |
| | | ClientTBPid clientTBPid1 = new ClientTBPid(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_ELEME_PID, |
| | | null, TaoBaoConstant.TAOBAO_ELEME_PID.split("_")[3]); |
| | | ClientTBPid clientTBPid1 = new ClientTBPid(TaoBaoConstant.TAOBAO_AUTH_APPKEY, elmePid, |
| | | null, elmePid.split("_")[3]); |
| | | data.put("taoKeParams", clientTBPid1); |
| | | if (StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "请绑定淘宝"))); |
| | | return; |
| | | } |
| | | |
| | | String elmePid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_ELME, SystemPIDInfo.PidType.fanli); |
| | | String relationPid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.share); |
| | | |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.elmeLink, 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], |
| | | dto = TaoKeApiUtil.officialActivityConvert(relationPid.split("_")[3], |
| | | activityId, userInfoExtra.getRelationId()); |
| | | } else { |
| | | dto = TaoKeApiUtil.officialActivityConvert(TaoBaoConstant.TAOBAO_ELEME_PID.split("_")[3], activityId, |
| | | dto = TaoKeApiUtil.officialActivityConvert(elmePid.split("_")[3], activityId, |
| | | userInfoExtra.getRelationId()); |
| | | } |
| | | |
| | |
| | | data.put("info", info); |
| | | |
| | | ClientTBPid clientTBPid1 = new ClientTBPid(TaoBaoConstant.TAOBAO_AUTH_APPKEY, |
| | | share ? TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT : TaoBaoConstant.TAOBAO_ELEME_PID, null, |
| | | TaoBaoConstant.TAOBAO_ELEME_PID.split("_")[3]); |
| | | share ? relationPid : elmePid, null, |
| | | elmePid.split("_")[3]); |
| | | clientTBPid1.setAdZoneId(clientTBPid1.getPid().split("_")[3]); |
| | | data.put("taoKeParams", clientTBPid1); |
| | | if (StringUtil.isNullOrEmpty(callback)) |
| | |
| | | public void getKouBeiLink(AcceptData acceptData, Long uid, String activityId, boolean share, boolean shareImg, |
| | | String callback, PrintWriter out) { |
| | | |
| | | String relationPid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_TAOBAO, SystemPIDInfo.PidType.share); |
| | | |
| | | UserExtraTaoBaoInfo userInfoExtra = userExtraTaoBaoInfoService.getByUid(uid); |
| | | if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getRelationId())) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "请绑定淘宝"))); |
| | |
| | | TaoKeOfficialActivityConvertResultDTO dto = null; |
| | | if (StringUtil.isNullOrEmpty(elmeResult)) { |
| | | if (share) { |
| | | dto = TaoKeApiUtil.officialActivityConvert(TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT.split("_")[3], |
| | | dto = TaoKeApiUtil.officialActivityConvert(relationPid.split("_")[3], |
| | | activityId, userInfoExtra.getRelationId()); |
| | | } else { |
| | | dto = TaoKeApiUtil.officialActivityConvert(TaoBaoConstant.TAOBAO_KOUBEI_PID.split("_")[3], activityId, |
| | |
| | | data.put("info", info); |
| | | |
| | | ClientTBPid clientTBPid1 = new ClientTBPid(TaoBaoConstant.TAOBAO_AUTH_APPKEY, |
| | | share ? TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT : TaoBaoConstant.TAOBAO_KOUBEI_PID, null, |
| | | share ? relationPid : TaoBaoConstant.TAOBAO_KOUBEI_PID, null, |
| | | TaoBaoConstant.TAOBAO_KOUBEI_PID.split("_")[3]); |
| | | clientTBPid1.setAdZoneId(clientTBPid1.getPid().split("_")[3]); |
| | | data.put("taoKeParams", clientTBPid1); |