Authored by zhaoyue

Fix openid problem

@@ -73,6 +73,7 @@ public class OpenIdController { @@ -73,6 +73,7 @@ public class OpenIdController {
73 } else {//已经存在 73 } else {//已经存在
74 xklMemberOpenid.setOpenid(openId); 74 xklMemberOpenid.setOpenid(openId);
75 } 75 }
  76 + xklMemberOpenidRespository.deleteByOpenid(openId);
76 xklMemberOpenidRespository.save(xklMemberOpenid); 77 xklMemberOpenidRespository.save(xklMemberOpenid);
77 } 78 }
78 return new ResponseEntity<>(ResultModel.ok(ResultStatus.OPENID_BIND_SUCCESS), HttpStatus.OK); 79 return new ResponseEntity<>(ResultModel.ok(ResultStatus.OPENID_BIND_SUCCESS), HttpStatus.OK);
@@ -118,7 +119,7 @@ public class OpenIdController { @@ -118,7 +119,7 @@ public class OpenIdController {
118 if (!(boolean) request.getAttribute("signAspect")) 119 if (!(boolean) request.getAttribute("signAspect"))
119 return new ResponseEntity<>(ResultModel.error(ResultStatus.SIGN_ERROR), HttpStatus.OK); 120 return new ResponseEntity<>(ResultModel.error(ResultStatus.SIGN_ERROR), HttpStatus.OK);
120 121
121 - XklMemberOpenidEntity xklMemberOpenid = xklMemberOpenidRespository.findByOpenidAndType(openId, openIdType); 122 + XklMemberOpenidEntity xklMemberOpenid = xklMemberOpenidRespository.findOneByOpenidAndType(openId, openIdType);
122 123
123 if (xklMemberOpenid == null) { 124 if (xklMemberOpenid == null) {
124 return new ResponseEntity<>(ResultModel.error(ResultStatus.OPENID_ERROR), HttpStatus.OK); 125 return new ResponseEntity<>(ResultModel.error(ResultStatus.OPENID_ERROR), HttpStatus.OK);
@@ -90,7 +90,7 @@ public class QRCodeController { @@ -90,7 +90,7 @@ public class QRCodeController {
90 if (!(boolean) request.getAttribute("signAspect")) { 90 if (!(boolean) request.getAttribute("signAspect")) {
91 return new ResponseEntity<>(ResultModel.error(ResultStatus.SIGN_ERROR), HttpStatus.OK); 91 return new ResponseEntity<>(ResultModel.error(ResultStatus.SIGN_ERROR), HttpStatus.OK);
92 } 92 }
93 - XklMemberOpenidEntity openidEntity = xklMemberOpenidRespository.findByOpenidAndType(openId, openIdType); 93 + XklMemberOpenidEntity openidEntity = xklMemberOpenidRespository.findOneByOpenidAndType(openId, openIdType);
94 // openId 未找到 94 // openId 未找到
95 if (openidEntity == null) { 95 if (openidEntity == null) {
96 return new ResponseEntity<>(ResultModel.ok(ResultStatus.OPENID_ERROR), HttpStatus.OK); 96 return new ResponseEntity<>(ResultModel.ok(ResultStatus.OPENID_ERROR), HttpStatus.OK);
@@ -11,5 +11,8 @@ public interface XklMemberOpenidRespository extends CrudRepository<XklMemberOpen @@ -11,5 +11,8 @@ public interface XklMemberOpenidRespository extends CrudRepository<XklMemberOpen
11 11
12 public XklMemberOpenidEntity findByAccountIdAndTypeAndOpenid(long accountId, int type, String openid); 12 public XklMemberOpenidEntity findByAccountIdAndTypeAndOpenid(long accountId, int type, String openid);
13 13
14 - public XklMemberOpenidEntity findByOpenidAndType(String openid,int type); 14 + public XklMemberOpenidEntity findOneByOpenidAndType(String openid,int type);
  15 +
  16 + public void deleteByOpenid(String openid);
  17 +
15 } 18 }