コード例 #1
0
        /// <summary>
        /// 创建永久带参数二维码
        /// </summary>
        /// <param name="offidialAccountId"></param>
        /// <param name="ticket">获取的二维码ticket,凭借此ticket可以在有效时间内换取二维码</param>
        /// <param name="url">二维码图片解析后的地址,开发者可根据该地址自行生成需要的二维码图片</param>
        /// <param name="scene">场景值</param>
        /// <param name="description">二维码详细信息</param>
        /// <returns><see cref="QrCodeInfo"/></returns>
        /// <exception cref="WeChatAdApterException"></exception>
        public async Task <QrCodeInfo> CreateLimitTimeQrCodeAsync(Guid offidialAccountId, string ticket, string url, string scene, string description = null)
        {
            if (string.IsNullOrEmpty(scene))
            {
                throw new WeChatAdApterException("场景值不能为空", $"{nameof(QrCodeManager)}-{nameof(CreateLimitTimeQrCodeAsync)}");
            }

            var qrCodeInfo = new QrCodeInfo(offidialAccountId, ticket, url, scene, description);

            qrCodeInfo.AddDomainEvent(new QrCodeCreatedDomainEvent());

            await _qrCodeRepository.AddAsync(qrCodeInfo);

            return(qrCodeInfo);
        }
コード例 #2
0
 public QrCodeScanRecord(QrCodeInfo qrCodeInfo)
     : this()
 {
     QrCodeInfo = qrCodeInfo;
 }