|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
import jnpf.base.ActionResult;
|
|
|
|
|
import jnpf.model.wx.WxCheckSession;
|
|
|
|
|
import jnpf.model.wx.WxLoginParam;
|
|
|
|
|
import jnpf.util.wxutil.HttpUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -30,10 +31,12 @@ public class WxController {
|
|
|
|
|
private String appsecret;
|
|
|
|
|
@Value("${wx.code2Session}")
|
|
|
|
|
private String code2Session;
|
|
|
|
|
@Value("${wx.checkSession}")
|
|
|
|
|
private String checkSession;
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "小程序登录-回收员端")
|
|
|
|
|
@GetMapping("/hsyLogin")
|
|
|
|
|
public String login(@RequestParam("code") String code) {
|
|
|
|
|
public String hsyLogin(@RequestParam("code") String code) {
|
|
|
|
|
log.info("小程序登录-回收员端:{}",code);
|
|
|
|
|
String url = code2Session+"?appid="+appid+"&secret="+appsecret+"&js_code="+code+"&grant_type=authorization_code";
|
|
|
|
|
return HttpUtil.sendHttpGet(url);
|
|
|
|
@ -59,6 +62,17 @@ public class WxController {
|
|
|
|
|
return decrypt.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Operation(summary = "小程序登录态校验-回收员端")
|
|
|
|
|
@GetMapping("/hsyCheckSession")
|
|
|
|
|
public String hsyCheckSession(@RequestBody WxCheckSession wxCheckSession) {
|
|
|
|
|
log.info("小程序登录态校验-回收员端:{}",JSONObject.toJSONString(wxCheckSession));
|
|
|
|
|
// todo
|
|
|
|
|
String url = checkSession+"?access_token="+wxCheckSession.getAccessToken()
|
|
|
|
|
+"&signature="+wxCheckSession.getSignature()
|
|
|
|
|
+"&openid="+wxCheckSession.getOpenid()
|
|
|
|
|
+"&sig_method=hmac_sha256";
|
|
|
|
|
return HttpUtil.sendHttpGet(url);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 解密成json
|
|
|
|
|