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