示例#1
0
        public ServerPriceInfo GetServerPriceListByUid(int sid, int uid)
        {
            var userInfo = _userRepository.FirstOrDefault(p => p.Id == uid);

            if (userInfo == null)
            {
                LogHelper.Logger.Error("获取用户账号信息失败,系统不存在该用户");
                throw new Exception("不存在的用户");
            }
            var serviceList     = _servicePriceRepository.GetServerPrices(sid, userInfo.Id);
            var serviceInfo     = _serviceRepository.FirstOrDefault(p => p.Id == sid);
            var serverPriceInfo = new ServerPriceInfo()
            {
                UserName        = !string.IsNullOrEmpty(userInfo.UserName) ? userInfo.UserName : userInfo.Mobile,
                ServiceName     = serviceInfo.ServiceName,
                ServerPrices    = serviceList,
                DescriptionList = GetDescByServiceList(serviceList),
            };

            return(serverPriceInfo);
        }
示例#2
0
        public ServerPriceInfo GetServerPriceList(int sid, string openId)
        {
            var userInfo = _userRepository.FirstOrDefault(p => p.WeChat == openId);

            if (userInfo == null)
            {
                LogHelper.Logger.Error("获取用户账号信息失败,用户可能还未绑定微信公众号");
                throw new Exception("您还没有绑定微信账号,请绑定后,再尝试购买");
            }
            var serviceList     = _servicePriceRepository.GetServerPrices(sid, userInfo.Id);
            var serviceInfo     = _serviceRepository.FirstOrDefault(p => p.Id == sid);
            var serverPriceInfo = new ServerPriceInfo()
            {
                UserName        = !string.IsNullOrEmpty(userInfo.UserName) ? userInfo.UserName : userInfo.Mobile,
                ServiceName     = serviceInfo.ServiceName,
                ServerPrices    = serviceList,
                DescriptionList = GetDescByServiceList(serviceList),
            };

            return(serverPriceInfo);
        }