You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.8 KiB
Java

6 years ago
package com.gszc.controller;
6 years ago
import org.springframework.web.bind.annotation.*;
@RestController
public class LoginController {
// @Autowired
// LoginService loginService;
//
//
// @RequestMapping("/")
// public void a(HttpServletRequest request, HttpServletResponse response) throws Exception {
// //消息来源可靠性验证
// String signature = request.getParameter("signature");// 微信加密签名
// String timestamp = request.getParameter("timestamp");// 时间戳
// String nonce = request.getParameter("nonce"); // 随机数
// String echostr = request.getParameter("echostr");//成为开发者验证
// //确认此次GET请求来自微信服务器原样返回echostr参数内容则接入生效成为开发者成功否则接入失败
// System.out.println();
// response.getWriter().println(request.getParameter("echostr"));
// }
//
//
// public void post(HttpServletRequest request, HttpServletResponse response) throws Exception {
// // TODO 消息的接收、处理、响应
// }
//
//
// /**
// * 登录
// *
// * @param username
// * @param password
// * @return
// */
// @PostMapping("/login")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "username", value = "用户名", dataType = "string", paramType = "query"),
// @ApiImplicitParam(name = "password", value = "密码", dataType = "string", paramType = "query")
// })
// public Result login(String username, String password, HttpServletResponse response) {
// boolean login = loginService.login(username, password);
// if (login) {
// Cookie cookie = new Cookie("username", username);
// cookie.setMaxAge(60 * 60);
// cookie.setPath("/");
// response.addCookie(cookie);
// String sign = JwtUtils.sign(username, password);
// return ResultBuilder.withPayload(sign).build();
// } else {
// return ResultBuilder.error("登录失败").build();
// }
// }
//
// @PostMapping("/getOpenid")
// public Result getOpenid(String code) {
//
// JSONObject token = loginService.getToken(code);
// String sign = JwtUtils.sign(token.getString("openid"), token.getString("openid"));
// return ResultBuilder.withPayload(sign).build();
// }
//
// @PostMapping("/getUser")
// @ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header")
// public Result getUser(HttpServletRequest request){
// String token = request.getHeader("token");
// String username = JwtUtils.getUsername(token);
// WxUser user = loginService.getUser(username);
// return ResultBuilder.withPayload(user).build();
// }
}