Пример #1
0
func (c *BaseController) Prepare() {

	c.Data["showLeftBar"] = true
	var keywords, _ = services.ParameterValue("index-keywords")
	c.Data["keywords"] = keywords
	var description, _ = services.ParameterValue("index-description")
	c.Data["description"] = description

	response := ResponseBody{Success: true}
	c.Data["response"] = response

	var args interface{}
	method := c.Ctx.Request.Method
	if "GET" == method {
		args = c.Ctx.Request.RequestURI
	} else {
		args = c.Ctx.Request.Form.Encode()
	}
	userAgent := c.Ctx.Request.UserAgent()
	userAgent = strings.ToLower(userAgent)
	//是否是手机访问
	c.Data["isMobile"] = false
	if strings.Contains(userAgent, "android") || strings.Contains(userAgent, "iphone") {
		c.Data["isMobile"] = true
	}
	user := c.CurrentUser()
	if nil != user {
		c.Data["user"] = user
	}

	beego.Info("request-params:", args)
}
func TestGetUsers(t *testing.T) {
	fmt.Println("*************************")
	var v, _ = services.ParameterValue("x-bmob-application-id")
	fmt.Println("v:", v)
}