本文整理汇总了Golang中github.com/bronze1man/kmg/kmgNet/kmgHttp.Context.GetInMap方法的典型用法代码示例。如果您正苦于以下问题:Golang Context.GetInMap方法的具体用法?Golang Context.GetInMap怎么用?Golang Context.GetInMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/bronze1man/kmg/kmgNet/kmgHttp.Context
的用法示例。
在下文中一共展示了Context.GetInMap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: mustNotifyActionV2
func (ot *OverseaTrade) mustNotifyActionV2(ctx *kmgHttp.Context, f func(info OverseaTradeTransaction)) {
kmgLog.Log("Alipay", "Oversea PayNotifyAction", ctx.GetInMap())
var err error
ctx.MustPost()
info := OverseaTradeTransaction{}
//info.NotifyId = ctx.MustInStr("notify_id") 这两项没有什么意义.
//info.NotifyTime = kmgTime.MustFromMysqlFormatInLocation(ctx.MustInStr("notify_time"), kmgTime.BeijingZone)
info.OutTradeNo = ctx.MustInStr("out_trade_no")
info.Currency = ctx.MustInStr("currency")
info.TotalFee, err = kmgStrconv.ParseFloat64(ctx.MustInStr("total_fee"))
if err != nil {
panic(err)
}
info.TradeStatus = OverseaTradeStatus(ctx.MustInStr("trade_status"))
info.TradeNo = ctx.MustInStr("trade_no")
err = ot.md5Verify(ctx.GetInMap())
if err != nil {
panic(err)
}
err = ot.VerifyNotify(ctx.MustInStr("notify_id"))
if err != nil {
panic(err)
}
// 向支付宝询问这个订单的情况
oInfo := ot.MustSingleTransactionQuery(info.OutTradeNo)
if oInfo.TradeStatus != info.TradeStatus {
panic("两次查询订单状态不一致")
}
info.Subject = oInfo.Subject
f(info)
ctx.WriteString("success")
}
示例2: DemoPostAction
func (e Example) DemoPostAction(ctx *kmgHttp.Context) {
ctx.MustPost()
b := kmgYaml.MustMarshal(ctx.GetInMap())
ctx.WriteString(kmgBootstrap.NewWrap("DemoPostAction", kmgBootstrap.Pre(`
You send me a HTTP POST Request
`+string(b))).HtmlRender())
}
示例3: MustReturnPage
// 同步回调
// 调用前请清除您自己的参数.
// @deprecated 请使用 OverseaTrade.PayFinishCallback 和 OverseaTrade.PayCloseCallback
func (ot *OverseaTrade) MustReturnPage(ctx *kmgHttp.Context) (info OverseaTradeTransaction) {
kmgLog.Log("Alipay", "Oversea PayReturnPage", ctx.GetInMap())
var err error
info.OutTradeNo = ctx.MustInStr("out_trade_no")
info.Currency = ctx.MustInStr("currency")
info.TotalFee, err = kmgStrconv.ParseFloat64(ctx.MustInStr("total_fee"))
if err != nil {
panic(err)
}
info.TradeStatus = OverseaTradeStatus(ctx.MustInStr("trade_status"))
info.TradeNo = ctx.MustInStr("trade_no")
//这个也可以验证数据,只是文档上面没写.
err = ot.md5Verify(ctx.GetInMap())
if err != nil {
panic(err)
}
// 向支付宝询问这个订单的情况
oInfo := ot.MustSingleTransactionQuery(info.OutTradeNo)
if oInfo.TradeStatus != info.TradeStatus {
panic("两次查询订单状态不一致")
}
info.Subject = oInfo.Subject
return info
}