banner

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Index

Constants

This section is empty.

Variables

View Source
var CreateRouter = router.Handler(func(c router.Context) {
	var (
		input CreateParams
	)

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return Create(helper.NewContext(&c), input)
	})
})
View Source
var DeleteRouter = router.Handler(func(c router.Context) {
	id := c.Param("banner_id")

	c.ResponseFunc(nil, func() schema.Response {
		return Delete(helper.NewContext(&c), id)
	})
})
View Source
var GetBannerListRouter = router.Handler(func(c router.Context) {
	var (
		query Query
	)

	c.ResponseFunc(c.ShouldBindQuery(&query), func() schema.Response {
		return GetBannerList(helper.NewContext(&c), query)
	})
})
View Source
var GetBannerRouter = router.Handler(func(c router.Context) {
	id := c.Param("banner_id")

	c.ResponseFunc(nil, func() schema.Response {
		return GetBanner(id)
	})
})
View Source
var UpdateRouter = router.Handler(func(c router.Context) {
	var (
		input UpdateParams
	)

	id := c.Param("banner_id")

	c.ResponseFunc(c.ShouldBindJSON(&input), func() schema.Response {
		return Update(helper.NewContext(&c), id, input)
	})
})

Functions

func Create

func Create(c helper.Context, input CreateParams) (res schema.Response)

func Delete

func Delete(c helper.Context, addressId string) (res schema.Response)

func DeleteBannerById

func DeleteBannerById(id string)

func GetBanner

func GetBanner(id string) (res schema.Response)

func GetBannerList

func GetBannerList(c helper.Context, query Query) (res schema.Response)

func Update

func Update(c helper.Context, bannerId string, input UpdateParams) (res schema.Response)

Types

type CreateParams

type CreateParams struct {
	Image       string               `json:"image" validate:"required,url,max=255" comment:"图片地址"`                   // 图片 URL
	Href        string               `json:"href" validate:"required,url,max=255" comment:"图片跳转的地址"`                 // 图片跳转的 URL
	Platform    model.BannerPlatform `json:"platform" validate:"required,max=32,oneof=pc app" comment:"平台"`          // 用于哪个平台, web/app
	Description *string              `json:"description" validate:"omitempty,max=255" comment:"描述"`                  // Banner 描述
	Priority    *int                 `json:"priority" validate:"omitempty,gt=0" comment:"优先级"`                       // 优先级,用于排序
	Identifier  *string              `json:"identifier" validate:"omitempty,max=32" comment:"APP 标识符"`               // APP 跳转标识符
	FallbackUrl *string              `json:"fallback_url" validate:"omitempty,url,max=255" comment:"APP 跳转标识符的备选方案"` // APP 跳转标识符的备选方案
}

type Query

type Query struct {
	schema.Query
	Platform *model.BannerPlatform `json:"platform" url:"platform" validate:"omitempty,oneof=pc app" comment:"平台"` // 根据平台筛选
	Active   *bool                 `json:"active" url:"active" validate:"omitempty" comment:"是否激活"`                // 是否激活
}

type UpdateParams

type UpdateParams struct {
	Image       *string               `json:"image" validate:"omitempty,url,max=255" comment:"图片地址"`                  // 图片 URL
	Href        *string               `json:"href" validate:"omitempty,url,max=255" comment:"图片跳转的地址"`                // 图片跳转的 URL
	Platform    *model.BannerPlatform `json:"platform" validate:"omitempty,max=32,oneof=pc app" comment:"平台"`         // 用于哪个平台, web/app
	Description *string               `json:"description" validate:"omitempty,max=255" comment:"描述"`                  // Banner 描述
	Priority    *int                  `json:"priority" validate:"omitempty,gt=0" comment:"优先级"`                       // 优先级,用于排序
	Identifier  *string               `json:"identifier" validate:"omitempty,max=32" comment:"APP 标识符"`               // APP 跳转标识符
	FallbackUrl *string               `json:"fallback_url" validate:"omitempty,url,max=255" comment:"APP 跳转标识符的备选方案"` // APP 跳转标识符的备选方案
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL