移除 backend .env,暂时关闭 JWT,改为一次性登录

This commit is contained in:
fish
2026-05-03 20:41:43 +08:00
parent d0e5ddb678
commit fbcde3cc71
8 changed files with 21 additions and 74 deletions

View File

@@ -54,13 +54,9 @@ func (d *Deps) Login(w http.ResponseWriter, r *http.Request) {
writeErr(w, http.StatusUnauthorized, "用户名或密码错误")
return
}
token, _, err := d.JWT.Issue(u.ID, u.Username, u.Role)
if err != nil {
writeErr(w, http.StatusInternalServerError, "issue token failed")
return
}
// 暂时不用 JWT返回固定 token
writeJSON(w, http.StatusOK, loginResp{
Token: token,
Token: "noop",
User: publicUserView{
ID: u.ID,
Username: u.Username,

View File

@@ -5,16 +5,14 @@ import (
"log"
"net/http"
"trade/web/internal/auth"
"trade/web/internal/store"
)
// Deps 是所有 handler 需要的运行时依赖,在 router 装配时一次性注入。
type Deps struct {
Auth *store.AuthStore
Futures *store.FuturesStore
JWT *auth.Manager
TushareURL string
Auth *store.AuthStore
Futures *store.FuturesStore
TushareURL string
}
func writeJSON(w http.ResponseWriter, status int, body any) {