zwxi 11 месяцев назад
Родитель
Сommit
48275ed18c
2 измененных файлов с 28 добавлено и 1 удалено
  1. 27 1
      controller/public.go
  2. 1 0
      routers/public.go

+ 27 - 1
controller/public.go

@@ -454,7 +454,7 @@ func BannerList(c *gin.Context) {
 	page, _ := strconv.Atoi(c.Query("page"))
 	limit, _ := strconv.Atoi(c.Query("limit"))
 	enable, _ := strconv.Atoi(c.Query("enable"))
-	cond := "  "
+	cond := ""
 	if enable == 0 {
 		cond += " enable = 0 "
 	} else {
@@ -473,3 +473,29 @@ func BannerList(c *gin.Context) {
 
 	response.OkData("获取成功", list, c)
 }
+
+// BannerHistoryList banner历史图列表
+// @Tags 公共模块
+// @Summary  banner图列表
+// @Description banner图列表
+// @Security ApiKeyAuth
+// @securityDefinitions.basic BasicAuth
+// @Accept  json
+// @Product json
+// @Success 200 {string} string 获取验证码成功
+// @Failure 400 {string} string 请输入邮箱地址
+// @Router /banner_history/list [get]
+func BannerHistoryList(c *gin.Context) {
+	page, _ := strconv.Atoi(c.Query("page"))
+	limit, _ := strconv.Atoi(c.Query("limit"))
+	cond := ""
+	cond += " enable = 0 "
+
+	list, err := banner.GetBannerList(cond, page, limit)
+	if err != nil {
+		response.FailMsg("获取失败", "获取banner失败, Err: "+err.Error(), c)
+		return
+	}
+
+	response.OkData("获取成功", list, c)
+}

+ 1 - 0
routers/public.go

@@ -30,6 +30,7 @@ func initPublic(r *gin.Engine) {
 		rGroup.POST("/view_log/update", controller.UpdateViewLog)
 		rGroup.POST("/banner/mark", controller.BannerMark)
 		rGroup.GET("/banner/list", controller.BannerList)
+		rGroup.GET("/banner_history/list", controller.BannerList)
 	}
 
 	rGroup2 := r.Group("api/public")