package com.project.zcustom.controller.system;

import cn.dev33.satoken.stp.StpUtil;
import com.project.zcustom.controller.core.AjaxResult;
import com.project.zcustom.tools.AESUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Author bqyang
 * @Date 2025/2/25 18:27
 * @Version 1.0
 */
@RestController
@RequestMapping("/user")
public class LoginController {

    @PostMapping("/doLogin")
    public AjaxResult login(@RequestParam String username, @RequestParam String password) {
        // 密码解密
        password = AESUtil.decrypt(password);
        StpUtil.login(1);
        String token = StpUtil.getTokenValue();
        return AjaxResult.success(token);
    }
}
