| | |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkException; |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | private TBPidService tbPidService; |
| | | |
| | | @Resource |
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService; |
| | | |
| | | @Resource |
| | | private UserInfoExtraService userInfoExtraService; |
| | | |
| | | @Resource |
| | | private FloatADService floatADService; |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private MsgDeviceReadStateService msgDeviceReadStateService; |
| | | |
| | | @Resource |
| | | private UserTaoLiJinOriginService uerTaoLiJinOriginService; |
| | | |
| | | @Resource |
| | | private UserActiveLogService userActiveLogService; |
| | |
| | | |
| | | @Resource |
| | | private PIDManager pidManager; |
| | | |
| | | @Resource |
| | | private ConvertLinkManager convertLinkManager; |
| | | |
| | | /** |
| | | * s 首页配置信息 |
| | |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.elmeLink, uid + ""); |
| | | String elmeLink = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(elmeLink)) { |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert( |
| | | elmePid.split("_")[3], "1571715733668", userInfoExtra.getRelationId()); |
| | | TaoKeOfficialActivityConvertResultDTO dto = null; |
| | | try { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, elmePid, "1571715733668", userInfoExtra.getRelationId(), false); |
| | | } catch (ConvertLinkException e) { |
| | | e.printStackTrace(); |
| | | if (StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadFalseResult(e.getMessage())); |
| | | else |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | if (dto != null) |
| | | elmeLink = dto.getShort_click_url(); |
| | | if (!StringUtil.isNullOrEmpty(elmeLink)) { |
| | |
| | | JSONObject data = new JSONObject(); |
| | | TaoKeOfficialActivityConvertResultDTO dto = null; |
| | | if (StringUtil.isNullOrEmpty(elmeResult)) { |
| | | if (share) { |
| | | dto = TaoKeApiUtil.officialActivityConvert(relationPid.split("_")[3], |
| | | activityId, userInfoExtra.getRelationId()); |
| | | } else { |
| | | dto = TaoKeApiUtil.officialActivityConvert(elmePid.split("_")[3], activityId, |
| | | userInfoExtra.getRelationId()); |
| | | try { |
| | | if (share) { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, relationPid, activityId, userInfoExtra.getRelationId(), true); |
| | | } else { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, elmePid, activityId, |
| | | userInfoExtra.getRelationId(), false); |
| | | } |
| | | } catch (ConvertLinkException e) { |
| | | if (StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadFalseResult(e.getMessage())); |
| | | else |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage()))); |
| | | return; |
| | | } |
| | | |
| | | if (dto != null) { |
| | |
| | | JSONObject data = new JSONObject(); |
| | | TaoKeOfficialActivityConvertResultDTO dto = null; |
| | | if (StringUtil.isNullOrEmpty(elmeResult)) { |
| | | if (share) { |
| | | dto = TaoKeApiUtil.officialActivityConvert(relationPid.split("_")[3], |
| | | activityId, userInfoExtra.getRelationId()); |
| | | } else { |
| | | dto = TaoKeApiUtil.officialActivityConvert(TaoBaoConstant.TAOBAO_KOUBEI_PID.split("_")[3], activityId, |
| | | userInfoExtra.getRelationId()); |
| | | |
| | | try { |
| | | if (share) { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, relationPid, |
| | | activityId, userInfoExtra.getRelationId(), true); |
| | | } else { |
| | | dto = convertLinkManager.taobaoOfficialActivityConvert(uid, TaoBaoConstant.TAOBAO_KOUBEI_PID, |
| | | activityId, userInfoExtra.getRelationId(), false); |
| | | } |
| | | } catch (ConvertLinkException e) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getCode(), e.getMessage()))); |
| | | return; |
| | | } |
| | | |
| | | if (dto != null) { |
| | |
| | | */ |
| | | @RequestMapping(value = "userProtocolListen") |
| | | public void userProtocolListen(AcceptData acceptData, Long uid, int type, PrintWriter out) { |
| | | LogHelper.userProtocolListen(String.format("%s#%s#%s", acceptData.getDevice(), uid, type)); |
| | | out.print(JsonUtil.loadTrueResult("")); |
| | | } |
| | | |
| | |
| | | @RequestMapping(value = "getShowAd") |
| | | public void showAd(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | String value = configService.getValue(ConfigKeyEnum.showSplashAd.getKey(), acceptData.getSystem()); |
| | | boolean huaweiShowAd = true; |
| | | if ("huawei".equalsIgnoreCase(acceptData.getChannel())) { |
| | | String version = configService.getValue(ConfigKeyEnum.huaweiOnLineVersionCode.getKey(), acceptData.getSystem()); |
| | | if (!StringUtil.isNullOrEmpty(version)) { |
| | | if (Integer.parseInt(version) == Integer.parseInt(acceptData.getVersion())) { |
| | | huaweiShowAd = false; |
| | | } |
| | | } |
| | | JSONObject configData = JSONObject.fromObject(value); |
| | | String channel = acceptData.getChannel().toLowerCase(); |
| | | if (configData.optString(channel) == null) { |
| | | channel = "qq"; |
| | | } |
| | | int version = configData.optInt(channel); |
| | | JSONObject data = new JSONObject(); |
| | | boolean show; |
| | | if (Integer.parseInt(acceptData.getVersion()) >= version) { |
| | | show = false; |
| | | } else { |
| | | show = true; |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | if ("0".equalsIgnoreCase(value.trim())) { |
| | | if (show) { |
| | | data.put("show", true); |
| | | //加载广告数据 |
| | | data.put("ad", configService.getValue(ConfigKeyEnum.gdtAdInfo, acceptData.getSystem())); |
| | | } else |
| | | data.put("show", false); |
| | | } else { |
| | | if (huaweiShowAd) { |
| | | data.put("show", true); |
| | | //加载广告数据 |
| | | data.put("ad", configService.getValue(ConfigKeyEnum.gdtAdInfo, acceptData.getSystem())); |
| | | } else |
| | | data.put("show", false); |
| | | } |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |