|
@@ -8,6 +8,7 @@ import com.platform.yijia.utils.ConstantUtil;
|
|
import com.platform.yijia.utils.HttpClientUtil;
|
|
import com.platform.yijia.utils.HttpClientUtil;
|
|
import com.platform.yijia.utils.SignUtil;
|
|
import com.platform.yijia.utils.SignUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
@@ -26,9 +27,9 @@ import java.util.List;
|
|
* @Description :
|
|
* @Description :
|
|
**/
|
|
**/
|
|
|
|
|
|
-@RestController
|
|
|
|
|
|
+@Controller
|
|
@RequestMapping("/wxAuth")
|
|
@RequestMapping("/wxAuth")
|
|
-public class WxLoginController {
|
|
|
|
|
|
+public class WXLoginController {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private AppUserInfoService appUserInfoService;
|
|
private AppUserInfoService appUserInfoService;
|
|
@@ -66,8 +67,8 @@ public class WxLoginController {
|
|
* @param response
|
|
* @param response
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
- @RequestMapping("/login")
|
|
|
|
- public String wxLogin(HttpServletResponse response) throws ParseException {
|
|
|
|
|
|
+ @RequestMapping("/wxLogin")
|
|
|
|
+ public String wxLogin(HttpServletResponse response) throws ParseException,IOException {
|
|
//请求获取code的回调地址
|
|
//请求获取code的回调地址
|
|
//用线上环境的域名或者用内网穿透,不能用ip
|
|
//用线上环境的域名或者用内网穿透,不能用ip
|
|
String callBack = "http://www.onlyfido.top/wxAuth/callBack";//域名填你自己的
|
|
String callBack = "http://www.onlyfido.top/wxAuth/callBack";//域名填你自己的
|
|
@@ -83,11 +84,10 @@ public class WxLoginController {
|
|
} catch (UnsupportedEncodingException e) {
|
|
} catch (UnsupportedEncodingException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
-
|
|
|
|
System.out.println(url);
|
|
System.out.println(url);
|
|
//重定向
|
|
//重定向
|
|
- // response.sendRedirect(url);
|
|
|
|
- return "redirect:" + url;
|
|
|
|
|
|
+// response.sendRedirect(url);
|
|
|
|
+ return "redirect:"+url;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -144,7 +144,9 @@ public class WxLoginController {
|
|
}
|
|
}
|
|
//此时已获取到userInfo,再根据业务进行处理
|
|
//此时已获取到userInfo,再根据业务进行处理
|
|
System.out.println("请求获取userInfo:" + resultInfo);
|
|
System.out.println("请求获取userInfo:" + resultInfo);
|
|
- return resultInfoObject.toString();
|
|
|
|
|
|
+ //跳转网页地址
|
|
|
|
+ System.out.println("跳转网页地址:" + "redirect:"+"http://www.onlyfido.top:27281/?openid="+resultObject.getString("openid"));
|
|
|
|
+ return "redirect:"+"http://www.onlyfido.top:27281/?openid="+resultObject.getString("openid");
|
|
}
|
|
}
|
|
|
|
|
|
-}
|
|
|
|
|
|
+}
|