mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-22 00:46:49 +08:00
🎨 🔥 ✨ 🚑 集成前端代码的&兼容容器化部署插件的插件改造&提供了一个新的轮播图插件
This commit is contained in:
41
server/addons/flashbanner/controller/api/banner/banner.go
Normal file
41
server/addons/flashbanner/controller/api/banner/banner.go
Normal file
@@ -0,0 +1,41 @@
|
||||
// Package banner
|
||||
// @Link https://github.com/bufanyun/hotgo
|
||||
// @Copyright Copyright (c) 2024 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
package banner
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/addons/flashbanner/api/admin/banner"
|
||||
"hotgo/addons/flashbanner/service"
|
||||
)
|
||||
|
||||
var (
|
||||
BannerIndex = cBanner{}
|
||||
)
|
||||
|
||||
type cBanner struct{}
|
||||
|
||||
// List 获取轮播图列表
|
||||
func (c *cBanner) List(ctx context.Context, req *banner.ListReq) (res *banner.ListRes, err error) {
|
||||
list, totalCount, err := service.SysBanner().List(ctx, &req.BannerListInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &banner.ListRes{
|
||||
List: list,
|
||||
}
|
||||
res.PageRes.Pack(&req.BannerListInp, totalCount)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// View 获取指定轮播图信息
|
||||
func (c *cBanner) View(ctx context.Context, req *banner.ViewReq) (res *banner.ViewRes, err error) {
|
||||
model, err := service.SysBanner().View(ctx, &req.BannerViewInp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res = &banner.ViewRes{model}
|
||||
return res, nil
|
||||
}
|
||||
Reference in New Issue
Block a user