Example #1
0
        public Cardstatus getcardstatus(string authorizationCode, string code, string card_id)
        {
            LogHelper.WriteLog("getcardlist start");
            LogHelper.WriteLog("getcardlist authorizationCode" + authorizationCode);
            LogHelper.WriteLog("getcardlist card_id" + card_id);
            LogHelper.WriteLog("getcardlist code" + code);
            var url = "https://api.weixin.qq.com/card/code/get?access_token=" + authorizationCode;

            LogHelper.WriteLog("微信认证url:" + url);

            Getcardstatus getcardstatus = new Getcardstatus();

            getcardstatus.card_id       = card_id;
            getcardstatus.code          = code;
            getcardstatus.check_consume = false;
            JavaScriptSerializer jsonSerialize = new JavaScriptSerializer();
            string postDate = jsonSerialize.Serialize(getcardstatus);
            string content  = HttpWebResponseUtility.PostUrl(url, postDate);


            LogHelper.WriteLog("getcardlist content:" + content);
            var cardstatus = jsonSerialize.Deserialize <Cardstatus>(content);

            if (cardstatus != null && cardstatus.errcode == 0)
            {
            }
            LogHelper.WriteLog("getcardlist end");
            return(cardstatus);
        }
Example #2
0
        public List <card> getcardlist(string authorizationCode, string openid, string card_id)
        {
            LogHelper.WriteLog("getcardlist start");
            LogHelper.WriteLog("getcardlist authorizationCode" + authorizationCode);
            LogHelper.WriteLog("getcardlist openid" + openid);
            LogHelper.WriteLog("getcardlist card_id" + card_id);
            var url = "https://api.weixin.qq.com/card/user/getcardlist?access_token=" + authorizationCode;

            LogHelper.WriteLog("微信认证url:" + url);

            Getcardlist getcardlist = new Getcardlist();

            getcardlist.openid  = openid;
            getcardlist.card_id = card_id;
            JavaScriptSerializer jsonSerialize = new JavaScriptSerializer();
            string postDate = jsonSerialize.Serialize(getcardlist);
            string content  = HttpWebResponseUtility.PostUrl(url, postDate);


            LogHelper.WriteLog("getcardlist content:" + content);
            var cardModel = jsonSerialize.Deserialize <cardModel>(content);

            if (cardModel != null && cardModel.errcode == 0)
            {
                cardModel.card_list.FirstOrDefault();
            }



            LogHelper.WriteLog("getcardlist end");
            return(cardModel.card_list);
        }