记得上下班打卡 | git大法好,push需谨慎

Commit c9fb7606 authored by jiangxiulong's avatar jiangxiulong

新增小程序获取openId、unionI

parent 06bb8234
package com.liquidnet.service.sweet.controller; package com.liquidnet.service.sweet.controller;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.dto.vo.WechatTokenInfoVo; import com.liquidnet.service.sweet.dto.vo.WechatTokenInfoVo;
import com.liquidnet.service.sweet.dto.vo.WechatUserInfoVo; import com.liquidnet.service.sweet.dto.vo.WechatUserInfoVo;
...@@ -49,6 +50,16 @@ public class SweetWechatLoginController { ...@@ -49,6 +50,16 @@ public class SweetWechatLoginController {
return sweetLoginService.wxaCode2Session(jsCode, type); return sweetLoginService.wxaCode2Session(jsCode, type);
} }
@ApiOperation(value = "小程序获取openId、unionId", notes = "这里仅用于获取openId、unionId使用")
@GetMapping(value = {"maJscodeResult"})
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "jsCode", value = "微信jsCode", required = true),
@ApiImplicitParam(type = "query", dataType = "Integer", name = "type", value = "1草莓 2五百里 3mdsk 4正在", required = true)
})
public ResponseDto<WxMaJscode2SessionResult> maJscodeResult(@RequestParam String jsCode, @RequestParam Integer type) {
return sweetLoginService.wxaCode2SessionAll(jsCode, type);
}
@ApiOperation(value = "服务号获取openid", notes = "这里仅用于获取OPENID使用") @ApiOperation(value = "服务号获取openid", notes = "这里仅用于获取OPENID使用")
@GetMapping(value = {"mpOpenId"}) @GetMapping(value = {"mpOpenId"})
@ApiImplicitParams({ @ApiImplicitParams({
......
...@@ -130,6 +130,16 @@ public class SweetWechatLoginServiceImpl { ...@@ -130,6 +130,16 @@ public class SweetWechatLoginServiceImpl {
} }
} }
public ResponseDto<WxMaJscode2SessionResult> wxaCode2SessionAll(String jsCode, Integer type) {
try {
WxMaJscode2SessionResult wxMaJscode2SessionResult = sweetWechatService.sessionInfo(jsCode, type);
return ResponseDto.success(wxMaJscode2SessionResult);
} catch (Exception e) {
log.error("wxaCode2SessionAllError Exception:{}", e);
return ResponseDto.failure();
}
}
public ResponseDto<String> wxOauth2AccessToken(String code, Integer type) { public ResponseDto<String> wxOauth2AccessToken(String code, Integer type) {
try { try {
WxOAuth2AccessToken wxOAuth2AccessToken = sweetWechatService.wxOauth2AccessToken(code, type); WxOAuth2AccessToken wxOAuth2AccessToken = sweetWechatService.wxOauth2AccessToken(code, type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment