mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-09-18 09:44:26 +08:00
refactor, fix bug and update i18n(search), to be continue
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/logs"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/beego/i18n"
|
||||
|
||||
"github.com/mindoc-org/mindoc/conf"
|
||||
"github.com/mindoc-org/mindoc/models"
|
||||
"github.com/mindoc-org/mindoc/utils"
|
||||
@@ -87,16 +89,16 @@ func (c *SearchController) User() {
|
||||
key := c.Ctx.Input.Param(":key")
|
||||
keyword := strings.TrimSpace(c.GetString("q"))
|
||||
if key == "" || keyword == "" {
|
||||
c.JsonResult(404, "参数错误")
|
||||
c.JsonResult(404, i18n.Tr(c.Lang, "message.param_error"))
|
||||
}
|
||||
keyword = sqltil.EscapeLike(keyword)
|
||||
|
||||
book, err := models.NewBookResult().FindByIdentify(key, c.Member.MemberId)
|
||||
if err != nil {
|
||||
if err == models.ErrPermissionDenied {
|
||||
c.JsonResult(403, "没有权限")
|
||||
c.JsonResult(403, i18n.Tr(c.Lang, "message.no_permission"))
|
||||
}
|
||||
c.JsonResult(500, "项目不存在")
|
||||
c.JsonResult(500, i18n.Tr(c.Lang, "message.item_not_exist"))
|
||||
}
|
||||
|
||||
//members, err := models.NewMemberRelationshipResult().FindNotJoinUsersByAccount(book.BookId, 10, "%"+keyword+"%")
|
||||
|
Reference in New Issue
Block a user