|
@@ -95,9 +95,13 @@ public class LoginController {
|
|
accessToken.setAccountName(accountName);
|
|
accessToken.setAccountName(accountName);
|
|
accessToken.setCode(result.getCode());
|
|
accessToken.setCode(result.getCode());
|
|
accessToken.setMessage(result.getMessage());
|
|
accessToken.setMessage(result.getMessage());
|
|
- accessToken.setFarmId(accountEntity.getFarmIds());
|
|
|
|
|
|
+ accessToken.setFarmId(accountEntity.getLastFarmId()+"");
|
|
String token = TokenSign.sign(accountName,id,accountEntity.getFarmIds());
|
|
String token = TokenSign.sign(accountName,id,accountEntity.getFarmIds());
|
|
accessToken.setToken(token);
|
|
accessToken.setToken(token);
|
|
|
|
+ accessToken.setFarmName("慧牧测试牧场");
|
|
|
|
+ accessToken.setOpenId(accountEntity.getOpenId());
|
|
|
|
+ accessToken.setImgUrl(accountEntity.getImgUrl());
|
|
|
|
+ accessToken.setWechatName(accountEntity.getWechatName());
|
|
|
|
|
|
accessToken.setId(id);
|
|
accessToken.setId(id);
|
|
accessToken.setLoginIp(remoteHost);
|
|
accessToken.setLoginIp(remoteHost);
|
|
@@ -108,7 +112,7 @@ public class LoginController {
|
|
}
|
|
}
|
|
|
|
|
|
//测试-token
|
|
//测试-token
|
|
- @PostMapping(value = "/getToken")
|
|
|
|
|
|
+ @GetMapping(value = "/getToken")
|
|
public String getToken(HttpServletRequest req) {
|
|
public String getToken(HttpServletRequest req) {
|
|
String token = TokenSign.sign("superadmin",1,null);
|
|
String token = TokenSign.sign("superadmin",1,null);
|
|
return token;
|
|
return token;
|
|
@@ -122,8 +126,8 @@ public class LoginController {
|
|
@GetMapping("/wechatLogin")
|
|
@GetMapping("/wechatLogin")
|
|
public String wechatLogin(@RequestParam(name = "js_code")String js_code){
|
|
public String wechatLogin(@RequestParam(name = "js_code")String js_code){
|
|
String URL = "https://api.weixin.qq.com/sns/jscode2session";
|
|
String URL = "https://api.weixin.qq.com/sns/jscode2session";
|
|
- String appid = "wxc5b3319392e20e72";
|
|
|
|
- String secret = "49d31f71e5300c28634e7753a36fede5";
|
|
|
|
|
|
+ String appid = "wxa1289282dcd0746c";
|
|
|
|
+ String secret = "a9669fef70b7377b34d90e5d1643c5f4";
|
|
String grant_type = "authorization_code";
|
|
String grant_type = "authorization_code";
|
|
|
|
|
|
String forObject = restTemplate.getForObject(URL + "?appid=" + appid + "&secret=" + secret + "&grant_type=" + grant_type + "&js_code=" + js_code, String.class);
|
|
String forObject = restTemplate.getForObject(URL + "?appid=" + appid + "&secret=" + secret + "&grant_type=" + grant_type + "&js_code=" + js_code, String.class);
|