backend增加租户简称登录

This commit is contained in:
2026-07-17 11:00:33 +08:00
parent dcf06db11b
commit 2232ef6f3c
14 changed files with 916 additions and 746 deletions
+6 -1
View File
@@ -78,7 +78,7 @@ func (c *BackendNotebookController) List() {
total, _ := qs.Count()
var list []models.BackendNotebook
_, err = qs.OrderBy("-update_time", "-create_time").
_, err = qs.OrderBy("-pinned", "-id").
Limit(pageSize).Offset((page - 1) * pageSize).
All(&list)
if err != nil && err != orm.ErrNoRows {
@@ -137,6 +137,7 @@ func (c *BackendNotebookController) Create() {
var payload struct {
Title string `json:"title"`
Content string `json:"content"`
Pinned int8 `json:"pinned"`
}
if err := json.Unmarshal(raw, &payload); err != nil {
c.nbJsonErr(400, 400, "参数错误")
@@ -153,6 +154,7 @@ func (c *BackendNotebookController) Create() {
Tid: claims.TenantId,
Title: payload.Title,
Content: payload.Content,
Pinned: payload.Pinned,
UserID: &userID,
UserName: &claims.Username,
IsDeleted: 0,
@@ -190,6 +192,7 @@ func (c *BackendNotebookController) Update() {
var payload struct {
Title string `json:"title"`
Content string `json:"content"`
Pinned int8 `json:"pinned"`
}
if err := json.Unmarshal(raw, &payload); err != nil {
c.nbJsonErr(400, 400, "参数错误")
@@ -219,6 +222,7 @@ func (c *BackendNotebookController) Update() {
Update(map[string]interface{}{
"title": payload.Title,
"content": payload.Content,
"pinned": payload.Pinned,
"update_time": now,
})
if err != nil {
@@ -228,6 +232,7 @@ func (c *BackendNotebookController) Update() {
note.Title = payload.Title
note.Content = payload.Content
note.Pinned = payload.Pinned
note.UpdateTime = &now
c.nbOk(note)
}