后台文章管理排序方式修改

master
DESKTOP-4RNDQIC\29019 2020-06-20 23:15:23 +08:00
parent 4687355510
commit bc4bdc7414
4 changed files with 51 additions and 28 deletions

View File

@ -74,7 +74,7 @@ func GetArticles(c *gin.Context) {
is_public = 0 is_public = 0
} }
sql = fmt.Sprintf("SELECT doc.id,doc.author,LEFT(doc.content,50) as content,doc.title from doc where is_public = %d " + sql = fmt.Sprintf("SELECT doc.id,doc.author,LEFT(doc.content,50) as content,doc.title from doc where is_public = %d " +
"limit %d offset %d",is_public,limit,offset) "order by id desc limit %d offset %d",is_public,limit,offset)
}else{ }else{
is_public := 0 is_public := 0
if public == "true" { if public == "true" {
@ -83,7 +83,7 @@ func GetArticles(c *gin.Context) {
is_public = 0 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 " + 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) " order by id desc limit %d offset %d",req.Type,is_public,limit,offset)
} }
} }
log.Print(sql) log.Print(sql)

View File

@ -6,6 +6,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"qiniupkg.com/x/log.v7" "qiniupkg.com/x/log.v7"
) )
func AddHardware(c *gin.Context) { func AddHardware(c *gin.Context) {
resp := RespBase{"unkown error",-231,nil} resp := RespBase{"unkown error",-231,nil}
defer func() { defer func() {

18
controller/webhook.go Normal file
View File

@ -0,0 +1,18 @@
package controller
import "github.com/gin-gonic/gin"
type WebHookController struct {
}
func (this *WebHookController) PushHook(c *gin.Context) {
resp := RespBase{"unkown error",-231,nil}
defer func() {
c.JSON(200,resp)
}()
repo := c.Param("repo")
if "" == repo{
return
}
}

View File

@ -17,6 +17,7 @@ var (
userController = controller.UserController{} userController = controller.UserController{}
mailContoller = controller.MailController{} mailContoller = controller.MailController{}
fileController = controller.FileController{} fileController = controller.FileController{}
webhookController = controller.WebHookController{}
) )
@ -139,7 +140,10 @@ func main() {
api.GET("/filelist", fileController.FileList) // 文件列表 api.GET("/filelist", fileController.FileList) // 文件列表
api.GET("/fileType", fileController.FileType) // 文件类型 api.GET("/fileType", fileController.FileType) // 文件类型
}
hookapi := r.Group("hookapi")
{
hookapi.POST("/push_hook/:repo",webhookController.PushHook)
} }
e := r.Run(":" + strconv.Itoa(config.GetPort())) e := r.Run(":" + strconv.Itoa(config.GetPort()))
if nil != e { if nil != e {