提交 6f4c8a65 编写于 作者: rushui.chen's avatar rushui.chen

20200119 绑定微信传递参数

上级 24c302ed
......@@ -137,18 +137,21 @@ public class LoginController extends AccountBaseController {
@PostMapping("/login/wechat/bind")
public PicaResponse bindWeChat(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
Long result = cacheClient.setnx(cache_prifix + request.getUnionId(), request.getUnionId());
Long result = cacheClient.setnx(cache_prifix + request.getWeChatCode(), request.getWeChatCode());
if (result == 1) {
cacheClient.set(cache_prifix + request.getUnionId(), 60);
cacheClient.set(cache_prifix + request.getWeChatCode(), 60);
long doctorId = super.getDoctorIdByToken();
String nickname = loginService.bindWeChat(doctorId, request);
Map<String, String> map = new HashMap();
map.put("nickname", nickname);
//成功以后释放锁
cacheClient.del(cache_prifix + request.getUnionId());
cacheClient.del(cache_prifix + request.getWeChatCode());
return PicaResponse.toResponse(map);
} else {
throw new AccountException(AccountExceptionEnum.PICA_WECHAT_UNBIND_CURRENT);
cacheClient.del(cache_prifix + request.getWeChatCode());
return PicaResponse.toResponse(null, AccountExceptionEnum.PICA_WECHAT_UNBIND_CURRENT.getCode(),
AccountExceptionEnum.PICA_WECHAT_UNBIND_CURRENT.getMessage());
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册