Merge branch 'main-v2' into lite
This commit is contained in:
19
CHANGELOG.md
19
CHANGELOG.md
@@ -1,5 +1,24 @@
|
||||
# 版本发布日志
|
||||
|
||||
## 2.2506.1-20250607
|
||||
|
||||
- 修复 sshsvc服务的私钥文件判断生成
|
||||
- 移除 旧跟踪任务相关的路由注册
|
||||
- 优化 文件资源统一放到/usr/local/omc
|
||||
- 优化 请求响应码用常量
|
||||
- 注释 标注告警neId接收是rmUID数据
|
||||
|
||||
## 2.2505.4-20250530
|
||||
|
||||
- 修复 socket异常退出捕获,停止信号退出循环读取
|
||||
- 新增 OMC参数配置添加NE信令跟踪服务开关
|
||||
- 修复 网元激活申请码提取两行中的激活码
|
||||
- 修复 修改命令执行函数的超时处理和输出文件名
|
||||
- 调整 目录变更系统配置和引导初始化
|
||||
- 修复 增加ne_list字段的长度限制,修改相关SQL脚本
|
||||
- 修复 系统菜单和角色分配菜单缺失
|
||||
- 修复 忽略特定SQL执行错误重复字段、索引和未知字段错误
|
||||
|
||||
## 2.2505.3-20250523
|
||||
|
||||
- 修复 增加对转发邮箱和手机号码为空的错误处理
|
||||
|
||||
17
README.md
17
README.md
@@ -4,13 +4,16 @@
|
||||
|
||||
## 文件资源
|
||||
|
||||
| 路径 | 说明 |
|
||||
| --------------------- | -------------------------- |
|
||||
| /usr/local/omc/static | 网管静态资源文件路径 |
|
||||
| /usr/local/omc/upload | 网管上传文件资源路径 |
|
||||
| /usr/local/omc/backup | 网管备份网元的数据路径 |
|
||||
| /usr/local/etc/omc | 网管与网元之间相关文件 |
|
||||
| /tmp/omc | 存放从网元拉取到本地的文件 |
|
||||
| 路径 | 说明 |
|
||||
| ---------------------- | -------------------------- |
|
||||
| /usr/local/omc/static | 网管静态资源文件路径 |
|
||||
| /usr/local/omc/upload | 网管上传文件资源路径 |
|
||||
| /usr/local/omc/backup | 网管备份网元的数据路径 |
|
||||
| /usr/local/omc/trace | 网管跟踪相关的数据路径 |
|
||||
| /usr/local/omc/tcpdump | 网管 tcpdump 抓包件路径 |
|
||||
| /usr/local/omc/packet | 网管信令抓包的数据路径 |
|
||||
| /usr/local/etc/omc | 网管与网元之间相关文件 |
|
||||
| /tmp/omc | 存放从网元拉取到本地的文件 |
|
||||
|
||||
## 端口
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ const (
|
||||
type Alarm struct {
|
||||
AlarmSeq int `json:"alarmSeq"`
|
||||
AlarmId string `json:"alarmId" xorm:"alarm_id"`
|
||||
NeId string `json:"neId"`
|
||||
NeId string `json:"neId"` // 收到实际是rmUID
|
||||
AlarmCode int `json:"alarmCode"`
|
||||
AlarmTitle string `json:"alarmTitle"`
|
||||
EventTime string `json:"eventTime"`
|
||||
|
||||
@@ -1,383 +0,0 @@
|
||||
package trace
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/go-resty/resty/v2"
|
||||
|
||||
"be.ems/lib/config"
|
||||
"be.ems/lib/dborm"
|
||||
"be.ems/lib/global"
|
||||
"be.ems/lib/log"
|
||||
"be.ems/lib/services"
|
||||
)
|
||||
|
||||
var (
|
||||
UriTraceTaskV1 = config.DefaultUriPrefix + "/traceManagement/v1/subscriptions"
|
||||
UriTraceTask = config.DefaultUriPrefix + "/traceManagement/{apiVersion}/subscriptions"
|
||||
|
||||
CustomUriTraceTaskV1 = config.UriPrefix + "/traceManagement/v1/subscriptions"
|
||||
CustomUriTraceTask = config.UriPrefix + "/traceManagement/{apiVersion}/subscriptions"
|
||||
)
|
||||
|
||||
type TraceTask struct {
|
||||
Id int `json:"id" xorm:"pk 'id' autoincr"`
|
||||
TraceType string `json:"traceType"`
|
||||
StartTime string `json:"startTime"`
|
||||
EndTime string `json:"endTime"`
|
||||
Imsi string `json:"imsi"`
|
||||
Msisdn string `json:"msisdn"`
|
||||
SrcIp string `json:"srcIp"`
|
||||
DstIp string `json:"dstIp"`
|
||||
SignalPort int16 `json:"signalPort"`
|
||||
NeType string `json:"neType"`
|
||||
NeId string `json:"neId"`
|
||||
UeIp string `json:"ueIp"`
|
||||
Interfaces []string `json:"interfaces"`
|
||||
NotifyUrl string `json:"notifyUrl" xorm:"-"`
|
||||
Status string `json:"-" xorm:"status"`
|
||||
SuccNEs []string `json:"-" xorm:"succ_nes"`
|
||||
FailNEs []string `json:"-" xorm:"fail_nes"`
|
||||
AccountID string `json:"accountId" xorm:"account_id"`
|
||||
Comment string `json:"comment" xorm:"comment"`
|
||||
UpdateTime string `json:"-" xorm:"-"`
|
||||
}
|
||||
|
||||
var client = resty.New()
|
||||
|
||||
/*
|
||||
func init() {
|
||||
client.SetTimeout(3 * time.Second)
|
||||
}
|
||||
*/
|
||||
|
||||
// Post trace task to NF/NFs
|
||||
func PostTraceTaskToNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("PostTraceTaskToNF processing... ")
|
||||
|
||||
//vars := mux.Vars(r)
|
||||
|
||||
// token, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Request error:", err)
|
||||
// return
|
||||
// }
|
||||
// log.Debug("AccessToken:", token)
|
||||
|
||||
body, err := io.ReadAll(io.LimitReader(r.Body, int64(config.GetYamlConfig().Params.UriMaxLen)))
|
||||
if err != nil {
|
||||
log.Error("io.ReadAll is failed:", err)
|
||||
services.ResponseNotFound404UriNotExist(w, r)
|
||||
return
|
||||
}
|
||||
log.Trace("body:", string(body))
|
||||
|
||||
traceTask := new(TraceTask)
|
||||
_ = json.Unmarshal(body, traceTask)
|
||||
log.Debug("traceTask:", traceTask)
|
||||
|
||||
var neTypes []string
|
||||
// do not set device
|
||||
if traceTask.NeType == "" {
|
||||
// query neType by interface
|
||||
if len(traceTask.Interfaces) > 0 {
|
||||
err := dborm.XormGetSingleColStringArrayByIn("trace_info", "ne_type", "interface", traceTask.Interfaces, &neTypes)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormGetSingleCol:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
neTypes = []string{"AMF", "SMF", "UDM", "AUSF", "UPF"}
|
||||
}
|
||||
} else {
|
||||
neTypes = append(neTypes, traceTask.NeType)
|
||||
}
|
||||
log.Debug("neTypes:", neTypes)
|
||||
|
||||
traceTask.Status = "Inactive"
|
||||
_, err = dborm.XormInsertTableOne("trace_task", traceTask)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormInsertTableOne:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
traceTask.NotifyUrl = config.GetYamlConfig().OMC.GtpUri
|
||||
log.Trace("traceTask:", traceTask)
|
||||
|
||||
for _, neType := range neTypes {
|
||||
var neInfos []dborm.NeInfo
|
||||
if traceTask.NeId == "" {
|
||||
err := dborm.XormGetNeInfoByNeType(neType, &neInfos)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormGetNeInfoByNeType:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
neInfo, err := dborm.XormGetNeInfo(neType, traceTask.NeId)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormGetNeInfoByNeType:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
neInfos = append(neInfos, *neInfo)
|
||||
}
|
||||
for _, neInfo := range neInfos {
|
||||
hostUri := fmt.Sprintf("http://%s:%v", neInfo.Ip, neInfo.Port)
|
||||
requestURI2NF := fmt.Sprintf("%s%s", hostUri, UriTraceTaskV1)
|
||||
log.Debug("requestURI2NF:", requestURI2NF)
|
||||
|
||||
body, _ := json.Marshal(traceTask)
|
||||
log.Debug("body:", string(body))
|
||||
resp, err := client.R().
|
||||
EnableTrace().
|
||||
SetHeaders(map[string]string{"User-Agent": config.GetDefaultUserAgent()}).
|
||||
SetHeaders(map[string]string{"Content-Type": "application/json;charset=UTF-8"}).
|
||||
SetBody(body).
|
||||
Post(requestURI2NF)
|
||||
if err != nil {
|
||||
log.Error("Failed to Post:", err)
|
||||
failNE := fmt.Sprintf("%s.%s", neInfo.NeType, neInfo.NeId)
|
||||
traceTask.FailNEs = append(traceTask.FailNEs, failNE)
|
||||
} else {
|
||||
switch resp.StatusCode() {
|
||||
case http.StatusOK, http.StatusCreated, http.StatusNoContent, http.StatusAccepted:
|
||||
succNE := fmt.Sprintf("%s.%s", neInfo.NeType, neInfo.NeId)
|
||||
traceTask.SuccNEs = append(traceTask.SuccNEs, succNE)
|
||||
default:
|
||||
log.Warnf("Post return code:%d, message:%s", resp.StatusCode(), string(resp.Body()))
|
||||
failNE := fmt.Sprintf("%s.%s", neInfo.NeType, neInfo.NeId)
|
||||
traceTask.FailNEs = append(traceTask.FailNEs, failNE)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(traceTask.SuccNEs) > 0 {
|
||||
traceTask.Status = "Active"
|
||||
_, err = dborm.XormUpdateTableById(traceTask.Id, "trace_task", traceTask)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormUpdateTableById:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
services.ResponseStatusOK204NoContent(w)
|
||||
} else {
|
||||
traceTask.Status = "Failed"
|
||||
_, err = dborm.XormUpdateTableById(traceTask.Id, "trace_task", traceTask)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormUpdateTableById:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
err = global.ErrTraceFailedDistributeToNEs
|
||||
log.Error(err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func PutTraceTaskToNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("PutTraceTaskToNF processing... ")
|
||||
|
||||
//vars := mux.Vars(r)
|
||||
|
||||
// token, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Request error:", err)
|
||||
// return
|
||||
// }
|
||||
// log.Debug("AccessToken:", token)
|
||||
|
||||
body, err := io.ReadAll(io.LimitReader(r.Body, int64(config.GetYamlConfig().Params.UriMaxLen)))
|
||||
if err != nil {
|
||||
log.Error("io.ReadAll is failed:", err)
|
||||
services.ResponseNotFound404UriNotExist(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
traceTask := new(TraceTask)
|
||||
_ = json.Unmarshal(body, traceTask)
|
||||
|
||||
traceTask.NotifyUrl = config.GetYamlConfig().OMC.GtpUri
|
||||
log.Debug("traceTask:", traceTask)
|
||||
|
||||
var neTypes []string
|
||||
// do not set device
|
||||
if traceTask.NeType == "" {
|
||||
// query neType by interface
|
||||
if len(traceTask.Interfaces) > 0 {
|
||||
err := dborm.XormGetSingleColStringArrayByIn("trace_info", "ne_type", "interface", traceTask.Interfaces, &neTypes)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormGetSingleColStringArrayByIn:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
neTypes = []string{"AMF", "SMF", "UDM", "AUSF", "UPF"}
|
||||
}
|
||||
|
||||
} else {
|
||||
neTypes = append(neTypes, traceTask.NeType)
|
||||
}
|
||||
log.Debug("neTypes:", neTypes)
|
||||
|
||||
for _, neType := range neTypes {
|
||||
var neInfos []dborm.NeInfo
|
||||
if traceTask.NeId == "" {
|
||||
err := dborm.XormGetNeInfoByNeType(neType, &neInfos)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormGetNeInfoByNeType:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
neInfo, err := dborm.XormGetNeInfo(neType, traceTask.NeId)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormGetNeInfoByNeType:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
neInfos = append(neInfos, *neInfo)
|
||||
}
|
||||
for _, neInfo := range neInfos {
|
||||
hostUri := fmt.Sprintf("http://%s:%v", neInfo.Ip, neInfo.Port)
|
||||
requestURI2NF := fmt.Sprintf("%s%s", hostUri, UriTraceTaskV1)
|
||||
log.Debug("requestURI2NF:", requestURI2NF)
|
||||
|
||||
body, _ := json.Marshal(traceTask)
|
||||
log.Debug("body:", string(body))
|
||||
resp, err := client.R().
|
||||
EnableTrace().
|
||||
SetHeaders(map[string]string{"User-Agent": config.GetDefaultUserAgent()}).
|
||||
SetHeaders(map[string]string{"Content-Type": "application/json;charset=UTF-8"}).
|
||||
SetBody(body).
|
||||
Put(requestURI2NF)
|
||||
if err != nil {
|
||||
log.Error("Failed to Put:", err)
|
||||
failNE := fmt.Sprintf("%s.%s", neInfo.NeType, neInfo.NeId)
|
||||
traceTask.FailNEs = append(traceTask.FailNEs, failNE)
|
||||
} else {
|
||||
switch resp.StatusCode() {
|
||||
case http.StatusOK, http.StatusCreated, http.StatusNoContent, http.StatusAccepted:
|
||||
succNE := fmt.Sprintf("%s.%s", neInfo.NeType, neInfo.NeId)
|
||||
traceTask.SuccNEs = append(traceTask.SuccNEs, succNE)
|
||||
default:
|
||||
log.Warn("Post return code:%d, message:%s", resp.StatusCode(), string(resp.Body()))
|
||||
failNE := fmt.Sprintf("%s.%s", neInfo.NeType, neInfo.NeId)
|
||||
traceTask.FailNEs = append(traceTask.FailNEs, failNE)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if len(traceTask.SuccNEs) > 0 {
|
||||
traceTask.Status = "Active"
|
||||
_, err = dborm.XormUpdateTableById(traceTask.Id, "trace_task", traceTask)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormUpdateTableById:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
services.ResponseStatusOK204NoContent(w)
|
||||
} else {
|
||||
traceTask.Status = "Failed"
|
||||
_, err = dborm.XormUpdateTableById(traceTask.Id, "trace_task", traceTask)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormUpdateTableById:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
err = global.ErrTraceFailedDistributeToNEs
|
||||
log.Error(err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func DeleteTraceTaskToNF(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("DeleteTraceTaskToNF processing... ")
|
||||
|
||||
// token, err := services.CheckFrontValidRequest(w, r)
|
||||
// if err != nil {
|
||||
// log.Error("Request error:", err)
|
||||
// return
|
||||
// }
|
||||
// log.Debug("AccessToken:", token)
|
||||
|
||||
vars := r.URL.Query()
|
||||
ids, ok := vars["id"]
|
||||
if !ok || len(ids) == 0 {
|
||||
err := global.ErrTraceNotCarriedTaskID
|
||||
log.Error(err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
log.Debug("ids:", ids)
|
||||
|
||||
for _, id := range ids {
|
||||
log.Debug("id:", id)
|
||||
|
||||
var succNes []string
|
||||
err := dborm.XormGetColStringArrayByWhere("trace_task", "succ_nes", fmt.Sprintf("id=%s", id), &succNes)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormGetSingleColStringArrayByWhere:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
log.Debug("succNes:", succNes)
|
||||
nes := new([]string)
|
||||
if len(succNes) > 0 {
|
||||
_ = json.Unmarshal([]byte(succNes[0]), nes)
|
||||
}
|
||||
log.Debug("nes:", nes)
|
||||
|
||||
for _, ne := range *nes {
|
||||
i := strings.Index(ne, ".")
|
||||
neType := ne[0:i]
|
||||
neId := ne[i+1:]
|
||||
log.Debugf("ne:%s neType:%s neId:%s", ne, neType, neId)
|
||||
neInfo, err := dborm.XormGetNeInfo(neType, neId)
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormGetNeInfo:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
hostUri := fmt.Sprintf("http://%s:%v", neInfo.Ip, neInfo.Port)
|
||||
requestURI2NF := fmt.Sprintf("%s%s?id=%s", hostUri, UriTraceTaskV1, id)
|
||||
log.Debug("requestURI2NF:", requestURI2NF)
|
||||
|
||||
_, err = client.R().
|
||||
EnableTrace().
|
||||
SetHeaders(map[string]string{"User-Agent": config.GetDefaultUserAgent()}).
|
||||
SetHeaders(map[string]string{"Content-Type": "application/json;charset=UTF-8"}).
|
||||
Delete(requestURI2NF)
|
||||
if err != nil {
|
||||
log.Error("Failed to Delete:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
_, err = dborm.XormDeleteDataByWhere(fmt.Sprintf("id=%s", id), "trace_task")
|
||||
if err != nil {
|
||||
log.Error("Failed to dborm.XormDeleteDataByWhere:", err)
|
||||
services.ResponseInternalServerError500ProcessError(w, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
services.ResponseStatusOK204NoContent(w)
|
||||
}
|
||||
|
||||
func GetRawMessage(w http.ResponseWriter, r *http.Request) {
|
||||
log.Debug("GetRawMessage processing... ")
|
||||
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
"be.ems/features/security"
|
||||
"be.ems/features/sm"
|
||||
"be.ems/features/state"
|
||||
"be.ems/features/trace"
|
||||
"be.ems/features/ue"
|
||||
"be.ems/lib/midware"
|
||||
"be.ems/lib/services"
|
||||
@@ -207,15 +206,6 @@ func init() {
|
||||
Register("PUT", cm.CustomUriSoftwareNE, cm.ActiveSoftwareToNF, nil)
|
||||
Register("PATCH", cm.CustomUriSoftwareNE, cm.RollBackSoftwareToNF, nil)
|
||||
|
||||
// Trace management 跟踪任务
|
||||
Register("POST", trace.UriTraceTask, trace.PostTraceTaskToNF, midware.LogOperate(collectlogs.OptionNew("Trace Task", collectlogs.BUSINESS_TYPE_INSERT)))
|
||||
Register("PUT", trace.UriTraceTask, trace.PutTraceTaskToNF, midware.LogOperate(collectlogs.OptionNew("Trace Task", collectlogs.BUSINESS_TYPE_UPDATE)))
|
||||
Register("DELETE", trace.UriTraceTask, trace.DeleteTraceTaskToNF, midware.LogOperate(collectlogs.OptionNew("Trace Task", collectlogs.BUSINESS_TYPE_DELETE)))
|
||||
|
||||
Register("POST", trace.CustomUriTraceTask, trace.PostTraceTaskToNF, nil)
|
||||
Register("PUT", trace.CustomUriTraceTask, trace.PutTraceTaskToNF, nil)
|
||||
Register("DELETE", trace.CustomUriTraceTask, trace.DeleteTraceTaskToNF, nil)
|
||||
|
||||
// file management
|
||||
Register("POST", file.UriFile, file.UploadFile, midware.LogOperate(collectlogs.OptionNew("File", collectlogs.BUSINESS_TYPE_INSERT)))
|
||||
Register("GET", file.UriFile, file.DownloadFile, midware.LogOperate(collectlogs.OptionNew("File", collectlogs.BUSINESS_TYPE_OTHER)))
|
||||
|
||||
@@ -20,14 +20,14 @@ func ErrorCatch() gin.HandlerFunc {
|
||||
|
||||
// 返回错误响应给客户端
|
||||
if config.Env() == "prod" {
|
||||
c.JSON(500, resp.CodeMsg(500001, "Internal Server Errors"))
|
||||
c.JSON(500, resp.CodeMsg(resp.CODE_INTERNAL, resp.MSG_INTERNAL))
|
||||
} else {
|
||||
// 通过实现 error 接口的 Error() 方法自定义错误类型进行捕获
|
||||
switch v := err.(type) {
|
||||
case error:
|
||||
c.JSON(500, resp.CodeMsg(500001, v.Error()))
|
||||
c.JSON(500, resp.CodeMsg(resp.CODE_INTERNAL, v.Error()))
|
||||
default:
|
||||
c.JSON(500, resp.CodeMsg(500001, fmt.Sprint(err)))
|
||||
c.JSON(500, resp.CodeMsg(resp.CODE_INTERNAL, fmt.Sprint(err)))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ func AuthorizeOauth2(scope []string) gin.HandlerFunc {
|
||||
// 获取请求头标识信息
|
||||
tokenStr := reqctx.Authorization(c)
|
||||
if tokenStr == "" {
|
||||
c.JSON(401, resp.CodeMsg(401003, "authorization token is empty"))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_NOTOKEN, "authorization token is empty"))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
@@ -27,7 +27,7 @@ func AuthorizeOauth2(scope []string) gin.HandlerFunc {
|
||||
// 验证令牌
|
||||
claims, err := token.Oauth2TokenVerify(tokenStr, "access")
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401001, err.Error()))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH, err.Error()))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
@@ -35,7 +35,7 @@ func AuthorizeOauth2(scope []string) gin.HandlerFunc {
|
||||
// 获取缓存的用户信息
|
||||
info := token.Oauth2InfoGet(claims)
|
||||
if info.ClientId == "" {
|
||||
c.JSON(401, resp.CodeMsg(401002, "invalid login user information"))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, "invalid login user information"))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func AuthorizeOauth2(scope []string) gin.HandlerFunc {
|
||||
}
|
||||
if !hasScope {
|
||||
msg := fmt.Sprintf("unauthorized access %s %s", c.Request.Method, c.Request.RequestURI)
|
||||
c.JSON(403, resp.CodeMsg(403001, msg))
|
||||
c.JSON(403, resp.CodeMsg(resp.CODE_PERMISSION, msg))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ func AuthorizeUser(options map[string][]string) gin.HandlerFunc {
|
||||
// 获取请求头标识信息
|
||||
tokenStr := reqctx.Authorization(c)
|
||||
if tokenStr == "" {
|
||||
c.JSON(401, resp.CodeMsg(401003, "authorization token is empty"))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_NOTOKEN, "authorization token is empty"))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
@@ -76,7 +76,7 @@ func AuthorizeUser(options map[string][]string) gin.HandlerFunc {
|
||||
// 验证令牌
|
||||
claims, err := token.UserTokenVerify(tokenStr, "access")
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401001, err.Error()))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH, err.Error()))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
@@ -84,7 +84,7 @@ func AuthorizeUser(options map[string][]string) gin.HandlerFunc {
|
||||
// 获取缓存的用户信息
|
||||
info := token.UserInfoGet(claims)
|
||||
if info.UserId <= 0 {
|
||||
c.JSON(401, resp.CodeMsg(401002, "invalid login user information"))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, "invalid login user information"))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func AuthorizeUser(options map[string][]string) gin.HandlerFunc {
|
||||
verifyOk := verifyRolePermission(roles, perms, options)
|
||||
if !verifyOk {
|
||||
msg := fmt.Sprintf("unauthorized access %s %s", c.Request.Method, c.Request.RequestURI)
|
||||
c.JSON(403, resp.CodeMsg(403001, msg))
|
||||
c.JSON(403, resp.CodeMsg(resp.CODE_PERMISSION, msg))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ func OperateLog(options Options) gin.HandlerFunc {
|
||||
// 获取登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ func CryptoApi(requestDecrypt, responseEncrypt bool) gin.HandlerFunc {
|
||||
|
||||
// 是否存在data字段数据
|
||||
if contentDe == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "decrypt not found field data"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "decrypt not found field data"))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
@@ -61,7 +61,7 @@ func CryptoApi(requestDecrypt, responseEncrypt bool) gin.HandlerFunc {
|
||||
dataBodyStr, err := crypto.AESDecryptBase64(contentDe, apiKey)
|
||||
if err != nil {
|
||||
logger.Errorf("CryptoApi decrypt err => %v", err)
|
||||
c.JSON(422, resp.CodeMsg(422001, "decrypted data could not be parsed"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, "decrypted data could not be parsed"))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func OperateLog(options Options) gin.HandlerFunc {
|
||||
// 获取登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, "invalid login user information"))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, "invalid login user information"))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -12,6 +11,7 @@ import (
|
||||
"be.ems/src/framework/ip2region"
|
||||
"be.ems/src/framework/reqctx"
|
||||
"be.ems/src/framework/resp"
|
||||
"be.ems/src/framework/utils/crypto"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -39,7 +39,7 @@ type LimitOption struct {
|
||||
// 参数表示:5秒内,最多请求10次,限制类型为 IP
|
||||
//
|
||||
// 使用 USER 时,请在用户身份授权认证校验后使用
|
||||
// 以便获取登录用户信息,无用户信息时默认为 GLOBAL
|
||||
// 以便获取登录用户信息,无用户信息时默认为 LIMIT_GLOBAL
|
||||
func RateLimit(option LimitOption) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// 初始可选参数数据
|
||||
@@ -55,38 +55,38 @@ func RateLimit(option LimitOption) gin.HandlerFunc {
|
||||
|
||||
// 获取执行函数名称
|
||||
funcName := c.HandlerName()
|
||||
lastDotIndex := strings.LastIndex(funcName, "/")
|
||||
funcName = funcName[lastDotIndex+1:]
|
||||
// 生成限流key
|
||||
limitKey := constants.CACHE_RATE_LIMIT + ":" + funcName
|
||||
limitKey := constants.CACHE_RATE_LIMIT + ":" + crypto.MD5(funcName)
|
||||
|
||||
// 用户
|
||||
if option.Type == LIMIT_USER {
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, "invalid login user information"))
|
||||
userId := reqctx.LoginUserToUserID(c)
|
||||
if userId <= 0 {
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, "invalid login user information"))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
limitKey = fmt.Sprintf("%s:%d:%s", constants.CACHE_RATE_LIMIT, loginUser.UserId, funcName)
|
||||
funcMd5 := crypto.MD5(fmt.Sprintf("%d:%s", userId, funcName))
|
||||
limitKey = constants.CACHE_RATE_LIMIT + ":" + funcMd5
|
||||
}
|
||||
|
||||
// IP
|
||||
if option.Type == LIMIT_IP {
|
||||
clientIP := ip2region.ClientIP(c.ClientIP())
|
||||
limitKey = constants.CACHE_RATE_LIMIT + ":" + clientIP + ":" + funcName
|
||||
funcMd5 := crypto.MD5(fmt.Sprintf("%s:%s", clientIP, funcName))
|
||||
limitKey = constants.CACHE_RATE_LIMIT + ":" + funcMd5
|
||||
}
|
||||
|
||||
// 在Redis查询并记录请求次数
|
||||
rateCount, err := redis.RateLimit("", limitKey, option.Time, option.Count)
|
||||
if err != nil {
|
||||
c.JSON(200, resp.ErrMsg("access too often, please try again later"))
|
||||
c.JSON(200, resp.CodeMsg(resp.CODE_RATELIMIT, resp.MSG_RATELIMIT))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
rateTime, err := redis.GetExpire("", limitKey)
|
||||
if err != nil {
|
||||
c.JSON(200, resp.ErrMsg("access too often, please try again later"))
|
||||
c.JSON(200, resp.CodeMsg(resp.CODE_RATELIMIT, resp.MSG_RATELIMIT))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
@@ -97,7 +97,7 @@ func RateLimit(option LimitOption) gin.HandlerFunc {
|
||||
c.Header("X-RateLimit-Reset", fmt.Sprintf("%d", time.Now().Unix()+rateTime)) // 重置时间戳
|
||||
|
||||
if rateCount >= option.Count {
|
||||
c.JSON(200, resp.ErrMsg("access too often, please try again later"))
|
||||
c.JSON(200, resp.CodeMsg(resp.CODE_RATELIMIT, resp.MSG_RATELIMIT))
|
||||
c.Abort() // 停止执行后续的处理函数
|
||||
return
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package middleware
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"be.ems/src/framework/logger"
|
||||
"be.ems/src/framework/reqctx"
|
||||
"be.ems/src/framework/resp"
|
||||
"be.ems/src/framework/utils/crypto"
|
||||
)
|
||||
|
||||
// repeatParam 重复提交参数的类型定义
|
||||
@@ -40,9 +41,12 @@ func RepeatSubmit(interval int64) gin.HandlerFunc {
|
||||
}
|
||||
paramsJSONStr := string(paramsJSONByte)
|
||||
|
||||
// 获取执行函数名称
|
||||
funcName := c.HandlerName()
|
||||
// 唯一标识(指定key + 客户端IP + 请求地址)
|
||||
clientIP := ip2region.ClientIP(c.ClientIP())
|
||||
repeatKey := constants.CACHE_REPEAT_SUBMIT + ":" + clientIP + ":" + c.Request.RequestURI
|
||||
funcMd5 := crypto.MD5(fmt.Sprintf("%s:%s", clientIP, funcName))
|
||||
repeatKey := constants.CACHE_REPEAT_SUBMIT + ":" + funcMd5
|
||||
|
||||
// 在Redis查询并记录请求次数
|
||||
repeatStr, _ := redis.Get("", repeatKey)
|
||||
@@ -56,7 +60,8 @@ func RepeatSubmit(interval int64) gin.HandlerFunc {
|
||||
compareParams := rp.Params == paramsJSONStr
|
||||
|
||||
// 设置重复提交声明响应头(毫秒)
|
||||
c.Header("X-RepeatSubmit-Rest", strconv.FormatInt(time.Now().Add(time.Duration(compareTime)*time.Second).UnixNano()/int64(time.Millisecond), 10))
|
||||
t := time.Now().Add(time.Duration(compareTime) * time.Second)
|
||||
c.Header("X-RepeatSubmit-Rest", fmt.Sprint(t.UnixMilli()))
|
||||
|
||||
// 小于间隔时间且参数内容一致
|
||||
if compareTime < interval && compareParams {
|
||||
|
||||
@@ -1,22 +1,5 @@
|
||||
package resp
|
||||
|
||||
const (
|
||||
// CODE_ERROR 响应-code错误失败
|
||||
CODE_ERROR = 400001
|
||||
// MSG_ERROR 响应-msg错误失败
|
||||
MSG_ERROR = "error"
|
||||
|
||||
// CODE_SUCCESS 响应-msg正常成功
|
||||
CODE_SUCCESS = 200001
|
||||
// MSG_SUCCCESS 响应-code正常成功
|
||||
MSG_SUCCCESS = "success"
|
||||
|
||||
// 响应-code加密数据
|
||||
CODE_ENCRYPT = 200999
|
||||
// 响应-msg加密数据
|
||||
MSG_ENCRYPT = "encrypt"
|
||||
)
|
||||
|
||||
// Resp 响应结构体
|
||||
type Resp struct {
|
||||
Code int `json:"code"` // 响应状态码
|
||||
|
||||
78
src/framework/resp/code.go
Normal file
78
src/framework/resp/code.go
Normal file
@@ -0,0 +1,78 @@
|
||||
package resp
|
||||
|
||||
// |HTTP|状态码|描述|排查建议|
|
||||
// |----|----|----|----|
|
||||
// |500 |500001 |internal error|服务内部错误|
|
||||
// |200 |200999 |encrypt|正常请求加密数据|
|
||||
// |200 |200001 |request success|正常请求成功|
|
||||
// |200 |400001 |exist error|正常请求错误信息|
|
||||
// |200 |400002 |ratelimit over|请求限流|
|
||||
// |401 |401001 |authentication error|身份认证失败或者过期|
|
||||
// |401 |401002 |authentication invalid error|无效身份信息|
|
||||
// |401 |401003 |authorization token error|令牌字符为空|
|
||||
// |401 |401004 |device fingerprint mismatch|设备指纹信息不匹配|
|
||||
// |403 |403001 |permission error|权限未分配|
|
||||
// |422 |422001 |params error|参数接收解析错误|
|
||||
// |422 |422002 |params error|参数属性传入错误|
|
||||
|
||||
// ====== 500 ======
|
||||
const (
|
||||
// CODE_ERROR_INTERNAL 响应-code服务内部错误
|
||||
CODE_INTERNAL = 500001
|
||||
// MSG_ERROR_INTERNAL 响应-msg服务内部错误
|
||||
MSG_INTERNAL = "internal error"
|
||||
)
|
||||
|
||||
// ====== 200 ======
|
||||
const (
|
||||
// CODE_ENCRYPT 响应-code加密数据
|
||||
CODE_ENCRYPT = 200999
|
||||
// MSG_ENCRYPT 响应-msg加密数据
|
||||
MSG_ENCRYPT = "encrypt"
|
||||
|
||||
// CODE_SUCCESS 响应-code正常成功
|
||||
CODE_SUCCESS = 200001
|
||||
// MSG_SUCCCESS 响应-msg正常成功
|
||||
MSG_SUCCCESS = "success"
|
||||
|
||||
// CODE_ERROR 响应-code错误失败
|
||||
CODE_ERROR = 400001
|
||||
// MSG_ERROR 响应-msg错误失败
|
||||
MSG_ERROR = "error"
|
||||
|
||||
// CODE_RATELIMIT 响应-code错误失败
|
||||
CODE_RATELIMIT = 400002
|
||||
// MSG_RATELIMIT 响应-msg错误失败
|
||||
MSG_RATELIMIT = "access too often, please try again later"
|
||||
)
|
||||
|
||||
// ====== 401 ======
|
||||
const (
|
||||
// CODE_ERROR 响应-code身份认证失败或者过期
|
||||
CODE_AUTH = 401001
|
||||
|
||||
// CODE_AUTH_INVALID 响应-code无效身份信息
|
||||
CODE_AUTH_INVALID = 401002
|
||||
|
||||
// CODE_AUTH_NOTOKEN 响应-code令牌字符为空
|
||||
CODE_AUTH_NOTOKEN = 401003
|
||||
|
||||
// CODE_AUTH_DEVICE 响应-code设备指纹信息不匹配
|
||||
CODE_AUTH_DEVICE = 401004
|
||||
// MSG_AUTH_DEVICE 响应-msg设备指纹信息不匹配
|
||||
MSG_AUTH_DEVICE = "device fingerprint mismatch"
|
||||
)
|
||||
|
||||
// ====== 403 ======
|
||||
const (
|
||||
// CODE_PERMISSION 响应-code权限未分配
|
||||
CODE_PERMISSION = 403001
|
||||
)
|
||||
|
||||
// ====== 422 ======
|
||||
const (
|
||||
// CODE_PARAM_PARSER 响应-code参数接收解析错误
|
||||
CODE_PARAM_PARSER = 422001
|
||||
// CODE_PARAM_CHEACK 响应-code参数属性传入错误
|
||||
CODE_PARAM_CHEACK = 422002
|
||||
)
|
||||
@@ -50,7 +50,7 @@ func (s AccountController) Login(c *gin.Context) {
|
||||
var body model.LoginBody
|
||||
if err := c.ShouldBindJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -154,14 +154,14 @@ func (s AccountController) RefreshToken(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
// 验证刷新令牌是否有效
|
||||
claims, err := token.UserTokenVerify(body.RefreshToken, "refresh")
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401001, err.Error()))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, err.Error()))
|
||||
return
|
||||
}
|
||||
userId := parse.Number(claims[constants.JWT_USER_ID])
|
||||
@@ -177,7 +177,7 @@ func (s AccountController) RefreshToken(c *gin.Context) {
|
||||
deviceId := fmt.Sprint(claims[constants.JWT_DEVICE_ID])
|
||||
deviceFingerprint := reqctx.DeviceFingerprint(c, userId)
|
||||
if deviceId != deviceFingerprint {
|
||||
c.JSON(200, resp.ErrMsg("device fingerprint mismatch"))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_DEVICE, resp.MSG_AUTH_DEVICE))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ func (s AccountController) Me(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
info, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, err.Error()))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ func (s RegisterController) Register(c *gin.Context) {
|
||||
var body model.RegisterBody
|
||||
if err := c.ShouldBindJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ func (s *ChartGraphController) Load(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func (s *ChartGraphController) Save(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ func (s *ChartGraphController) Save(c *gin.Context) {
|
||||
func (s *ChartGraphController) Delete(c *gin.Context) {
|
||||
group := c.Param("group")
|
||||
if group == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: group is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: group is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ func (s *BootloaderController) Account(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ func (s CommonController) Hash(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@ func (s *FileController) Download(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
filePath := c.Param("filePath")
|
||||
if len(filePath) < 8 {
|
||||
c.JSON(422, resp.CodeMsg(422002, i18n.TKey(language, "app.common.err400")))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, i18n.TKey(language, "app.common.err400")))
|
||||
return
|
||||
}
|
||||
// base64解析出地址
|
||||
decodedBytes, err := base64.StdEncoding.DecodeString(filePath)
|
||||
if err != nil {
|
||||
c.JSON(422, resp.CodeMsg(422002, err.Error()))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, err.Error()))
|
||||
return
|
||||
}
|
||||
routerPath := string(decodedBytes)
|
||||
@@ -87,14 +87,14 @@ func (s *FileController) Upload(c *gin.Context) {
|
||||
// 上传的文件
|
||||
formFile, err := c.FormFile("file")
|
||||
if err != nil {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: file is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: file is empty"))
|
||||
return
|
||||
}
|
||||
// 子路径需要在指定范围内
|
||||
subPath := c.PostForm("subPath")
|
||||
_, ok := constants.UPLOAD_SUB_PATH[subPath]
|
||||
if subPath != "" && !ok {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: subPath not in range"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: subPath not in range"))
|
||||
return
|
||||
}
|
||||
if subPath == "" {
|
||||
@@ -136,7 +136,7 @@ func (s *FileController) ChunkCheck(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -170,12 +170,12 @@ func (s *FileController) ChunkMerge(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 子路径需要在指定范围内
|
||||
if _, ok := constants.UPLOAD_SUB_PATH[body.SubPath]; body.SubPath != "" && !ok {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: subPath not in range"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: subPath not in range"))
|
||||
return
|
||||
}
|
||||
if body.SubPath == "" {
|
||||
@@ -218,13 +218,13 @@ func (s *FileController) ChunkUpload(c *gin.Context) {
|
||||
// 切片唯一标识
|
||||
identifier := c.PostForm("identifier")
|
||||
if index == "" || identifier == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: index and identifier must be set"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: index and identifier must be set"))
|
||||
return
|
||||
}
|
||||
// 上传的文件
|
||||
formFile, err := c.FormFile("file")
|
||||
if err != nil {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: file is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: file is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ func (s *FileController) List(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -322,12 +322,12 @@ func (s *FileController) File(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
// 检查路径是否在允许的目录范围内
|
||||
allowedPaths := []string{"/var/log", "/tmp", "/usr/local/omc/backup"}
|
||||
allowedPaths := []string{"/var/log", "/tmp", "/usr/local/omc"}
|
||||
allowed := false
|
||||
for _, p := range allowedPaths {
|
||||
if strings.HasPrefix(querys.Path, p) {
|
||||
@@ -373,7 +373,7 @@ func (s *FileController) Remove(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ func (s *FileController) TransferStaticFile(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ func (s *MonitorController) Load(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ func (s SysCacheController) Keys(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ func (s SysCacheController) Value(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ func (s SysCacheController) CleanKeys(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if constants.CACHE_TOKEN_DEVICE == query.CacheName {
|
||||
@@ -196,7 +196,7 @@ func (s SysCacheController) CleanValue(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ func (s *SysJobController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
jobId := parse.Number(c.Param("jobId"))
|
||||
if jobId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: jobId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: jobId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -87,11 +87,11 @@ func (s *SysJobController) Add(c *gin.Context) {
|
||||
var body model.SysJob
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.JobId > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: jobId not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: jobId not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -143,11 +143,11 @@ func (s *SysJobController) Edit(c *gin.Context) {
|
||||
var body model.SysJob
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.JobId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: jobId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: jobId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ func (s *SysJobController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
jobId := c.Param("jobId")
|
||||
if jobId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: jobId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: jobId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ func (s *SysJobController) Status(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ func (s *SysJobController) Run(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
jobId := parse.Number(c.Param("jobId"))
|
||||
if jobId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: jobId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: jobId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ func (s *SysJobLogController) List(c *gin.Context) {
|
||||
func (s *SysJobLogController) Info(c *gin.Context) {
|
||||
logId := parse.Number(c.Param("logId"))
|
||||
if logId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: logId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: logId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func (s *SysJobLogController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
logId := c.Param("logId")
|
||||
if logId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: logId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: logId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ func (s *SysUserOnlineController) List(c *gin.Context) {
|
||||
func (s SysUserOnlineController) Logout(c *gin.Context) {
|
||||
tokenIdStr := c.Param("tokenId")
|
||||
if tokenIdStr == "" || strings.Contains(tokenIdStr, "*") {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: tokenId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: tokenId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ func (s AlarmController) List(c *gin.Context) {
|
||||
var query model.AlarmQuery
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 查询数据
|
||||
@@ -72,7 +72,7 @@ func (s AlarmController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ func (s AlarmController) Clear(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ func (s AlarmController) Ack(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ func (s AlarmController) Export(c *gin.Context) {
|
||||
var query model.AlarmQuery
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 限制导出数据集
|
||||
|
||||
@@ -43,7 +43,7 @@ func (s AlarmForwardController) List(c *gin.Context) {
|
||||
var query model.AlarmForwardLogQuery
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 查询数据
|
||||
|
||||
@@ -49,7 +49,7 @@ func (s AlarmLogController) List(c *gin.Context) {
|
||||
var query model.AlarmLogQuery
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 查询数据
|
||||
@@ -82,7 +82,7 @@ func (s AlarmLogController) Event(c *gin.Context) {
|
||||
var query model.AlarmEventQuery
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 查询数据
|
||||
|
||||
@@ -35,7 +35,7 @@ func (s BackupController) FTPUpdate(c *gin.Context) {
|
||||
var body model.BackupDataFTP
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ func (s BackupController) FTPPush(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 判断路径是否合法
|
||||
|
||||
@@ -49,7 +49,7 @@ func (s KPIController) KPIData(c *gin.Context) {
|
||||
var querys model.KPIQuery
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ func (s KPIController) KPIData(c *gin.Context) {
|
||||
func (s KPIController) KPITitle(c *gin.Context) {
|
||||
neType := c.Query("neType")
|
||||
if neType == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neType is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neType is empty"))
|
||||
return
|
||||
}
|
||||
kpiTitles := s.kpiReportService.FindTitle(neType)
|
||||
|
||||
@@ -53,7 +53,7 @@ func (s NBStateController) List(c *gin.Context) {
|
||||
var query model.NBStateQuery
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ func (s NBStateController) Export(c *gin.Context) {
|
||||
var querys model.NBStateQuery
|
||||
if err := c.ShouldBindBodyWithJSON(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 限制导出数据集
|
||||
|
||||
@@ -49,7 +49,7 @@ func (s NEStateController) List(c *gin.Context) {
|
||||
var query model.NEStateQuery
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ func (s *AMFController) UEList(c *gin.Context) {
|
||||
var querys model.UEEventAMFQuery
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ func (s *AMFController) UERemove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ func (s *AMFController) UEExport(c *gin.Context) {
|
||||
var querys model.UEEventAMFQuery
|
||||
if err := c.ShouldBindBodyWithJSON(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 限制导出数据集
|
||||
@@ -181,7 +181,7 @@ func (s *AMFController) NbInfoList(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ func (s *AMFController) NbStateList(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
neId := c.Query("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ func (s *IMSController) CDRList(c *gin.Context) {
|
||||
var querys model.CDREventIMSQuery
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ func (s *IMSController) CDRExport(c *gin.Context) {
|
||||
var querys model.CDREventIMSQuery
|
||||
if err := c.ShouldBindBodyWithJSON(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 限制导出数据集
|
||||
@@ -177,7 +177,7 @@ func (s *IMSController) UeSessionNum(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
neId := c.Query("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ func (s *IMSController) UeSessionList(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ func (s *MMEController) UEList(c *gin.Context) {
|
||||
var querys model.UEEventMMEQuery
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ func (s *MMEController) UERemove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ func (s *MMEController) UEExport(c *gin.Context) {
|
||||
var querys model.UEEventMMEQuery
|
||||
if err := c.ShouldBindBodyWithJSON(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 限制导出数据集
|
||||
@@ -181,7 +181,7 @@ func (s *MMEController) NbInfoList(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ func (s *MMEController) NbStateList(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
neId := c.Query("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func (s PCFController) RuleInfoList(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ func (s PCFController) RuleInfoAdd(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ func (s PCFController) RuleInfoEdit(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ func (s PCFController) RuleInfoRemove(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ func (s PCFController) RuleInfoExport(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ func (s PCFController) RuleInfoImport(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ func (s *SGWCController) CDRList(c *gin.Context) {
|
||||
var querys model.CDREventSGWCQuery
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ func (s *SGWCController) CDRRemove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ func (s *SGWCController) CDRExport(c *gin.Context) {
|
||||
var querys model.CDREventSGWCQuery
|
||||
if err := c.ShouldBindBodyWithJSON(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 限制导出数据集
|
||||
|
||||
@@ -55,7 +55,7 @@ func (s *SMFController) CDRList(c *gin.Context) {
|
||||
var querys model.CDREventSMFQuery
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ func (s *SMFController) CDRRemove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ func (s *SMFController) CDRExport(c *gin.Context) {
|
||||
var querys model.CDREventSMFQuery
|
||||
if err := c.ShouldBindBodyWithJSON(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 限制导出数据集
|
||||
@@ -182,7 +182,7 @@ func (s *SMFController) SubUserNum(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ func (s *SMFController) SubUserList(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ func (s *SMSCController) CDRList(c *gin.Context) {
|
||||
var querys model.CDREventSMSCQuery
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ func (s *SMSCController) CDRRemove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ func (s *SMSCController) CDRExport(c *gin.Context) {
|
||||
var querys model.CDREventSMSCQuery
|
||||
if err := c.ShouldBindBodyWithJSON(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 限制导出数据集
|
||||
|
||||
@@ -51,7 +51,7 @@ type UDMAuthController struct {
|
||||
func (s *UDMAuthController) ResetData(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ func (s *UDMAuthController) Info(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
imsi := c.Param("imsi")
|
||||
if neId == "" || imsi == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId/imsi is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -155,18 +155,18 @@ func (s *UDMAuthController) Add(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
neId := c.Param("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMAuthUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.IMSI == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: imsi is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: imsi is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -220,18 +220,18 @@ func (s *UDMAuthController) Adds(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
num := c.Param("num")
|
||||
if neId == "" || num == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId/num is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/num is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMAuthUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.IMSI == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: imsi is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: imsi is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -283,18 +283,18 @@ func (s *UDMAuthController) Edit(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
neId := c.Param("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMAuthUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.IMSI == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: imsi is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: imsi is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -347,7 +347,7 @@ func (s *UDMAuthController) Remove(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
imsi := c.Param("imsi")
|
||||
if neId == "" || imsi == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId/imsi is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ func (s *UDMAuthController) Removes(c *gin.Context) {
|
||||
imsi := c.Param("imsi")
|
||||
num := c.Param("num")
|
||||
if neId == "" || imsi == "" || num == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId/imsi/num is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi/num is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -469,7 +469,7 @@ func (s *UDMAuthController) Export(c *gin.Context) {
|
||||
neId := c.Query("neId")
|
||||
fileType := c.Query("type")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
if !(fileType == "csv" || fileType == "txt") {
|
||||
@@ -557,7 +557,7 @@ func (s *UDMAuthController) Import(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ type UDMSubController struct {
|
||||
func (s *UDMSubController) ResetData(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ func (s *UDMSubController) Info(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
imsi := c.Param("imsi")
|
||||
if neId == "" || imsi == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId or imsi is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or imsi is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -155,18 +155,18 @@ func (s *UDMSubController) Add(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
neId := c.Param("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMSubUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if len(body.IMSI) != 15 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: IMSI length is not 15 bits"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: IMSI length is not 15 bits"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -221,18 +221,18 @@ func (s *UDMSubController) Adds(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
num := c.Param("num")
|
||||
if neId == "" || num == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId/num is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/num is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMSubUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if len(body.IMSI) != 15 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: IMSI length is not 15 bits"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: IMSI length is not 15 bits"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -287,18 +287,18 @@ func (s *UDMSubController) Edit(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
neId := c.Param("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMSubUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if len(body.IMSI) != 15 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: IMSI length is not 15 bits"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: IMSI length is not 15 bits"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -352,7 +352,7 @@ func (s *UDMSubController) Remove(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
imsi := c.Param("imsi")
|
||||
if neId == "" || len(imsi) < 15 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId/imsi is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ func (s *UDMSubController) Removes(c *gin.Context) {
|
||||
imsi := c.Param("imsi")
|
||||
num := c.Param("num")
|
||||
if neId == "" || len(imsi) < 15 || num == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId/imsi/num is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi/num is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ func (s *UDMSubController) Export(c *gin.Context) {
|
||||
neId := c.Query("neId")
|
||||
fileType := c.Query("type")
|
||||
if neId == "" || fileType == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId or type is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or type is empty"))
|
||||
return
|
||||
}
|
||||
if !(fileType == "csv" || fileType == "txt") {
|
||||
@@ -555,7 +555,7 @@ func (s *UDMSubController) Import(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ type UDMVOIPController struct {
|
||||
func (s *UDMVOIPController) ResetData(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ func (s *UDMVOIPController) Info(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
username := c.Param("username")
|
||||
if neId == "" || username == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId or username is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or username is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -158,18 +158,18 @@ func (s *UDMVOIPController) Add(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
neId := c.Param("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMVOIPUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.UserName == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: username is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: username is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -222,18 +222,18 @@ func (s *UDMVOIPController) Adds(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
num := c.Param("num")
|
||||
if neId == "" || num == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId or num is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or num is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMVOIPUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.UserName == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: username is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: username is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ func (s *UDMVOIPController) Remove(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
username := c.Param("username")
|
||||
if neId == "" || username == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId or username is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or username is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ func (s *UDMVOIPController) Removes(c *gin.Context) {
|
||||
username := c.Param("username")
|
||||
num := c.Param("num")
|
||||
if neId == "" || username == "" || num == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId/username/num is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/username/num is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ func (s *UDMVOIPController) Export(c *gin.Context) {
|
||||
neId := c.Query("neId")
|
||||
fileType := c.Query("type")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
if !(fileType == "csv" || fileType == "txt") {
|
||||
@@ -485,7 +485,7 @@ func (s *UDMVOIPController) Import(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ type UDMVolteIMSController struct {
|
||||
func (s *UDMVolteIMSController) ResetData(c *gin.Context) {
|
||||
neId := c.Param("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -101,11 +101,11 @@ func (s *UDMVolteIMSController) Info(c *gin.Context) {
|
||||
imsi := c.Param("imsi")
|
||||
msisdn := c.Query("msisdn")
|
||||
if neId == "" || imsi == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId or imsi is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId or imsi is empty"))
|
||||
return
|
||||
}
|
||||
if msisdn == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: msisdn is required"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: msisdn is required"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -164,18 +164,18 @@ func (s *UDMVolteIMSController) Add(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
neId := c.Param("neId")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
var body model.UDMVolteIMSUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.IMSI == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: imsi is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: imsi is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -242,11 +242,11 @@ func (s *UDMVolteIMSController) Adds(c *gin.Context) {
|
||||
var body model.UDMVolteIMSUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.IMSI == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: imsi is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: imsi is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ func (s *UDMVolteIMSController) Removes(c *gin.Context) {
|
||||
imsi := c.Param("imsi")
|
||||
num := c.Param("num")
|
||||
if neId == "" || imsi == "" || num == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId/imsi/num is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId/imsi/num is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ func (s *UDMVolteIMSController) Export(c *gin.Context) {
|
||||
neId := c.Query("neId")
|
||||
fileType := c.Query("type")
|
||||
if neId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neId is empty"))
|
||||
return
|
||||
}
|
||||
if !(fileType == "csv" || fileType == "txt") {
|
||||
@@ -514,7 +514,7 @@ func (s *UDMVolteIMSController) Import(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ func (s UPFController) FlowTotal(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); querys.Day < 0 || err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ func (s *NeActionController) PushFile(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ func (s *NeActionController) PushFile(c *gin.Context) {
|
||||
localFilePath := file.ParseUploadFileAbsPath(body.UploadPath)
|
||||
// 网元端临时目录
|
||||
// sshClient.RunCMD("mkdir -p /tmp/omc/push && sudo chmod 777 -R /tmp/omc")
|
||||
cmd.Exec("mkdir -p /tmp/omc/push && sudo chmod 777 -R /tmp/omc")
|
||||
cmd.Exec("sudo mkdir -p /tmp/omc/push && sudo chmod 755 -R /tmp/omc")
|
||||
neFilePath := filepath.ToSlash(filepath.Join("/tmp/omc/push", filepath.Base(localFilePath)))
|
||||
// 复制到远程
|
||||
// if err = sftpClient.CopyFileLocalToRemote(localFilePath, neFilePath); err != nil {
|
||||
@@ -132,7 +132,7 @@ func (s *NeActionController) PullFile(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ func (s *NeActionController) PullDirZip(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ func (s *NeActionController) ViewFile(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ func (s *NeActionController) Files(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ func (s *NeActionController) Service(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ func (s NeConfigController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := parse.Number(c.Query("id"))
|
||||
if id <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func (s NeConfigController) Add(c *gin.Context) {
|
||||
var body model.NeConfig
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ func (s NeConfigController) Edit(c *gin.Context) {
|
||||
var body model.NeConfig
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ func (s NeConfigController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Query("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ func (s NeConfigController) Remove(c *gin.Context) {
|
||||
func (s NeConfigController) ListByNeType(c *gin.Context) {
|
||||
neType := c.Param("neType")
|
||||
if neType == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: neType is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: neType is empty"))
|
||||
return
|
||||
}
|
||||
data := s.neConfigService.FindByNeType(neType)
|
||||
@@ -204,7 +204,7 @@ func (s NeConfigController) DataInfo(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ func (s NeConfigController) DataEdit(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ func (s NeConfigController) DataAdd(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ func (s NeConfigController) DataRemove(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ func (s NeConfigBackupController) Download(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := parse.Number(c.Query("id"))
|
||||
if id <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ func (s NeConfigBackupController) Edit(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ func (s NeConfigBackupController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Query("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ func (s NeConfigBackupController) Import(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if !strings.HasSuffix(body.Path, ".zip") {
|
||||
@@ -181,7 +181,7 @@ func (s NeConfigBackupController) Export(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
// 查网元
|
||||
|
||||
@@ -75,11 +75,11 @@ func (s NeHostController) Add(c *gin.Context) {
|
||||
var body model.NeHost
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.ID != 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -116,11 +116,11 @@ func (s NeHostController) Edit(c *gin.Context) {
|
||||
var body model.NeHost
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.ID <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ func (s NeHostController) Test(c *gin.Context) {
|
||||
var body model.NeHost
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ func (s NeHostController) Cmd(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ func (s NeHostController) CheckBySSH(c *gin.Context) {
|
||||
var body model.NeHost
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -460,11 +460,11 @@ func (s NeHostController) AuthorizedBySSH(c *gin.Context) {
|
||||
var body model.NeHost
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.AuthMode == "2" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: auth mode not equals 2"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: auth mode not equals 2"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ func (s NeHostCmdController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := parse.Number(c.Param("id"))
|
||||
if id <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ func (s NeHostCmdController) Add(c *gin.Context) {
|
||||
var body model.NeHostCmd
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func (s NeHostCmdController) Edit(c *gin.Context) {
|
||||
var body model.NeHostCmd
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ func (s NeHostCmdController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ func (s NeInfoController) State(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ func (s NeInfoController) NeTypeAndID(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ func (s NeInfoController) ListAll(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ func (s NeInfoController) Para5GFileWrite(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ func (s NeInfoController) OAMFileRead(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ func (s NeInfoController) OAMFileWrite(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ func (s NeInfoController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := parse.Number(c.Param("id"))
|
||||
if id <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -345,11 +345,11 @@ func (s NeInfoController) Add(c *gin.Context) {
|
||||
err := c.ShouldBindBodyWithJSON(&body)
|
||||
if err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.ID != 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -441,11 +441,11 @@ func (s NeInfoController) Edit(c *gin.Context) {
|
||||
err := c.ShouldBindBodyWithJSON(&body)
|
||||
if err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.ID <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -555,7 +555,7 @@ func (s NeInfoController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ func (s *NeLicenseController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := parse.Number(c.Param("id"))
|
||||
if id <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ func (s *NeLicenseController) NeTypeAndID(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ func (s *NeLicenseController) Code(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ func (s *NeLicenseController) Change(c *gin.Context) {
|
||||
err := c.ShouldBindBodyWithJSON(&body)
|
||||
if err != nil || body.LicensePath == "" {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ func (s NeSoftwareController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := parse.Number(c.Param("id"))
|
||||
if id <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -86,11 +86,11 @@ func (s NeSoftwareController) Add(c *gin.Context) {
|
||||
var body model.NeSoftware
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.Path == "" || body.ID > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: path is empty or id is not empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: path is empty or id is not empty"))
|
||||
return
|
||||
}
|
||||
// 找到已存在的删除后重新添加
|
||||
@@ -130,11 +130,11 @@ func (s NeSoftwareController) Edit(c *gin.Context) {
|
||||
var body model.NeSoftware
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.Path == "" || body.ID == 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: path or id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: path or id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ func (s NeSoftwareController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ func (s NeSoftwareController) NewNeVersion(c *gin.Context) {
|
||||
var body model.NeSoftware
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ func (s *NeVersionController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := parse.Number(c.Param("id"))
|
||||
if id <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ func (s *NeVersionController) Operate(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -95,8 +95,8 @@ func (s NeConfigBackup) FileLocalToNe(neInfo model.NeInfo, localFile string) err
|
||||
|
||||
// 网元配置端上的临时目录
|
||||
neDirTemp := fmt.Sprintf("/tmp/omc/ne_config/%s/%s", neTypeLower, neInfo.NeId)
|
||||
// sshClient.RunCMD(fmt.Sprintf("mkdir -p /tmp/omc && sudo chmod 777 -R /tmp/omc && sudo rm -rf %s", neDirTemp))
|
||||
cmd.Execf("mkdir -p /tmp/omc && sudo chmod 777 -R /tmp/omc && sudo rm -rf %s", neDirTemp)
|
||||
// sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p /tmp/omc/ne_config && sudo chmod 755 -R /tmp/omc && sudo rm -rf %s", neDirTemp))
|
||||
cmd.Execf("sudo mkdir -p /tmp/omc/ne_config && sudo chmod 755 -R /tmp/omc && sudo rm -rf %s", neDirTemp)
|
||||
// 复制到网元端
|
||||
// if err = sftpClient.CopyDirLocalToRemote(localDirPath, neDirTemp); err != nil {
|
||||
// return fmt.Errorf("copy config to ne err")
|
||||
@@ -159,7 +159,8 @@ func (s NeConfigBackup) FileNeToLocal(neInfo model.NeInfo) (string, error) {
|
||||
localDirPath := fmt.Sprintf("%s/%s/%s/from_ne_tmp", omcPath, neTypeLower, neInfo.NeId)
|
||||
|
||||
// 网元配置文件先复制到临时目录
|
||||
cmd.Exec("mkdir -p /tmp/omc && sudo chmod 777 -R /tmp/omc")
|
||||
// sshClient.RunCMD("sudo mkdir -p /tmp/omc/ne_config && sudo chmod 755 -R /tmp/omc")
|
||||
cmd.Exec("sudo mkdir -p /tmp/omc/ne_config && sudo chmod 755 -R /tmp/omc")
|
||||
neDirTemp := fmt.Sprintf("/tmp/omc/ne_config/%s/%s", neTypeLower, neInfo.NeId)
|
||||
if neTypeLower == "ims" {
|
||||
// ims目录
|
||||
|
||||
@@ -38,7 +38,7 @@ func (s Oauth2Controller) Authorize(c *gin.Context) {
|
||||
var query model.CodeQuery
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ func (s Oauth2Controller) Token(c *gin.Context) {
|
||||
var body model.TokenBody
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.GrantType != "authorization_code" || body.Code == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "grantType or code error"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "grantType or code error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -137,18 +137,18 @@ func (s Oauth2Controller) RefreshToken(c *gin.Context) {
|
||||
var body model.TokenBody
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.GrantType != "refresh_token" || body.RefreshToken == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "grantType or refreshToken error"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "grantType or refreshToken error"))
|
||||
return
|
||||
}
|
||||
|
||||
// 验证刷新令牌是否有效
|
||||
claims, err := token.Oauth2TokenVerify(body.RefreshToken, "refresh")
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401001, err.Error()))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, err.Error()))
|
||||
return
|
||||
}
|
||||
clientId := fmt.Sprint(claims[constants.JWT_CLIENT_ID])
|
||||
@@ -173,7 +173,7 @@ func (s Oauth2Controller) RefreshToken(c *gin.Context) {
|
||||
deviceId := fmt.Sprint(claims[constants.JWT_DEVICE_ID])
|
||||
deviceFingerprint := reqctx.DeviceFingerprint(c, clientId)
|
||||
if deviceId != deviceFingerprint {
|
||||
c.JSON(200, resp.ErrMsg("device fingerprint mismatch"))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_DEVICE, resp.MSG_AUTH_DEVICE))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ func (s Oauth2ClientController) List(c *gin.Context) {
|
||||
func (s Oauth2ClientController) Info(c *gin.Context) {
|
||||
clientId := c.Param("clientId")
|
||||
if clientId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: clientId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: clientId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -60,11 +60,11 @@ func (s Oauth2ClientController) Add(c *gin.Context) {
|
||||
var body model.Oauth2Client
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.Id > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ func (s Oauth2ClientController) Edit(c *gin.Context) {
|
||||
var body model.Oauth2Client
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.Id <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ func (s Oauth2ClientController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ func (s *SysConfigController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
configId := parse.Number(c.Param("configId"))
|
||||
if configId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: configId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: configId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ func (s *SysConfigController) Add(c *gin.Context) {
|
||||
var body model.SysConfig
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.ConfigId > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: configId not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: configId not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -132,11 +132,11 @@ func (s *SysConfigController) Edit(c *gin.Context) {
|
||||
var body model.SysConfig
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.ConfigId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: configId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: configId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ func (s SysConfigController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
configId := c.Param("configId")
|
||||
if configId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: configId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: configId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ func (s SysConfigController) Refresh(c *gin.Context) {
|
||||
func (s SysConfigController) ConfigKey(c *gin.Context) {
|
||||
configKey := c.Param("configKey")
|
||||
if configKey == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: configKey is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: configKey is empty"))
|
||||
return
|
||||
}
|
||||
key := s.sysConfigService.FindValueByKey(configKey)
|
||||
@@ -319,7 +319,7 @@ func (s *SysConfigController) ConfigValue(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ func (s *SysDeptController) List(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ func (s SysDeptController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
deptId := parse.Number(c.Param("deptId"))
|
||||
if deptId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: deptId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: deptId is empty"))
|
||||
return
|
||||
}
|
||||
data := s.sysDeptService.FindById(deptId)
|
||||
@@ -111,11 +111,11 @@ func (s SysDeptController) Add(c *gin.Context) {
|
||||
var body model.SysDept
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.DeptId > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: deptId not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: deptId not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -169,11 +169,11 @@ func (s SysDeptController) Edit(c *gin.Context) {
|
||||
var body model.SysDept
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.DeptId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: deptId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: deptId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ func (s SysDeptController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
deptId := parse.Number(c.Param("deptId"))
|
||||
if deptId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: deptId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: deptId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ func (s SysDeptController) Remove(c *gin.Context) {
|
||||
func (s *SysDeptController) ExcludeChild(c *gin.Context) {
|
||||
deptIdStr := c.Param("deptId")
|
||||
if deptIdStr == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: deptId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: deptId is empty"))
|
||||
return
|
||||
}
|
||||
deptId := parse.Number(deptIdStr)
|
||||
@@ -333,7 +333,7 @@ func (s *SysDeptController) Tree(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
sysDept := model.SysDept{
|
||||
@@ -367,7 +367,7 @@ func (s *SysDeptController) TreeRole(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
roleId := parse.Number(c.Param("roleId"))
|
||||
if roleId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: roleId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: roleId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ func (s SysDictDataController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
dataId := parse.Number(c.Param("dataId"))
|
||||
if dataId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: deptId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: deptId is empty"))
|
||||
return
|
||||
}
|
||||
data := s.sysDictDataService.FindById(dataId)
|
||||
@@ -102,11 +102,11 @@ func (s SysDictDataController) Add(c *gin.Context) {
|
||||
var body model.SysDictData
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.DataId > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: dataId not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: dataId not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -153,11 +153,11 @@ func (s SysDictDataController) Edit(c *gin.Context) {
|
||||
var body model.SysDictData
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.DataId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: dataId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: dataId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ func (s SysDictDataController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
dataId := c.Param("dataId")
|
||||
if dataId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: dataId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: dataId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ func (s SysDictDataController) DictType(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
dictType := c.Param("dictType")
|
||||
if dictType == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: dictType is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: dictType is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ func (s *SysDictTypeController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
dictId := parse.Number(c.Param("dictId"))
|
||||
if dictId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: dictId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: dictId is empty"))
|
||||
return
|
||||
}
|
||||
data := s.sysDictTypeService.FindById(dictId)
|
||||
@@ -95,11 +95,11 @@ func (s *SysDictTypeController) Add(c *gin.Context) {
|
||||
var body model.SysDictType
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.DictId > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: dictId not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: dictId not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -138,11 +138,11 @@ func (s *SysDictTypeController) Edit(c *gin.Context) {
|
||||
var body model.SysDictType
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.DictId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: dictId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: dictId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ func (s SysDictTypeController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
dictId := c.Param("dictId")
|
||||
if dictId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: dictId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: dictId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ func (s SysLogLoginController) Unlock(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
userName := c.Param("userName")
|
||||
if userName == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: userName is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: userName is empty"))
|
||||
return
|
||||
}
|
||||
ok := s.accountService.CleanLoginRecordCache(userName)
|
||||
|
||||
@@ -82,7 +82,7 @@ func (s *SysMenuController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
menuId := parse.Number(c.Param("menuId"))
|
||||
if menuId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: menuId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: menuId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -105,11 +105,11 @@ func (s *SysMenuController) Add(c *gin.Context) {
|
||||
var body model.SysMenu
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.MenuId > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: menuId not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: menuId not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -158,11 +158,11 @@ func (s *SysMenuController) Edit(c *gin.Context) {
|
||||
var body model.SysMenu
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.MenuId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: menuId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: menuId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ func (s SysMenuController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
menuId := parse.Number(c.Param("menuId"))
|
||||
if menuId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: menuId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: menuId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -359,7 +359,7 @@ func (s *SysMenuController) TreeRole(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
roleId := parse.Number(c.Param("roleId"))
|
||||
if roleId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: roleId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: roleId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -95,11 +95,11 @@ func (s *SysPostController) Add(c *gin.Context) {
|
||||
var body model.SysPost
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.PostId > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: postId not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: postId not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -138,11 +138,11 @@ func (s *SysPostController) Edit(c *gin.Context) {
|
||||
var body model.SysPost
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.PostId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: postId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: postId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ func (s SysPostController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
postId := c.Param("postId")
|
||||
if postId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: postId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: postId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ func (s *SysProfileController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -104,14 +104,14 @@ func (s *SysProfileController) UpdateProfile(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
// 登录用户信息
|
||||
info, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, err.Error()))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, err.Error()))
|
||||
return
|
||||
}
|
||||
userId := info.UserId
|
||||
@@ -202,14 +202,14 @@ func (s *SysProfileController) PasswordUpdate(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
// 登录用户信息
|
||||
info, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, err.Error()))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, err.Error()))
|
||||
return
|
||||
}
|
||||
userId := info.UserId
|
||||
@@ -264,7 +264,7 @@ func (s *SysProfileController) PasswordForce(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ func (s *SysProfileController) PasswordForce(c *gin.Context) {
|
||||
// 登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ func (s *SysRoleController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
roleId := parse.Number(c.Param("roleId"))
|
||||
if roleId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: roleId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: roleId is empty"))
|
||||
return
|
||||
}
|
||||
data := s.sysRoleService.FindById(roleId)
|
||||
@@ -96,11 +96,11 @@ func (s *SysRoleController) Add(c *gin.Context) {
|
||||
var body model.SysRole
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.RoleId > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: roleId not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: roleId not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -139,11 +139,11 @@ func (s *SysRoleController) Edit(c *gin.Context) {
|
||||
var body model.SysRole
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.RoleId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: roleId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: roleId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ func (s *SysRoleController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
roleId := c.Param("roleId")
|
||||
if roleId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: roleId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: roleId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ func (s SysRoleController) Status(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -311,7 +311,7 @@ func (s *SysRoleController) DataScope(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ func (s SysRoleController) UserAuthList(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
roleId := parse.Number(c.Query("roleId"))
|
||||
if roleId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: roleId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: roleId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -380,11 +380,11 @@ func (s SysRoleController) UserAuthChecked(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if len(body.UserIds) <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: userIds is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: userIds is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ func (s *SysUserController) Info(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
userId := parse.Number(c.Param("userId"))
|
||||
if userId < 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: userId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: userId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
var body model.SysUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -175,13 +175,13 @@ func (s *SysUserController) Add(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&bodyPassword); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
body.Password = bodyPassword.Password
|
||||
|
||||
if body.UserId > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: userId not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: userId not is empty"))
|
||||
return
|
||||
}
|
||||
if !regular.ValidUsername(body.UserName) {
|
||||
@@ -279,11 +279,11 @@ func (s *SysUserController) Edit(c *gin.Context) {
|
||||
var body model.SysUser
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.UserId <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: userId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: userId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ func (s *SysUserController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
userId := c.Param("userId")
|
||||
if userId == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: userId is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: userId is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ func (s *SysUserController) Password(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ func (s *SysUserController) Status(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@ func (s *SysUserController) Import(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ func (s *IPerfController) Version(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ func (s *IPerfController) Install(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -128,14 +128,14 @@ func (s *IPerfController) Run(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
// 登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ func (s *PingController) Statistics(c *gin.Context) {
|
||||
var body model.Ping
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func (s *PingController) StatisticsOn(c *gin.Context) {
|
||||
// 登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ func (s *PingController) Version(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -163,14 +163,14 @@ func (s *PingController) Run(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
// 登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ func (s *PacketController) Start(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ func (s *PacketController) Stop(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ func (s *PacketController) Filter(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ func (s *PacketController) KeepAlive(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -137,11 +137,11 @@ func (s *PacketController) FilePull(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
fileName := fmt.Sprintf("%s.pcap", querys.TaskNo)
|
||||
localFilePath := filepath.Join("/tmp/omc/packet", fileName)
|
||||
localFilePath := filepath.Join("/usr/local/omc/packet", fileName)
|
||||
if runtime.GOOS == "windows" {
|
||||
localFilePath = fmt.Sprintf("C:%s", localFilePath)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ func (s *TCPdumpController) DumpStart(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ func (s *TCPdumpController) DumpStop(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ func (s *TCPdumpController) UPFTrace(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ func (s *TraceDataController) List(c *gin.Context) {
|
||||
func (s *TraceDataController) Info(c *gin.Context) {
|
||||
id := parse.Number(c.Param("id"))
|
||||
if id <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ func (s *TraceDataController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ func (s *TraceTaskController) List(c *gin.Context) {
|
||||
func (s *TraceTaskController) Info(c *gin.Context) {
|
||||
id := parse.Number(c.Param("id"))
|
||||
if id <= 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -63,11 +63,11 @@ func (s *TraceTaskController) Add(c *gin.Context) {
|
||||
var body model.TraceTask
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if body.ID > 0 {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id not is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id not is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ func (s *TraceTaskController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -116,12 +116,12 @@ func (s *TraceTaskController) FilePull(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
fileName := fmt.Sprintf("task_%s.pcap", querys.TraceId)
|
||||
localFilePath := filepath.Join("/tmp/omc/trace", fileName)
|
||||
localFilePath := filepath.Join("/usr/local/omc/trace", fileName)
|
||||
if runtime.GOOS == "windows" {
|
||||
localFilePath = fmt.Sprintf("C:%s", localFilePath)
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ func (s *TraceTaskHlrController) List(c *gin.Context) {
|
||||
var query model.TraceTaskHlrQuery
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ func (s *TraceTaskHlrController) Remove(c *gin.Context) {
|
||||
language := reqctx.AcceptLanguage(c)
|
||||
id := c.Param("id")
|
||||
if id == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "bind err: id is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "bind err: id is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -89,12 +89,12 @@ func (s *TraceTaskHlrController) Start(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
if body.IMSI == "" && body.MSISDN == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, "imsi amd msisdn is empty"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "imsi amd msisdn is empty"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ func (s *TraceTaskHlrController) Stop(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -163,13 +163,13 @@ func (s *TraceTaskHlrController) File(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindBodyWithJSON(&body); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
task := s.traceTaskHlrService.FindById(body.ID)
|
||||
if task.ID == 0 || task.ID != body.ID {
|
||||
c.JSON(422, resp.CodeMsg(422002, "task not found"))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, "task not found"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -195,14 +195,14 @@ func (s *TraceTaskHlrController) FilePull(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&querys); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
// 查询网元获取IP
|
||||
neInfo := s.neInfoService.FindByNeTypeAndNeID(querys.NeType, querys.NeID)
|
||||
if neInfo.NeId != querys.NeID || neInfo.IP == "" {
|
||||
c.JSON(422, resp.CodeMsg(422002, i18n.TKey(language, "app.common.noNEInfo")))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_CHEACK, i18n.TKey(language, "app.common.noNEInfo")))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ func (s *Packet) LiveStart(taskNo, deviceName, filterBPF string, outputPCAP bool
|
||||
var f *os.File
|
||||
if outputPCAP {
|
||||
// 网管本地路径
|
||||
localFilePath := fmt.Sprintf("/tmp/omc/packet/%s.pcap", taskNo)
|
||||
localFilePath := fmt.Sprintf("/usr/local/omc/packet/%s.pcap", taskNo)
|
||||
if runtime.GOOS == "windows" {
|
||||
localFilePath = fmt.Sprintf("C:%s", localFilePath)
|
||||
}
|
||||
|
||||
@@ -54,9 +54,9 @@ func (s *TCPdump) DumpStart(neType, neId, cmdStr string) (string, error) {
|
||||
}
|
||||
|
||||
taskCode := time.Now().Format("20060102150405")
|
||||
// 存放文件目录 /tmp/omc/tcpdump/udm/001/20240817104241
|
||||
neDirTemp := fmt.Sprintf("/tmp/omc/tcpdump/%s/%s/%s", strings.ToLower(neType), neId, taskCode)
|
||||
cmd.Exec(fmt.Sprintf("mkdir -p %s && sudo chmod 777 -R /tmp/omc", neDirTemp))
|
||||
// 存放文件目录 /usr/local/omc/tcpdump/udm/001/20240817104241
|
||||
neDirTemp := fmt.Sprintf("/usr/local/omc/tcpdump/%s/%s/%s", strings.ToLower(neType), neId, taskCode)
|
||||
cmd.Exec(fmt.Sprintf("sudo mkdir -p %s && sudo chmod 755 -R /usr/local/omc/tcpdump", neDirTemp))
|
||||
|
||||
// 命令拼装
|
||||
logPath := fmt.Sprintf("%s/tcpdump.log", neDirTemp)
|
||||
@@ -65,8 +65,8 @@ func (s *TCPdump) DumpStart(neType, neId, cmdStr string) (string, error) {
|
||||
filePath = fmt.Sprintf("%s/part_%%Y%%m%%d%%H%%M%%S.pcap ", neDirTemp)
|
||||
}
|
||||
sendCmd := fmt.Sprintf("sudo timeout 60m sudo tcpdump -i any %s -w %s > %s 2>&1 & echo $!", cmdStr, filePath, logPath)
|
||||
// sudo timeout 60m sudo tcpdump -i any -n -s 0 -v -G 60 -W 6 -w /tmp/omc/tcpdump/udm/001/20240817104241/part_%Y-%m-%d_%H:%M:%S.pcap > /tmp/omc/tcpdump/udm/001/20240817104241/tcpdump.log 2>&1 & echo $!
|
||||
// sudo timeout 60m sudo tcpdump -i any -n -s 0 -v -w /tmp/omc/tcpdump/udm/001/20240817105440/part_2024-08-17_10:54:40.pcap > /tmp/omc/tcpdump/udm/001/20240817105440/tcpdump.log 2>&1 & echo $!
|
||||
// sudo timeout 60m sudo tcpdump -i any -n -s 0 -v -G 60 -W 6 -w /usr/local/omc/tcpdump/udm/001/20240817104241/part_%Y-%m-%d_%H:%M:%S.pcap > /usr/local/omc/tcpdump/udm/001/20240817104241/tcpdump.log 2>&1 & echo $!
|
||||
// sudo timeout 60m sudo tcpdump -i any -n -s 0 -v -w /usr/local/omc/tcpdump/udm/001/20240817105440/part_2024-08-17_10:54:40.pcap > /usr/local/omc/tcpdump/udm/001/20240817105440/tcpdump.log 2>&1 & echo $!
|
||||
//
|
||||
// timeout 超时60分钟后发送kill命令,1分钟后强制终止命令。tcpdump -G 文件轮转间隔时间(秒) -W 文件轮转保留最近数量
|
||||
// sudo timeout --kill-after=1m 60m sudo tcpdump -i any -n -s 0 -v -G 10 -W 7 -w /tmp/part_%Y%m%d%H%M%S.pcap > /tmp/part.log 2>&1 & echo $!
|
||||
@@ -119,11 +119,11 @@ func (s *TCPdump) DumpStop(neType, neId, taskCode string) ([]string, error) {
|
||||
}
|
||||
s.logFileLastLineToFile(PIDMap.(map[string]string))
|
||||
|
||||
// 存放文件目录 /tmp/omc/tcpdump/udm/001/20240817104241
|
||||
neDirTemp := fmt.Sprintf("/tmp/omc/tcpdump/%s/%s/%s", strings.ToLower(neType), neId, taskCode)
|
||||
// 存放文件目录 /usr/local/omc/tcpdump/udm/001/20240817104241
|
||||
neDirTemp := fmt.Sprintf("/usr/local/omc/tcpdump/%s/%s/%s", strings.ToLower(neType), neId, taskCode)
|
||||
// 命令拼装
|
||||
sendCmd := fmt.Sprintf("pids=$(pgrep -P %s) && [ -n \"$pids\" ] && sudo kill $pids;sudo timeout 2s ls %s", pid, neDirTemp)
|
||||
// pids=$(pgrep -P 1914341) && [ -n "$pids" ] && sudo kill $pids;sudo timeout 2s ls /tmp/omc/tcpdump/udm/001/20240817104241
|
||||
// pids=$(pgrep -P 1914341) && [ -n "$pids" ] && sudo kill $pids;sudo timeout 2s ls /usr/local/omc/tcpdump/udm/001/20240817104241
|
||||
output, err := cmd.Exec(sendCmd)
|
||||
output = strings.TrimSpace(output)
|
||||
if err != nil || strings.HasPrefix(output, "ls: ") {
|
||||
@@ -158,7 +158,8 @@ func (s *TCPdump) logFileLastLine(neType string) map[string]string {
|
||||
}
|
||||
|
||||
for _, v := range logFileArr {
|
||||
lastLine, err := cmd.Exec(fmt.Sprintf("sed -n '$=' %s", v))
|
||||
// lastLine, err := sshClient.RunCMD(fmt.Sprintf("sudo sed -n '$=' %s", v))
|
||||
lastLine, err := cmd.Exec(fmt.Sprintf("sudo sed -n '$=' %s", v))
|
||||
lastLine = strings.TrimSpace(lastLine)
|
||||
if err != nil || strings.HasPrefix(lastLine, "sed: can't") {
|
||||
logger.Errorf("logFileLastLine err: %s => %s", lastLine, err.Error())
|
||||
@@ -181,9 +182,10 @@ func (s *TCPdump) logFileLastLineToFile(PIDMap map[string]string) error {
|
||||
neType := PIDMap["neType"]
|
||||
neId := PIDMap["neId"]
|
||||
taskCode := PIDMap["taskCode"]
|
||||
// 存放文件目录 /tmp/omc/tcpdump/udm/001/20240817104241
|
||||
cmd.Exec("mkdir -p /tmp/omc && sudo chmod 777 -R /tmp/omc")
|
||||
neDirTemp := fmt.Sprintf("/tmp/omc/tcpdump/%s/%s/%s", strings.ToLower(neType), neId, taskCode)
|
||||
// 存放文件目录 /usr/local/omc/tcpdump/udm/001/20240817104241
|
||||
neDirTemp := fmt.Sprintf("/usr/local/omc/tcpdump/%s/%s/%s", strings.ToLower(neType), neId, taskCode)
|
||||
// sshClient.RunCMD(fmt.Sprintf("sudo mkdir -p %s && sudo chmod 755 -R /usr/local/omc/tcpdump", neDirTemp))
|
||||
cmd.Exec(fmt.Sprintf("sudo mkdir -p %s && sudo chmod 755 -R /usr/local/omc/tcpdump", neDirTemp))
|
||||
|
||||
lastLineMap := s.logFileLastLine(neType)
|
||||
for lastLogFile, lastFileLine := range lastLineMap {
|
||||
@@ -193,8 +195,10 @@ func (s *TCPdump) logFileLastLineToFile(PIDMap map[string]string) error {
|
||||
startFileLine = "1" // 起始行号从第一行开始
|
||||
}
|
||||
outputFile := fmt.Sprintf("%s/%s", neDirTemp, filepath.Base(lastLogFile))
|
||||
sendCmd := fmt.Sprintf("sed -n \"%s,%sp\" \"%s\" > \"%s\"", startFileLine, lastFileLine, lastLogFile, outputFile)
|
||||
// sed -n "1,5p" "/var/log/amf.log" > "/tmp/omc/tcpdump/amf/001/20241008141336/amf.log"
|
||||
// sendCmd := fmt.Sprintf("sudo sed -n \"%s,%sp\" \"%s\" | sudo tee \"%s\" > /dev/null", startFileLine, lastFileLine, lastLogFile, outputFile)
|
||||
// sudo sed -n "1,5p" "/var/log/amf.log" | sudo tee "/usr/local/omc/tcpdump/amf/001/20241008141336/amf.log" > /dev/null
|
||||
// output, err := sshClient.RunCMD(sendCmd)
|
||||
sendCmd := fmt.Sprintf("sudo sed -n \"%s,%sp\" \"%s\" | sudo tee \"%s\" > /dev/null", startFileLine, lastFileLine, lastLogFile, outputFile)
|
||||
output, err := cmd.Exec(sendCmd)
|
||||
if err != nil || strings.HasPrefix(output, "stderr:") {
|
||||
logger.Errorf("logFileLastLineToFile err: %s => %s", strings.TrimSpace(output), err.Error())
|
||||
|
||||
@@ -34,7 +34,7 @@ func traceHandler(data []byte) (*TraceMsgToOamTraceData, error) {
|
||||
}
|
||||
|
||||
// 输出到文件
|
||||
filePath := fmt.Sprintf("/tmp/omc/trace/task_%d.pcap", decodeData.NfTraceMsg.TraceId)
|
||||
filePath := fmt.Sprintf("/usr/local/omc/trace/task_%d.pcap", decodeData.NfTraceMsg.TraceId)
|
||||
if runtime.GOOS == "windows" {
|
||||
filePath = fmt.Sprintf("C:%s", filePath)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func (s *WSController) WS(c *gin.Context) {
|
||||
// 登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func (s *WSController) Test(c *gin.Context) {
|
||||
// 登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,14 @@ func (s *WSController) Redis(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
|
||||
// 登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ func (s *WSController) SSH(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if query.Cols < 80 || query.Cols > 400 {
|
||||
@@ -39,7 +39,7 @@ func (s *WSController) SSH(c *gin.Context) {
|
||||
// 登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ func (s *WSController) Telnet(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if query.Cols < 120 || query.Cols > 400 {
|
||||
@@ -40,7 +40,7 @@ func (s *WSController) Telnet(c *gin.Context) {
|
||||
// 登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ func (s *WSController) ShellView(c *gin.Context) {
|
||||
}
|
||||
if err := c.ShouldBindQuery(&query); err != nil {
|
||||
errMsgs := fmt.Sprintf("bind err: %s", resp.FormatBindError(err))
|
||||
c.JSON(422, resp.CodeMsg(422001, errMsgs))
|
||||
c.JSON(422, resp.CodeMsg(resp.CODE_PARAM_PARSER, errMsgs))
|
||||
return
|
||||
}
|
||||
if query.Cols < 120 || query.Cols > 400 {
|
||||
@@ -53,7 +53,7 @@ func (s *WSController) ShellView(c *gin.Context) {
|
||||
// 登录用户信息
|
||||
loginUser, err := reqctx.LoginUser(c)
|
||||
if err != nil {
|
||||
c.JSON(401, resp.CodeMsg(401002, i18n.TKey(language, err.Error())))
|
||||
c.JSON(401, resp.CodeMsg(resp.CODE_AUTH_INVALID, i18n.TKey(language, err.Error())))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user