单条搜索
This commit is contained in:
parent
c5e755faec
commit
9b733a1923
@ -16,6 +16,7 @@ type ESFieldConfig struct {
|
||||
func GetESFieldConfig() *ESFieldConfig {
|
||||
return &ESFieldConfig{
|
||||
AllowUpdate: map[string]bool{
|
||||
"book_name": true,
|
||||
"book_pic": true,
|
||||
"book_pic_s": true,
|
||||
"book_pic_b": true,
|
||||
|
||||
@ -12,8 +12,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
@ -21,6 +19,9 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
|
||||
"github.com/elastic/go-elasticsearch/v8/esapi"
|
||||
)
|
||||
|
||||
@ -158,6 +159,10 @@ func (book *ESBook) ConvertToResponse() ESBookResponse {
|
||||
"localPath": book.BookDefPic.LocalPath,
|
||||
"pddPath": book.BookDefPic.PddPath,
|
||||
}
|
||||
publicationTime := book.PublicationTime
|
||||
if publicationTime == "" || publicationTime == "0" || publicationTime == "0000-00-00" {
|
||||
publicationTime = time.Unix(0, 0).Format("2006-01")
|
||||
}
|
||||
return ESBookResponse{
|
||||
ID: book.ID,
|
||||
BookName: book.BookName.Value,
|
||||
@ -170,7 +175,7 @@ func (book *ESBook) ConvertToResponse() ESBookResponse {
|
||||
Author: book.Author,
|
||||
Category: book.Category,
|
||||
Publisher: book.Publisher,
|
||||
PublicationTime: book.PublicationTime,
|
||||
PublicationTime: publicationTime,
|
||||
BindingLayout: book.BindingLayout,
|
||||
FixPrice: float64(book.FixPrice),
|
||||
Content: book.Content,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user