yujian
2019-07-10 aad0554cc7f18a6ec05e2e5e646b5e501d41617d
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Date;
@@ -100,7 +101,7 @@
            nickName = URLDecoder.decode(nickName, "UTF-8");
         } catch (Exception e) {
         }
         final String name=nickName;
         final String name = nickName;
         // LogHelper.test("uid:" + uid + "\n accessToken:" + accessToken);
         // 获取渠道ID与会员ID
@@ -115,9 +116,9 @@
               LogHelper.test(e.getMsg());
               errCode = 5;
            }
            //异步申请会员ID
                ThreadUtil.run(new Runnable() {
            // 异步申请会员ID
            ThreadUtil.run(new Runnable() {
               @Override
               public void run() {
                  String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
@@ -132,7 +133,7 @@
                  }
               }
            });
         } else if ("zigou".equalsIgnoreCase(source)) {
            String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                  TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
@@ -145,11 +146,10 @@
               LogHelper.test(e.getMsg());
               errCode = 5;
            }
            //异步申请渠道ID
                ThreadUtil.run(new Runnable() {
            // 异步申请渠道ID
            ThreadUtil.run(new Runnable() {
               @Override
               public void run() {
                  String relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
@@ -163,7 +163,7 @@
                  }
               }
            });
         } else if ("bind".equalsIgnoreCase(source)) {
            boolean bindInfo = true;
@@ -215,20 +215,18 @@
      } catch (Exception e) {
         errCode = 4;
         try {
            LogHelper.errorDetailInfo(e);
         } catch (Exception e1) {
            e1.printStackTrace();
         }
         LogHelper.errorDetailInfo(e);
      }
      try {
         if (errCode == 0)// 成功
         {
            if ("share".equalsIgnoreCase(source)) {
               response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_bonusState.html?code=0");
               // response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_bonusState.html?code=0");
               closeWebPage(response.getWriter());
            } else if ("zigou".equalsIgnoreCase(source)) {
               response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_rebateState.html?code=0");
               // response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_rebateState.html?code=0");
               closeWebPage(response.getWriter());
            } else if ("bind".equalsIgnoreCase(source)) {
               String script = String.format(
                     "<script>if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {window.location.href = 'yestv://toast#%s';setTimeout(function(){window.location.href = 'yestv://finishPage';},100);} else {yestv.toast(\"恭喜你,淘宝绑定成功\");yestv.finishPage();}</script>",
@@ -237,9 +235,11 @@
            }
         } else {// 失败
            if ("share".equalsIgnoreCase(source)) {
               response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_bonusState.html?code=1");
               // response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_bonusState.html?code=1");
               closeWebPage(response.getWriter());
            } else if ("zigou".equalsIgnoreCase(source)) {
               response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_rebateState.html?code=1");
               // response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_rebateState.html?code=1");
               closeWebPage(response.getWriter());
            } else if ("bind".equalsIgnoreCase(source)) {
               String script = String.format(
                     "<script>if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {window.location.href = 'yestv://toast#%s';setTimeout(function(){window.location.href = 'yestv://finishPage';},100);} else {yestv.toast(\"抱歉,淘宝绑定失败\");yestv.finishPage();}</script>",
@@ -253,4 +253,14 @@
   }
   private void closeWebPage(PrintWriter out) {
      String script = "<script>if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {setTimeout(function(){window.location.href = 'yestv://finishPage';},100);} else {yestv.finishPage();}</script>";
      out.print(script);
   }
   @RequestMapping(value = "pinduoduo")
   public void pinDuoDuo(HttpServletResponse response) {
   }
}