改成内网验证token
This commit is contained in:
parent
03142cf8f3
commit
4f73a4d042
@ -49,11 +49,7 @@ func (a *ItemIcon) Edit(c *gin.Context) {
|
||||
}
|
||||
|
||||
if req.ID != 0 {
|
||||
if userInfo.Role != 1 {
|
||||
apiReturn.ErrorNoAccess(c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
|
||||
// 修改
|
||||
updateField := []string{"IconJson", "Icon", "Title", "Url", "LanUrl", "Description", "OpenMethod", "GroupId", "UserId", "ItemIconGroupId"}
|
||||
if req.Sort != 0 {
|
||||
@ -194,7 +190,7 @@ func (a *ItemIcon) SaveSort(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
userInfo, exist := base.GetCurrentUserInfo(c)
|
||||
_, exist := base.GetCurrentUserInfo(c)
|
||||
if exist != true {
|
||||
// 处理获取用户信息失败的情况
|
||||
// 这里可以根据实际情况返回错误或进行其他处理
|
||||
@ -204,14 +200,6 @@ func (a *ItemIcon) SaveSort(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if userInfo.Role != 1 {
|
||||
// 如果 userInfo 为空或者 userInfo 的 Role 不等于 1
|
||||
// 可以根据实际情况返回错误或进行其他处理
|
||||
// 例如,返回一个 HTTP 错误响应或记录错误日志
|
||||
apiReturn.ErrorNoAccess(c)
|
||||
|
||||
return
|
||||
}
|
||||
transactionErr := global.Db.Transaction(func(tx *gorm.DB) error {
|
||||
// 在事务中执行一些 db 操作(从这里开始,您应该使用 'tx' 而不是 'db')
|
||||
for _, v := range req.SortItems {
|
||||
|
@ -166,7 +166,7 @@ func (l LoginApi) GetToken(c *gin.Context) {
|
||||
data.Set("loginid", param.Username)
|
||||
|
||||
// 创建 HTTP 请求
|
||||
req, err := http.NewRequest("POST", "https://oa.zwgczx.com/ssologin/getToken", strings.NewReader(data.Encode()))
|
||||
req, err := http.NewRequest("POST", "http://192.168.2.221:8088/ssologin/getToken", strings.NewReader(data.Encode()))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -188,7 +188,7 @@ func (l LoginApi) GetToken(c *gin.Context) {
|
||||
}
|
||||
|
||||
if strings.Contains(string(body), "Token获取失败") {
|
||||
fmt.Println("请求失败: Token获取失败")
|
||||
fmt.Println(string(body))
|
||||
apiReturn.ErrorNoAccess(c)
|
||||
|
||||
panic("请求失败: Token获取失败")
|
||||
|
Loading…
x
Reference in New Issue
Block a user