Compare commits

...

2 Commits

Author SHA1 Message Date
junleea 3721ba137d 修复run cid接口问题 2025-07-29 20:49:44 +08:00
junleea 9ef020f229 拦截请求处理 2025-06-13 13:58:47 +08:00
2 changed files with 4 additions and 2 deletions

View File

@ -72,13 +72,13 @@ func RunCID(c *gin.Context) {
if err := c.ShouldBind(&req); err == nil {
// 获取用户ID
username, _ := c.Get("username")
//username, _ := c.Get("username")
cid := dao.FindCIDByID(req.ID, authID)
if cid.ID == 0 {
c.JSON(200, gin.H{"error": "CID not found", "code": proto.OperationFailed, "message": "failed"})
return
} else {
go RunShell(username.(string), cid.Url, cid.Script, req.ID, authID)
go RunShell("", cid.Url, cid.Script, req.ID, authID)
c.JSON(200, gin.H{"code": proto.SuccessCode, "message": "success", "data": "success"})
}
} else {

View File

@ -178,7 +178,9 @@ func JWTAuthMiddleware() gin.HandlerFunc {
// 将用户信息添加到上下文中
id := token.Claims.(jwt.MapClaims)["id"]
username := token.Claims.(jwt.MapClaims)["username"]
c.Set("id", id)
c.Set("username", username)
c.Set("user_id", int(id.(float64)))
if UserFuncIntercept(int(id.(float64)), c.Request.URL.Path) {