public void SyncGroup(ContactList contact) { string sql = @" select top 1 * from wx_group where RobotId=@robotId and IsDelete=0 and GroupId=@groupId "; string groupId = WechatCommon.GetTrueId(contact.UserName); wx_group group = tobotDB.GetInstance().Query <wx_group>(sql, new { robotId = Global.robot.Id, groupId = groupId }).FirstOrDefault(); if (group == null) { group = new wx_group(); group.GroupId = contact.Alias; group.Isdelete = false; group.GroupName = contact.NickName; group.Createtime = DateTime.Now; group.Updatetime = DateTime.Now; //group.HeadImgUrl = contact.HeadImgUrl; group.MemberCount = contact.MemberCount; group.OwnerUin = contact.OwnerUin; group.PYQuanPin = contact.PYQuanPin; group.RobotId = Global.robot.Id; group.UserName = contact.UserName; group.RobotAlias = Global.robot.Alias; group.Statues = contact.Statues; tobotDB.GetInstance().Insert(group); } else { group.GroupName = contact.NickName; group.Updatetime = DateTime.Now; //group.HeadImgUrl = contact.HeadImgUrl; group.MemberCount = contact.MemberCount; group.OwnerUin = contact.OwnerUin; group.PYQuanPin = contact.PYQuanPin; group.RobotId = Global.robot.Id; group.UserName = contact.UserName; group.RobotAlias = Global.robot.Alias; group.Statues = contact.Statues; tobotDB.GetInstance().Update(group); } SyncGroupMember(contact.MemberList, groupId, contact.UserName); }