admin
2019-04-12 2406574c36a8c4e8e8ffe7c56a34e25dde107a84
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java
@@ -14,6 +14,7 @@
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.taobao.TaoBaoUnionAuthRecord;
import com.yeshi.fanli.exception.user.UserExtraTaoBaoInfoException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionAuthRecordService;
import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
@@ -90,14 +91,57 @@
                  TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
            if (StringUtil.isNullOrEmpty(relationId))
               LogHelper.test(uid + "渠道备案失败");
            userExtraTaoBaoInfoService.addRelationId(uid, relationId, taoBaoUid, true);
         } else {
            try {
               userExtraTaoBaoInfoService.addRelationId(uid, relationId, taoBaoUid,nickName, true);
            } catch (UserExtraTaoBaoInfoException e) {
               LogHelper.test(e.getMsg());
               errCode = 5;
            }
         } else if ("zigou".equalsIgnoreCase(source))  {
            String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
                  TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
            if (StringUtil.isNullOrEmpty(specialId))
               LogHelper.test(uid + "会员备案失败");
            userExtraTaoBaoInfoService.addSpecialId(uid, specialId, taoBaoUid, true);
            try {
               userExtraTaoBaoInfoService.addSpecialId(uid, specialId, taoBaoUid, nickName, true);
            } catch (UserExtraTaoBaoInfoException e) {
               LogHelper.test(e.getMsg());
               errCode = 5;
            }
         } else if ("bind".equalsIgnoreCase(source)) {
            boolean bindInfo = true;
            // 绑定淘宝:V1.5.3
            String relationId = TaoKeApiUtil.getRelationId(accessToken, Constant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET);// 渠道ID
            if (StringUtil.isNullOrEmpty(relationId)) {
               LogHelper.test(uid + "渠道备案失败");
               bindInfo = false;
            }
            String specialId = null;
            if(bindInfo) {
               specialId = TaoKeApiUtil.getSpecialId(accessToken, Constant.TAOBAO_AUTH_APPKEY,
                     TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
               if (StringUtil.isNullOrEmpty(specialId)) {
                  LogHelper.test(uid + "会员备案失败");
                  bindInfo = false;
               }
            }
            if (!bindInfo) {
               errCode = 5;// 信息获取不全
            } else {
               try {
                  userExtraTaoBaoInfoService.saveUserTaoBaoInfo(uid, relationId, specialId, taoBaoUid, nickName, true);
               } catch (UserExtraTaoBaoInfoException e) {
                  LogHelper.test(e.getMsg());
                  errCode = 6;
               }
            }
         }
         if (!StringUtil.isNullOrEmpty(nickName))
            try {
@@ -112,6 +156,7 @@
         record.setTaoBaoUserNick(nickName);
         record.setCreateTime(new Date());
         taoBaoUnionAuthRecordService.addAuthRecord(record);
      } catch (Exception e) {
         errCode = 4;
         try {
@@ -124,15 +169,21 @@
      try {
         if (errCode == 0)// 成功
         {
            if ("share".equalsIgnoreCase(source))
            if ("share".equalsIgnoreCase(source)) {
               response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_bonusState.html?code=0");
            else
            } else if ("zigou".equalsIgnoreCase(source)) {
               response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_rebateState.html?code=0");
            } else if ("bind".equalsIgnoreCase(source)) {
               response.getWriter().print("<script>yestv.toast(\"恭喜你,淘宝绑定成功\");yestv.finishPage();</script>");
            }
         } else {// 失败
            if ("share".equalsIgnoreCase(source))
            if ("share".equalsIgnoreCase(source)) {
               response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_bonusState.html?code=1");
            else
            } else if ("zigou".equalsIgnoreCase(source)) {
               response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_rebateState.html?code=1");
            } else if ("bind".equalsIgnoreCase(source)) {
               response.getWriter().print("<script>yestv.toast(\"抱歉,淘宝绑定失败\");yestv.finishPage();</script>");
            }
         }
      } catch (Exception e) {