Ejemplo n.º 1
0
        public string GetUserAccountByCode(string code)
        {
            if (Config.OrganizeSecret.IsNullOrEmpty())
            {
                List <RoadFlow.Data.Model.Dictionary> childs = new RoadFlow.Platform.Dictionary().GetChilds("weixinagents", false);
                if (childs.Count == 0)
                {
                    return("");
                }
                this.secret = childs.OrderBy <RoadFlow.Data.Model.Dictionary, int>((Func <RoadFlow.Data.Model.Dictionary, int>)(p => p.Sort)).First <RoadFlow.Data.Model.Dictionary>().Note.Trim1();
            }
            else
            {
                this.secret = Config.OrganizeSecret;
            }
            string   str1     = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=" + this.GetAccessToken() + "&code=" + code;
            string   str2     = HttpHelper.SendGet(str1);
            JsonData jsonData = JsonMapper.ToObject(str2);
            string   str3     = jsonData.ContainsKey("UserId") ? jsonData["UserId"].ToString() : "";

            RoadFlow.Platform.Log.Add("调用了微信获取人员帐号", str1, RoadFlow.Platform.Log.Types.微信企业号, str2, "", (RoadFlow.Data.Model.Users)null);
            return(str3);
        }