修复文章查找公开选项倒反了

master
a7458969 2020-05-27 22:05:43 +08:00
parent 592d2fd90e
commit 9f80b48fd7
2 changed files with 8 additions and 3 deletions

View File

@ -63,7 +63,8 @@ func GetArticles(c *gin.Context) {
}else{
is_public = 1
}
sql = fmt.Sprintf("select * from doc where doc.title like '%%%s%%' and doc.type = %d and is_public = %d limit %d offset %d ",is_public,req.Name,req.Type,limit,offset*limit)
sql = fmt.Sprintf("select * from doc where doc.title like '%%%s%%' and doc.type = %d and is_public = %d limit %d offset %d ",
is_public,req.Name,req.Type,limit,offset*limit)
}
}else{
if req.Type == 110{
@ -78,9 +79,9 @@ func GetArticles(c *gin.Context) {
}else{
is_public := 0
if public == "true"{
is_public = 0
}else{
is_public = 1
}else{
is_public = 0
}
sql = fmt.Sprintf("SELECT doc.id,doc.author,LEFT(doc.content,50) as content,doc.title,doc.type from doc where doc.type = %d and is_public = %d " +
"limit %d offset %d",req.Type,is_public,limit,offset)

View File

@ -52,6 +52,7 @@ func InitConfig() {
log.Println(e.Error())
}
}
func InitMysql() {
c := config.GetMysqlConfig()
if c == nil {
@ -60,6 +61,7 @@ func InitMysql() {
db.Init()
}
}
func InitRedisConfig() {
e := config.InitRedis()
if nil != e {
@ -67,12 +69,14 @@ func InitRedisConfig() {
return
}
}
func InitElasticSearch(){
e := db.GetElastic().CreateIndex("hardware",model.HardwareTypeMapping())
if nil != e{
}
}
func InitLogs() {
logs.Init(config.GetLogConfig().Dir, config.GetLogConfig().File, config.GetLogConfig().Level, config.GetLogConfig().SaveFile)
}