| | |
| | | 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.config.AppHomeFloatImg;
|
| | | import com.yeshi.fanli.entity.taobao.ClientTBPid;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import com.yeshi.fanli.service.inter.homemodule.FloatADService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private TBPidService tbPidService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private FloatADService floatADService;
|
| | | |
| | | |
| | | /**
|
| | | * 首页配置信息
|
| | | *
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHomeConfig", method = RequestMethod.POST)
|
| | | public void getHomeConfig(AcceptData acceptData, PrintWriter out) {
|
| | | public void getHomeConfig(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | AppHomeFloatImg appHomeFloatImg = configService.getAppHomeFloatImg();
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && !Constant.IS_TEST) {
|
| | | appHomeFloatImg = null;
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | if (appHomeFloatImg != null)
|
| | | if (appHomeFloatImg != null) {
|
| | | data.put("floatImg", appHomeFloatImg);
|
| | | }
|
| | | |
| | | String notifyImg = configService.getAppHomeFloatNotifyImg();
|
| | | if (!StringUtil.isNullOrEmpty(notifyImg)) {
|
| | | data.put("floatNotifyImg", notifyImg);
|
| | | }
|
| | | |
| | | // 悬浮大图 1.5.2 -2019.3.20
|
| | | FloatAD floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX);
|
| | | 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());
|
| | | |
| | | if (uid != null && userInfoExtraService.isNewUser(uid)) {
|
| | | // 新用户
|
| | | data.put("floatImgDetail", detail);
|
| | | } else {
|
| | | 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"));
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getTaoBaoCartConfig", method = RequestMethod.POST)
|
| | | public void getTaoBaoCartConfig(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | 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");
|
| | | 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("s.click") || url.contains("taobao.com") || url.contains("tmall.com"))) {
|
| | | data.put("baichuan", true);// 采用阿里百川的方式加载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);
|
| | | 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, PrintWriter out) {
|
| | | String orderJS = "var orderId= document.getElementById('tp-bought-root').getElementsByClassName('js-order-container')[0].getElementsByTagName('div')[0].getAttribute('data-id');";
|
| | | orderJS += "if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {window.location.href='yestv://taobaoorder#'+orderId;} else {window.handle.showOrder(orderId)}";
|
| | | 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));
|
| | | }
|
| | | }
|