Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mall.oytour.com
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
mall.oytour.com
Commits
6f79776f
Commit
6f79776f
authored
May 27, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品导入
parent
6a6ff417
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1203 additions
and
180 deletions
+1203
-180
Mall.Common.csproj
Mall.Common/Mall.Common.csproj
+3
-0
CSVHelper.cs
Mall.Common/Plugin/CSVHelper.cs
+76
-0
GoodsBetchDataHelper.cs
Mall.DataHelper/Import/GoodsBetchDataHelper.cs
+180
-0
RB_Goods.cs
Mall.Model/Entity/Product/RB_Goods.cs
+1
-1
RB_Goods_OrderDetail.cs
Mall.Model/Entity/Product/RB_Goods_OrderDetail.cs
+1
-1
RB_Goods_SpecificationValue.cs
Mall.Model/Entity/Product/RB_Goods_SpecificationValue.cs
+1
-1
RB_Destination_Extend.cs
Mall.Model/Extend/BaseSetUp/RB_Destination_Extend.cs
+5
-0
RB_Goods_Extend.cs
Mall.Model/Extend/Product/RB_Goods_Extend.cs
+12
-0
GoodsImport.cs
Mall.Model/Query/GoodsImport.cs
+130
-0
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+26
-48
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+607
-100
UserModule.cs
Mall.Module.User/UserModule.cs
+4
-23
RB_DestinationRepository.cs
Mall.Repository/BaseSetUp/RB_DestinationRepository.cs
+3
-0
ProductController.cs
Mall.WebApi/Controllers/Product/ProductController.cs
+154
-6
No files found.
Mall.Common/Mall.Common.csproj
View file @
6f79776f
...
...
@@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LumenWorksX.Framework.IO" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.0.1" />
...
...
@@ -12,6 +13,8 @@
<PackageReference Include="NPOI" Version="2.4.1" />
<PackageReference Include="StackExchange.Redis" Version="2.0.601" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.6.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.7.1" />
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
</ItemGroup>
</Project>
Mall.Common/Plugin/CSVHelper.cs
0 → 100644
View file @
6f79776f
using
LumenWorks.Framework.IO.Csv
;
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.IO
;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Threading.Tasks
;
using
System.Text.Encodings
;
namespace
Mall.Common
{
public
class
CSVHelper
{
/// <summary>
/// 获取路径下的.csv文件
/// </summary>
/// <param name="FilePath"></param>
/// <returns></returns>
public
DataTable
GetStream
(
string
FilePath
)
{
FileStream
fileStream
=
new
FileStream
(
FilePath
,
FileMode
.
Open
,
FileAccess
.
Read
,
FileShare
.
Read
);
byte
[]
bytes
=
new
byte
[
fileStream
.
Length
];
fileStream
.
Read
(
bytes
,
0
,
bytes
.
Length
);
fileStream
.
Close
();
Stream
stream
=
new
MemoryStream
(
bytes
);
Encoding
.
RegisterProvider
(
CodePagesEncodingProvider
.
Instance
);
return
GetData
(
stream
,
Encoding
.
GetEncoding
(
"GB2312"
));
}
/// <summary>
/// 将.csv文件转换成DataTable
/// </summary>
/// <param name="stream"></param>
/// <returns></returns>
private
DataTable
GetData
(
Stream
stream
,
Encoding
enc
)
{
using
(
stream
)
{
using
(
StreamReader
input
=
new
StreamReader
(
stream
,
enc
))
{
using
(
CsvReader
csv
=
new
CsvReader
(
input
,
true
))
{
DataTable
dt
=
new
DataTable
();
//第一行字段数量
int
columnCount
=
csv
.
FieldCount
;
//标题数组
string
[]
headers
=
csv
.
GetFieldHeaders
();
//循环添加标题行
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
dt
.
Columns
.
Add
(
headers
[
i
]);
}
//循环添加列数据
while
(
csv
.
ReadNextRecord
())
{
DataRow
dr
=
dt
.
NewRow
();
for
(
int
i
=
0
;
i
<
columnCount
;
i
++)
{
if
(!
string
.
IsNullOrWhiteSpace
(
csv
[
i
]))
{
dr
[
i
]
=
csv
[
i
];
}
}
dt
.
Rows
.
Add
(
dr
);
}
return
dt
;
}
}
}
}
}
}
Mall.DataHelper/Import/GoodsBetchDataHelper.cs
0 → 100644
View file @
6f79776f
using
Mall.Common
;
using
Mall.Model.Extend.Product
;
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Linq
;
namespace
Mall.DataHelper
{
/// <summary>
/// 商品导入
/// </summary>
public
class
GoodsBetchDataHelper
{
/// <summary>
/// 导入模板
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public
static
List
<
RB_Goods_Extend
>
ImportClaimData
(
string
fileName
)
{
List
<
RB_Goods_Extend
>
list
=
new
List
<
RB_Goods_Extend
>();
var
dt
=
new
DataTable
();
if
(
fileName
.
Contains
(
".csv"
))
{
dt
=
new
CSVHelper
().
GetStream
(
fileName
);
}
else
{
dt
=
Mall
.
Common
.
Plugin
.
NPOIHelper
.
ImportExceltoDt
(
fileName
,
0
,
0
,
true
);
}
if
(
dt
!=
null
&&
dt
.
Rows
.
Count
>
0
)
{
foreach
(
DataRow
dr
in
dt
.
Rows
)
{
list
.
Add
(
DataRowToModel
(
dr
));
}
}
return
list
;
}
/// <summary>
/// DataRow转实体
/// </summary>
/// <param name="dr"></param>
/// <returns></returns>
public
static
RB_Goods_Extend
DataRowToModel
(
DataRow
dr
)
{
RB_Goods_Extend
model
=
new
RB_Goods_Extend
();
if
(
dr
!=
null
)
{
if
(
dr
.
Table
.
Columns
.
Contains
(
"商品名称"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"商品名称"
].
ToString
().
Trim
()))
{
model
.
Name
=
dr
[
"商品名称"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"原价"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"原价"
].
ToString
().
Trim
()))
{
model
.
OriginalPrice
=
Convert
.
ToDecimal
(
dr
[
"原价"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"成本价"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"成本价"
].
ToString
().
Trim
()))
{
model
.
CostPrice
=
Convert
.
ToDecimal
(
dr
[
"成本价"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"商品详情"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"商品详情"
].
ToString
().
Trim
()))
{
model
.
GoodsDetails
=
dr
[
"商品详情"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"商品缩略图"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"商品缩略图"
].
ToString
().
Trim
()))
{
model
.
CoverImage
=
dr
[
"商品缩略图"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"商品轮播图"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"商品轮播图"
].
ToString
().
Trim
()))
{
model
.
CarouselImage
=
dr
[
"商品轮播图"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"商品视频"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"商品视频"
].
ToString
().
Trim
()))
{
model
.
VideoAddress
=
dr
[
"商品视频"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"单位"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"单位"
].
ToString
().
Trim
()))
{
model
.
Unit
=
dr
[
"单位"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"售价"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"售价"
].
ToString
().
Trim
()))
{
model
.
SellingPrice
=
Convert
.
ToDecimal
(
dr
[
"售价"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"是否使用规格"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"是否使用规格"
].
ToString
().
Trim
()))
{
model
.
IsCustomSpecification
=
Convert
.
ToInt32
(
dr
[
"是否使用规格"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"规格组"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"规格组"
].
ToString
().
Trim
()))
{
model
.
SpecificationImport
=
dr
[
"规格组"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"商品库存"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"商品库存"
].
ToString
().
Trim
()))
{
model
.
InventoryNum
=
Convert
.
ToInt32
(
dr
[
"商品库存"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"虚拟销量"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"虚拟销量"
].
ToString
().
Trim
()))
{
model
.
SalesNum
=
Convert
.
ToInt32
(
dr
[
"虚拟销量"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"购物数量限制"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"购物数量限制"
].
ToString
().
Trim
()))
{
model
.
LimitBuyGoodsNum
=
Convert
.
ToInt32
(
dr
[
"购物数量限制"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"单品满件包邮"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"单品满件包邮"
].
ToString
().
Trim
()))
{
model
.
FullNumPinkage
=
Convert
.
ToInt32
(
dr
[
"单品满件包邮"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"单品满额包邮"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"单品满额包邮"
].
ToString
().
Trim
()))
{
model
.
FullMoneyPinkage
=
Convert
.
ToDecimal
(
dr
[
"单品满额包邮"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"赠送积分"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"赠送积分"
].
ToString
().
Trim
()))
{
model
.
IntegralPresent
=
Convert
.
ToInt32
(
dr
[
"赠送积分"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"赠送积分类型"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"赠送积分类型"
].
ToString
().
Trim
()))
{
model
.
IntegralPresentType
=
Convert
.
ToInt32
(
dr
[
"赠送积分类型"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"可抵扣积分"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"可抵扣积分"
].
ToString
().
Trim
()))
{
model
.
PointsDeduction
=
Convert
.
ToDecimal
(
dr
[
"可抵扣积分"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"可抵扣积分类型"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"可抵扣积分类型"
].
ToString
().
Trim
()))
{
model
.
PointsDeductionType
=
Convert
.
ToInt32
(
dr
[
"可抵扣积分类型"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"允许多件累计折扣"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"允许多件累计折扣"
].
ToString
().
Trim
()))
{
model
.
IsMultipleDeduction
=
Convert
.
ToInt32
(
dr
[
"允许多件累计折扣"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"自定义分享图片"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"自定义分享图片"
].
ToString
().
Trim
()))
{
model
.
CustomShareImage
=
dr
[
"自定义分享图片"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"自定义分享标题"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"自定义分享标题"
].
ToString
().
Trim
()))
{
model
.
CustomShareTitles
=
dr
[
"自定义分享标题"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"排序"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"排序"
].
ToString
().
Trim
()))
{
model
.
Sort
=
Convert
.
ToInt32
(
dr
[
"排序"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"限购订单"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"限购订单"
].
ToString
().
Trim
()))
{
model
.
LimitBuyOrderNum
=
Convert
.
ToInt32
(
dr
[
"限购订单"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"是否单独区域购买"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"是否单独区域购买"
].
ToString
().
Trim
()))
{
model
.
IsAreaBuy
=
Convert
.
ToInt32
(
dr
[
"是否单独区域购买"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"区域限购详情"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"区域限购详情"
].
ToString
().
Trim
()))
{
model
.
AreaImport
=
dr
[
"区域限购详情"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"规格详情"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"规格详情"
].
ToString
().
Trim
()))
{
model
.
SpecificationPriceImport
=
dr
[
"规格详情"
].
ToString
();
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"是否快速购买"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"是否快速购买"
].
ToString
().
Trim
()))
{
model
.
IsQuickBuy
=
Convert
.
ToInt32
(
dr
[
"是否快速购买"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"是否热销"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"是否热销"
].
ToString
().
Trim
()))
{
model
.
IsSellWell
=
Convert
.
ToInt32
(
dr
[
"是否热销"
].
ToString
());
}
if
(
dr
.
Table
.
Columns
.
Contains
(
"是否面议"
)
&&
!
string
.
IsNullOrEmpty
(
dr
[
"是否面议"
].
ToString
().
Trim
()))
{
model
.
IsGoodsNegotiable
=
Convert
.
ToInt32
(
dr
[
"是否面议"
].
ToString
());
}
}
return
model
;
}
}
}
\ No newline at end of file
Mall.Model/Entity/Product/RB_Goods.cs
View file @
6f79776f
...
...
@@ -58,7 +58,7 @@ namespace Mall.Model.Entity.Product
/// <summary>
/// 自定义分享图片
/// </summary>
public
int
?
CustomShareImage
public
string
CustomShareImage
{
get
;
set
;
...
...
Mall.Model/Entity/Product/RB_Goods_OrderDetail.cs
View file @
6f79776f
...
...
@@ -58,7 +58,7 @@ namespace Mall.Model.Entity.Product
/// <summary>
/// 封面图
/// </summary>
public
int
?
CoverImage
public
string
CoverImage
{
get
;
set
;
...
...
Mall.Model/Entity/Product/RB_Goods_SpecificationValue.cs
View file @
6f79776f
...
...
@@ -49,7 +49,7 @@ namespace Mall.Model.Entity.Product
/// <summary>
/// 规格图片
/// </summary>
public
int
?
Image
public
string
Image
{
get
;
set
;
...
...
Mall.Model/Extend/BaseSetUp/RB_Destination_Extend.cs
View file @
6f79776f
...
...
@@ -75,5 +75,10 @@ namespace Mall.Model.Extend.BaseSetUp
/// ID查询字符串
/// </summary>
public
string
QIds
{
get
;
set
;
}
/// <summary>
/// 批量name查询
/// </summary>
public
string
NameStr
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Goods_Extend.cs
View file @
6f79776f
...
...
@@ -96,10 +96,18 @@ namespace Mall.Model.Extend.Product
/// </summary>
public
List
<
RB_Goods_Area_Extend
>
AreaList
{
get
;
set
;
}
/// <summary>
/// 区域购买导入
/// </summary>
public
string
AreaImport
{
get
;
set
;
}
/// <summary>
/// 规格名列表
/// </summary>
public
List
<
RB_Goods_Specification_Extend
>
SpecificationList
{
get
;
set
;
}
/// <summary>
/// 规格组导入
/// </summary>
public
string
SpecificationImport
{
get
;
set
;
}
/// <summary>
/// 规格值名称列表
/// </summary>
public
List
<
string
>
SpecificationNameList
{
get
;
set
;
}
...
...
@@ -108,6 +116,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public
List
<
RB_Goods_SpecificationPrice_Extend
>
SpecificationPriceList
{
get
;
set
;
}
/// <summary>
/// 规格价格详情导入
/// </summary>
public
string
SpecificationPriceImport
{
get
;
set
;
}
/// <summary>
/// 分销佣金列表
/// </summary>
public
List
<
RB_Goods_DistributionCommission_Extend
>
DistributionCommissionList
{
get
;
set
;
}
...
...
Mall.Model/Query/GoodsImport.cs
0 → 100644
View file @
6f79776f
using
Mall.Common.AOP
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Query
{
/// <summary>
/// 赞羊商品轮播
/// </summary>
[
Serializable
]
public
class
GoodsCarouselImport
{
/// <summary>
/// id
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
/// 图片地址
/// </summary>
public
string
pic_url
{
get
;
set
;
}
}
/// <summary>
/// 赞羊规格
/// </summary>
[
Serializable
]
public
class
GoodsSpecificationImport
{
/// <summary>
/// attr_group_id
/// </summary>
public
int
attr_group_id
{
get
;
set
;
}
/// <summary>
/// 规格名称
/// </summary>
public
string
attr_group_name
{
get
;
set
;
}
/// <summary>
/// 子集
/// </summary>
public
List
<
GoodsSpecificationValueImport
>
attr_list
{
get
;
set
;
}
}
/// <summary>
/// 赞羊规格值
/// </summary>
[
Serializable
]
public
class
GoodsSpecificationValueImport
{
/// <summary>
/// attr_id
/// </summary>
public
int
attr_id
{
get
;
set
;
}
/// <summary>
/// 图片地址
/// </summary>
public
string
attr_name
{
get
;
set
;
}
/// <summary>
/// 图片地址
/// </summary>
public
string
pic_url
{
get
;
set
;
}
}
/// <summary>
/// 赞羊规格价格
/// </summary>
[
Serializable
]
public
class
GoodsSpecificationPriceImport
{
/// <summary>
/// id
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
/// 商品id
/// </summary>
public
int
goods_id
{
get
;
set
;
}
/// <summary>
/// key
/// </summary>
public
string
sign_id
{
get
;
set
;
}
/// <summary>
/// 库存
/// </summary>
public
int
stock
{
get
;
set
;
}
/// <summary>
/// 价格
/// </summary>
public
decimal
price
{
get
;
set
;
}
/// <summary>
/// 货号
/// </summary>
public
string
no
{
get
;
set
;
}
/// <summary>
/// 重量
/// </summary>
public
int
weight
{
get
;
set
;
}
/// <summary>
/// 图片地址
/// </summary>
public
string
pic_url
{
get
;
set
;
}
}
/// <summary>
/// 赞羊区域导入
/// </summary>
[
Serializable
]
public
class
GoodsAreaListImport
{
/// <summary>
/// 列表
/// </summary>
public
List
<
GoodsAreaImport
>
list
{
get
;
set
;
}
}
/// <summary>
/// 赞羊区域详情
/// </summary>
[
Serializable
]
public
class
GoodsAreaImport
{
/// <summary>
/// id
/// </summary>
public
int
id
{
get
;
set
;
}
/// <summary>
/// 名称
/// </summary>
public
string
name
{
get
;
set
;
}
}
}
Mall.Module.Product/OrderModule.cs
View file @
6f79776f
This diff is collapsed.
Click to expand it.
Mall.Module.Product/ProductModule.cs
View file @
6f79776f
This diff is collapsed.
Click to expand it.
Mall.Module.User/UserModule.cs
View file @
6f79776f
...
...
@@ -1924,9 +1924,9 @@ namespace Mall.Module.User
item
.
CoverImage
=
""
;
if
(!
string
.
IsNullOrEmpty
(
item
.
CarouselImage
)
&&
item
.
CarouselImage
!=
"[]"
)
{
List
<
int
>
CarouselIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
item
.
CarouselImage
);
List
<
string
>
CarouselIdList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
item
.
CarouselImage
);
//封面图
item
.
CoverImage
=
material_InfoRepository
.
GetEntity
(
CarouselIdList
[
0
])?.
Path
??
""
;
item
.
CoverImage
=
CarouselIdList
[
0
]
;
}
}
}
...
...
@@ -2527,25 +2527,6 @@ namespace Mall.Module.User
//查询商品信息
string
goodsIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
GoodsId
).
Distinct
());
var
goodsList
=
goodsRepository
.
GetList
(
new
RB_Goods_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
//查询图片
List
<
RB_Material_Info_Extend
>
Mlist
=
new
List
<
RB_Material_Info_Extend
>();
if
(
goodsList
.
Any
())
{
List
<
int
>
imgIds
=
new
List
<
int
>();
foreach
(
var
item
in
goodsList
)
{
if
(!
string
.
IsNullOrEmpty
(
item
.
CarouselImage
)
&&
item
.
CarouselImage
!=
"[]"
)
{
List
<
int
>
CarouselIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
item
.
CarouselImage
);
//封面图
imgIds
.
Add
(
CarouselIdList
[
0
]);
}
}
if
(
imgIds
.
Any
())
{
Mlist
=
material_InfoRepository
.
GetList
(
new
RB_Material_Info_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
MaterialIds
=
string
.
Join
(
","
,
imgIds
.
Distinct
())
});
}
}
foreach
(
var
item
in
list
)
{
...
...
@@ -2557,9 +2538,9 @@ namespace Mall.Module.User
{
if
(!
string
.
IsNullOrEmpty
(
goodsModel
.
CarouselImage
)
&&
goodsModel
.
CarouselImage
!=
"[]"
)
{
List
<
int
>
CarouselIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
goodsModel
.
CarouselImage
);
List
<
string
>
CarouselIdList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
goodsModel
.
CarouselImage
);
//封面图
item
.
GoodsImgPath
=
Mlist
.
Where
(
x
=>
x
.
Id
==
CarouselIdList
[
0
]).
FirstOrDefault
()?.
Path
??
""
;
item
.
GoodsImgPath
=
CarouselIdList
[
0
]
;
}
}
}
...
...
Mall.Repository/BaseSetUp/RB_DestinationRepository.cs
View file @
6f79776f
...
...
@@ -100,6 +100,9 @@ namespace Mall.Repository.BaseSetUp
{
sb
.
AppendFormat
(
" AND {0} LIKE '%{1}%' "
,
nameof
(
RB_Destination_Extend
.
Name
),
where
.
Name
.
Trim
());
}
if
(!
string
.
IsNullOrEmpty
(
where
.
NameStr
))
{
sb
.
AppendFormat
(
" AND {0} in({1})"
,
nameof
(
RB_Destination_Extend
.
Name
),
where
.
NameStr
);
}
}
return
Get
<
RB_Destination_Extend
>(
sb
.
ToString
()).
ToList
();
...
...
Mall.WebApi/Controllers/Product/ProductController.cs
View file @
6f79776f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment