// Member session connect func (this *mainC) Msc(ctx *web.Context) { form := ctx.Request.URL.Query() util.SetDeviceByUrlQuery(ctx, &form) ok, memberId := util.MemberHttpSessionConnect(ctx, func(memberId int) { v := ctx.Session().Get("member") var m *member.ValueMember if v != nil { m = v.(*member.ValueMember) if m.Id != memberId { // 如果会话冲突 m = nil } } if m == nil { m = dps.MemberService.GetMember(memberId) ctx.Session().Set("member", m) ctx.Session().Save() } }) if ok { ctx.Items["client_member_id"] = memberId } rtu := form.Get("return_url") if len(rtu) == 0 { rtu = "/" } ctx.Response.Header().Add("Location", rtu) ctx.Response.WriteHeader(302) }
// Member session connect func (this *mainC) Msc(ctx *web.Context) { form := ctx.Request.URL.Query() util.SetDeviceByUrlQuery(ctx, &form) ok, memberId := util.MemberHttpSessionConnect(ctx, func(memberId int) { if ctx.Session().Get("member") == nil { m := dps.MemberService.GetMember(memberId) ctx.Session().Set("member", m) } }) if ok { ctx.Items["client_member_id"] = memberId } rtu := form.Get("return_url") if len(rtu) == 0 { rtu = "/" } ctx.ResponseWriter.Header().Add("Location", rtu) ctx.ResponseWriter.WriteHeader(302) }