Пример #1
0
    public void RegisterClick()
    {
        if (Username.text == "" || Password.text == "" || RPassword.text == "")
        {
            AllTools.Instance.Alert("用户信息不完整");
            return;
        }

        if (Password.text != RPassword.text)
        {
            AllTools.Instance.Alert("两次输入密码不一致");
            return;
        }


        //可能是1(之前没有注册过)
        //存储JSON的文件应该是不存在的

        if (!File.Exists(AllPaths.Instance.AccountJsonPath))   //通过文件不存在,判定出之前没有注册过
        {
            //JsonData 生成列表
            WriteJson();
        }
        //可能性2(之前注册过)
        //存储的JSON的文件应该是存在的
        else
        {
            //JsonData 生成列表
            UserInfoList list = AllToObject.Instance.GetUserInfo();
            WriteJson(list);

            //把列表的JSON数据,写入文件中
            File.WriteAllText(AllPaths.Instance.AccountJsonPath, JsonMapper.ToJson(list), System.Text.Encoding.UTF8);
        }
    }
Пример #2
0
        public bool GetDataList()
        {
            string functionName = "GetDataList";

            try
            {
                List <AMS.Model.AMS_UserInfo> modelList = new List <Model.AMS_UserInfo>();
                //TODO:获取用户列表
                modelList = AMS.ServiceProxy.IUserInfoService.GetUserInfoList();
                UserInfoList.Clear();
                foreach (AMS.Model.AMS_UserInfo model in modelList)
                {
                    UserInfoList.Add(model);
                }
                return(true);
            }
            catch (AMS.Model.CustomerException ex)
            {
                ErrorMessage = string.Format("{0} 出自{1}.{2}", ex.Message, ex.ErrorSourcesClass, ex.ErrorSourcesFunction);
                return(false);
            }
            catch (Exception ex)
            {
                ErrorMessage = string.Format("{0} 出自{1}.{2}", ex.Message, CLASSNAME, functionName);
                return(false);
            }
        }
        public UserInfo getUserFromId(long id, Boolean local)
        {
            SymConfig          symConfig          = botClient.getConfig();
            UserInfoList       info               = null;
            RestRequestHandler restRequestHandler = new RestRequestHandler();
            string             url = CommonConstants.HTTPSPREFIX + symConfig.podHost + ":" + symConfig.podPort + PodConstants.GETUSERSV3 + "?uid=" + id + "&local=" + local;

            HttpWebResponse resp = restRequestHandler.executeRequest(null, url, false, WebRequestMethods.Http.Get, symConfig, true);

            if (resp.StatusCode == HttpStatusCode.NoContent)
            {
                resp.Close();
                throw new Exception("No user found.");
            }
            else if (resp.StatusCode == HttpStatusCode.OK)
            {
                string body = restRequestHandler.ReadResponse(resp);
                info = JsonConvert.DeserializeObject <UserInfoList>(body);
            }
            resp.Close();

            if (info != null && info.users != null && info.users.Count > 0)
            {
                return(info.users[0]);
            }

            throw new Exception("No user found or empty user list returned.");
        }
Пример #4
0
    //刷新左上角玩家UI数据方法
    public void Display_PlayerDataInfo()
    {
        PlayerDataInfo characterInfo = DisplayInfo();

        exp.text     = AllFormula.Instance.GetExpInfo(characterInfo.exp) [0].ToString();;   //经验
        maxExp.text  = AllFormula.Instance.GetExpInfo(characterInfo.exp) [3].ToString();
        gold.text    = characterInfo.gold.ToString();
        diamond.text = characterInfo.diamond.ToString();

        //玩家经验条UI变动
        float exp_1    = AllFormula.Instance.GetExpInfo(characterInfo.exp) [0];
        float maxExp_1 = AllFormula.Instance.GetExpInfo(characterInfo.exp) [3];

        expImage.fillAmount = exp_1 / maxExp_1;

        userName = PlayerModel.Instance.userName;
        info     = AllToObject.Instance.GetUserInfo();
        for (int i = 0; i < info.User.Count; i++)
        {
            if (info.User[i].playerDataInfo.userName == userName)
            {
                name1.text = info.User[i].characterInfo.characterInfos[0].name;
                lv.text    = AllFormula.Instance.GetExpInfo(info.User[i].playerDataInfo.exp) [2].ToString();
                hp.text    = info.User[i].characterInfo.characterInfos[0].hp.ToString();
                maxHp.text = info.User[i].characterInfo.characterInfos[0].maxHp.ToString();
                exp.text   = info.User[i].playerDataInfo.exp.ToString();

                //玩家血条UI变动
                float hp_1    = info.User[i].characterInfo.characterInfos[0].hp;
                float maxhp_1 = info.User[i].characterInfo.characterInfos[0].maxHp;
                hpImage.fillAmount = hp_1 / maxhp_1;
            }
        }
    }
Пример #5
0
        public void Initialize(string pAreaCode = "")
        {
            PT.Profile.Types.DeptInfoList deptLsit = new PT.Profile.Types.DeptInfoList();


            PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <PT.Profile.Interface.IOrganization, PT.Profile.Types.DeptInfoList>(p =>
            {
                deptLsit = p.GetDeptInfos();
                return(deptLsit);
            });
            //获取所有用户信息
            PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <PT.Profile.Interface.IOrganization>(channel =>
            {
                this.userInfoList = channel.GetUsers();
                if (this.userInfoList == null)
                {
                    this.userInfoList = new UserInfoList();
                }
            });

            PP_DepartmentInfoList.Clear();
            _areaCode = string.IsNullOrWhiteSpace(pAreaCode)
                            ? ParameterInformation.Current.GlobalParameter.Code
                            : pAreaCode;
            if (string.IsNullOrWhiteSpace(_areaCode) || _areaCode.Equals("0"))
            {
                return;
            }
            //添加服务引用方式调用服务

            OrganizationClientOnGetDeptInfos(deptLsit);
        }
Пример #6
0
 /// <summary>
 /// 显示列表
 /// </summary>
 public void ShowUserInfoTable()
 {
     foreach (var model in GetUserInfoList())
     {
         UserInfoList.Add(model);
     }
     ShowUserInfoList();
 }
Пример #7
0
        public IHttpActionResult Getsys_user(int myUnitId)
        {
            //var tmp = db.sys_user.Select(m => new UserItem { m.user_name, m.user_id });
            UserInfoList userList = new UserInfoList();

            userList.resultList = db.sys_user.Where(m => m.unit_id == myUnitId).ToList();
            userList.code       = 100;
            return(Ok(userList));
        }
