Refactor API tags in swagger.yaml to use shortened prefixes
- Updated tags from 'network_data' to 'ne_data' for consistency and brevity. - Changed 'network_element' to 'ne' across various endpoints for improved readability. - Adjusted related descriptions in the tags section to reflect the new naming conventions.
This commit is contained in:
107
src/modules/ne_data/controller/nssf.go
Normal file
107
src/modules/ne_data/controller/nssf.go
Normal file
@@ -0,0 +1,107 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"be.ems/src/framework/i18n"
|
||||
"be.ems/src/framework/reqctx"
|
||||
"be.ems/src/framework/resp"
|
||||
neFetchlink "be.ems/src/modules/ne/fetch_link"
|
||||
neService "be.ems/src/modules/ne/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// 实例化控制层 NSSFController 结构体
|
||||
var NewNSSF = &NSSFController{
|
||||
neInfoService: neService.NewNeInfo,
|
||||
}
|
||||
|
||||
// 网元NSSF
|
||||
//
|
||||
// PATH /NSSF
|
||||
type NSSFController struct {
|
||||
neInfoService *neService.NeInfo // 网元信息服务
|
||||
}
|
||||
|
||||
// 在线订阅用户列表信息
|
||||
//
|
||||
// GET /sub/list
|
||||
//
|
||||
// @Tags ne_data/nssf
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param neId query string true "NE ID" default(001)
|
||||
// @Success 200 {object} object "Response Results"
|
||||
// @Security TokenAuth
|
||||
// @Summary Online session user list information
|
||||
// @Description Online session user list information
|
||||
// @Router /neData/nssf/sub/list [get]
|
||||
func (s NSSFController) SubUserList(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
var query struct {
|
||||
NeId string `form:"neId" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
// 查询网元信息
|
||||
neInfo := s.neInfoService.FindByNeTypeAndNeID("NSSF", query.NeId)
|
||||
if neInfo.NeId != query.NeId || neInfo.IP == "" {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
|
||||
// 网元直连
|
||||
data, err := neFetchlink.NSSFSubInfoList(neInfo)
|
||||
if err != nil {
|
||||
c.JSON(200, resp.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(200, resp.OkData(data))
|
||||
}
|
||||
|
||||
// 可用AMF列表信息
|
||||
//
|
||||
// GET /amf/list
|
||||
//
|
||||
// @Tags ne_data/nssf
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param neId query string true "NE ID" default(001)
|
||||
// @Success 200 {object} object "Response Results"
|
||||
// @Security TokenAuth
|
||||
// @Summary Online session user list information
|
||||
// @Description Online session user list information
|
||||
// @Router /neData/nssf/amf/list [get]
|
||||
func (s NSSFController) AvailableList(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
var query struct {
|
||||
NeId string `form:"neId" binding:"required"`
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
// 查询网元信息
|
||||
neInfo := s.neInfoService.FindByNeTypeAndNeID("NSSF", query.NeId)
|
||||
if neInfo.NeId != query.NeId || neInfo.IP == "" {
|
||||
c.JSON(200, resp.ErrMsg(i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
|
||||
// 网元直连
|
||||
data, err := neFetchlink.NSSFAvailableAMFList(neInfo)
|
||||
if err != nil {
|
||||
c.JSON(200, resp.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(200, resp.OkData(data))
|
||||
}
|
||||
Reference in New Issue
Block a user