回滚main

This commit is contained in:
橙子
2021-11-09 19:51:35 +08:00
parent 08ba7207bb
commit 2d2dd55cc0
20 changed files with 6 additions and 672 deletions

View File

@@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Search;
namespace Yi.Framework.Service
{
public class GoodsService : IGoodsService
{
public PageResult<spu> QuerySpuByPage(int page, int rows, string key, bool? saleable)
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,65 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Core;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Model.Search;
namespace Yi.Framework.Service
{
public class SearchService : ISearchService
{
private IGoodsService _goodsService;
private ElasticSearchInvoker _elasticSearchInvoker ;
public SearchService(IGoodsService goodsService, ElasticSearchInvoker elasticSearchInvoker)
{
_goodsService = goodsService;
_elasticSearchInvoker = elasticSearchInvoker;
}
public void ImpDataBySpu()
{
ImportToEs();
}
private void ImportToEs()
{
int page = 1;
int size;
int rows = 100;
do
{
List<Goods> goodsList = new List<Goods>();
// 上架商品
PageResult<spu> result = _goodsService.QuerySpuByPage(page, rows, null, true);
List<spu> spus = result.rows;
size = spus.Count;
foreach (var spu in spus)
{
try
{
Goods g = BuildGoods(spu);
// 处理好的数据添加到集合中
goodsList.Add(g);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
continue;//部分数据不严格
}
}
// 存入es,先留着,不写
_elasticSearchInvoker.Send(goodsList);
page++;
} while (size == 100);
}
private Goods BuildGoods(spu spu)
{
Goods goods = new Goods();
return goods;
}
}
}

View File

@@ -11,42 +11,6 @@ using Yi.Framework.Model.ModelFactory;
namespace Yi.Framework.Service
{
public partial class BrandService:BaseService<brand>,IBrandService
{
public BrandService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var brandList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
brandList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(brandList);
}
public async Task<IEnumerable<brand>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class CategoryService:BaseService<category>,ICategoryService
{
public CategoryService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var categoryList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
categoryList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(categoryList);
}
public async Task<IEnumerable<category>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class MenuService:BaseService<menu>,IMenuService
{
public MenuService(IDbContextFactory DbFactory):base(DbFactory){ }
@@ -83,24 +47,6 @@ namespace Yi.Framework.Service
}
public partial class OrderService:BaseService<order>,IOrderService
{
public OrderService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var orderList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
orderList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(orderList);
}
public async Task<IEnumerable<order>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class RoleService:BaseService<role>,IRoleService
{
public RoleService(IDbContextFactory DbFactory):base(DbFactory){ }
@@ -119,114 +65,6 @@ namespace Yi.Framework.Service
}
public partial class SkuService:BaseService<sku>,ISkuService
{
public SkuService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var skuList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
skuList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(skuList);
}
public async Task<IEnumerable<sku>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class Spec_groupService:BaseService<spec_group>,ISpec_groupService
{
public Spec_groupService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var spec_groupList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
spec_groupList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(spec_groupList);
}
public async Task<IEnumerable<spec_group>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class Spec_paramService:BaseService<spec_param>,ISpec_paramService
{
public Spec_paramService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var spec_paramList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
spec_paramList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(spec_paramList);
}
public async Task<IEnumerable<spec_param>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class SpuService:BaseService<spu>,ISpuService
{
public SpuService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var spuList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
spuList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(spuList);
}
public async Task<IEnumerable<spu>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class Spu_detailService:BaseService<spu_detail>,ISpu_detailService
{
public Spu_detailService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var spu_detailList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
spu_detailList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(spu_detailList);
}
public async Task<IEnumerable<spu_detail>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class StockService:BaseService<stock>,IStockService
{
public StockService(IDbContextFactory DbFactory):base(DbFactory){ }
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var stockList = await GetEntitiesAsync(u=>_ids.Contains(u.id));
stockList.ToList().ForEach(u => u.is_delete = (short)Common.Enum.DelFlagEnum.Deleted);
return await UpdateListAsync(stockList);
}
public async Task<IEnumerable<stock>> GetAllEntitiesTrueAsync()
{
return await GetEntitiesAsync(u=> u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
}
}
public partial class UserService:BaseService<user>,IUserService
{
public UserService(IDbContextFactory DbFactory):base(DbFactory){ }