message

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: 12 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.

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 CreateMessageParams
	)

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

	c.ResponseFunc(nil, func() schema.Response {
		return DeleteByAdmin(helper.NewContext(&c), id)
	})
})
View Source
var GetAdminRouter = router.Handler(func(c router.Context) {
	id := c.Param(ParamsIdName)

	c.ResponseFunc(nil, func() schema.Response {
		return GetByAdmin(helper.NewContext(&c), id)
	})
})

管理员获取个人消息详情

View Source
var GetMessageListByAdminRouter = router.Handler(func(c router.Context) {
	var (
		input Query
	)

	c.ResponseFunc(c.ShouldBindQuery(&input), func() schema.Response {
		return GetMessageListByAdmin(helper.NewContext(&c), input)
	})
})
View Source
var (
	ParamsIdName = "message_id"
)
View Source
var UpdateRouter = router.Handler(func(c router.Context) {
	var (
		input UpdateParams
	)

	id := c.Param(ParamsIdName)

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

Functions

func Create

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

func DeleteByAdmin

func DeleteByAdmin(c helper.Context, messageId string) (res schema.Response)

func DeleteMessageById

func DeleteMessageById(id string)

func GetByAdmin

func GetByAdmin(c helper.Context, id string) (res schema.Response)

Get Message detail

func GetMessageListByAdmin

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

用户获取自己的消息列表

func Update

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

Types

type CreateMessageParams

type CreateMessageParams struct {
	Uid     string `json:"uid" validate:"required,max=32" comment:"用户 ID "`
	Title   string `json:"title" validate:"required,max=32" comment:"标题"`
	Content string `json:"content" validate:"required" comment:"内容"`
}

type Query

type Query struct {
	schema.Query
	Status *model.MessageStatus `json:"status" url:"status" validate:"omitempty,number" comment:"状态"`
	Read   *bool                `json:"read" url:"read" validate:"omitempty" comment:"是否已读"`
	Uid    *string              `json:"uid" url:"uid" validate:"omitempty" comment:"用户ID"`
}

type UpdateParams

type UpdateParams struct {
	Title   *string `json:"title" validate:"required,max=32" comment:"标题"`
	Content *string `json:"content" validate:"required" comment:"内容"`
}

Jump to

Keyboard shortcuts

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