report

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.

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 GetListRouter = router.Handler(func(c router.Context) {
	var (
		input Query
	)

	c.ResponseFunc(c.ShouldBindQuery(&input), func() schema.Response {
		return GetList(helper.NewContext(&c), input)
	})
})
View Source
var GetReportRouter = router.Handler(func(c router.Context) {
	id := c.Param("report_id")

	c.ResponseFunc(nil, func() schema.Response {
		return GetReportByUser(helper.NewContext(&c), id)
	})
})
View Source
var GetTypesRouter = router.Handler(func(c router.Context) {
	c.ResponseFunc(nil, func() schema.Response {
		return schema.Response{
			Message: "",
			Status:  schema.StatusSuccess,
			Data:    model.ReportTypes,
		}
	})
})
View Source
var UpdateRouter = router.Handler(func(c router.Context) {
	var (
		input UpdateParams
	)

	reportId := c.Param("report_id")

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

Functions

func Create

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

func DeleteReportById

func DeleteReportById(id string)

func GetList

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

func GetReportByAdmin

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

func GetReportByUser

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

func Update

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

Types

type CreateParams

type CreateParams struct {
	Title       string           `json:"title" validate:"required,max=32" comment:"标题"`  // 标题
	Content     string           `json:"content" validate:"required" comment:"内容"`       // 内容
	Type        model.ReportType `json:"type" validate:"required,max=12" comment:"反馈类型"` // 反馈类型
	Screenshots []string         `json:"screenshots" validate:"omitempty" comment:"截图"`  // 截图
}

type Query

type Query struct {
	schema.Query
	Type   *model.ReportType   `json:"type" url:"type" validate:"omitempty,max=16" comment:"类型"` // 类型
	Status *model.ReportStatus `json:"status" url:"status" validate:"omitempty" comment:"状态"`    // 状态
}

type UpdateParams

type UpdateParams struct {
	Status *model.ReportStatus `json:"status" validate:"omitempty,min=0" comment:"状态"`
}

Jump to

Keyboard shortcuts

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