/// <summary> /// 绑定用户 /// </summary> /// <param name="wxuser"></param> private MemberInfo BindUser(WechatUserInfo wxuser) { var memberInfoDal = new MemberInfoDal(); var memberInfo = memberInfoDal.GetModel(string.Format("OpenId='{0}'", wxuser.OpenId)); if (memberInfo == null) { memberInfo = new MemberInfo { OpenId = wxuser.OpenId, NickName = wxuser.Nickname, Role = (int)MemberRole.顾客, CreateOn = DateTime.Now.ToUnixStamp() }; memberInfo.Uid = memberInfoDal.Add(memberInfo); } else { memberInfo.NickName = wxuser.Nickname; memberInfoDal.Update(memberInfo); } SetCookie(memberInfo); return(memberInfo); }