message

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 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.

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

	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, input QueryAdmin) (res schema.Response)

用户获取自己的消息列表

func GetMessageListByUser

func GetMessageListByUser(c helper.Context, input 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" valid:"required~请添加用户ID"`
	Title   string `json:"title" valid:"required~请填写消息标题"`
	Content string `json:"content" valid:"required~请填写消息内容"`
}

type Query

type Query struct {
	schema.Query
	Status *model.MessageStatus `json:"status" form:"status"`
	Read   *bool                `json:"read" form:"read"`
}

type QueryAdmin

type QueryAdmin struct {
	Query
	Uid *string `json:"uid" form:"uid"` // 指定某个用户ID
}

type UpdateParams

type UpdateParams struct {
	Title   *string `json:"title"`   // 消息标题
	Content *string `json:"content"` // 消息内容
}

Jump to

Keyboard shortcuts

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