You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
817 B
46 lines
817 B
package http |
|
|
|
import ( |
|
"encoding/json" |
|
|
|
bm "go-common/library/net/http/blademaster" |
|
) |
|
|
|
func sudo(ctx *bm.Context) { |
|
cmd := ctx.Request.Form.Get("cmd") |
|
if cmd == "" { |
|
ctx.AbortWithStatus(400) |
|
return |
|
} |
|
ctx.Set("command", cmd) |
|
} |
|
|
|
func notityPurgeCache(ctx *bm.Context) { |
|
cmd, ok := ctx.Get("command") |
|
if !ok { |
|
ctx.AbortWithStatus(400) |
|
return |
|
} |
|
plain, ok := cmd.(string) |
|
if !ok { |
|
ctx.AbortWithStatus(400) |
|
return |
|
} |
|
|
|
var param struct { |
|
Mid int64 `json:"mid"` |
|
Action string `json:"action"` |
|
} |
|
if err := json.Unmarshal([]byte(plain), ¶m); err != nil { |
|
ctx.AbortWithStatus(400) |
|
return |
|
} |
|
if param.Mid <= 0 { |
|
ctx.AbortWithStatus(400) |
|
return |
|
} |
|
if param.Action == "" { |
|
param.Action = "updateByAdmin" |
|
} |
|
ctx.JSON(nil, memberSvc.NotityPurgeCache(ctx, param.Mid, param.Action)) |
|
}
|
|
|