Compare commits
No commits in common. "3721ba137d73e54fe339bd21996ad5b0ea9f3905" and "4e915d02efb70d22a3c65115f4c2fcea914e2cec" have entirely different histories.
3721ba137d
...
4e915d02ef
|
|
@ -72,13 +72,13 @@ func RunCID(c *gin.Context) {
|
||||||
|
|
||||||
if err := c.ShouldBind(&req); err == nil {
|
if err := c.ShouldBind(&req); err == nil {
|
||||||
// 获取用户ID
|
// 获取用户ID
|
||||||
//username, _ := c.Get("username")
|
username, _ := c.Get("username")
|
||||||
cid := dao.FindCIDByID(req.ID, authID)
|
cid := dao.FindCIDByID(req.ID, authID)
|
||||||
if cid.ID == 0 {
|
if cid.ID == 0 {
|
||||||
c.JSON(200, gin.H{"error": "CID not found", "code": proto.OperationFailed, "message": "failed"})
|
c.JSON(200, gin.H{"error": "CID not found", "code": proto.OperationFailed, "message": "failed"})
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
go RunShell("", cid.Url, cid.Script, req.ID, authID)
|
go RunShell(username.(string), cid.Url, cid.Script, req.ID, authID)
|
||||||
c.JSON(200, gin.H{"code": proto.SuccessCode, "message": "success", "data": "success"})
|
c.JSON(200, gin.H{"code": proto.SuccessCode, "message": "success", "data": "success"})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
2
main.go
2
main.go
|
|
@ -178,9 +178,7 @@ func JWTAuthMiddleware() gin.HandlerFunc {
|
||||||
|
|
||||||
// 将用户信息添加到上下文中
|
// 将用户信息添加到上下文中
|
||||||
id := token.Claims.(jwt.MapClaims)["id"]
|
id := token.Claims.(jwt.MapClaims)["id"]
|
||||||
username := token.Claims.(jwt.MapClaims)["username"]
|
|
||||||
c.Set("id", id)
|
c.Set("id", id)
|
||||||
c.Set("username", username)
|
|
||||||
c.Set("user_id", int(id.(float64)))
|
c.Set("user_id", int(id.(float64)))
|
||||||
|
|
||||||
if UserFuncIntercept(int(id.(float64)), c.Request.URL.Path) {
|
if UserFuncIntercept(int(id.(float64)), c.Request.URL.Path) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue