|
|
|
@ -0,0 +1,32 @@
|
|
|
|
|
package com.prj.controller;
|
|
|
|
|
|
|
|
|
|
import com.prj.common.constant.Constants;
|
|
|
|
|
import com.prj.common.core.domain.AjaxResult;
|
|
|
|
|
import com.prj.common.core.domain.model.LoginBody;
|
|
|
|
|
import com.prj.framework.web.service.LoginService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
public class LoginController
|
|
|
|
|
{
|
|
|
|
|
@Autowired
|
|
|
|
|
private LoginService loginService;
|
|
|
|
|
|
|
|
|
|
@PostMapping("/login")
|
|
|
|
|
public AjaxResult login(@RequestBody LoginBody loginBody)
|
|
|
|
|
{
|
|
|
|
|
AjaxResult ajax = AjaxResult.success();
|
|
|
|
|
// 完成登录,生成token
|
|
|
|
|
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
|
|
|
|
loginBody.getUuid());
|
|
|
|
|
ajax.put(Constants.TOKEN, token);
|
|
|
|
|
return ajax;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|