Beispiel #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));
        }
Beispiel #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)ResultTypes.ParaNotMeet, Message = "卡券数目不和要求,请不要为空或超过五个!"
                       }
            }
            ;

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

            return(await CreateCardQrCodeAsync(actionInfo));
        }