| | |
| | | package com.yeshi.fanli.controller.client.v1;
|
| | |
|
| | | 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.config.AppHomeFloatImg;
|
| | | import com.yeshi.fanli.entity.taobao.ClientTBPid;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | 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;
|
| | |
|
| | | /**
|
| | | * 动态
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Controller("ConfigController1")
|
| | | @RequestMapping("api/v1/config")
|
| | | public class ConfigController {
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private TBPidService tbPidService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private FloatADService floatADService;
|
| | | |
| | | |
| | | /**
|
| | | * 首页配置信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHomeConfig", method = RequestMethod.POST)
|
| | | 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) {
|
| | | 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));
|
| | | }
|
| | | }
|
| | | package com.yeshi.fanli.controller.client.v1; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.json.JSONArray; |
| | | 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.homemodule.FloatAD.FloatADTypeEnum; |
| | | import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState; |
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale; |
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify; |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo; |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo; |
| | | 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.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.homemodule.SwiperPictureService; |
| | | import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService; |
| | | import com.yeshi.fanli.service.inter.user.TBPidService; |
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; |
| | | import com.yeshi.fanli.service.inter.user.notify.UserActivedRecordService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserLevelUpgradedNotifyService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.ThreadUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import com.yeshi.fanli.util.VersionUtil; |
| | | import com.yeshi.fanli.vo.homemodule.BannerVO; |
| | | import com.yeshi.fanli.vo.user.UserDialogBtnVO; |
| | | import com.yeshi.fanli.vo.user.UserDialogVO; |
| | | import com.yeshi.fanli.vo.user.VIPUpgradedNotifyVO; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | /** |
| | | * 动态 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Controller("ConfigController1") |
| | | @RequestMapping("api/v1/config") |
| | | public class ConfigController { |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | @Resource |
| | | private TBPidService tbPidService; |
| | | |
| | | @Resource |
| | | private FloatADService floatADService; |
| | | |
| | | @Resource |
| | | private JumpDetailV2Service jumpDetailV2Service; |
| | | |
| | | @Resource |
| | | private MsgDeviceReadStateService msgDeviceReadStateService; |
| | | |
| | | @Resource |
| | | private UserActiveLogService userActiveLogService; |
| | | |
| | | @Resource |
| | | private SwiperPictureService swiperPictureService; |
| | | |
| | | @Resource |
| | | private UserActivedRecordService userActivedRecordService; |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private UserVIPInfoService userVIPInfoService; |
| | | |
| | | @Resource |
| | | private UserVIPPreInfoService userVIPPreInfoService; |
| | | |
| | | @Resource |
| | | private UserLevelUpgradedNotifyService userLevelUpgradedNotifyService; |
| | | |
| | | @Resource |
| | | private ThreeSaleSerivce threeSaleSerivce; |
| | | |
| | | @Resource |
| | | private UserVipConfigService userVipConfigService; |
| | | |
| | | /** |
| | | * 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)); |
| | | } |
| | | |
| | | /** |
| | | * 消息中心弹框 |
| | | * |
| | | * @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("s.click") || url.contains("taobao.com") || url.contains("tmall.com") |
| | | || url.contains("m.tb.cn"))) { |
| | | 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.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 uid |
| | | * @param id |
| | | * @param type |
| | | * 0-关闭 1-点击右边按钮 2-点击左边按钮 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "closeDialogNotify", method = RequestMethod.POST) |
| | | public void closeDialogNotify(AcceptData acceptData, Long uid, String id, String sourceId, int type, |
| | | PrintWriter out) { |
| | | |
| | | if (uid == null) { |
| | | out.print(JsonUtil.loadFalseResult("用户未登录")); |
| | | return; |
| | | } |
| | | if (StringUtil.isNullOrEmpty(id)) { |
| | | out.print(JsonUtil.loadFalseResult("id为空")); |
| | | return; |
| | | } |
| | | if (id.equalsIgnoreCase("tearcherNotify")) { |
| | | userActivedRecordService.setTearcherNotified(uid); |
| | | out.print(JsonUtil.loadTrueResult("")); |
| | | } else if (id.equalsIgnoreCase("vipUpgradedNotify")) { |
| | | userLevelUpgradedNotifyService.setNotified(sourceId); |
| | | out.print(JsonUtil.loadTrueResult("")); |
| | | } else { |
| | | out.print(JsonUtil.loadFalseResult("id不存在")); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "getUserConfig", method = RequestMethod.POST) |
| | | public void getUserConfig(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | try { |
| | | // 用户协议链接 |
| | | String serviceProtocol = configService.getValue(ConfigKeyEnum.serviceProtocolLink.getKey(),acceptData.getSystem()); |
| | | // 隐私条款链接 |
| | | String privacyProtocol = configService.getValue(ConfigKeyEnum.privacyProtocolLink.getKey(),acceptData.getSystem()); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("serviceProtocolLink", serviceProtocol); |
| | | data.put("privacyProtocolLink", privacyProtocol); |
| | | // 购物车跳转方式(包含jumpDetail与params) |
| | | JSONObject source = JSONObject |
| | | .fromObject(configService.getByVersion(ConfigKeyEnum.taobaoCartJumpDetail.getKey(), |
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())); |
| | | data.put("taoBaoCart", source); |
| | | |
| | | if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | // IOS正在上线版本 |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) { |
| | | data.put("banner", new JSONArray()); |
| | | } else { |
| | | // 我的界面banner |
| | | List<BannerVO> banner = swiperPictureService.getByBannerCardAndVersion("my_interface_banner", |
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); |
| | | if (banner == null) |
| | | banner = new ArrayList<BannerVO>(); |
| | | data.put("banner", JsonUtil.getApiCommonGson().toJson(banner)); |
| | | } |
| | | } |
| | | |
| | | if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | // 转链的网页链接 |
| | | String convertLinkUrl = configService.getValue(ConfigKeyEnum.convertDocWebLink.getKey(),acceptData.getSystem()); |
| | | data.put("convertLinkUrl", convertLinkUrl); |
| | | if (uid != null) { |
| | | |
| | | String tearcherLink = configService.getByVersion(ConfigKeyEnum.tearcherLink.getKey(), |
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); |
| | | if (userActivedRecordService.canNotifyAddTearcher(uid) && !StringUtil.isNullOrEmpty(tearcherLink)) { |
| | | UserInfo userInfo = userInfoService.selectAvailableByPrimaryKey(uid); |
| | | if (userInfo != null) { |
| | | JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("web", |
| | | Constant.getPlatformCode(acceptData.getPlatform()), |
| | | Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); |
| | | |
| | | JSONObject negativeParams = new JSONObject(); |
| | | negativeParams.put("url", configService.getByVersion(ConfigKeyEnum.newerGonglue.getKey(), |
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())); |
| | | |
| | | JSONObject positiveParams = new JSONObject(); |
| | | positiveParams.put("url", tearcherLink); |
| | | |
| | | UserDialogVO dialog = new UserDialogVO("tearcherNotify", true, |
| | | "HI," + userInfo.getNickName(), |
| | | "我是你的导师,为你在省赚过程中解难答疑,对你一对一辅导,倾听你的需求总结并反馈给板栗快省官方运营团队,快来添加我吧。", |
| | | new UserDialogBtnVO("复制导师微信", jumpDetail, positiveParams), |
| | | new UserDialogBtnVO("去新手攻略", jumpDetail, negativeParams)); |
| | | data.put("dialog", dialog); |
| | | } |
| | | } |
| | | |
| | | data.put("tearcherLink", tearcherLink); |
| | | } |
| | | } |
| | | |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | UserVIPPreInfo info = userVIPPreInfoService.getLatestProcessInfo(uid); |
| | | JSONObject inner = new JSONObject(); |
| | | inner.put("link", userVipConfigService.getValueByKey("vip_link")); |
| | | inner.put("ion", "http://img.flqapp.com/resource/vip/icon_vip.png"); |
| | | inner.put("title", "免费升级 享会员权益"); |
| | | inner.put("btnName", "升级会员"); |
| | | |
| | | if (uid != null) { |
| | | if (info != null && info.getProcess() >= UserVIPPreInfo.PROCESS_3) { |
| | | inner.put("link", userVipConfigService.getValueByKey("vip_link")); |
| | | inner.put("ion", "http://img.flqapp.com/resource/vip/icon_tearcher.png"); |
| | | inner.put("title", "拿五险与津贴 享导师权益"); |
| | | if (info.getProcess() == UserVIPPreInfo.PROCESS_4) |
| | | inner.put("btnName", "板栗快省"); |
| | | else |
| | | inner.put("btnName", "升级导师"); |
| | | } else { |
| | | UserVIPPreInfo userVIPPreInfo = userVIPPreInfoService.getLatestProcessInfo(uid); |
| | | if (userVIPPreInfo != null) { |
| | | if (userVIPPreInfo.getProcess() == UserVIPPreInfo.PROCESS_1) { |
| | | inner.put("btnName", "升级高级会员"); |
| | | } else if (userVIPPreInfo.getProcess() == UserVIPPreInfo.PROCESS_2) { |
| | | inner.put("btnName", "升级超级会员"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // IOS正在上线 |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) { |
| | | } else |
| | | data.put("vip", inner); |
| | | // 平台规则 |
| | | String platformRuleLink = configService.getValue(ConfigKeyEnum.platformRule.getKey(),acceptData.getSystem()); |
| | | data.put("platformRule", platformRuleLink); |
| | | } |
| | | |
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()) && uid != null) { |
| | | UserLevelUpgradedNotify notify = userLevelUpgradedNotifyService.getNeedNotifyByUid(uid); |
| | | if (notify != null) { |
| | | Date endTime = getUpgradedTime(uid, notify.getToLevel()); |
| | | Date startTime = getUpgradedTime(uid, notify.getFromLevel()); |
| | | if (endTime != null && startTime != null) { |
| | | VIPUpgradedNotifyVO notifyVO = new VIPUpgradedNotifyVO(); |
| | | notifyVO.setDay(TimeUtil.getDayDifferenceCount(startTime, endTime)); |
| | | notifyVO.setDetailLink(notify.getToLevel().getDetailLink()); |
| | | notifyVO.setFromLevelName(notify.getFromLevel().getName()); |
| | | notifyVO.setId("vipUpgradedNotify"); |
| | | notifyVO.setSourceId(notify.getId()); |
| | | notifyVO.setToLevel(notify.getToLevel().getTag()); |
| | | notifyVO.setToLevelName(notify.getToLevel().getName()); |
| | | data.put("vipUpgradedNotify", notifyVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 云发单链接 |
| | | if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpen.getKey(),acceptData.getPlatform(), acceptData.getVersion(),acceptData.getSystem()); |
| | | if (!cloudOpen && uid != null) { |
| | | List<String> testUsers = configService.getTestUsers(acceptData.getSystem()); |
| | | if (testUsers != null && testUsers.contains(uid+"")) { |
| | | cloudOpen = true; |
| | | } |
| | | } |
| | | |
| | | if (cloudOpen) { |
| | | data.put("cloudLink", configService.getValue(ConfigKeyEnum.robotCloudLink.getKey(),acceptData.getSystem())); |
| | | } |
| | | } |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult("获取失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | // 获取升级时间 |
| | | private Date getUpgradedTime(Long uid, UserLevelEnum level) { |
| | | Date time = null; |
| | | if (level == UserLevelEnum.superVIP) { |
| | | UserVIPInfo vipInfo = userVIPInfoService.selectByUid(uid); |
| | | if (vipInfo != null && vipInfo.getState() == UserVIPInfo.STATE_SUCCESS) |
| | | time = vipInfo.getSuccessTime(); |
| | | |
| | | } else if (level == UserLevelEnum.highVIP) { |
| | | UserVIPPreInfo info = userVIPPreInfoService.selectByUidAndProcess(uid, level.getLevel()); |
| | | if (info != null) |
| | | time = info.getCreateTime(); |
| | | } else if (level == UserLevelEnum.daRen) { |
| | | |
| | | // 成为达人的时间,用户激活时间 |
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid); |
| | | if (threeSale != null && threeSale.getState() == true && threeSale.getSucceedTime() != null) { |
| | | time = new Date(threeSale.getSucceedTime()); |
| | | } else {// 取用户注册时间 |
| | | UserInfo user = userInfoService.selectAvailableByPrimaryKey(uid); |
| | | time = new Date(user.getCreatetime()); |
| | | } |
| | | } |
| | | |
| | | return time; |
| | | } |
| | | |
| | | /** |
| | | * 订单解析配置 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getOrderParseConfig", method = RequestMethod.POST) |
| | | public void getOrderParseConfig(AcceptData acceptData, PrintWriter out) { |
| | | |
| | | if ("0".equalsIgnoreCase(configService.getValue(ConfigKeyEnum.autoFindTaobaoOrder.getKey(),acceptData.getSystem()))) |
| | | out.print(JsonUtil.loadFalseResult(1, "暂不支持")); |
| | | else { |
| | | String orderJS = configService.getValue(ConfigKeyEnum.taobaoOrderParseJS.getKey(),acceptData.getSystem()); |
| | | 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)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取订单配置 |
| | | * |
| | | * @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)); |
| | | } |
| | | |
| | | } |