首页>代码>springboot2整合vue开发在线音乐网站>/music-server/src/main/java/com/example/demo/controller/AdminController.java
package com.example.demo.controller; import com.alibaba.fastjson.JSONObject; import com.example.demo.service.impl.AdminServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; @RestController @Controller public class AdminController { @Autowired private AdminServiceImpl adminService; // 判断是否登录成功 @ResponseBody @RequestMapping(value = "/admin/login/status", method = RequestMethod.POST) public Object loginStatus(HttpServletRequest req, HttpSession session){ JSONObject jsonObject = new JSONObject(); String name = req.getParameter("name"); String password = req.getParameter("password"); boolean res = adminService.veritypasswd(name, password); if (res) { jsonObject.put("code", 1); jsonObject.put("msg", "登录成功"); session.setAttribute("name", name); return jsonObject; } else { jsonObject.put("code", 0); jsonObject.put("msg", "用户名或密码错误"); return jsonObject; } } }
最近下载更多
3263394665 LV9
2023年11月29日
阿凡达 LV9
2023年10月20日
wq011020 LV1
2023年10月18日
xk16675552250 LV33
2023年10月7日
2304972630 LV3
2023年9月26日
拜托你仔细听 LV3
2023年9月21日
qazwsx0987 LV5
2023年9月13日
syczzxj LV9
2023年8月1日
小代123abc LV3
2023年6月30日
cmq258159 LV2
2023年6月20日