Exemple #1
0
        /// <summary>
        ///   生成单卡券投放二维码
        /// </summary>
        /// <param name="type"></param>
        /// <param name="expireSeconds"></param>
        /// <param name="cardQrMo"></param>
        /// <returns></returns>
        public async Task <WXCardQrCodeResp> CreateCardQrCodeAsync(WXQrCodeType type, int expireSeconds, WXCardQrMo cardQrMo)
        {
            var actionInfo = new WXCreateCardQrReq()
            {
                expire_seconds = expireSeconds,
                action_name    = type.ToString(),
                action_info    = new { card = cardQrMo }
            };

            return(await CreateCardQrCodeAsync(actionInfo));
        }
Exemple #2
0
        /// <summary>
        ///   生成多卡券投放二维码
        /// </summary>
        /// <param name="type"></param>
        /// <param name="expireSeconds"></param>
        /// <param name="cardList"></param>
        /// <returns></returns>
        public async Task <WXCardQrCodeResp> CreateMultiCardQrCode(WXQrCodeType type, int expireSeconds, List <WXCardQrMo> cardList)
        {
            if (cardList == null || cardList.Count > 5)
            {
                return new WXCardQrCodeResp()
                       {
                           ret = (int)RespTypes.ParaError, msg = "卡券数目不和要求,请不要为空或超过五个!"
                       }
            }
            ;

            var actionInfo = new WXCreateCardQrReq()
            {
                expire_seconds = expireSeconds,
                action_name    = type.ToString(),
                action_info    = new { multiple_card = new { card_list = cardList } }
            };

            return(await CreateCardQrCodeAsync(actionInfo));
        }