Esempio n. 1
0
        public static async Task InsertGroupMemberInfo(Model.GetGroupMemberListPackage getGroupMemberListPackage)
        {
            System.Collections.Concurrent.ConcurrentDictionary <int, DB.GroupMemberInfo> dic = new System.Collections.Concurrent.ConcurrentDictionary <int, DB.GroupMemberInfo>();
            var array = getGroupMemberListPackage.data.items.ToArray();

            foreach (var item in array)
            {
                DB.GroupMemberInfo info = new DB.GroupMemberInfo()
                {
                    groupId         = item.groupId,
                    memoInGroup     = item.memoInGroup,//群昵称
                    userId          = item.userId,
                    userName        = item.userName,
                    auditUserId     = item.auditUserId,
                    city            = item.city,
                    createTime      = item.createTime,
                    mobile          = item.mobile,
                    photo           = item.photo,
                    province        = item.province,
                    recommendByUser = item.recommendByUser,
                    sex             = item.sex
                };
                dic.TryAdd(info.userId, info);
            }
            try
            {
                await SDKProperty.SQLiteConn.ExecuteAsync($"delete from GroupMemberInfo where groupId ={getGroupMemberListPackage.data.groupId}");

                await SDKProperty.SQLiteConn.InsertAllAsync(dic.Values);
            }
            catch (Exception)
            {
                await SDKProperty.SQLiteConn.ExecuteAsync($"delete from GroupMemberInfo where groupId ={getGroupMemberListPackage.data.groupId}");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取群成员列表
        /// </summary>
        /// <param name="package"></param>
        /// <returns></returns>
        public static Model.GetGroupMemberListPackage GetMemberList(Model.GetGroupMemberListPackage package)
        {
            var resp = new Util.Webs.Clients.WebClient().Post(IMServiceURL.GetMemberList)
                       .Header("token", SDKClient.Instance.property.CurrentAccount.token)
                       .Header("signature", Util.Helpers.Encrypt.Md5By32(SDKClient.Instance.property.CurrentAccount.lastlastLoginTime.Value.Ticks + ProtocolBase.ImLinkSignUri))
                       .Header("version", SDKClient.Instance.property.CurrentAccount.httpVersion ?? "1.0")
                       .Header("timeStamp", SDKClient.Instance.property.CurrentAccount.lastlastLoginTime.Value.Ticks)
                       .JsonData <Model.GetGroupMemberListPackage>(package)
                       .OnFail((s, c) => SDKClient.logger.Error($"GetMemberList 调用失败: {s},错误码:{(int)c}"))
                       .ContentType(Util.Webs.Clients.HttpContentType.Json)
                       .ResultFromJson <Model.GetGroupMemberListPackage>();

            return(resp);
        }