Esempio n. 1
0
        public string InitPayInfo([FromBody] QueryPayGood query)
        {
            query.Ssid = query.Ssid.Substring(1, query.Ssid.Length - 2);
            var json = new CartgoBll().GetPayGoodsList(query);

            return(JsonConvert.SerializeObject(json));
        }
Esempio n. 2
0
        public ResultPayGoods GetPayGoodsList(QueryPayGood query)
        {
            var result = new ResultPayGoods {
                Exception = new MyException(), GoodsList = new List <PayGoodsList>()
            };

            try
            {
                var realSsid = GetRealSsid(query.Ssid);
                if (string.IsNullOrEmpty(realSsid))
                {
                    throw new Exception(IndexShow.客户端被篡改.ToString());
                }
                var sessionArr = GetSession(realSsid);
                if (sessionArr == null)
                {
                    throw new Exception(IndexShow.redis失效了.ToString());
                }
                if (sessionArr.Length == 3)
                {
                    realSsid = sessionArr.GetValue(2).ToString();
                }
                var cartGo = _userCartgo.GetUserCartgoInfo(realSsid);
                if (sessionArr.Length == 3)
                {
                    var userInfo = _userInfo.GeTbUserInfos(sessionArr.GetValue(2).ToString());
                    result.Phone   = new EncryDecryPhone().Md5Decrypt(userInfo?[0].Phone1);
                    result.Address = userInfo?[0].Address;
                }
                var payFee = 0m;
                foreach (var item in cartGo)
                {
                    result.GoodsList.Add(new PayGoodsList
                    {
                        GoodsName  = item.GoodsName,
                        GoodsPrice = $"{item.CurPrice}×{item.BuyCnt}={item.TotalPrice}",
                        GoodsCode  = item.StockCode
                    });
                    payFee += item.TotalPrice;
                }
                result.PayFee            = $"{payFee}";
                result.Exception.Success = true;
            }
            catch (Exception ex)
            {
                result.Exception.Success = false;
                result.Exception.Exmsg   = ex.Message;
            }
            return(result);
        }