yujian
2019-05-20 c4d752a1d340652d9c7d2abb5abff65cdee40d69
fanli/src/main/java/com/yeshi/fanli/controller/client/UserAuthController.java
@@ -61,80 +61,6 @@
         return;
      }
      
      //
      UserExtraTaoBaoInfo user = userExtraTaoBaoInfoService.getByUid(uid);
      if ("share".equalsIgnoreCase(source)) {
         if (user != null && !StringUtil.isNullOrEmpty(user.getRelationId()) && user.getRelationValid()) {
            out.print(JsonUtil.loadFalseResult(1, "无需授权"));
            return;
         }
      } else {
         if (user != null && !StringUtil.isNullOrEmpty(user.getSpecialId()) && user.getSpecialValid()) {
            out.print(JsonUtil.loadFalseResult(1, "无需授权"));
            return;
         }
      }
      String link = TaoBaoUtil.getTaoBaoUnionAuthUrl(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
            "http://api.flqapp.com/fanli/client/v1/auth/callback/tb", uid, source);
      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();
      data.put("authLink", link);
      try {
         data.put("orderJS", DESUtil.encode(orderJS, StringUtil.getBase64String("YeShiFANLI889*+"),
               StringUtil.getBase64String("*M#34f?,")));
      } catch (Exception e) {
         e.printStackTrace();
      }
      data.put("orderUrl", "https://buyertrade.taobao.com/trade/itemlist/list_bought_items.htm");
      if (first)
         out.print(JsonUtil.loadTrueResult(data));
      else
         out.print(JsonUtil.loadTrue(0, data, "淘宝授权未成功,请稍后再试"));
   }
   /**
    * 获取淘宝授权信息
    *
    * @param acceptData
    * @param uid
    * @param source
    * @param out
    */
   @RequestMapping(value = "getTaoBaoAuthInfoNew", method = RequestMethod.POST)
   public void getTaoBaoAuthInfoNew(AcceptData acceptData, Long uid, String source, Boolean first, PrintWriter out) {
      if (uid == null) {
         out.print(JsonUtil.loadFalseResult(2, "用户未登录"));
         return;
      }
      if (StringUtil.isNullOrEmpty(source)) {
         out.print(JsonUtil.loadFalseResult(3, "来源错误"));
         return;
      }
      if (first == null) {
         out.print(JsonUtil.loadFalseResult(4, "请传first"));
         return;
      }
      if (!"1".equalsIgnoreCase(configService.get("open_speical_and_relation_apply"))) {
         out.print(JsonUtil.loadFalseResult(1, "暂不开放申请"));
         return;
      }
      //
      UserExtraTaoBaoInfo user = userExtraTaoBaoInfoService.getByUid(uid);
      if ("share".equalsIgnoreCase(source)) {
         if (user != null && !StringUtil.isNullOrEmpty(user.getRelationId()) && user.getRelationValid()) {
@@ -152,8 +78,7 @@
      String link = TaoBaoUtil.getTaoBaoUnionAuthUrl(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
            "http://api.flqapp.com/fanli/client/v1/auth/callback/tb", uid, source);
      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)}";
      String orderJS=configService.get("taobao_order_parse_js");
      JSONObject data = new JSONObject();
      data.put("authLink", link);
      try {
@@ -169,6 +94,7 @@
      else
         out.print(JsonUtil.loadTrue(0, data, "淘宝授权未成功,请稍后再试"));
   }
}