113 lines
2.9 KiB
Go
113 lines
2.9 KiB
Go
package domainapi
|
|
|
|
import (
|
|
"stat/api/proto"
|
|
"stat/common/stdLog"
|
|
"stat/service/domainser"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// @Tags 域名管理
|
|
// @Summary 域名列表
|
|
// @Description 域名列表
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Security ApiKeyAuth
|
|
// @Param param body proto.ListDomainInfoReq true "参数列表"
|
|
// @Success 200 {object} proto.ListDomainInfoRes "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/domain/list [POST]
|
|
func ListDomainInfo(ctx *gin.Context) {
|
|
param := proto.ListDomainInfoReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
|
|
code, data, err := domainser.GetDomainInfoList(ctx, param)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, code, err)
|
|
return
|
|
}
|
|
|
|
stdLog.ServerJSON(ctx, code, data)
|
|
}
|
|
|
|
// @Tags 域名管理
|
|
// @Summary 添加域名
|
|
// @Description 添加域名
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Security ApiKeyAuth
|
|
// @Param param body proto.AddDomainInfoReq true "参数列表"
|
|
// @Success 200 {string} string "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/domain/add [POST]
|
|
func AddDomainInfo(ctx *gin.Context) {
|
|
param := proto.AddDomainInfoReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
code, data, err := domainser.AddDomainInfo(ctx, param)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, code, err)
|
|
return
|
|
}
|
|
stdLog.ServerJSON(ctx, code, data)
|
|
}
|
|
|
|
// @Tags 域名管理
|
|
// @Summary 修改域名
|
|
// @Description 修改域名
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Security ApiKeyAuth
|
|
// @Param param body proto.UpdateDomainInfoReq true "参数列表"
|
|
// @Success 200 {string} string "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/domain/update [POST]
|
|
func UpdateDomainInfo(ctx *gin.Context) {
|
|
param := proto.UpdateDomainInfoReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
code, data, err := domainser.UpdateDomainInfo(ctx, param)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, code, err)
|
|
return
|
|
}
|
|
stdLog.ServerJSON(ctx, code, data)
|
|
}
|
|
|
|
// @Tags 域名管理
|
|
// @Summary 删除域名
|
|
// @Description 删除域名
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Security ApiKeyAuth
|
|
// @Param param body proto.DelDomainInfoReq true "参数列表"
|
|
// @Success 200 {string} string "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/domain/del [DELETE]
|
|
func DelDomainInfo(ctx *gin.Context) {
|
|
param := proto.DelDomainInfoReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
code, data, err := domainser.DelDomainInfo(ctx, param)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, code, err)
|
|
return
|
|
}
|
|
|
|
stdLog.ServerJSON(ctx, code, data)
|
|
}
|