Ejemplo n.º 1
0
        /// <summary>
        /// 图文消息群发卡券(目前该接口仅支持填入非自定义code的卡券,自定义code的卡券需先进行code导入后调用。 )
        /// </summary>
        /// <param name="cardId"></param>
        /// <returns></returns>
        public ActionResult GetHtml(string cardId)
        {
            if (!VerifyParam("cardId"))
            {
                return(ErrMsg());
            }

            var weChatConfig = GetWechatConfig();

            var ret = CardApi.GetHtml(weChatConfig.WeixinAppId, weChatConfig.WeixinCorpSecret, cardId);


            if (ret.errcode == Weixin.ReturnCode.请求成功)
            {
                return(Json(new
                {
                    message = "",
                    success = true,
                    content = ret.content
                }));
            }
            else
            {
                return(Json(new
                {
                    message = ret.errmsg,
                    success = false
                }, JsonRequestBehavior.AllowGet));
            }
        }