| @@ -60,23 +60,23 @@ public class AliPayController extends BaseController { | |||||
| if ("alipay_app_auth".equals(source)) { | if ("alipay_app_auth".equals(source)) { | ||||
| String tenantId = request.getParameter("state"); | String tenantId = request.getParameter("state"); | ||||
| if (StringUtils.isBlank(tenantId)) { | if (StringUtils.isBlank(tenantId)) { | ||||
| out.print("参数错误!tenantId为空."); | |||||
| out.print("Param Error!tenantId is null."); | |||||
| }else { | }else { | ||||
| WxMall wxMall = mallService.getByTenantId(tenantId); | WxMall wxMall = mallService.getByTenantId(tenantId); | ||||
| if (null == wxMall ) { | if (null == wxMall ) { | ||||
| out.print("参数错误!wxMall未查询到."); | |||||
| out.print("Auth Failed!wxMall not fond."); | |||||
| }else { | }else { | ||||
| String appAuthCode = request.getParameter("app_auth_code"); | String appAuthCode = request.getParameter("app_auth_code"); | ||||
| if (StringUtils.isBlank(appAuthCode)) { | if (StringUtils.isBlank(appAuthCode)) { | ||||
| out.print("参数错误!app_auth_code为空."); | |||||
| out.print("Auth Failed!app_auth_code is null."); | |||||
| }else { | }else { | ||||
| String token = alipayUtil.getAppAuthToken(appAuthCode); | String token = alipayUtil.getAppAuthToken(appAuthCode); | ||||
| if (StringUtils.isBlank(token)) { | if (StringUtils.isBlank(token)) { | ||||
| out.print("授权始飙,token为空,请重新再试!."); | |||||
| out.print("Auth Failed!token is empity , Retry."); | |||||
| }else { | }else { | ||||
| wxMall.setAlipayAppAuthToken(token); | wxMall.setAlipayAppAuthToken(token); | ||||
| mallService.update(wxMall); | mallService.update(wxMall); | ||||
| out.print("授权成功!."); | |||||
| out.print("Auth success!."); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -90,22 +90,22 @@ public class AliPayController extends BaseController { | |||||
| String tenantId = args[1]; | String tenantId = args[1]; | ||||
| WxMall wxMall = mallService.getByTenantId(tenantId); | WxMall wxMall = mallService.getByTenantId(tenantId); | ||||
| if (null == wxMall ) { | if (null == wxMall ) { | ||||
| out.print("参数错误!wxMall未查询到."); | |||||
| out.print("Auth Failed!wxMall not fond."); | |||||
| } | } | ||||
| if (null == wxMall.getAlipayAppAuthToken() || "".equals(wxMall.getAlipayAppAuthToken()) ) { | if (null == wxMall.getAlipayAppAuthToken() || "".equals(wxMall.getAlipayAppAuthToken()) ) { | ||||
| out.print("参数错误!wxMall alipayAppToken为空."); | |||||
| out.print("Auth Failed!wxMall alipayAppToken is null."); | |||||
| }else { | }else { | ||||
| UserAuthData authData = alipayUtil.queryUserAuthData(wxMall.getAlipayAppAuthToken(), authCode); | UserAuthData authData = alipayUtil.queryUserAuthData(wxMall.getAlipayAppAuthToken(), authCode); | ||||
| if (null == authData ) { | if (null == authData ) { | ||||
| out.print("获取用户授权令牌错误!queryUserAuthData返回信息为空."); | |||||
| out.print("Auth Failed!queryUserAuthData return null."); | |||||
| }else { | }else { | ||||
| Map<EnumMemberCardConfig,Object> map = alipayUtil.queryUserFormData(wxMall.getAlipayAppAuthToken(), authData.getAccessToken(), templateId, requestId); | Map<EnumMemberCardConfig,Object> map = alipayUtil.queryUserFormData(wxMall.getAlipayAppAuthToken(), authData.getAccessToken(), templateId, requestId); | ||||
| if (null == map) { | if (null == map) { | ||||
| out.print("获取用户表单信息错误!queryUserFormData返回信息为空."); | |||||
| out.print("Auth Failed!queryUserFormData return null."); | |||||
| }else { | }else { | ||||
| String phone = (String) map.get(EnumMemberCardConfig.OPEN_FORM_FIELD_MOBILE); | String phone = (String) map.get(EnumMemberCardConfig.OPEN_FORM_FIELD_MOBILE); | ||||
| if (StringUtils.isBlank(phone)) { | if (StringUtils.isBlank(phone)) { | ||||
| out.print("获取用户表单信息错误!手机号为空."); | |||||
| out.print("Auth Failed! Phone is Empity."); | |||||
| }else { | }else { | ||||
| //查询该userId是否已经开卡,已经开卡不再开卡 | //查询该userId是否已经开卡,已经开卡不再开卡 | ||||
| AliPayCUser query = new AliPayCUser(); | AliPayCUser query = new AliPayCUser(); | ||||
| @@ -121,15 +121,15 @@ public class AliPayController extends BaseController { | |||||
| aliPayCUserService.saveOrUpdate(alicuser); | aliPayCUserService.saveOrUpdate(alicuser); | ||||
| } | } | ||||
| if (null != alicuser.getCardOpen() && alicuser.getCardOpen() > 0) { | if (null != alicuser.getCardOpen() && alicuser.getCardOpen() > 0) { | ||||
| out.print("用户授权成功!."); | |||||
| out.print("Auth success!."); | |||||
| }else { | }else { | ||||
| boolean opencard = alipayUtil.openCard(wxMall.getAlipayAppAuthToken(), authData.getAccessToken(), templateId, authData.getUserId()); | boolean opencard = alipayUtil.openCard(wxMall.getAlipayAppAuthToken(), authData.getAccessToken(), templateId, authData.getUserId()); | ||||
| if (opencard) { | if (opencard) { | ||||
| alicuser.setCardOpen(1); | alicuser.setCardOpen(1); | ||||
| aliPayCUserService.saveOrUpdate(alicuser); | aliPayCUserService.saveOrUpdate(alicuser); | ||||
| out.print("用户授权成功!."); | |||||
| out.print("Auth success!."); | |||||
| }else { | }else { | ||||
| out.print("用户授权失败!."); | |||||
| out.print("Auth Failed!"); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||