Exemplo n.º 1
0
        protected void BtnYes_Click(object sender, EventArgs e)
        {
            Business.userinfo userinfo = new Business.userinfo();

            //清除用户列表
            userinfo.DeleteByCase("");

            var accessToken = AccessTokenBox.GetTokenValue();
            //获取用户列表
            var ret = BaseUser.GetUserList(accessToken, "");

            for (int i = 0; i < ret.data.openid.Count; i++)
            {
                var data = BaseUser.GetUserInfo(ret.data.openid[i], accessToken);

                Business.userinfoData userinfodata = new Business.userinfoData();
                userinfodata.subscribe      = data.subscribe.ToString();
                userinfodata.openid         = data.openid;
                userinfodata.nickname       = data.nickname;
                userinfodata.sex            = data.sex.ToString() == "1" ? "男" : "女";
                userinfodata.language       = data.language;
                userinfodata.city           = data.city;
                userinfodata.province       = data.province;
                userinfodata.country        = data.country;
                userinfodata.headimgurl     = data.headimgurl;
                userinfodata.subscribe_time = data.subscribe_time.ToString();
                userinfodata.unionid        = data.unionid == null ? "" : data.unionid;
                userinfodata.remark         = data.remark;
                if (data.privilege == null)
                {
                    userinfodata.privilege = "";
                }
                else
                {
                    userinfodata.privilege = data.privilege.ToString();
                }
                userinfo.Insert(userinfodata);
            }
            //var reet = BaseUser.GetUserInfo(ret.data.openid[0], accessToken);
        }