v1.0.0
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"sun-panel/api/api_v1/common/apiData/systemApiStructs"
|
||||
"sun-panel/api/api_v1/common/apiReturn"
|
||||
"sun-panel/global"
|
||||
"sun-panel/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
|
||||
type NoticeApi struct {
|
||||
}
|
||||
|
||||
func (a *NoticeApi) GetListByDisplayType(c *gin.Context) {
|
||||
req := systemApiStructs.NoticeGetListByDisplayTypeReq{}
|
||||
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||
apiReturn.ErrorParamFomat(c, err.Error())
|
||||
return
|
||||
}
|
||||
noticeList := []models.Notice{}
|
||||
if err := global.Db.Find(¬iceList, "display_type in ?", req.DisplayType).Error; err != nil {
|
||||
apiReturn.ErrorDatabase(c, err.Error())
|
||||
return
|
||||
}
|
||||
apiReturn.SuccessListData(c, noticeList, 0)
|
||||
}
|
||||
Reference in New Issue
Block a user