后台文章管理排序方式修改
parent
4687355510
commit
bc4bdc7414
|
@ -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)
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
6
main.go
6
main.go
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue