Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Clear();
            SaturnServiceReference.SaturnServiceSoapClient client = new SaturnServiceReference.SaturnServiceSoapClient();
            var result = client.getAuthenticationCode("{\"common\":{\"userId\":\"admin\",\"version\":\"3.1\"},\"special\":{\"authCode\":\"123\",\"captchaCode\":\"321\"}}");

            Response.Write(result);

            //"{\"code\":\"200\",\"description\":\"操作成功\",\"content\":{\"itemName\":\"1573\",\"norm\":\"2.5L\",\"alcohol\":\"68度\",\"baseWineYear\":\"3年\",\"agePitPits\":\"300年\",\"barcode\":\"LJ2013112823132\",\"isAuthCode\":\"1\",\"categoryName\":\"白酒\",\"categoryId\":\"大师酒\",\"brandName\":\"国窖1573\",\"dealerName\":\"\",\"dealerId\":\"\",\"imageList\":{\"imageURL\":\"\",\"displayIndex\":\"\"},\"wineDescList\":{\"wineDesc\":\"介绍信息\",\"displayIndex\":\"\"}}}"
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 商品认证
        ///
        /// 返回结果
        /// 1.	已验证过
        /// 2.	验证成功
        /// 3.	验证失败
        /// </summary>
        /// <param name="loggingSessionInfo"></param>
        /// <param name="userId"></param>
        /// <param name="authCode"></param>
        /// <param name="captchaCode"></param>
        /// <returns></returns>
        public string CheckAuthCode(LoggingSessionInfo loggingSessionInfo, string userId, string authCode, string captchaCode)
        {
            string       result       = "";
            LItemAuthBLL lItemAuthBLL = new LItemAuthBLL(loggingSessionInfo);
            var          itemAuthList = lItemAuthBLL.QueryByEntity(new LItemAuthEntity()
            {
                AuthCode = authCode
            }, null);
            LItemAuthEntity itemAuthObj = null;

            if (itemAuthList != null && itemAuthList.Length > 0)
            {
                itemAuthObj            = itemAuthList[0];
                itemAuthObj.AuthCount += 1;
                lItemAuthBLL.Update(itemAuthObj, false);
                result = "1";
                return(result);
            }
            else
            {
                SaturnServiceReference.SaturnServiceSoapClient client = new SaturnServiceReference.SaturnServiceSoapClient();
                var resultStr = client.getAuthenticationCode("{\"common\":{\"userId\":\"" + userId + "\",\"version\":\"3.1\"},\"special\":{\"authCode\":\"" + authCode + "\",\"captchaCode\":\"" + captchaCode + "\"}}");
                var authObj   = resultStr.DeserializeJSONTo <CheckAuthCodeResp>();
                if (authObj.code == "200")
                {
                    if (authObj.content.isAuthCode == "1")
                    {
                        result = "2";
                    }
                    else
                    {
                        result = "3";
                    }
                    var newItemAuthObj = new LItemAuthEntity();
                    newItemAuthObj.ItemAuthId   = Utils.NewGuid();
                    newItemAuthObj.AuthCode     = authCode;
                    newItemAuthObj.CaptchaCode  = captchaCode;
                    newItemAuthObj.ItemName     = authObj.content.itemName;
                    newItemAuthObj.Norm         = authObj.content.norm;
                    newItemAuthObj.Alcohol      = authObj.content.alcohol;
                    newItemAuthObj.BaseWineYear = authObj.content.baseWineYear;
                    newItemAuthObj.AgePitPits   = authObj.content.agePitPits;
                    newItemAuthObj.Barcode      = authObj.content.barcode;
                    newItemAuthObj.IsAuthCode   = ToInt(authObj.content.isAuthCode);
                    newItemAuthObj.CategoryName = authObj.content.categoryName;
                    newItemAuthObj.CategoryId   = authObj.content.categoryId;
                    newItemAuthObj.BrandName    = authObj.content.brandName;
                    newItemAuthObj.DealerName   = authObj.content.dealerName;
                    newItemAuthObj.DealerId     = authObj.content.dealerId;
                    newItemAuthObj.AuthCount    = 1;
                    newItemAuthObj.StoreCode    = authObj.content.storeCode;
                    newItemAuthObj.VipId        = userId;

                    lItemAuthBLL.Create(newItemAuthObj);
                }
                else
                {
                    result = authObj.description;
                }
            }
            return(result);
        }