🎨 新增轮播图修改状态接口
This commit is contained in:
parent
1cf8afb7ba
commit
8d71e58734
@ -106,3 +106,22 @@ func (b *BannerApi) GetBannerById(ctx *gin.Context) {
|
||||
|
||||
r.OkWithDetailed(banner, "获取成功", ctx)
|
||||
}
|
||||
|
||||
// UpdateBannerStatus 更新轮播图状态
|
||||
func (b *BannerApi) UpdateBannerStatus(ctx *gin.Context) {
|
||||
var banner common.Banner
|
||||
if err := ctx.ShouldBindJSON(&banner); err != nil {
|
||||
global.GVA_LOG.Error("参数错误" + err.Error())
|
||||
r.FailWithMessage("参数错误"+err.Error(), ctx)
|
||||
return
|
||||
}
|
||||
|
||||
err := bannerService.UpdateBannerStatus(&banner)
|
||||
if err != nil {
|
||||
global.GVA_LOG.Error("更新失败" + err.Error())
|
||||
r.FailWithMessage("更新失败"+err.Error(), ctx)
|
||||
return
|
||||
}
|
||||
|
||||
r.OkWithMessage("更新成功", ctx)
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ func RunWindowsServer() {
|
||||
// 保证文本顺序输出
|
||||
// In order to ensure that the text order output can be deleted
|
||||
time.Sleep(10 * time.Microsecond)
|
||||
global.GVA_LOG.Info("server.exe.exe run success on ", zap.String("address", address))
|
||||
global.GVA_LOG.Info("server run success on ", zap.String("address", address))
|
||||
|
||||
global.GVA_LOG.Error(s.ListenAndServe().Error())
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ func (s *BannerRouter) InitBannerRouter(Router *gin.RouterGroup) {
|
||||
bannerApi := v1.ApiGroupApp.SystemApiGroup.BannerApi
|
||||
|
||||
{
|
||||
hospitalRouter.POST("", bannerApi.CreateBanner) // 创建医院
|
||||
hospitalRouter.DELETE("", bannerApi.DeleteBanner) // 删除医院
|
||||
hospitalRouter.PUT("", bannerApi.UpdateBanner) // 更新医院
|
||||
|
||||
hospitalRouter.POST("", bannerApi.CreateBanner) // 创建医院
|
||||
hospitalRouter.DELETE("", bannerApi.DeleteBanner) // 删除医院
|
||||
hospitalRouter.PUT("", bannerApi.UpdateBanner) // 更新医院
|
||||
hospitalRouter.PUT("status", bannerApi.UpdateBannerStatus) // 更新医院状态
|
||||
}
|
||||
{
|
||||
publicRouter.GET("list", bannerApi.GetBannerList) // 获取医院列表
|
||||
|
@ -35,3 +35,8 @@ func (b BannerService) GetBannerById(id string) (banner *common.Banner, err erro
|
||||
err = global.GVA_DB.Where("id = ?", id).First(&banner).Error
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateBannerStatus 更新轮播图状态
|
||||
func (b BannerService) UpdateBannerStatus(c *common.Banner) (err error) {
|
||||
return global.GVA_DB.Model(&c).Update("status", c.Status).Error
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user