Пример #8
0
 /// <summary>
 /// 是否可以执行打印命令
 /// </summary>
 /// <returns></returns>
 private bool OnCanExecutePrintCommand()
 {
     if (Equals(UserInfoList, null) || !UserInfoList.Any())
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Пример #9
0
        public ActionResult Index(int page = 1)
        {
            UserInfoList userinfo = new UserInfoList
            {
                userinfoList = new ClassLibrary.ManagePerson().getALLNormalUser(),
                pageinfo     = new ViewModel.PagingInfo {
                    currentpage = page, itemperpage = pageSize, Totalitems = new ClassLibrary.ManagePerson().getUserCount()
                }
            };

            return(View(userinfo));
        }
Пример #10
0
 public UserInfo GetInfo()
 {
     info = AllToObject.Instance.GetUserInfo();
     for (int i = 0; i < info.User.Count; i++)
     {
         if (info.User[i].playerDataInfo.userName == userName)
         {
             infoUserListNum = i;
             _userInfo       = info.User[i];
             return(_userInfo);
         }
     }
     return(null);
 }
Пример #11
0
        protected void ListBind()
        {
            string        queryStr = "select * from tbMeetingRoom";
            SqlConnection con      = new SqlConnection(connStr);

            con.Open();
            SqlDataAdapter sda = new SqlDataAdapter(queryStr, con);
            DataSet        ds  = new DataSet();

            sda.Fill(ds);
            UserInfoList.DataSource = ds;
            UserInfoList.DataBind();
            con.Close();
        }
Пример #12
0
        /// <summary>
        /// 取得分页数据
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        private void getPageData(int pageIndex, int pageSize)
        {
#if DEBUG
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();
#endif
            //pageRepuestParams.SortField = "LastUpdatedTime";
            pageRepuestParams.SortOrder = "desc";

            pageRepuestParams.PageIndex = pageIndex;
            pageRepuestParams.PageSize  = pageSize;


            //_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
            //Console.WriteLine(await (await _httpClient.GetAsync("/api/service/EnterpriseInfo/Get?id='1'")).Content.ReadAsStringAsync());

            var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult <PageResult <UserModel> > >(GlobalData.ServerRootUri + "UserManager/PageData", Utility.JsonHelper.ToJson(pageRepuestParams));

#if DEBUG
            stopwatch.Stop();
            Utility.LogHelper.Info("获取用户信息用时(毫秒):" + stopwatch.ElapsedMilliseconds);
            Utility.LogHelper.Info("用户信息内容:" + Utility.JsonHelper.ToJson(result));
#endif

            if (!Equals(result, null) && result.Successed)
            {
                Application.Current.Resources["UiMessage"] = result?.Message;
                LogHelper.Info(Application.Current.Resources["UiMessage"].ToString());
                if (result.Data.Data.Any())
                {
                    //TotalCounts = result.Data.Total;
                    //Messenger.Default.Send(LoginUser, MessengerToken.LoginSuccess);
                    UserInfoList = new ObservableCollection <UserModel>(result.Data.Data);
                    TotalCounts  = result.Data.Total;
                }
                else
                {
                    UserInfoList?.Clear();
                    TotalCounts = 0;
                    Application.Current.Resources["UiMessage"] = "未找到数据";
                }
            }
            else
            {
                //操作失败,显示错误信息
                UserInfoList = new ObservableCollection <UserModel>();
                Application.Current.Resources["UiMessage"] = result?.Message ?? "查询用户信息失败,请联系管理员!";
            }
        }
Пример #13
0
    public void WriteJson(UserInfoList list = null)
    {
        if (list == null)
        {
            list      = new UserInfoList();
            list.User = new List <UserInfo>();
        }
        for (int i = 0; i < list.User.Count; i++)
        {
            if (list.User[i].playerDataInfo.userName == Username.text)
            {
                AllTools.Instance.Alert("该账号已被注册!");
                return;
            }
        }

        UserInfo userInfo = new UserInfo();

        userInfo.characterInfo = AllToObject.Instance.GetCharacterInfo();
        userInfo.characterInfo.characterInfos[0].name = Username.text;
        userInfo.playerDataInfo          = AllToObject.Instance.GetPlayDataInfo();
        userInfo.playerDataInfo.userName = Username.text;
        userInfo.playerDataInfo.password = Password.text;

        //Debug.Log(userInfo.characterInfo.characterInfos[1].name);

        //生成一行的数据
        list.User.Add(userInfo);

        //把列表的JSON数据,写入文件中
        File.WriteAllText(AllPaths.Instance.AccountJsonPath, JsonMapper.ToJson(list), System.Text.Encoding.UTF8);
        //保存用户数据
        PlayerPrefs.SetString("Name", Username.text);
        PlayerPrefs.SetString("Password", Password.text);


        //跨页面传递参数 把刚刚注册的账号密码传递到登录页面
        Log_in login = transform.parent.Find("Log_in").GetComponent <Log_in>();

        login.Username.text = Username.text;
        login.Password.text = Password.text;


        //添加用户背包
        UIPackageModel.Instance.NewPackage();

        //将关闭页面的回调方法,给Alert传递过去
        AllTools.Instance.Alert("注册成功", GObackClick);
    }
 protected void ListBind()
 {
     UserInfoList.DataSource = CreateSource();
     UserInfoList.DataBind();
     NextPage.Enabled = true;
     PrevPage.Enabled = true;
     if (CurrentPage == (PageCount - 1))
     {
         NextPage.Enabled = false;
     }
     if (CurrentPage == 0)
     {
         PrevPage.Enabled = false;
     }
     lblCurrentPage.Text = (CurrentPage + 1).ToString();
 }
Пример #15
0
    public UserInfoList DisplayUserInfoList()
    {
        string temp = AllJson.Instance.UserInfoJson();

        if (_userJson == temp)
        {
            return(info);
        }
        else
        {
            _userJson = temp;
            info      = AllToObject.Instance.GetUserInfo();
            _userInfo = GetInfo();
            return(info);
        }
    }
Пример #16
0
        //用户信息(表格显示)
        public UserInfoList SearchInfo(UserParams userInfo)
        {
            UserInfoList userInfoList = new UserInfoList();

            userInfoList.rows = new List <UserInfo>();

            DataTable dtUerInfo = userInfoDAL.SearchInfo(userInfo);

            //总记录数
            if (dtUerInfo.Rows.Count > 0)
            {
                userInfoList.total = Convert.ToInt32(dtUerInfo.Rows[0]["Total"]);
            }
            //将DT转换成对象并返回
            userInfoList.rows = dtUerInfo.toList <UserInfo>();
            return(userInfoList);
        }
Пример #17
0
 //遍历玩家账号与登录的账号相对应,获得账号下的数据
 public PlayerDataInfo DisplayInfo()
 {
     userName = Log_in.Instance._userName;
     info     = AllToObject.Instance.GetUserInfo();
     for (int i = 0; i < info.User.Count; i++)
     {
         if (info.User[i].playerDataInfo.userName == userName)
         {
             if (info.User[i].characterInfo.characterInfos[0].name == null)
             {
                 info.User[i].characterInfo.characterInfos[0].name = userName;
             }
             return(info.User[i].playerDataInfo);
         }
     }
     return(null);
 }
Пример #18
0
 //遍历玩家动态表里的账号,获得这个账号就会获得这个账号下的关联数据
 public CharacterInfo DisplayCharacterInfo()
 {
     userName = Log_in.Instance._userName;  //登录的账号传给  userName
     info     = AllToObject.Instance.GetUserInfo();
     for (int i = 0; i < info.User.Count; i++)
     {
         if (info.User[i].playerDataInfo.userName == userName)
         {
             if (info.User[i].characterInfo.characterInfos[0].name == null)   //判断名字是否为空,如果是,则把账号赋值给 name
             {
                 info.User[i].characterInfo.characterInfos[0].name = userName;
             }
             return(info.User[i].characterInfo.characterInfos[0]);
         }
     }
     return(null);
 }
Пример #19
0
        public async Task <UserInfoList> GetUserInfo(int UserId)
        {
            Users        u        = new Users();
            UserInfoList response = new UserInfoList();

            if (UserId != 0)
            {
                u = await information.GetUserById(UserId);
            }
            response.UserId     = u.UserId;
            response.UserName   = u.UserName;
            response.Sex        = u.Sex;
            response.PhoneNum   = u.PhoneNum;
            response.PostalCode = u.PostalCode;
            response.Address    = u.Address;
            return(response);
        }
Пример #20
0
    public Transform LoginClick()
    {
        if (!File.Exists(AllPaths.Instance.AccountJsonPath))
        {
            AllTools.Instance.Alert("请先注册");
            return(null);
        }
        UserInfoList    Userlist = AllToObject.Instance.GetUserInfo();
        List <UserInfo> list     = Userlist.User;

        for (int i = 0; i < list.Count; i++)
        {
            //和即将注册的用户名进行比较,如果相同,说明已经注册过

            if (list[i].playerDataInfo.userName == Username.text)
            {
                if (list[i].playerDataInfo.password != Password.text)
                {
                    AllTools.Instance.Alert("密码错误");
                    return(null);
                }
                else
                {
                    // AllTools.Instance.Alert("登录成功");
                    Transform temp = AllTools.Instance.Load("Prefabs/Reg_log/Panel_UI").transform;
                    _userName = list[i].playerDataInfo.userName;
                    PlayerModel.Instance.userName        = _userName;                               //登录的账号等于 M层的账号
                    PlayerModel.Instance._characterInfo  = list[i].characterInfo.characterInfos[0]; //M层获得这个账号下的玩家属性
                    PlayerModel.Instance._bossInfo       = list[i].characterInfo.characterInfos[1];
                    PlayerModel.Instance._playerDaraInfo = list[i].playerDataInfo;                  //M层获得这个账号下玩家的基础信息
                    //获取唯一ID
                    UIPackageModel.Instance.userID = i;
                    transform.DOScale(0, 0.3f).OnComplete(() => { transform.parent.Find("register").gameObject.SetActive(false); });
                    //初始化数据
                    list[i].characterInfo.characterInfos[0].hp = list[i].characterInfo.characterInfos[0].maxHp;
                    list[i].characterInfo.characterInfos[1].hp = list[i].characterInfo.characterInfos[1].maxHp;
                    PlayerModel.Instance.SaveCharacterInfo(list[i].characterInfo.characterInfos[0]);
                    PlayerModel.Instance.SaveBossInfo(list[i].characterInfo.characterInfos[1]);
                    return(temp);
                }
            }
        }
        AllTools.Instance.Alert("当前用户不存在");
        return(null);
    }
Пример #21
0
        /// <summary>
        /// 批量获取用户基本信息,开发者可通过该接口来批量获取用户基本信息。最多支持一次拉取100条。
        /// </summary>
        /// <param name="batchgetUserInfoList">要请求的批量用户</param>
        /// <returns></returns>
        public List <UserInfoModel> BatchGetUserInfo(List <ParamBatchgetUserInfo> batchgetUserInfoList)
        {
            string url = ApiUrl.BatchGetUserInfoUrl(Config.AccessToken);

            var paramBatchgetUserInfoList = new ParamBatchgetUserInfoList {
                user_list = batchgetUserInfoList
            };

            string json = HttpHelper.PostJson(url, JsonConvert.SerializeObject(paramBatchgetUserInfoList));

            ResultModel.CreateInstance(json).HasException();

            JObject jo = JObject.Parse(json);

            UserInfoList userInfoList = jo.ToObject <UserInfoList>();

            return(userInfoList.user_info_list);
        }
Пример #22
0
        /// <summary>
        /// 模型数据改变
        /// </summary>
        /// <param name="obj"></param>
        private void dataChanged(UserModel UserModel)
        {
            getPageData(pageRepuestParams.PageIndex, pageRepuestParams.PageSize);
            var tmpModel = UserInfoList.FirstOrDefault(a => a.Id == UserModel.Id);

            this.UserInfo = UserInfoList.FirstOrDefault();
            ////新增、不存在的数据插入到第一行便于查看
            //if (Equals(tmpModel, null))
            //{
            //    this.EnterpriseInfoList.Insert(0, enterpriseModel);
            //    //this.EnterpriseInfoList.Insert(0, enterpriseModel);
            //    EnterpriseInfoList.RemoveAt(this.EnterpriseInfoList.Count - 1);
            //}
            //else
            //{
            //    //修改的更新后置于第一行,便于查看
            //    tmpModel = enterpriseModel;
            //    EnterpriseInfoList.Move(EnterpriseInfoList.IndexOf(tmpModel), 0);
            //    tmpModel = enterpriseModel;
            //}
        }
Пример #23
0
        //列表绑定
        private void ListBind()
        {
            //筛选条件
            var FilterFields = new List <ListFilterField>();

            if (!string.IsNullOrWhiteSpace(inpFilter.Text.Trim()))
            {
                FilterFields.Add(new ListFilterField
                {
                    Name       = "Name",
                    CmpareMode = FilterCmpareMode.Like,
                    Value      = new List <string>(inpFilter.Text.Trim().Split(' '))
                });
            }

            //排序字段
            var OrderByFields = new List <ListOrderField>();

            foreach (string item in new string[] { "ListOrderByID", "ListOrderByName", "ListOrderByStateID", "ListOrderByUpdateTime" })
            {
                GetOrderByField(UserInfoList, item, OrderByFields, out OrderByFields);
            }

            //显示列表页
            var userInfos = Ziri.BLL.SYS.User.GetUserInfos(FilterFields, OrderByFields
                                                           , UserInfoListPager.PageSize, UserInfoListPager.PageIndex, out long rowCount, out AlertMessage alertMessage);

            UserInfoList.DataSource = userInfos;
            UserInfoList.DataBind();
            UserInfoListPager.RowCount = rowCount;

            //提示信息
            if (alertMessage != null)
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ListMessage"
                                                        , string.Format("<script> swal('{0}', '', '{1}'); </script>", alertMessage.Message, alertMessage.Type));
            }
        }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="isMultSelect">是否多选</param>
 /// <param name="isShowAll">是否显示全部</param>
 /// <param name="exsitUserIDList">过滤列表</param>
 public UserSettingWindow(IEnumerable <string> ignoreUserIDs)
 {
     InitializeComponent();
     if (ignoreUserIDs != null)
     {
         this.ignoreUserIDList.AddRange(ignoreUserIDs);
     }
     this.dataGridSelectedStaff.ItemsSource = this.selectedUserInfoCollection;
     if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
     {
         PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <PT.Profile.Interface.IOrganization>(channel =>
         {
             var result = channel.GetDeptInfosByParentDeptID(PT.Profile.Definition.SpecialIDs.DeptRootID, true);
             if (result != null)
             {
                 Department[] depts = new Department[result.Count];
                 for (int i = 0; i < depts.Length; i++)
                 {
                     depts[i] = new Department {
                         Guid = result[i].DeptID, Name = result[i].DeptName, ParentDept = result[i].ParentDeptID, IsOrganization = result[i].IsOrganization
                     };
                 }
                 var treeNodeList = TreeNode <Department> .CreateTreeNodes(depts, dept => PT.Profile.Definition.SpecialIDs.DeptRootID.Equals(dept.ParentDept),
                                                                           (dept, partentNode) => dept.ParentDept == partentNode.Value.Guid);
                 this.treeViewOrg.ItemsSource = treeNodeList;
             }
         });
         PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <PT.Profile.Interface.IOrganization>(channel =>
         {
             this.userInfoList = channel.GetUsers();
             if (this.userInfoList == null)
             {
                 this.userInfoList = new UserInfoList();
             }
         });
     }
 }
Пример #25
0
        /// <summary>
        /// 批量获取关注用户信息
        /// </summary>
        /// <returns></returns>
        public bool GetUserListAndUpdateDb()
        {
            var nextOpenid = "";

            //用户详情列表对象,用于最后批量插入数据库
            var userInfoList = new UserInfoList()
            {
                User_info_list = new List <MassUserInfo>()
            };
            var lockObj = new object();

            //用于标识异步操作是否全部完成
            var isFinished = false;
            //是否有待获取用户详情的任务
            var hasTask = false;

            //nextOpenid不为空则继续获取下一页
            #region 获取已关注用户列表
            do
            {
                var openidList = WxApi.WxApi.GetUserList(nextOpenid).JsonToObj <OpenidListModel>();
                if (openidList == null || openidList.Data == null || openidList.Data.Openid.Count <= 0)
                {
                    break;//跳出循环体
                }

                //构造批量获取用户详情参数
                var openidListParam = new OpenidListParam()
                {
                    user_list = new List <GetUserInfoParam>()
                };
                openidList.Data.Openid.ForEach(a =>
                {
                    //db中不存在的用户,才加入待获取列表
                    if (!Table.Any(m => m.Openid == a))
                    {
                        openidListParam.user_list.Add(new GetUserInfoParam()
                        {
                            lang = "zh-CN", openid = a
                        });
                    }
                });
                nextOpenid = openidList.Next_Openid;

                //待获取列表为空时,跳出循环体
                if (openidListParam.user_list.Count <= 0)
                {
                    //如果无任务,直接完成
                    if (!hasTask)
                    {
                        isFinished = true;
                    }
                    break;
                }
                else
                {
                    hasTask = true;
                }
                #region 每500用户启动一个线程获取详细信息
                //每500个openid启动一个线程请求,每个请求最多100个openid
                Task.Run(() =>
                {
                    var requestDataCount = 100;
                    var threadDataCount  = requestDataCount * 5;
                    var times            = openidListParam.user_list.Count % threadDataCount > 0 ? openidListParam.user_list.Count / threadDataCount + 1 : openidListParam.user_list.Count / threadDataCount;

                    //并行for循环,for()循环参数小于第二个参数值
                    Parallel.For(1, times + 1, i =>
                    {
                        //最多请求100条用户详情,存入变量中。
                        var userInfoListJson = WxApi.WxApi.GetBatchUserInfos(new OpenidListParam()
                        {
                            user_list = openidListParam.user_list.Skip((i - 1) * requestDataCount).Take(requestDataCount).ToList()
                        });
                        lock (lockObj)
                        {
                            userInfoList.User_info_list.AddRange(userInfoListJson.JsonToObj <UserInfoList>()?.User_info_list);
                        }
                        if (i == times)
                        {
                            isFinished = true;
                        }
                    });
                });
                #endregion 每500用户启动一个线程获取细信息
            } while (true);
            #endregion 获取已关注用户列表

            //如果线程未全部完成,则等待1秒钟
            while (!isFinished)//=="false")
            {
                Thread.Sleep(1000);
            }

            //无已关注用户,正常情况
            if (userInfoList.User_info_list.Count <= 0)
            {
                return(true);
            }

            //todo:批量插入userInfoList.User_info_list到DB;
            using (var entity = new MHContext())
            {
                var wxUsersList = Mapper.Map <List <MassUserInfo>, List <WxUsers> >(userInfoList.User_info_list);
                entity.WxUsers.AddRange(wxUsersList.Where(a => !Table.Any(m => m.Openid == a.Openid)));
                //todo:批量插入user表。。
                var usersList = Mapper.Map <List <WxUsers>, List <User> >(wxUsersList);
                entity.User.AddRange(usersList.Where(a => !entity.User.Any(m => m.Openid == a.Openid)));
                entity.SaveChanges();
            }
            return(true);
        }
Пример #26
0
        /// <summary>
        /// Adds one or more users to an existing group. Adds one or more users to an existing group.
        /// </summary>
        /// <exception cref="DocuSign.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountId">The external account number (int) or account ID Guid.</param>
        /// <param name="groupId">The ID of the group being accessed.</param>
        /// <param name="userInfoList"> (optional)</param>
        /// <returns>GroupUsers</returns>
        public GroupUsers GroupsPutGroupUsers(string accountId, string groupId, UserInfoList userInfoList = null)
        {
            ApiResponse <GroupUsers> localVarResponse = GroupsPutGroupUsersWithHttpInfo(accountId, groupId, userInfoList);

            return(localVarResponse.Data);
        }
Пример #27
0
        /// <summary>
        /// Adds one or more users to an existing group. Adds one or more users to an existing group.
        /// </summary>
        /// <exception cref="DocuSign.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountId">The external account number (int) or account ID Guid.</param>
        /// <param name="groupId">The ID of the group being accessed.</param>
        /// <param name="userInfoList"> (optional)</param>
        /// <returns>Task of GroupUsers</returns>
        public async System.Threading.Tasks.Task <GroupUsers> GroupsPutGroupUsersAsync(string accountId, string groupId, UserInfoList userInfoList = null)
        {
            ApiResponse <GroupUsers> localVarResponse = await GroupsPutGroupUsersAsyncWithHttpInfo(accountId, groupId, userInfoList);

            return(localVarResponse.Data);
        }
