回滚main
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -338,4 +338,6 @@ ASALocalRun/
|
|||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
# BeatPulse healthcheck temp database
|
||||||
healthchecksdb
|
healthchecksdb
|
||||||
|
|
||||||
|
appsettings.json
|
||||||
*.json
|
*.json
|
||||||
|
|||||||
@@ -27,15 +27,14 @@ namespace Yi.Framework.ElasticSearchProcessor
|
|||||||
private readonly ElasticSearchInvoker _elasticSearchInvoker;
|
private readonly ElasticSearchInvoker _elasticSearchInvoker;
|
||||||
private readonly IOptionsMonitor<ElasticSearchOptions> _ElasticSearchOptions = null;
|
private readonly IOptionsMonitor<ElasticSearchOptions> _ElasticSearchOptions = null;
|
||||||
|
|
||||||
private readonly ISearchService _searchService;
|
|
||||||
public WarmupESIndexWorker(ILogger<WarmupESIndexWorker> logger, RabbitMQInvoker rabbitMQInvoker, IConfiguration configuration, ElasticSearchInvoker elasticSearchInvoker, IOptionsMonitor<ElasticSearchOptions> optionsMonitor, ISearchService searchService)
|
public WarmupESIndexWorker(ILogger<WarmupESIndexWorker> logger, RabbitMQInvoker rabbitMQInvoker, IConfiguration configuration, ElasticSearchInvoker elasticSearchInvoker, IOptionsMonitor<ElasticSearchOptions> optionsMonitor)
|
||||||
{
|
{
|
||||||
this._logger = logger;
|
this._logger = logger;
|
||||||
this._RabbitMQInvoker = rabbitMQInvoker;
|
this._RabbitMQInvoker = rabbitMQInvoker;
|
||||||
this._configuration = configuration;
|
this._configuration = configuration;
|
||||||
this._elasticSearchInvoker = elasticSearchInvoker;
|
this._elasticSearchInvoker = elasticSearchInvoker;
|
||||||
this._ElasticSearchOptions = optionsMonitor;
|
this._ElasticSearchOptions = optionsMonitor;
|
||||||
this._searchService=searchService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
@@ -48,14 +47,14 @@ namespace Yi.Framework.ElasticSearchProcessor
|
|||||||
HttpClient _HttpClient = new HttpClient();
|
HttpClient _HttpClient = new HttpClient();
|
||||||
this._RabbitMQInvoker.RegistReciveAction(rabbitMQConsumerModel, message =>
|
this._RabbitMQInvoker.RegistReciveAction(rabbitMQConsumerModel, message =>
|
||||||
{
|
{
|
||||||
SKUWarmupQueueModel skuWarmupQueueModel = JsonConvert.DeserializeObject<SKUWarmupQueueModel>(message);
|
//SKUWarmupQueueModel skuWarmupQueueModel = JsonConvert.DeserializeObject<SKUWarmupQueueModel>(message);
|
||||||
//<2F><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ģ<EFBFBD>͡<EFBFBD>
|
//<2F><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ģ<EFBFBD>͡<EFBFBD>
|
||||||
#region <EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>Index---<EFBFBD>½<EFBFBD>Index---<EFBFBD>ٽ<EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
#region <EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>Index---<EFBFBD>½<EFBFBD>Index---<EFBFBD>ٽ<EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this._elasticSearchInvoker.DropIndex(this._ElasticSearchOptions.CurrentValue.IndexName);
|
this._elasticSearchInvoker.DropIndex(this._ElasticSearchOptions.CurrentValue.IndexName);
|
||||||
this._searchService.ImpDataBySpu();
|
//this._searchService.ImpDataBySpu();
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>es<65><73><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>es<65><73><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
this._logger.LogInformation($"{nameof(WarmupESIndexWorker)}.InitAll succeed");
|
this._logger.LogInformation($"{nameof(WarmupESIndexWorker)}.InitAll succeed");
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Yi.Framework.Model.Models;
|
|
||||||
using Yi.Framework.Model.Search;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Interface
|
|
||||||
{
|
|
||||||
public interface IGoodsService
|
|
||||||
{
|
|
||||||
PageResult<spu> QuerySpuByPage(int page, int rows, string key, bool? saleable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Interface
|
|
||||||
{
|
|
||||||
public interface ISearchService
|
|
||||||
{
|
|
||||||
void ImpDataBySpu();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,18 +8,6 @@ using Yi.Framework.Model.Models;
|
|||||||
namespace Yi.Framework.Interface
|
namespace Yi.Framework.Interface
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial interface IBrandService:IBaseService<brand>
|
|
||||||
{
|
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
|
||||||
Task<IEnumerable<brand>> GetAllEntitiesTrueAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial interface ICategoryService:IBaseService<category>
|
|
||||||
{
|
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
|
||||||
Task<IEnumerable<category>> GetAllEntitiesTrueAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial interface IMenuService:IBaseService<menu>
|
public partial interface IMenuService:IBaseService<menu>
|
||||||
{
|
{
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
||||||
@@ -32,54 +20,12 @@ namespace Yi.Framework.Interface
|
|||||||
Task<IEnumerable<mould>> GetAllEntitiesTrueAsync();
|
Task<IEnumerable<mould>> GetAllEntitiesTrueAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial interface IOrderService:IBaseService<order>
|
|
||||||
{
|
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
|
||||||
Task<IEnumerable<order>> GetAllEntitiesTrueAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial interface IRoleService:IBaseService<role>
|
public partial interface IRoleService:IBaseService<role>
|
||||||
{
|
{
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
||||||
Task<IEnumerable<role>> GetAllEntitiesTrueAsync();
|
Task<IEnumerable<role>> GetAllEntitiesTrueAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial interface ISkuService:IBaseService<sku>
|
|
||||||
{
|
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
|
||||||
Task<IEnumerable<sku>> GetAllEntitiesTrueAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial interface ISpec_groupService:IBaseService<spec_group>
|
|
||||||
{
|
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
|
||||||
Task<IEnumerable<spec_group>> GetAllEntitiesTrueAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial interface ISpec_paramService:IBaseService<spec_param>
|
|
||||||
{
|
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
|
||||||
Task<IEnumerable<spec_param>> GetAllEntitiesTrueAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial interface ISpuService:IBaseService<spu>
|
|
||||||
{
|
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
|
||||||
Task<IEnumerable<spu>> GetAllEntitiesTrueAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial interface ISpu_detailService:IBaseService<spu_detail>
|
|
||||||
{
|
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
|
||||||
Task<IEnumerable<spu_detail>> GetAllEntitiesTrueAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial interface IStockService:IBaseService<stock>
|
|
||||||
{
|
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
|
||||||
Task<IEnumerable<stock>> GetAllEntitiesTrueAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
public partial interface IUserService:IBaseService<user>
|
public partial interface IUserService:IBaseService<user>
|
||||||
{
|
{
|
||||||
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
Task<bool> DelListByUpdateAsync(List<int> _ids);
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
public class brand:baseModel<int>
|
|
||||||
{
|
|
||||||
[Comment("品牌名称")]
|
|
||||||
public string name { get; set; }
|
|
||||||
[Comment("品牌图片")]
|
|
||||||
public string image { get; set; }
|
|
||||||
[Comment("品牌首字母")]
|
|
||||||
public string letter { get; set; }
|
|
||||||
[Comment("类别")]
|
|
||||||
public List<category > categories { get; set; }
|
|
||||||
[Comment("spu")]
|
|
||||||
public List<spu> spus { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
public class category:baseModel<int>
|
|
||||||
{
|
|
||||||
[Comment("类别名称")]
|
|
||||||
public string name { get; set; }
|
|
||||||
[Comment("排序")]
|
|
||||||
public int sort { get; set; }
|
|
||||||
[Comment("是否父类别")]
|
|
||||||
public int is_parent { get; set; }
|
|
||||||
[Comment("子类别")]
|
|
||||||
public List<category> chidrens { get; set; }
|
|
||||||
[Comment("品牌")]
|
|
||||||
public List<brand> brands { get; set; }
|
|
||||||
[Comment("spu")]
|
|
||||||
public List<spu> spus { get; set; }
|
|
||||||
[Comment("规格组")]
|
|
||||||
public List<spec_group> spec_Groups { get; set; }
|
|
||||||
[Comment("规格")]
|
|
||||||
public List<spec_param> spec_Params { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
public class order : baseModel<int>
|
|
||||||
{
|
|
||||||
[Comment("总金额,单位为分")]
|
|
||||||
public int total_pay { get; set; }
|
|
||||||
[Comment("实付金额。单位:分。如:20007,表示:200元7分")]
|
|
||||||
public int actual_pay { get; set; }
|
|
||||||
[Comment("支付类型,1、在线支付,2、货到付款")]
|
|
||||||
public int payment_type { get; set; }
|
|
||||||
[Comment("邮费。单位:分。如:20007,表示:200元7分")]
|
|
||||||
public int post_fee { get; set; }
|
|
||||||
[Comment("promotion_ids")]
|
|
||||||
public string promotion_ids { get; set; }
|
|
||||||
[Comment("订单创建时间")]
|
|
||||||
public DateTime creat_time { get; set; }
|
|
||||||
[Comment("物流名称")]
|
|
||||||
public string shipping_name { get; set; }
|
|
||||||
[Comment("物流单号")]
|
|
||||||
public string shipping_code { get; set; }
|
|
||||||
[Comment("买家留言")]
|
|
||||||
public string buyer_message { get; set; }
|
|
||||||
[Comment("买家昵称")]
|
|
||||||
public string buyer_nick { get; set; }
|
|
||||||
[Comment("买家是否已经评价,0未评价,1已评价")]
|
|
||||||
public int buyer_rate { get; set; }
|
|
||||||
[Comment("收获地址(省)")]
|
|
||||||
public string receiver_state { get; set; }
|
|
||||||
[Comment("收获地址(市)")]
|
|
||||||
public string receiver_city { get; set; }
|
|
||||||
[Comment("收获地址(区/县)")]
|
|
||||||
public string receiver_district { get; set; }
|
|
||||||
[Comment("收获地址(街道、住址等详细地址)")]
|
|
||||||
public string receiver_address { get; set; }
|
|
||||||
[Comment("收货人手机")]
|
|
||||||
public string receiver_mobile { get; set; }
|
|
||||||
[Comment("收货人邮编")]
|
|
||||||
public string receiver_zip { get; set; }
|
|
||||||
[Comment("收货人")]
|
|
||||||
public string receiver { get; set; }
|
|
||||||
[Comment("发票类型:0无发票1普通发票,2电子发票,3增值税发票")]
|
|
||||||
public int invoice_type { get; set; }
|
|
||||||
[Comment("订单来源:1:app端,2:pc端,3:M端,4:微信端,5:手机qq端")]
|
|
||||||
public int source_type { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
public class sku : baseModel<int>
|
|
||||||
{
|
|
||||||
[Comment("商品标题")]
|
|
||||||
public string title { get; set; }
|
|
||||||
[Comment("商品的图片,多个图片以‘,’分割")]
|
|
||||||
public string images { get; set; }
|
|
||||||
[Comment("销售价格,单位为分")]
|
|
||||||
public int price { get; set; }
|
|
||||||
[Comment("特有规格属性在spu属性模板中的对应下标组合")]
|
|
||||||
public string indexes { get; set; }
|
|
||||||
[Comment("是否有效,0无效,1有效")]
|
|
||||||
public int enable { get; set; }
|
|
||||||
[Comment("sku的特有规格参数键值对,json格式,反序列化时请使用linkedHashMap,保证有序")]
|
|
||||||
public string own_spec { get; set; }
|
|
||||||
[Comment("创建时间")]
|
|
||||||
public DateTime crate_time { get; set; }
|
|
||||||
[Comment("最后更新时间")]
|
|
||||||
public DateTime last_update_time { get; set; }
|
|
||||||
[Comment("spu")]
|
|
||||||
public spu spu { get; set; }
|
|
||||||
[Comment("订单")]
|
|
||||||
public List<order> orders { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
public class spec_group : baseModel<int>
|
|
||||||
{
|
|
||||||
[Comment("规格组名称")]
|
|
||||||
public string name { get; set; }
|
|
||||||
[Comment("类别")]
|
|
||||||
public category category { get; set; }
|
|
||||||
[Comment("规格")]
|
|
||||||
public List<spec_param> spec_Params { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
public class spec_param:baseModel<int>
|
|
||||||
{
|
|
||||||
[Comment("参数名")]
|
|
||||||
public string name { get; set; }
|
|
||||||
[Comment("是否是数字类型参数,true或false")]
|
|
||||||
public int numeric { get; set; }
|
|
||||||
[Comment("数字类型参数的单位,非数字类型可以为空")]
|
|
||||||
public string unit { get; set; }
|
|
||||||
[Comment("是否是sku通用属性,true或false")]
|
|
||||||
public int generic { get; set; }
|
|
||||||
[Comment("是否用于搜索过滤,true或false")]
|
|
||||||
public int searching { get; set; }
|
|
||||||
[Comment("数值类型参数,如果需要搜索,则添加分段间隔值,如CPU频率间隔:0.5-1.0")]
|
|
||||||
public string segments { get; set; }
|
|
||||||
[Comment("规格组")]
|
|
||||||
public spec_group spec_Group { get; set; }
|
|
||||||
[Comment("类别")]
|
|
||||||
public category category { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
public class spu : baseModel<int>
|
|
||||||
{
|
|
||||||
[Comment("标题")]
|
|
||||||
public string title { get; set; }
|
|
||||||
[Comment("子标题")]
|
|
||||||
public string sub_title { get; set; }
|
|
||||||
[Comment("是否上架")]
|
|
||||||
public int saleable { get; set; }
|
|
||||||
[Comment("是否有效")]
|
|
||||||
public int valid { get; set; }
|
|
||||||
[Comment("创建时间")]
|
|
||||||
public DateTime crate_time { get; set; }
|
|
||||||
[Comment("最后更新时间")]
|
|
||||||
public DateTime last_update_time { get; set; }
|
|
||||||
[Comment("类别")]
|
|
||||||
public List<category> categories { get; set; }
|
|
||||||
[Comment("品牌")]
|
|
||||||
public brand brand { get; set; }
|
|
||||||
[Comment("spu详情")]
|
|
||||||
public spu_detail spu_Detail { get; set; }
|
|
||||||
[Comment("skus")]
|
|
||||||
public List<sku> skus { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
public class spu_detail : baseModel<int>
|
|
||||||
{
|
|
||||||
[Comment("描述")]
|
|
||||||
public string description { get; set; }
|
|
||||||
[Comment("通用规格参数数据")]
|
|
||||||
public string generic_spec { get; set; }
|
|
||||||
[Comment("特有规格参数及可选值信息,json格式")]
|
|
||||||
public string special_spec { get; set; }
|
|
||||||
[Comment("包装清单")]
|
|
||||||
public string packing_list { get; set; }
|
|
||||||
[Comment("售后服务")]
|
|
||||||
public string after_service { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Models
|
|
||||||
{
|
|
||||||
public class stock:baseModel<int>
|
|
||||||
{
|
|
||||||
[Comment("可秒杀库存")]
|
|
||||||
public int seckill_stock { get; set; }
|
|
||||||
[Comment("秒杀总数量")]
|
|
||||||
public int seckill_total { get; set; }
|
|
||||||
[Comment("库存数量")]
|
|
||||||
public int stock_count { get; set; }
|
|
||||||
[Comment("sku")]
|
|
||||||
public sku sku { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
using Nest;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Yi.Framework.Model.Models;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Search
|
|
||||||
{
|
|
||||||
[ElasticsearchType(IdProperty = "id")]//主键声明,且主键必须是属性
|
|
||||||
public class Goods
|
|
||||||
{
|
|
||||||
public long id { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public spu spu { get; set; }
|
|
||||||
public string all; //所有需要被搜索的信息,包括品牌,分类,标题
|
|
||||||
public string subtitle; //子标题
|
|
||||||
public brand brand;
|
|
||||||
public category cid1;
|
|
||||||
public category cid2;
|
|
||||||
public category cid3;
|
|
||||||
public DateTime? createTime;
|
|
||||||
|
|
||||||
|
|
||||||
public HashSet<double> price = new HashSet<double>(); //是所有sku的价格集合。方便根据价格进行筛选过滤
|
|
||||||
public List<sku> skus; //sku信息的json结构数据
|
|
||||||
public Dictionary<string, object> specs = new Dictionary<string, object>(); //可搜索的规格参数,key是参数名,值是参数值
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Yi.Framework.Model.Models;
|
|
||||||
|
|
||||||
namespace Yi.Framework.Model.Search
|
|
||||||
{
|
|
||||||
public class SearchResult<Goods> : PageResult<Goods>
|
|
||||||
{
|
|
||||||
public List<brand> brands = new List<brand>();
|
|
||||||
public List<category> categories = new List<category>();
|
|
||||||
//规格参数过滤条件
|
|
||||||
public List<Dictionary<string, object>> specs = new List<Dictionary<string, object>>();
|
|
||||||
public SearchResult(long total,
|
|
||||||
int totalPage,
|
|
||||||
List<Goods> items,
|
|
||||||
List<category> categories,
|
|
||||||
List<brand> brands,
|
|
||||||
List<Dictionary<string, object>> specs) : base
|
|
||||||
(total, items)
|
|
||||||
{
|
|
||||||
|
|
||||||
this.categories = categories;
|
|
||||||
this.brands = brands;
|
|
||||||
this.specs = specs;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,18 +8,9 @@ namespace Yi.Framework.Model
|
|||||||
{
|
{
|
||||||
public partial class DataContext :DbContext
|
public partial class DataContext :DbContext
|
||||||
{
|
{
|
||||||
public DbSet<brand> brand { get; set; }
|
|
||||||
public DbSet<category> category { get; set; }
|
|
||||||
public DbSet<menu> menu { get; set; }
|
public DbSet<menu> menu { get; set; }
|
||||||
public DbSet<mould> mould { get; set; }
|
public DbSet<mould> mould { get; set; }
|
||||||
public DbSet<order> order { get; set; }
|
|
||||||
public DbSet<role> role { get; set; }
|
public DbSet<role> role { get; set; }
|
||||||
public DbSet<sku> sku { get; set; }
|
|
||||||
public DbSet<spec_group> spec_group { get; set; }
|
|
||||||
public DbSet<spec_param> spec_param { get; set; }
|
|
||||||
public DbSet<spu> spu { get; set; }
|
|
||||||
public DbSet<spu_detail> spu_detail { get; set; }
|
|
||||||
public DbSet<stock> stock { get; set; }
|
|
||||||
public DbSet<user> user { get; set; }
|
public DbSet<user> user { get; set; }
|
||||||
public DbSet<visit> visit { get; set; }
|
public DbSet<visit> visit { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,42 +11,6 @@ using Yi.Framework.Model.ModelFactory;
|
|||||||
namespace Yi.Framework.Service
|
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 partial class MenuService:BaseService<menu>,IMenuService
|
||||||
{
|
{
|
||||||
public MenuService(IDbContextFactory DbFactory):base(DbFactory){ }
|
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 partial class RoleService:BaseService<role>,IRoleService
|
||||||
{
|
{
|
||||||
public RoleService(IDbContextFactory DbFactory):base(DbFactory){ }
|
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 partial class UserService:BaseService<user>,IUserService
|
||||||
{
|
{
|
||||||
public UserService(IDbContextFactory DbFactory):base(DbFactory){ }
|
public UserService(IDbContextFactory DbFactory):base(DbFactory){ }
|
||||||
|
|||||||
Reference in New Issue
Block a user