| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- // Code scaffolded by goctl. Safe to edit.
- // goctl 1.10.2
- package custompage
- import (
- "context"
- "strings"
- "udeServer/internal/apierr"
- pagecache "udeServer/internal/custompage"
- "udeServer/internal/svc"
- "udeServer/internal/types"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type SetCacheLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- // 设置自定义页面信息(标题/logo)
- func NewSetCacheLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetCacheLogic {
- return &SetCacheLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *SetCacheLogic) SetCache(req *types.SetCacheReq) (*types.SetCacheResp, error) {
- if strings.TrimSpace(req.Name) == "" && strings.TrimSpace(req.Logo) == "" {
- return nil, apierr.BadRequest("页面标题与 logo 不能同时为空")
- }
- pagecache.SetCache(req.Name, req.Logo)
- return &types.SetCacheResp{Name: req.Name, Logo: req.Logo}, nil
- }
|