Пример #28
0
        /// <summary>
        /// Adds one or more users to an existing group. Adds one or more users to an existing group.
        /// </summary>
        /// <exception cref="DocuSign.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountId">The external account number (int) or account ID Guid.</param>
        /// <param name="groupId">The ID of the group being accessed.</param>
        /// <param name="userInfoList"> (optional)</param>
        /// <returns>Task of ApiResponse (GroupUsers)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <GroupUsers> > GroupsPutGroupUsersAsyncWithHttpInfo(string accountId, string groupId, UserInfoList userInfoList = null)
        {
            // verify the required parameter 'accountId' is set
            if (accountId == null)
            {
                throw new ApiException(400, "Missing required parameter 'accountId' when calling GroupUsersApi->GroupsPutGroupUsers");
            }
            // verify the required parameter 'groupId' is set
            if (groupId == null)
            {
                throw new ApiException(400, "Missing required parameter 'groupId' when calling GroupUsersApi->GroupsPutGroupUsers");
            }

            var    localVarPath         = "/v2/accounts/{accountId}/groups/{groupId}/users";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };
            String localVarHttpContentType    = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            localVarPathParams.Add("format", "json");
            if (accountId != null)
            {
                localVarPathParams.Add("accountId", Configuration.ApiClient.ParameterToString(accountId));                    // path parameter
            }
            if (groupId != null)
            {
                localVarPathParams.Add("groupId", Configuration.ApiClient.ParameterToString(groupId));                  // path parameter
            }
            if (userInfoList != null && userInfoList.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(userInfoList); // http body (model) parameter
            }
            else
            {
                localVarPostBody = userInfoList; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GroupsPutGroupUsers", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <GroupUsers>(localVarStatusCode,
                                                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                (GroupUsers)Configuration.ApiClient.Deserialize(localVarResponse, typeof(GroupUsers))));
        }
Пример #29
0
 internal static UserInfoList UserFetchInfoList(UserCriteria criteria)
 {
     return(UserInfoList.FetchUserInfoList(criteria));
 }
        public ActionResult GetUserList()
        {
            UserInfoList list = UserInfoList.GetUserInfoList();

            return(this.Direct(list));
        }