Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.3.2^2
zouap 4 years ago
parent
commit
3c779296ac
2 changed files with 9 additions and 4 deletions
  1. +2
    -4
      public/home/search.js
  2. +7
    -0
      routers/search.go

+ 2
- 4
public/home/search.js View File

@@ -391,8 +391,7 @@ function displayOrgResult(page,jsonResult,onlyReturnNum,keyword){
html +=" <i class=\"ri-links-line\"></i>" + "<a href=\""+ recordMap["website"] + "\" target=\"_blank\">" + recordMap["website"] + "</a>";
}
html +=" <i class=\"ri-time-line am-ml-10\"></i> 加入于 ";
var userAddDate = new Date(recordMap["created_unix"]*1000);
html += monthDisplay[userAddDate.getMonth()] + " " + userAddDate.getDay() + " " + userAddDate.getFullYear();
html += recordMap["add_time"]
html +=" </p>";
html +=" </div>";
html +=" </div>";
@@ -436,8 +435,7 @@ function displayUserResult(page,jsonResult,onlyReturnNum,keyword){
html +=" <p class=\"has-emoji\">";
html +=" <i class=\"ri-mail-line\"></i>" + recordMap["email"];
html +=" <i class=\"ri-time-line am-ml-10\"></i> 加入于 ";
var userAddDate = new Date(recordMap["created_unix"]*1000);
html += monthDisplay[userAddDate.getMonth()] + " " + userAddDate.getDay() + " " + userAddDate.getFullYear();
html += recordMap["add_time"]
html +=" </p>";
html +=" </div>";
html +=" </div>";


+ 7
- 0
routers/search.go View File

@@ -10,6 +10,7 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/timeutil"
"github.com/olivere/elastic/v7"
)

@@ -642,6 +643,7 @@ func makeUserOrOrgResult(sRes *elastic.SearchResult, Key string, ctx *context.Co
record["avatar"] = strings.TrimRight(setting.AppSubURL, "/") + "/user/avatar/" + recordSource["name"].(string) + "/" + strconv.Itoa(-1)
record["updated_unix"] = recordSource["updated_unix"]
record["created_unix"] = recordSource["created_unix"]
record["add_time"] = getAddTime(recordSource["created_unix"].(int64))
result = append(result, record)
} else {
log.Info("deal user source error," + err.Error())
@@ -658,6 +660,11 @@ func makeUserOrOrgResult(sRes *elastic.SearchResult, Key string, ctx *context.Co
return returnObj
}

func getAddTime(time int64) string {
t := timeutil.TimeStamp(time)
return t.FormatShort()
}

func searchDataSet(ctx *context.Context, TableName string, Key string, Page int, PageSize int, OnlyReturnNum bool) {
/*
数据集,ES名称:dataset-es-index


Loading…
Cancel
Save