banner

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 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, q 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" valid:"required~请填写图片URL"` // 图片 URL
	Href        string               `json:"href" valid:"required~请填写图片跳转链接"` // 图片跳转的 URL
	Platform    model.BannerPlatform `json:"platform" valid:"required~请选择平台"` // 用于哪个平台, web/app
	Description *string              `json:"description"`                     // Banner 描述
	Priority    *int                 `json:"priority"`                        // 优先级,用于排序
	Identifier  *string              `json:"identifier"`                      // APP 跳转标识符
	FallbackUrl *string              `json:"fallback_url"`                    // APP 跳转标识符的备选方案
}

type Query

type Query struct {
	schema.Query
	Platform *model.BannerPlatform `json:"platform" form:"platform"` // 根据平台筛选
	Active   *bool                 `json:"active" form:"active"`     // 是否激活
}

type UpdateParams

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

Jump to

Keyboard shortcuts

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