Exemplo n.º 1
0
        /// <summary>
        /// 添加群聊数据
        /// </summary>
        static void AddChatGroup()
        {
            e3net.Common.NetWork.HttpUtil http = new e3net.Common.NetWork.HttpUtil();
            System.Diagnostics.Stopwatch  sw   = new System.Diagnostics.Stopwatch();
            sw.Start();
            for (int j = 0; j < 5; j++)
            {
                for (int k = 0; k < 10000; k++)
                {
                    string deviceId = "device_" + k;
                    for (int i = 0; i < 3; i++)
                    {
                        PostChatGroupData postEntity = new PostChatGroupData();
                        postEntity.deviceId   = deviceId;
                        postEntity.speakerId  = string.Format("id_{0}_{1}", k, i);
                        postEntity.timePeriod = 3;

                        string jsonData = JsonHelper.ObjectToJSON(postEntity);
                        string url      = "http://localhost:29105/WeChat/AddChatGroup";
                        http.PostRequest(url, jsonData);
                    }
                }
            }

            sw.Stop();
            Console.WriteLine("总耗时:" + sw.Elapsed.TotalMilliseconds);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 模拟添加设备关联人员
        /// </summary>
        /// <returns></returns>
        public static void ModelChatGroupLink()
        {
            e3net.Common.NetWork.HttpUtil http = new e3net.Common.NetWork.HttpUtil();
            for (int i = 0; i < 10000; i++)
            {
                for (int k = 0; k < 3; k++)
                {
                    GhatGroupUserInfo userInfor = new GhatGroupUserInfo();
                    userInfor.deviceId = "device_" + i;
                    userInfor.nickName = string.Format("name_{0}_{1}", i, k);
                    userInfor.userId   = string.Format("id_{0}_{1}", i, k);

                    string jsonData = JsonHelper.ObjectToJSON(userInfor);
                    string url      = "http://localhost:29105/WeChat/AddGroupChatLink";
                    http.PostRequest(url, jsonData);
                }
            }
        }