后台文章管理排序方式修改
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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
56
main.go
56
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{}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,10 +102,10 @@ func main() {
|
||||||
/** 删除用户 **/
|
/** 删除用户 **/
|
||||||
api.DELETE("/user", userController.DelUser)
|
api.DELETE("/user", userController.DelUser)
|
||||||
/** 获取单独用户详情信息 methods(id) **/
|
/** 获取单独用户详情信息 methods(id) **/
|
||||||
api.GET("/user", middle.AuthMiddle,userController.GetUser)
|
api.GET("/user", middle.AuthMiddle, userController.GetUser)
|
||||||
/** 获取所有用户 **/
|
/** 获取所有用户 **/
|
||||||
api.GET("/users", middle.AuthMiddle,userController.Users)
|
api.GET("/users", middle.AuthMiddle, userController.Users)
|
||||||
api.POST("/search_users",middle.AuthMiddle,userController.SerarchUsers)
|
api.POST("/search_users", middle.AuthMiddle, userController.SerarchUsers)
|
||||||
/** 用户登录 **/
|
/** 用户登录 **/
|
||||||
api.POST("/login", userController.Login)
|
api.POST("/login", userController.Login)
|
||||||
/** 用户注册 **/
|
/** 用户注册 **/
|
||||||
|
@ -113,34 +114,37 @@ func main() {
|
||||||
api.GET("/logout/:token", userController.Logout)
|
api.GET("/logout/:token", userController.Logout)
|
||||||
api.POST("/verify", mailContoller.OnSendEmailCode)
|
api.POST("/verify", mailContoller.OnSendEmailCode)
|
||||||
/** 修改密码**/
|
/** 修改密码**/
|
||||||
api.POST("modify_pass",middle.AuthMiddle,userController.ModifyPasswd)
|
api.POST("modify_pass", middle.AuthMiddle, userController.ModifyPasswd)
|
||||||
|
|
||||||
api.GET("/article/:id",controller.GetArticle) //获取文章
|
api.GET("/article/:id", controller.GetArticle) //获取文章
|
||||||
api.POST("/articles",controller.GetArticles) // 获取所有文章
|
api.POST("/articles", controller.GetArticles) // 获取所有文章
|
||||||
api.PUT("/article",controller.AddArticle) // 添加文章
|
api.PUT("/article", controller.AddArticle) // 添加文章
|
||||||
api.PUT("/article_search",controller.SearchArticle) // 添加文章
|
api.PUT("/article_search", controller.SearchArticle) // 添加文章
|
||||||
api.GET("article_type",controller.ArticlesType) //获取所有文章分类
|
api.GET("article_type", controller.ArticlesType) //获取所有文章分类
|
||||||
api.PUT("article_type",controller.AddArticleType)
|
api.PUT("article_type", controller.AddArticleType)
|
||||||
api.DELETE("article_type",controller.DeleteArticleType)
|
api.DELETE("article_type", controller.DeleteArticleType)
|
||||||
|
|
||||||
api.POST("/article_update",controller.UpdateArtilce) //更新文章
|
api.POST("/article_update", controller.UpdateArtilce) //更新文章
|
||||||
api.GET("/articleCount",controller.GetArticleCount) //获取所有文章个数
|
api.GET("/articleCount", controller.GetArticleCount) //获取所有文章个数
|
||||||
api.DELETE("/article/:id",controller.DeleteArticle) ////删除文章
|
api.DELETE("/article/:id", controller.DeleteArticle) ////删除文章
|
||||||
api.POST("/image_upload",fileController.OnUpload) // 上传图片
|
api.POST("/image_upload", fileController.OnUpload) // 上传图片
|
||||||
api.GET("/image_download/:file",fileController.OnDownLoad) // 下载图片
|
api.GET("/image_download/:file", fileController.OnDownLoad) // 下载图片
|
||||||
api.GET("/image_thumbnail/:file",fileController.OnThumbnail) // 下载图片
|
api.GET("/image_thumbnail/:file", fileController.OnThumbnail) // 下载图片
|
||||||
api.GET("/doc_types",controller.ArticlesTypes) // 获取所有的文章类型
|
api.GET("/doc_types", controller.ArticlesTypes) // 获取所有的文章类型
|
||||||
api.POST("/hardware",controller.AddHardware) // 新增硬件
|
api.POST("/hardware", controller.AddHardware) // 新增硬件
|
||||||
api.GET("/hardware",controller.ReadHardWare) // 读取硬件
|
api.GET("/hardware", controller.ReadHardWare) // 读取硬件
|
||||||
api.DELETE("/hardware",controller.DeleteHardWare) // 读取硬件
|
api.DELETE("/hardware", controller.DeleteHardWare) // 读取硬件
|
||||||
|
|
||||||
api.PUT("/file",fileController.OnFileUploadFile) // 上传文件
|
|
||||||
api.GET("/file",fileController.DownloadFile) // 下载 文件
|
|
||||||
api.GET("/filelist",fileController.FileList) // 文件列表
|
|
||||||
api.GET("/fileType",fileController.FileType) // 文件类型
|
|
||||||
|
|
||||||
|
api.PUT("/file", fileController.OnFileUploadFile) // 上传文件
|
||||||
|
api.GET("/file", fileController.DownloadFile) // 下载 文件
|
||||||
|
api.GET("/filelist", fileController.FileList) // 文件列表
|
||||||
|
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 {
|
||||||
log.Print(e.Error())
|
log.Print(e.Error())
|
||||||
|
|
Loading…
Reference in New Issue