Exemple #1
0
        /// <summary>
        /// 批量查询卡列表
        /// </summary>
        /// <param name="offset">查询卡列表的起始偏移量,从0 开始,即offset: 5 是指从从列表里的第六个开始读取。</param>
        /// <param name="count">需要查询的卡片的数量(数量最大50)</param>
        /// <returns></returns>
        public ActionResult GetCardList(int offset, int count)
        {
            string os  = offset.ToString();
            string cou = count.ToString();

            if (!VerifyParam("os,cou"))
            {
                return(ErrMsg());
            }


            var weChatConfig = GetWechatConfig();

            var ret = CardApi.CardBatchGet(weChatConfig.WeixinAppId, weChatConfig.WeixinCorpSecret, offset, count);

            if (ret.errcode == Weixin.ReturnCode.请求成功)
            {
                return(Json(new
                {
                    message = "",
                    success = true,
                    card_id_list = ret.card_id_list,
                    total_num = ret.total_num
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new
                {
                    message = ret.errmsg,
                    success = false
                }, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult Get()
        {
            var reslut = CardApi.CardBatchGet(AppId, 0, 50, new List <string>()
            {
                "CARD_STATUS_NOT_VERIFY", "CARD_STATUS_VERIFY_OK"
            });

            return(new JsonResult(HttpResult.Success(reslut)));
        }
Exemple #3
0
        //[TestMethod]
        public List <string> CardBatchGetTest()
        {
            var accessToken = AccessTokenContainer.GetToken(_appId);

            var result = CardApi.CardBatchGet(accessToken, 0, 5);

            Console.Write(result);
            Assert.IsNotNull(result);
            return(result.card_id_list);
        }