go-common/app/interface/main/creative/http/web_internal.go
2019-04-22 18:49:16 +08:00

29 lines
518 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package http
import (
"strconv"
"go-common/library/log"
"go-common/library/net/http/blademaster"
)
// setContextMid 把form中的mid写入context中用以调用interface的http接口
func setContextMid(c *blademaster.Context) {
var _, ok = c.Get("mid")
if ok {
return
}
var midstr = c.Request.Form.Get("mid")
if midstr == "" {
return
}
var mid, err = strconv.ParseInt(midstr, 10, 64)
if err != nil {
log.Error("parse mid fail, midstr=%s, err=%v", midstr, err)
return
}
c.Set("mid", mid)
}