| | |
| | | package com.yeshi.fanli.controller.client.v2;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.encrypt.DESUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
|
| | | import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.config.AppHomeFloatImg;
|
| | | import com.yeshi.fanli.entity.taobao.ClientTBPid;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.FloatADService;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 动态
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Controller
|
| | | @RequestMapping("api/v2/config")
|
| | | public class ConfigControllerV2 {
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private TBPidService tbPidService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private FloatADService floatADService;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | @Resource
|
| | | private MsgDeviceReadStateService msgDeviceReadStateService;
|
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinOriginService uerTaoLiJinOriginService;
|
| | |
|
| | | @Resource
|
| | | private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService;
|
| | |
|
| | | @Resource
|
| | | private UserActiveLogService userActiveLogService;
|
| | |
|
| | | /**
|
| | | * s 首页配置信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHomeConfig", method = RequestMethod.POST)
|
| | | public void getHomeConfig(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid != null && uid == 0L)
|
| | | uid = null;
|
| | |
|
| | | AppHomeFloatImg appHomeFloatImg = configService.getAppHomeFloatImg();
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && !Constant.IS_TEST) {
|
| | | appHomeFloatImg = null;
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (appHomeFloatImg != null) {
|
| | | data.put("floatImg", appHomeFloatImg);
|
| | | }
|
| | |
|
| | | String notifyImg = configService.getAppHomeFloatNotifyImg();
|
| | | if (!StringUtil.isNullOrEmpty(notifyImg)) {
|
| | | data.put("floatNotifyImg", notifyImg);
|
| | | }
|
| | |
|
| | | FloatAD floatAD = null;
|
| | |
|
| | | if (VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (uid == null) {
|
| | | DeviceTaoLiJinRecord deviceRecord = deviceTaoLiJinRecordService.getByDevice(acceptData.getDevice());
|
| | | if (deviceRecord == null) {
|
| | | floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 1);
|
| | | }
|
| | | } else {
|
| | | UserTaoLiJinOrigin userTaoLiJin = uerTaoLiJinOriginService.getByUidAndOrigin(uid,
|
| | | TaoLiJinOriginEnum.newbiesWin.name());
|
| | | if (userTaoLiJin == null) {
|
| | | floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 1);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 无新人弹框 则查询默认
|
| | | if (floatAD == null) {
|
| | | floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 0);
|
| | | }
|
| | |
|
| | | if (floatAD != null) {
|
| | | JSONObject detail = new JSONObject();
|
| | | detail.put("img", floatAD.getPicture());
|
| | | detail.put("jumpDetail", floatAD.getJumpDetail());
|
| | | detail.put("params", floatAD.getParams());
|
| | | detail.put("showTime", floatAD.getShowMode());
|
| | | detail.put("accountLogin", floatAD.isJumpNeedLogin());
|
| | | data.put("floatImgDetail", detail);
|
| | | }
|
| | |
|
| | | // 领券帮助链接,1.5.2后生效
|
| | | String couponHelp = configService.get("taobao_coupon_help");
|
| | | data.put("couponHelpUrl", couponHelp);
|
| | |
|
| | | // 底部网页链接
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equalsIgnoreCase(platform)) {
|
| | | data.put("htmlLink", configService.get("index_html_link_android"));
|
| | | }
|
| | |
|
| | | // 判断新老用户
|
| | | UserActiveLog da = null;
|
| | | if (uid != null)
|
| | | da = userActiveLogService.getFirstActiveInfo(uid);
|
| | | // 新人
|
| | | if (da == null || (System.currentTimeMillis() - da.getCreateTime().getTime()) <= 1000 * 60 * 60 * 24 * 15L) {
|
| | | data.put("userTimeType", 0);
|
| | | } else {// 老人
|
| | | data.put("userTimeType", 1);
|
| | | }
|
| | | data.put("hotFuctionLink", configService.get("hot_function_url"));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 消息中心弹框
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getMSGConfig", method = RequestMethod.POST)
|
| | | public void getMSGConfig(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | boolean show = false;
|
| | | if (uid != null) {
|
| | | show = uerTaoLiJinOriginService.hasRankHongBao(uid);
|
| | | }
|
| | |
|
| | | if (show) {
|
| | | FloatAD floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_MSGCENTER, null);
|
| | | if (floatAD != null) {
|
| | | JSONObject detail = new JSONObject();
|
| | | detail.put("img", floatAD.getPicture());
|
| | | detail.put("jumpDetail", floatAD.getJumpDetail());
|
| | | detail.put("params", floatAD.getParams());
|
| | | detail.put("showTime", floatAD.getShowMode());
|
| | | detail.put("accountLogin", floatAD.isJumpNeedLogin());
|
| | | data.put("floatImgDetail", detail);
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getTaoBaoCartConfig", method = RequestMethod.POST)
|
| | | public void getTaoBaoCartConfig(AcceptData acceptData, String position, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult("用户尚未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 是否需要购物城转链
|
| | | boolean convert = "0".equalsIgnoreCase(configService.get("show_taobao_cart_convert")) ? false : true;
|
| | |
|
| | | if (!"cart".equalsIgnoreCase(position) && !convert) {
|
| | | out.print(JsonUtil.loadFalseResult(""));
|
| | | return;
|
| | | }
|
| | |
|
| | | ClientTBPid clientTBPid = null;
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
|
| | | clientTBPid = tbPidService.getIOSDefault();
|
| | | } else {
|
| | | clientTBPid = tbPidService.getAndroidDefault();
|
| | | }
|
| | |
|
| | | String cartJS = configService.get("taobao_cart_js");
|
| | | String cartUrl = configService.get("taobao_cart_link");
|
| | | if (!convert)// 不转链
|
| | | {
|
| | | cartUrl = "http://";
|
| | | cartJS = "-";
|
| | | }
|
| | | String js = null;
|
| | | String link = null;
|
| | | try {
|
| | | js = DESUtil.encode(cartJS, StringUtil.getBase64String("YeShiFANLI889*+"),
|
| | | StringUtil.getBase64String("*M#34f?,"));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | try {
|
| | | link = DESUtil.encode(cartUrl, StringUtil.getBase64String("YeShiFANLI889*+"),
|
| | | StringUtil.getBase64String("*M#34f?,"));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("js", js);
|
| | | data.put("link", link);
|
| | | data.put("tbPidInfo", clientTBPid);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getWebConfig", method = RequestMethod.POST)
|
| | | public void getWebConfig(AcceptData acceptData, String url, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | |
|
| | | if (url != null && url.contains("ifeeds.tmall.com/article.html?")) {
|
| | | if (VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | data.put("baichuan", false);
|
| | | else
|
| | | data.put("baichuan", true);
|
| | | data.put("goodsDetail", false);
|
| | | } else if (url != null && (url.contains("s.click") || url.contains("taobao.com") || url.contains("tmall.com")
|
| | | || url.contains("m.tb.cn"))) {
|
| | | if (VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | data.put("baichuan", false);
|
| | | else
|
| | | data.put("baichuan", true);
|
| | | data.put("goodsDetail", true);// 需要拦截商品详情
|
| | | } else if (url != null && (url.contains("jd.com"))) {
|
| | | // 不能包含详情页
|
| | | String skuId = JDUtil.parseJDSkuIdByUrl(url);
|
| | | if (StringUtil.isNullOrEmpty(skuId))// 不能拦截详情页面,防止前端进入死循环
|
| | | if (url.startsWith("https://union-click.jd.com/jdc?"))
|
| | | data.put("goodsDetail", false);
|
| | | else
|
| | | data.put("goodsDetail", true);
|
| | | else
|
| | | data.put("goodsDetail", false);
|
| | |
|
| | | data.put("baichuan", false);// 不需要采用阿里百川的方式加载webview
|
| | |
|
| | | } else if (url != null && ((url.contains("yangkeduo.com") && !url.contains("yangkeduo.com/goods.html?")
|
| | | && !url.contains("yangkeduo.com/duo_coupon_landing.html?"))
|
| | | || (url.startsWith("https://p.pinduoduo.com/")))) {
|
| | | data.put("baichuan", false);// 不需要采用阿里百川的方式加载webview
|
| | | data.put("goodsDetail", true);// 不需要拦截商品详情
|
| | | } else {
|
| | | data.put("baichuan", false);// 不需要采用阿里百川的方式加载webview
|
| | | data.put("goodsDetail", false);// 不需要拦截商品详情
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取账号绑定中的配置信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | |
|
| | | @RequestMapping(value = "getBindAccountConfig", method = RequestMethod.POST)
|
| | | public void getBindAccountConfig(AcceptData acceptData, PrintWriter out) {
|
| | | String alipayHelpUrl = configService.get("alipay_help");// 支付宝帮助
|
| | | String alipayBindFailUrl = configService.get("alipay_bind_fail_reason");// 支付宝绑定失败原因
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("alipayHelp", alipayHelpUrl);
|
| | | data.put("alipayBindFailReason", alipayBindFailUrl);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getUserConfig", method = RequestMethod.POST)
|
| | | public void getUserConfig(AcceptData acceptData, PrintWriter out) {
|
| | | try {
|
| | | // 用户协议链接
|
| | | String serviceProtocol = configService.get("service_protocol_link");
|
| | | // 隐私条款链接
|
| | | String privacyProtocol = configService.get("privacy_protocol_link");
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("serviceProtocolLink", serviceProtocol);
|
| | | data.put("privacyProtocolLink", privacyProtocol);
|
| | | // 购物车跳转方式(包含jumpDetail与params)
|
| | | JSONObject source = JSONObject.fromObject(configService.get("taobao_cart_jump_detail"));
|
| | | data.put("taoBaoCart", source);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 订单解析配置
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getOrderParseConfig", method = RequestMethod.POST)
|
| | | public void getOrderParseConfig(AcceptData acceptData, int type, PrintWriter out) {
|
| | |
|
| | | switch (type) {
|
| | | case Constant.SOURCE_TYPE_TAOBAO:
|
| | | if ("0".equalsIgnoreCase(configService.get("auto_find_taobao_order")))
|
| | | out.print(JsonUtil.loadFalseResult(1, "暂不支持"));
|
| | | else {
|
| | | String orderJS = configService.get("taobao_order_parse_js");
|
| | | JSONObject data = new JSONObject();
|
| | | try {
|
| | | data.put("orderJS", DESUtil.encode(orderJS, StringUtil.getBase64String("YeShiFANLI889*+"),
|
| | | StringUtil.getBase64String("*M#34f?,")));
|
| | | data.put("orderUrl",
|
| | | DESUtil.encode("https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm",
|
| | | StringUtil.getBase64String("YeShiFANLI889*+"),
|
| | | StringUtil.getBase64String("*M#34f?,")));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | break;
|
| | |
|
| | | case Constant.SOURCE_TYPE_JD: {
|
| | |
|
| | | }
|
| | | break;
|
| | |
|
| | | case Constant.SOURCE_TYPE_PDD: {
|
| | |
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取订单配置
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | |
|
| | | @RequestMapping(value = "getOrderConfig", method = RequestMethod.POST)
|
| | | public void getOrderConfig(AcceptData acceptData, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | // 测试
|
| | | data.put("showTaoBaoOrder", "0".equalsIgnoreCase(configService.get("show_taobao_order").trim()) ? false : true);
|
| | | data.put("taoBaoOrderUrl", "https://main.m.taobao.com/olist/index.html");
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getKeFuConfig", method = RequestMethod.POST)
|
| | | public void getKeFuConfig(AcceptData acceptData, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("meiqia", "1".equalsIgnoreCase(configService.get("kefu_meiqia")) ? true : false);// 是否跳转美洽,不跳转美洽就用原来的
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | // 设置消息已读
|
| | | ThreadUtil.run(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | msgDeviceReadStateService.setDeviceMsgRead(MsgDeviceReadState.TYPE_KEFU, acceptData.getDevice(),
|
| | | "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取邀请码帮助链接
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getInviteCodeInputHelp", method = RequestMethod.POST)
|
| | | public void getInviteCodeInputHelp(AcceptData acceptData, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("helpUrl", configService.get("invite_code_input_help"));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.controller.client.v2; |
| | | |
| | | import java.io.InputStream; |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.yeshi.utils.HttpUtil; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.encrypt.DESUtil; |
| | | import org.yeshi.utils.entity.FileUploadResult; |
| | | import org.yeshi.utils.tencentcloud.COSManager; |
| | | |
| | | import com.yeshi.fanli.dto.taobao.api.TaoKeOfficialActivityConvertResultDTO; |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.fanli.entity.bus.homemodule.FloatAD; |
| | | import com.yeshi.fanli.entity.bus.homemodule.FloatAD.FloatADTypeEnum; |
| | | import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState; |
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog; |
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; |
| | | import com.yeshi.fanli.entity.common.JumpDetailV2; |
| | | import com.yeshi.fanli.entity.config.AppHomeFloatImg; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.taobao.ClientTBPid; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.homemodule.FloatADService; |
| | | import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService; |
| | | import com.yeshi.fanli.service.inter.redpack.UserTaoLiJinNewbiesService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; |
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; |
| | | import com.yeshi.fanli.service.inter.user.TBPidService; |
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.util.AESUtil; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.FilePathEnum; |
| | | import com.yeshi.fanli.util.ImageUtil; |
| | | import com.yeshi.fanli.util.RedisKeyEnum; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.TaoBaoConstant; |
| | | import com.yeshi.fanli.util.ThreadUtil; |
| | | import com.yeshi.fanli.util.VersionUtil; |
| | | import com.yeshi.fanli.util.jd.JDUtil; |
| | | import com.yeshi.fanli.util.suning.SuningUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.util.vipshop.VipShopUtil; |
| | | import com.yeshi.fanli.vo.elme.ElemeConvertInfoResultVO; |
| | | import com.yeshi.fanli.vo.homemodule.FloatImgDetailVO; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | /** |
| | | * 动态 |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | @Controller |
| | | @RequestMapping("api/v2/config") |
| | | public class ConfigControllerV2 { |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | @Resource |
| | | private TBPidService tbPidService; |
| | | |
| | | @Resource |
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService; |
| | | |
| | | @Resource |
| | | private UserInfoExtraService userInfoExtraService; |
| | | |
| | | @Resource |
| | | private FloatADService floatADService; |
| | | |
| | | @Resource |
| | | private JumpDetailV2Service jumpDetailV2Service; |
| | | |
| | | @Resource |
| | | private MsgDeviceReadStateService msgDeviceReadStateService; |
| | | |
| | | @Resource |
| | | private UserTaoLiJinOriginService uerTaoLiJinOriginService; |
| | | |
| | | @Resource |
| | | private UserActiveLogService userActiveLogService; |
| | | |
| | | @Resource |
| | | private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService; |
| | | |
| | | @Resource |
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | /** |
| | | * s 首页配置信息 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getHomeConfig", method = RequestMethod.POST) |
| | | public void getHomeConfig(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | if (uid != null && uid == 0L) |
| | | uid = null; |
| | | |
| | | AppHomeFloatImg appHomeFloatImg = configService.getAppHomeFloatImg(acceptData.getSystem()); |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && !Constant.IS_TEST) { |
| | | appHomeFloatImg = null; |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | if (appHomeFloatImg != null) { |
| | | data.put("floatImg", appHomeFloatImg); |
| | | } |
| | | |
| | | String notifyImg = configService.getAppHomeFloatNotifyImg(acceptData.getSystem()); |
| | | if (!StringUtil.isNullOrEmpty(notifyImg)) { |
| | | data.put("floatNotifyImg", notifyImg); |
| | | } |
| | | |
| | | // 无新人弹框 则查询默认 |
| | | FloatAD floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 0, acceptData.getSystem()); |
| | | |
| | | if (floatAD != null && floatAD.getTypeEnum() != FloatADTypeEnum.newUserRedPack) { |
| | | JSONObject detail = new JSONObject(); |
| | | detail.put("img", floatAD.getPicture()); |
| | | detail.put("jumpDetail", floatAD.getJumpDetail()); |
| | | detail.put("params", floatAD.getParams()); |
| | | detail.put("showTime", floatAD.getShowMode()); |
| | | detail.put("accountLogin", floatAD.isJumpNeedLogin()); |
| | | data.put("floatImgDetail", detail); |
| | | } |
| | | |
| | | // 领券帮助链接,1.5.2后生效 |
| | | String couponHelp = configService.getValue(ConfigKeyEnum.taobaoCouponHelp.getKey(), acceptData.getSystem()); |
| | | data.put("couponHelpUrl", couponHelp); |
| | | |
| | | // 底部网页链接 |
| | | String platform = acceptData.getPlatform(); |
| | | if ("android".equalsIgnoreCase(platform)) { |
| | | data.put("htmlLink", configService.getValue(ConfigKeyEnum.indexHtmlLinkAndroid.getKey(), acceptData.getSystem())); |
| | | } |
| | | |
| | | // 判断新老用户 |
| | | UserActiveLog da = null; |
| | | if (uid != null) |
| | | da = userActiveLogService.getFirstActiveInfo(uid); |
| | | // 新人 |
| | | if (da == null || (System.currentTimeMillis() - da.getCreateTime().getTime()) <= 1000 * 60 * 60 * 24 * 15L) { |
| | | data.put("userTimeType", 0); |
| | | } else {// 老人 |
| | | data.put("userTimeType", 1); |
| | | } |
| | | data.put("hotFuctionLink", configService.getByVersion(ConfigKeyEnum.hotFunctionUrl.getKey(), platform, |
| | | Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | /** |
| | | * s 首页配置信息 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getHomeConfigNew") |
| | | public void getHomeConfigNew(AcceptData acceptData, Long uid, String callback, PrintWriter out) { |
| | | if (uid != null && uid == 0L) |
| | | uid = null; |
| | | |
| | | String platform = acceptData.getPlatform(); |
| | | String version = acceptData.getVersion(); |
| | | |
| | | // 活动弹框 |
| | | List<FloatAD> listAD = new ArrayList<FloatAD>(); |
| | | List<FloatImgDetailVO> listVO = new ArrayList<FloatImgDetailVO>(); |
| | | List<FloatAD> list = floatADService.getValidFloatADCache(FloatAD.POSITION_INDEX, null, platform, |
| | | Integer.parseInt(version), acceptData.getSystem()); |
| | | if (list != null && !list.isEmpty()) |
| | | listAD.addAll(list); |
| | | |
| | | for (int i = 0; i < listAD.size(); i++) { |
| | | FloatAD floatAD = listAD.get(i); |
| | | FloatADTypeEnum typeEnum = floatAD.getTypeEnum(); |
| | | if (typeEnum == FloatADTypeEnum.newUserRedPack && (!VersionUtil.greaterThan_2_0_5(platform, version) |
| | | || !userTaoLiJinNewbiesService.verifyHasReward(uid, acceptData.getDevice()))) { |
| | | |
| | | listAD.remove(i); |
| | | i--; |
| | | continue; |
| | | } |
| | | |
| | | JumpDetailV2 jumpDetail = floatAD.getJumpDetail(); |
| | | if (jumpDetail != null) { |
| | | jumpDetail = jumpDetailV2Service.selectByPrimaryKey(jumpDetail.getId()); |
| | | if (jumpDetail != null) { |
| | | jumpDetail.setNeedLogin(floatAD.isJumpNeedLogin()); |
| | | } |
| | | } |
| | | FloatImgDetailVO floatImgVO = new FloatImgDetailVO(); |
| | | floatImgVO.setId(floatAD.getId().toString()); |
| | | floatImgVO.setImg(floatAD.getPicture()); |
| | | floatImgVO.setParams(floatAD.getParams()); |
| | | floatImgVO.setJumpDetail(jumpDetail); |
| | | floatImgVO.setShowTime(floatAD.getShowMode()); |
| | | floatImgVO.setAccountLogin(floatAD.isJumpNeedLogin()); |
| | | if (floatAD.getPlaySound() != null) |
| | | floatImgVO.setPlaySound(floatAD.getPlaySound());// 默认都播放音效 |
| | | else |
| | | floatImgVO.setPlaySound(false); |
| | | listVO.add(floatImgVO); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("listAD", JsonUtil.getApiCommonGson().toJson(listVO)); |
| | | data.put("protocol", configService.getValue(ConfigKeyEnum.userProtocolHomeData.getKey(), acceptData.getSystem())); |
| | | |
| | | // 领券帮助链接,1.5.2后生效 |
| | | String couponHelp = configService.getValue(ConfigKeyEnum.taobaoCouponHelp.getKey(), acceptData.getSystem()); |
| | | data.put("couponHelpUrl", couponHelp); |
| | | |
| | | // 判断新老用户 显示热门功能按钮滑动 |
| | | UserActiveLog da = null; |
| | | if (uid != null) |
| | | da = userActiveLogService.getFirstActiveInfo(uid); |
| | | // 新人 |
| | | if (da == null || (System.currentTimeMillis() - da.getCreateTime().getTime()) <= 1000 * 60 * 60 * 24 * 15L) { |
| | | data.put("userTimeType", 0); |
| | | } else {// 老人 |
| | | data.put("userTimeType", 1); |
| | | } |
| | | |
| | | // 是否显示热门功能按钮 |
| | | data.put("hotFuctionLink", |
| | | configService.getByVersion(ConfigKeyEnum.hotFunctionUrl.getKey(), platform, Integer.parseInt(version), acceptData.getSystem())); |
| | | if (StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | else |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | |
| | | /** |
| | | * 消息中心弹框 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getMSGConfig", method = RequestMethod.POST) |
| | | public void getMSGConfig(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | out.print(JsonUtil.loadFalseResult("推广红包相关功能已下线!")); |
| | | } |
| | | |
| | | @RequestMapping(value = "getTaoBaoCartConfig", method = RequestMethod.POST) |
| | | public void getTaoBaoCartConfig(AcceptData acceptData, String position, Long uid, PrintWriter out) { |
| | | if (uid == null || uid <= 0) { |
| | | out.print(JsonUtil.loadFalseResult("用户尚未登录")); |
| | | return; |
| | | } |
| | | |
| | | // 是否需要购物城转链 |
| | | boolean convert = "0".equalsIgnoreCase(configService.getValue(ConfigKeyEnum.showTaobaoCartConvert.getKey(), acceptData.getSystem())) ? false |
| | | : true; |
| | | |
| | | if (!"cart".equalsIgnoreCase(position) && !convert) { |
| | | out.print(JsonUtil.loadFalseResult("")); |
| | | return; |
| | | } |
| | | |
| | | ClientTBPid clientTBPid = null; |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { |
| | | clientTBPid = tbPidService.getIOSDefault(); |
| | | } else { |
| | | clientTBPid = tbPidService.getAndroidDefault(); |
| | | } |
| | | |
| | | String cartJS = configService.getValue(ConfigKeyEnum.taobaoCartJS.getKey(), acceptData.getSystem()); |
| | | String cartUrl = configService.getValue(ConfigKeyEnum.taobaoCartLink.getKey(), acceptData.getSystem()); |
| | | if (!convert)// 不转链 |
| | | { |
| | | cartUrl = "http://"; |
| | | cartJS = "-"; |
| | | } |
| | | String js = null; |
| | | String link = null; |
| | | try { |
| | | js = DESUtil.encode(cartJS, StringUtil.getBase64String("YeShiFANLI889*+"), |
| | | StringUtil.getBase64String("*M#34f?,")); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | link = DESUtil.encode(cartUrl, StringUtil.getBase64String("YeShiFANLI889*+"), |
| | | StringUtil.getBase64String("*M#34f?,")); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | data.put("js", js); |
| | | data.put("link", link); |
| | | data.put("tbPidInfo", clientTBPid); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | @RequestMapping(value = "getWebConfig", method = RequestMethod.POST) |
| | | public void getWebConfig(AcceptData acceptData, String url, PrintWriter out) { |
| | | JSONObject data = new JSONObject(); |
| | | |
| | | if (url != null && url.contains("ifeeds.tmall.com/article.html?")) { |
| | | if (VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) |
| | | data.put("baichuan", false); |
| | | else |
| | | data.put("baichuan", true); |
| | | data.put("goodsDetail", false); |
| | | } else if (url != null && (url.contains("s.click") || url.contains("taobao.com") || url.contains("tmall.com") |
| | | || url.contains("m.tb.cn"))) { |
| | | if (VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) |
| | | data.put("baichuan", false); |
| | | else |
| | | data.put("baichuan", true); |
| | | data.put("goodsDetail", true);// 需要拦截商品详情 |
| | | } else if (url != null && (url.contains("jd.com"))) { |
| | | // 不能包含详情页 |
| | | String skuId = JDUtil.parseJDSkuIdByUrl(url); |
| | | if (StringUtil.isNullOrEmpty(skuId))// 不能拦截详情页面,防止前端进入死循环 |
| | | if (url.startsWith("https://union-click.jd.com/jdc?")) |
| | | data.put("goodsDetail", false); |
| | | else |
| | | data.put("goodsDetail", true); |
| | | else |
| | | data.put("goodsDetail", false); |
| | | |
| | | data.put("baichuan", false);// 不需要采用阿里百川的方式加载webview |
| | | |
| | | } else if (url != null && (url.contains(".vip.com"))) {// 唯品会 |
| | | String goodsId = VipShopUtil.parseGoodsIdByUrl(url); |
| | | if (StringUtil.isNullOrEmpty(goodsId))// 不能拦截详情页面,防止前端进入死循环 |
| | | data.put("goodsDetail", true); |
| | | else |
| | | data.put("goodsDetail", false); |
| | | } else if (url != null && (url.contains(".suning.com"))) {// 苏宁 |
| | | String goodsId = SuningUtil.parseGoodsIdByUrl(url); |
| | | if (StringUtil.isNullOrEmpty(goodsId))// 不能拦截详情页面,防止前端进入死循环 |
| | | data.put("goodsDetail", true); |
| | | else |
| | | data.put("goodsDetail", false); |
| | | } else if (url != null && ((url.contains("yangkeduo.com") && !url.contains("yangkeduo.com/goods.html?") |
| | | && !url.contains("yangkeduo.com/duo_coupon_landing.html?")) |
| | | || (url.startsWith("https://p.pinduoduo.com/")))) { |
| | | data.put("baichuan", false);// 不需要采用阿里百川的方式加载webview |
| | | data.put("goodsDetail", true);// 不需要拦截商品详情 |
| | | } else { |
| | | data.put("baichuan", false);// 不需要采用阿里百川的方式加载webview |
| | | data.put("goodsDetail", false);// 不需要拦截商品详情 |
| | | } |
| | | // TODO 前端需要处理 |
| | | // if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), |
| | | // acceptData.getVersion())) { |
| | | // JSONObject js = new JSONObject(); |
| | | // String jsStr = configService.get("url_extract_id"); |
| | | // String md5 = StringUtil.Md5(jsStr); |
| | | // js.put("md5", md5); |
| | | // data.put("js", js); |
| | | // } |
| | | |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | @RequestMapping(value = "getWebJS", method = RequestMethod.POST) |
| | | public void getWebJS(AcceptData acceptData, PrintWriter out) { |
| | | JSONObject data = new JSONObject(); |
| | | String urlIdJS = configService.getValue("url_extract_id", acceptData.getSystem()); |
| | | data.put("urlIdJSMD5", StringUtil.Md5(urlIdJS)); |
| | | data.put("urlIdJS", AESUtil.encrypt(urlIdJS, Constant.UIDAESKEY)); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | /** |
| | | * 获取账号绑定中的配置信息 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | |
| | | @RequestMapping(value = "getBindAccountConfig", method = RequestMethod.POST) |
| | | public void getBindAccountConfig(AcceptData acceptData, PrintWriter out) { |
| | | String alipayHelpUrl = configService.getValue(ConfigKeyEnum.alipayHelp.getKey(), acceptData.getSystem());// 支付宝帮助 |
| | | String alipayBindFailUrl = configService.getValue(ConfigKeyEnum.alipayBindFailReason.getKey(), acceptData.getSystem());// 支付宝绑定失败原因 |
| | | JSONObject data = new JSONObject(); |
| | | data.put("alipayHelp", alipayHelpUrl); |
| | | data.put("alipayBindFailReason", alipayBindFailUrl); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | /** |
| | | * 获取订单配置 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | |
| | | @RequestMapping(value = "getOrderConfig", method = RequestMethod.POST) |
| | | public void getOrderConfig(AcceptData acceptData, PrintWriter out) { |
| | | JSONObject data = new JSONObject(); |
| | | // 测试 |
| | | data.put("showTaoBaoOrder", |
| | | "0".equalsIgnoreCase(configService.getValue(ConfigKeyEnum.showTaobaoOrder.getKey(), acceptData.getSystem()).trim()) ? false : true); |
| | | data.put("taoBaoOrderUrl", "https://main.m.taobao.com/olist/index.html"); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | @RequestMapping(value = "getKeFuConfig", method = RequestMethod.POST) |
| | | public void getKeFuConfig(AcceptData acceptData, PrintWriter out) { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("meiqia", "1".equalsIgnoreCase(configService.getValue(ConfigKeyEnum.kefuMeiqia.getKey(), acceptData.getSystem())) ? true : false);// 是否跳转美洽,不跳转美洽就用原来的 |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | // 设置消息已读 |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | msgDeviceReadStateService.setDeviceMsgRead(MsgDeviceReadState.TYPE_KEFU, acceptData.getDevice(), |
| | | "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 获取邀请码帮助链接 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getInviteCodeInputHelp", method = RequestMethod.POST) |
| | | public void getInviteCodeInputHelp(AcceptData acceptData, PrintWriter out) { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("helpUrl", configService.getValue(ConfigKeyEnum.inviteCodeInputHelp.getKey(), acceptData.getSystem())); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | /** |
| | | * 获取饿了么的推广链接 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param out |
| | | */ |
| | | @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 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()); |
| | | if (dto != null) |
| | | elmeLink = dto.getShort_click_url(); |
| | | if (!StringUtil.isNullOrEmpty(elmeLink)) { |
| | | redisManager.cacheCommonString(key, elmeLink, 60 * 60);// 缓存1个小时 |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | |
| | | // data.put("hongBao", |
| | | // configService.get("eleme_hongbao_link").replace("{用户ID}", uid + "")); |
| | | // data.put("goods", |
| | | // configService.get("eleme_goods_link").replace("{用户ID}", uid + "")); |
| | | |
| | | 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]); |
| | | data.put("taoKeParams", clientTBPid1); |
| | | if (StringUtil.isNullOrEmpty(callback)) |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | else |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); |
| | | } |
| | | |
| | | /** |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param activityId 活动ID |
| | | * @param share -是否为分享 |
| | | * @param callback |
| | | * @param out void 返回类型 |
| | | * @throws |
| | | * @Title: getElemeLinkNew |
| | | * @Description: |
| | | */ |
| | | @RequestMapping(value = "getElemeLinkNew") |
| | | public void getElemeLinkNew(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.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], |
| | | activityId, userInfoExtra.getRelationId()); |
| | | } else { |
| | | dto = TaoKeApiUtil.officialActivityConvert(TaoBaoConstant.TAOBAO_ELEME_PID.split("_")[3], activityId, |
| | | userInfoExtra.getRelationId()); |
| | | } |
| | | |
| | | if (dto != null) { |
| | | if (share) {// 生成口令 |
| | | String token = TaoKeApiUtil.getTKToken("http://", "饿了么", dto.getShort_click_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.getShort_click_url()); |
| | | dto.setToken(TaoBaoUtil.filterTaoToken(token)); |
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(dto), 60 * 60);// 缓存1个小时 |
| | | } |
| | | |
| | | } |
| | | |
| | | ElemeConvertInfoResultVO info = new ElemeConvertInfoResultVO(null, dto.getToken(), dto.getShort_click_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_ELEME_PID, null, |
| | | TaoBaoConstant.TAOBAO_ELEME_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))); |
| | | } |
| | | |
| | | @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))); |
| | | } |
| | | |
| | | /** |
| | | * 获取饿了么的推广链接 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param out |
| | | */ |
| | | @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("")); |
| | | } |
| | | |
| | | /** |
| | | * 是否显示广告 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param out void 返回类型 |
| | | * @throws |
| | | * @Title: showAd |
| | | * @Description: |
| | | */ |
| | | @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 data = new JSONObject(); |
| | | if ("0".equalsIgnoreCase(value.trim())) { |
| | | 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)); |
| | | } |
| | | |
| | | /** |
| | | * 获取注销协议 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getLogoutProtocol") |
| | | public void getLogoutProtocol(String callback, AcceptData acceptData, PrintWriter out) { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("link", configService.getValue(ConfigKeyEnum.accountLogoutProtocolLink.getKey(), acceptData.getSystem())); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } |
| | | } |