/// <summary> /// 支付接口列表-获取分页数据 /// </summary> /// <returns></returns> public IEnumerable <dynamic> GetPayApiPaging(System.Collections.Specialized.NameValueCollection nvl, out int totalCount) { var pms = new { ChannelNo = nvl["ChannelNo"] == null ? 0 : nvl["ChannelNo"].ToObject <int>(), State = nvl["State"] == null ? new List <short>() : nvl["State"].Split(',').Select(o => short.Parse(o)).ToList() }; var query = PayApiRepository.GetQuery(); if (pms.ChannelNo > 0) { query = query.Where(o => o.ChannelNo == pms.ChannelNo); } if (pms.State.Count > 0) { query = query.Where(o => pms.State.Contains(o.State)); } else { query = query.Where(o => o.State != (short)PayApiState.Expired); } query = from upay in query join juc in UserRepository.GetQuery() on upay.CreateUID equals juc.UserId into iuc from uc in iuc.DefaultIfEmpty() join jur in UserRepository.GetQuery() on upay.CreateUID equals jur.UserId into iur from ur in iur.DefaultIfEmpty() join jpc in PayChannelReposit.GetQuery() on upay.ChannelNo equals jpc.ChannelNo into ipc from pc in ipc.DefaultIfEmpty() select new PayApiExt() { Id = upay.Id, Method = upay.Method, Title = upay.Title, ApiNo = upay.ApiNo, ApiUrl = upay.ApiUrl, Version = upay.Version, State = upay.State, TradeMode = upay.TradeMode, Memo = upay.Memo, ChannelNo = upay.ChannelNo, ChannelCode = pc.ChannelCode, OptType = upay.OptType, CreateDT = upay.CreateDT, CreateUID = upay.CreateUID, Creater = uc.FullName, ReleasedDT = upay.ReleasedDT, ReleasedUID = upay.ReleasedUID, Releaseder = ur.FullName }; totalCount = query.Count(); return(query.ToPageList()); }
/// <summary> /// 获取PayApi支付表里已有支付通道的收单渠道list /// </summary> /// <returns></returns> public List <DropdownItem> GetPayChannels() { var result = new List <DropdownItem>(); var query = from pa in PayApiRepository.GetQuery() join jpc in PayChannelReposit.GetQuery() on pa.ChannelNo equals jpc.ChannelNo into ipc from pc in ipc.DefaultIfEmpty() where pa.State == 1 select new { Text = pc.ChannelCode, Value = pa.ChannelNo }; var data = query.Distinct().ToList(); if (data != null && data.Count > 0) { data.ForEach(o => { result.Add(new DropdownItem() { Text = o.Text, Value = o.Value.ToString() }); }); } return(result); }