feat:更新elastic模块
This commit is contained in:
@@ -4,10 +4,10 @@ from config.elastic import es, BLOG_INDEX
|
||||
from schemas.blog_elastic import BlogElastic
|
||||
|
||||
|
||||
def create_blog(blog: BlogElastic) -> bool:
|
||||
def add_blog_elastic(blog: BlogElastic) -> bool:
|
||||
now = datetime.now()
|
||||
blog.createTime = now
|
||||
blog.updateTime = now
|
||||
blog.createTime = now.strftime("%Y-%m-%d %H:%M:%S")
|
||||
blog.updateTime = now.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
es.index(
|
||||
index=BLOG_INDEX,
|
||||
@@ -18,8 +18,9 @@ def create_blog(blog: BlogElastic) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def update_blog(blog: BlogElastic) -> bool:
|
||||
blog.updateTime = datetime.now()
|
||||
def update_blog_elastic(blog: BlogElastic) -> bool:
|
||||
now = datetime.now()
|
||||
blog.updateTime = now.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
es.index(
|
||||
index=BLOG_INDEX,
|
||||
|
||||
Reference in New Issue
Block a user