示例#1
0
文件: route.go 项目: jacobxk/go2o
//处理请求
func Handle(ctx *web.Context) {
	switch util.GetBrownerDevice(ctx) {
	default:
	case util.DevicePC:
		ctx.Items["device_view_dir"] = "pc"
		routes.Handle(ctx)
	case util.DeviceTouchPad, util.DeviceMobile:
		ctx.Items["device_view_dir"] = "touchpad"
		mos.Handle(ctx)
	case util.DeviceAppEmbed:
		ctx.Items["device_view_dir"] = "app_embed"
		routes.Handle(ctx)
	}
}
示例#2
0
文件: user_c.go 项目: linux-mac/go2o
// 跳转到会员中心
// url : /user/jump_m
func (this *UserC) JumpToMCenter(ctx *web.Context) {
	w := ctx.ResponseWriter
	m := this.BaseC.GetMember(ctx)
	var location string
	if m == nil {
		location = "/user/login?return_url=/user/jump_m"
	} else {
		location = fmt.Sprintf("http://%s.%s/login/partner_connect?device=%s&sessionId=%s&mid=%d&token=%s",
			variable.DOMAIN_MEMBER_PREFIX,
			ctx.App.Config().GetString(variable.ServerDomain),
			util.GetBrownerDevice(ctx),
			ctx.Session().GetSessionId(),
			m.Id,
			m.DynamicToken,
		)
	}
	w.Header().Add("Location", location)
	w.WriteHeader(302)
}