本文整理匯總了Golang中github.com/gpmgo/switch/modules/middleware.Context.ParamsInt64方法的典型用法代碼示例。如果您正苦於以下問題:Golang Context.ParamsInt64方法的具體用法?Golang Context.ParamsInt64怎麽用?Golang Context.ParamsInt64使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/gpmgo/switch/modules/middleware.Context
的用法示例。
在下文中一共展示了Context.ParamsInt64方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DeleteBlockRule
func DeleteBlockRule(ctx *middleware.Context) {
ctx.Data["PageIsBlocks"] = true
ctx.Data["PageIsBlocksRules"] = true
if err := models.DeleteBlockRule(ctx.ParamsInt64(":id")); err != nil {
ctx.Handle(500, "DeleteBlockRule", err)
return
}
ctx.Flash.Success("Block rule has been deleted!")
ctx.Redirect("/admin/blocks/rules")
}
示例2: UnblockPackage
func UnblockPackage(ctx *middleware.Context) {
ctx.Data["PageIsBlocks"] = true
ctx.Data["PageIsBlocksList"] = true
if err := models.UnblockPackage(ctx.ParamsInt64(":id")); err != nil {
ctx.Handle(500, "UnblockPackage", err)
return
}
ctx.Flash.Success("Package has been unblocked!")
ctx.Redirect("/admin/blocks")
}
示例3: RunRule
func RunRule(ctx *middleware.Context) {
ctx.Data["PageIsBlocks"] = true
ctx.Data["PageIsBlocksRules"] = true
rid := ctx.ParamsInt64(":id")
count, keys, err := models.RunBlockRule(rid)
if err != nil {
ctx.Handle(500, "RunBlockRule", err)
return
}
if setting.ProdMode {
for _, k := range keys {
log.Trace("Deleting archive: %s", k)
if err = qiniu.DeleteArchive(k); err != nil {
log.Error(4, "Fail to delete archive(%s): %v", k, err)
}
log.Info("Archive deleted: %s", k)
}
}
ctx.Flash.Success(fmt.Sprintf("%d packages are blocked by rule ID: %d.", count, rid))
ctx.Redirect("/admin/blocks/rules")
}