Example #1
0
        /// <summary>
        /// 生成有规则的二维码字符串
        /// </summary>
        /// <param name="plateform">系统</param>
        /// <param name="business">业务</param>
        /// <param name="code">信息数据</param>
        /// <returns>二维码字符串</returns>
        public static string Generate(SystemPlatform plateform, QRCodeEnum business, string code)
        {
            if (!Enum.IsDefined(typeof(SystemPlatform), plateform) || !Enum.IsDefined(typeof(QRCodeEnum), business))
            {
                throw new ArgumentException();
            }

            string platformStr = ((int)plateform).ToString();
            string actionStr   = ((int)business).ToString();

            return($"{platformStr}-{actionStr}-{code}");
        }
Example #2
0
 private string GetQRSceneEnumStr(QRCodeEnum qrCodeEnum)
 {
     if (qrCodeEnum == QRCodeEnum.Forever)
     {
         return(QR_LIMIT_SCENE);
     }
     else if (qrCodeEnum == QRCodeEnum.Temporary)
     {
         return(QR_SCENE);
     }
     else
     {
         throw new Exception("未知道二维码类型");
     }
 }