| | |
| | |
|
| | | 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;
|
| | |
| | | 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 {
|
| | |
| | | record.setTaoBaoUserNick(nickName);
|
| | | record.setCreateTime(new Date());
|
| | | taoBaoUnionAuthRecordService.addAuthRecord(record);
|
| | | |
| | | } catch (Exception e) {
|
| | | errCode = 4;
|
| | | try {
|
| | |
| | | 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) {
|
| | |
|