Exemplo n.º 1
0
        public JsonResult Get(string id)
        {
            try
            {
                var    result = new QrCodeDTO();
                var    key    = System.Configuration.ConfigurationManager.AppSettings["QrCodeKey"];
                var    values = Des.DesDecrypt(id, Des.GetLegalKey(key)).Split('|');
                string type   = values[0];
                if (values.Length > 1)
                {
                    string ID = values[1], version = "";
                    if (values.Length > 2)
                    {
                        version = values[2];
                    }

                    var qrcode = ProductService.GetProductDetail(ID, decimal.Parse(version));
                    qrcode.Type = type;
                    result      = qrcode;

                    result.State = true;
                }
                else
                {
                    throw new Exception("系统错误,请联系管理员");
                }
                return(Json(result));
            }
            catch (Exception e)
            {
                return(Json(new QrCodeDTO {
                    State = false, Message = e.Message
                }));
            }
        }