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
7cab95d8
Commit
7cab95d8
authored
Jul 27, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增字段
parent
98ba09cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
377 additions
and
336 deletions
+377
-336
RB_Miniprogram_Template_Extend.cs
.../Extend/MarketingCenter/RB_Miniprogram_Template_Extend.cs
+12
-1
MiniprogramTemplateModule.cs
Mall.Module.MarketingCenter/MiniprogramTemplateModule.cs
+3
-1
MallHelper.cs
Mall.WebApi/Controllers/Mall/MallHelper.cs
+362
-334
No files found.
Mall.Model/Extend/MarketingCenter/RB_Miniprogram_Template_Extend.cs
View file @
7cab95d8
...
@@ -254,7 +254,7 @@ namespace Mall.Model.Extend.MarketingCenter
...
@@ -254,7 +254,7 @@ namespace Mall.Model.Extend.MarketingCenter
public
bool
scroll
{
get
;
set
;
}
public
bool
scroll
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 导航类型(1-导航模式,
2
-Tab模式)
/// 导航类型(1-导航模式,
0
-Tab模式)
/// </summary>
/// </summary>
public
int
navType
{
get
;
set
;
}
public
int
navType
{
get
;
set
;
}
...
@@ -309,6 +309,17 @@ namespace Mall.Model.Extend.MarketingCenter
...
@@ -309,6 +309,17 @@ namespace Mall.Model.Extend.MarketingCenter
/// </summary>
/// </summary>
public
string
icon
{
get
;
set
;
}
public
string
icon
{
get
;
set
;
}
/// <summary>
/// 选中导航图标
/// </summary>
public
string
checkIcon
{
get
;
set
;
}
/// <summary>
/// 选中背景图
/// </summary>
public
string
checkBgImg
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 导航名称
/// 导航名称
/// </summary>
/// </summary>
...
...
Mall.Module.MarketingCenter/MiniprogramTemplateModule.cs
View file @
7cab95d8
...
@@ -934,7 +934,9 @@ namespace Mall.Module.MarketingCenter
...
@@ -934,7 +934,9 @@ namespace Mall.Module.MarketingCenter
//相亲ppplus (招募贴)插件
//相亲ppplus (招募贴)插件
case
"blindDatePPPlus"
:
item
.
data
=
JsonHelper
.
DeserializeObject
<
blindDatePPPlusItem
>(
item
.
data
.
ToString
());
break
;
case
"blindDatePPPlus"
:
item
.
data
=
JsonHelper
.
DeserializeObject
<
blindDatePPPlusItem
>(
item
.
data
.
ToString
());
break
;
//导航-页面
//导航-页面
case
"nav-page"
:
item
.
data
=
JsonHelper
.
DeserializeObject
<
navPageItem
>(
item
.
data
.
ToString
());
break
;
case
"nav-page"
:
item
.
data
=
JsonHelper
.
DeserializeObject
<
navPageItem
>(
item
.
data
.
ToString
());
break
;
//首店-自定义列表
//首店-自定义列表
case
"tradePavilionCustom"
:
case
"tradePavilionCustom"
:
...
...
Mall.WebApi/Controllers/Mall/MallHelper.cs
View file @
7cab95d8
...
@@ -174,9 +174,23 @@ namespace Mall.WebApi.Controllers
...
@@ -174,9 +174,23 @@ namespace Mall.WebApi.Controllers
var
tempModel
=
tempList
?.
Where
(
qitem
=>
qitem
.
Id
==
item
.
TemplateId
)?.
FirstOrDefault
();
var
tempModel
=
tempList
?.
Where
(
qitem
=>
qitem
.
Id
==
item
.
TemplateId
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
&&
tempModel
.
Id
>
0
)
if
(
tempModel
!=
null
&&
tempModel
.
Id
>
0
)
{
{
item
.
TemplateData
=
tempModel
.
ComponentDataList
;
var
tempDataList
=
tempModel
.
ComponentDataList
;
if
(
tempDataList
!=
null
&&
tempDataList
.
Count
>
0
)
{
foreach
(
var
sItem
in
tempDataList
)
{
if
(
sItem
.
Id
==
"goods"
)
{
var
sItemGoodsData
=
sItem
.
data
as
goodsItem
;
GetGoodData
(
sItemGoodsData
,
TenantId
,
MallBaseId
,
IsOpenSchool
,
SmallShopsId
);
sItem
.
data
=
sItemGoodsData
;
}
}
}
item
.
TemplateData
=
tempDataList
;
}
}
}
}
}
}
}
}
}
}
...
@@ -243,339 +257,7 @@ namespace Mall.WebApi.Controllers
...
@@ -243,339 +257,7 @@ namespace Mall.WebApi.Controllers
//商品插件
//商品插件
case
"goods"
:
case
"goods"
:
var
goodsData
=
subItem
.
data
as
goodsItem
;
var
goodsData
=
subItem
.
data
as
goodsItem
;
if
(
goodsData
!=
null
)
GetGoodData
(
goodsData
,
TenantId
,
MallBaseId
,
IsOpenSchool
,
SmallShopsId
);
{
//显示商品分类
if
(
goodsData
.
showCat
)
{
if
(
goodsData
.
catList
!=
null
&&
goodsData
.
catList
.
Count
>
0
)
{
foreach
(
var
childItem
in
goodsData
.
catList
)
{
//自定义商品
if
(
childItem
.
staticGoods
)
{
if
(
childItem
.
goodsList
!=
null
&&
childItem
.
goodsList
.
Count
>
0
)
{
var
Ids
=
"0,"
+
string
.
Join
(
","
,
childItem
.
goodsList
.
Select
(
qitem
=>
qitem
.
id
));
var
tempGoodsList
=
productModule
.
GetProductGoodsList
(
new
Model
.
Extend
.
Product
.
RB_Goods_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
GoodsIds
=
Ids
,
GoodsStatus
=
1
,
CreateBy
=
-
1
,
GoodsClassify
=
1
,
//查询非司导
GoodsPageType
=
IsOpenSchool
==
1
?
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
School
:
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
Mall
},
SmallShopsId
:
SmallShopsId
);
List
<
GoodsDetailsItem2
>
newGoodsList
=
new
List
<
GoodsDetailsItem2
>();
foreach
(
var
goodItem
in
childItem
.
goodsList
)
{
var
lastItem
=
new
GoodsDetailsItem2
();
var
tempGood
=
tempGoodsList
?.
Where
(
qitem
=>
qitem
.
Id
==
goodItem
.
id
)?.
FirstOrDefault
();
if
(
tempGood
!=
null
&&
tempGood
.
Id
>
0
)
{
lastItem
.
id
=
tempGood
.
Id
;
lastItem
.
name
=
tempGood
.
Name
;
lastItem
.
price
=
Math
.
Round
((
tempGood
?.
SellingPrice
??
0
),
2
);
lastItem
.
picUrl
=
tempGood
?.
CoverImage
!=
null
?
Common
.
Config
.
GetFileUrl
(
tempGood
.
CoverImage
)
:
""
;
lastItem
.
OriginalPrice
=
Math
.
Round
((
tempGood
?.
OriginalPrice
??
0
),
2
);
lastItem
.
courseScore
=
(
tempGood
.
CourseScore
??
0
);
newGoodsList
.
Add
(
lastItem
);
}
}
childItem
.
goodsList
=
newGoodsList
;
}
}
//自动添加商品
else
{
childItem
.
goodsList
=
new
List
<
GoodsDetailsItem2
>();
var
catGoodsList
=
productModule
.
GetProductGoodsPageList_V2
(
1
,
childItem
.
goodsNum
,
out
long
rowsCount
,
new
Model
.
Extend
.
Product
.
RB_Goods_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
CategoryIds
=
childItem
.
id
.
ToString
(),
GoodsStatus
=
1
,
GoodsClassify
=
1
,
//查询非司导
OrderBy
=
2
,
CreateBy
=
-
1
,
GoodsPageType
=
IsOpenSchool
==
1
?
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
School
:
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
Mall
},
SmallShopsId
:
SmallShopsId
);
if
(
catGoodsList
!=
null
&&
catGoodsList
.
Count
>
0
)
{
foreach
(
var
gItem
in
catGoodsList
)
{
childItem
.
goodsList
.
Add
(
new
GoodsDetailsItem2
()
{
id
=
gItem
.
Id
,
price
=
Math
.
Round
((
gItem
?.
SellingPrice
??
0
),
2
),
name
=
gItem
.
Name
,
picUrl
=
Common
.
Config
.
GetFileUrl
(
gItem
.
CoverImage
),
OriginalPrice
=
Math
.
Round
((
gItem
?.
OriginalPrice
??
0
),
2
),
courseScore
=
gItem
.
CourseScore
??
0
});
}
}
}
}
}
}
//不显示商品分类
else
{
//自动添加商品
if
(
goodsData
.
addGoodsType
==
0
)
{
goodsData
.
list
=
new
List
<
GoodsDetailsItem2
>();
var
goodsList
=
productModule
.
GetProductGoodsPageList_V2
(
1
,
goodsData
.
goodsLength
,
out
long
rowsCount
,
new
Model
.
Extend
.
Product
.
RB_Goods_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
GoodsStatus
=
1
,
GoodsClassify
=
1
,
//查询非司导
OrderBy
=
2
,
CreateBy
=
-
1
,
GoodsPageType
=
IsOpenSchool
==
1
?
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
School
:
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
Mall
});
#
region
微店价格
RB_SmallShops_Info_Extend
smallModel
=
new
RB_SmallShops_Info_Extend
();
List
<
RB_SmallShops_Price_Extend
>
smallPList
=
new
List
<
RB_SmallShops_Price_Extend
>();
if
(
SmallShopsId
>
0
&&
goodsList
.
Any
())
{
string
goodsId
=
string
.
Join
(
","
,
goodsList
.
Select
(
x
=>
x
.
Id
));
smallModel
=
smallShops_InfoRepository
.
GetEntity
<
RB_SmallShops_Info_Extend
>(
SmallShopsId
);
smallPList
=
smallShops_PriceRepository
.
GetList
(
new
RB_SmallShops_Price_Extend
()
{
SmallShopsId
=
SmallShopsId
,
GoodsIds
=
goodsId
});
var
spriceList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsId
});
foreach
(
var
item
in
goodsList
)
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
||
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
UpPrice
>
0
).
Any
())
{
var
spList
=
spriceList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
if
(
spList
.
Any
())
{
foreach
(
var
qitem
in
spList
)
{
var
sspModel
=
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
SpecificationKey
==
qitem
.
SpecificationSort
).
FirstOrDefault
();
if
(
sspModel
!=
null
)
{
//单商品设置的
if
(
sspModel
.
PriceType
==
1
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
qitem
.
SellingPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
sspModel
.
PriceType
==
2
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
}
}
else
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
)
{
if
(
smallModel
.
PriceType
==
1
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
qitem
.
SellingPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
smallModel
.
PriceType
==
2
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
}
}
}
}
item
.
SellingPrice
=
spList
.
Min
(
x
=>
x
.
SellingPrice
??
0
);
decimal
MaxPrice
=
spList
.
Max
(
x
=>
x
.
SellingPrice
??
0
);
MaxPrice
+=
Math
.
Ceiling
(
MaxPrice
/
10
);
if
(
MaxPrice
>
item
.
OriginalPrice
)
{
item
.
OriginalPrice
=
MaxPrice
;
}
}
else
{
var
sspModel
=
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
SpecificationKey
==
""
).
FirstOrDefault
();
if
(
sspModel
!=
null
)
{
//单商品设置的
if
(
sspModel
.
PriceType
==
1
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
item
.
SellingPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
Math
.
Ceiling
((
item
.
OriginalPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
sspModel
.
PriceType
==
2
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
}
}
else
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
)
{
if
(
smallModel
.
PriceType
==
1
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
item
.
SellingPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
Math
.
Ceiling
((
item
.
OriginalPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
smallModel
.
PriceType
==
2
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
}
}
}
}
}
}
}
#
endregion
if
(
goodsList
!=
null
&&
goodsList
.
Count
>
0
)
{
foreach
(
var
gItem
in
goodsList
)
{
goodsData
.
list
.
Add
(
new
GoodsDetailsItem2
()
{
id
=
gItem
.
Id
,
price
=
Math
.
Round
((
gItem
?.
SellingPrice
??
0
),
2
),
name
=
gItem
.
Name
,
picUrl
=
Common
.
Config
.
GetFileUrl
(
gItem
.
CoverImage
),
OriginalPrice
=
Math
.
Round
((
gItem
?.
OriginalPrice
??
0
),
2
),
courseScore
=
gItem
.
CourseScore
??
0
});
}
}
}
//手动添加商品
else
{
if
(
goodsData
.
list
!=
null
&&
goodsData
.
list
.
Count
>
0
)
{
var
Ids
=
"0,"
+
string
.
Join
(
","
,
goodsData
.
list
.
Select
(
qitem
=>
qitem
.
id
));
var
tempGoodsList
=
productModule
.
GetProductGoodsList
(
new
Model
.
Extend
.
Product
.
RB_Goods_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
GoodsIds
=
Ids
,
GoodsStatus
=
1
,
GoodsClassify
=
1
,
//查询非司导
CreateBy
=
-
1
,
GoodsPageType
=
IsOpenSchool
==
1
?
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
School
:
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
Mall
});
#
region
微店价格
RB_SmallShops_Info_Extend
smallModel
=
new
RB_SmallShops_Info_Extend
();
List
<
RB_SmallShops_Price_Extend
>
smallPList
=
new
List
<
RB_SmallShops_Price_Extend
>();
if
(
SmallShopsId
>
0
&&
tempGoodsList
.
Any
())
{
string
goodsId
=
string
.
Join
(
","
,
tempGoodsList
.
Select
(
x
=>
x
.
Id
));
smallModel
=
smallShops_InfoRepository
.
GetEntity
<
RB_SmallShops_Info_Extend
>(
SmallShopsId
);
smallPList
=
smallShops_PriceRepository
.
GetList
(
new
RB_SmallShops_Price_Extend
()
{
SmallShopsId
=
SmallShopsId
,
GoodsIds
=
goodsId
});
var
spriceList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsId
});
foreach
(
var
item
in
tempGoodsList
)
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
||
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
UpPrice
>
0
).
Any
())
{
var
spList
=
spriceList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
if
(
spList
.
Any
())
{
foreach
(
var
qitem
in
spList
)
{
var
sspModel
=
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
SpecificationKey
==
qitem
.
SpecificationSort
).
FirstOrDefault
();
if
(
sspModel
!=
null
)
{
//单商品设置的
if
(
sspModel
.
PriceType
==
1
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
qitem
.
SellingPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
sspModel
.
PriceType
==
2
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
}
}
else
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
)
{
if
(
smallModel
.
PriceType
==
1
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
qitem
.
SellingPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
smallModel
.
PriceType
==
2
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
}
}
}
}
item
.
SellingPrice
=
spList
.
Min
(
x
=>
x
.
SellingPrice
??
0
);
decimal
MaxPrice
=
spList
.
Max
(
x
=>
x
.
SellingPrice
??
0
);
MaxPrice
+=
Math
.
Ceiling
(
MaxPrice
/
10
);
if
(
MaxPrice
>
item
.
OriginalPrice
)
{
item
.
OriginalPrice
=
MaxPrice
;
}
}
else
{
var
sspModel
=
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
SpecificationKey
==
""
).
FirstOrDefault
();
if
(
sspModel
!=
null
)
{
//单商品设置的
if
(
sspModel
.
PriceType
==
1
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
item
.
SellingPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
Math
.
Ceiling
((
item
.
OriginalPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
sspModel
.
PriceType
==
2
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
}
}
else
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
)
{
if
(
smallModel
.
PriceType
==
1
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
item
.
SellingPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
Math
.
Ceiling
((
item
.
OriginalPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
smallModel
.
PriceType
==
2
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
}
}
}
}
}
}
}
#
endregion
List
<
GoodsDetailsItem2
>
newGoodsList
=
new
List
<
GoodsDetailsItem2
>();
foreach
(
var
goodItem
in
goodsData
.
list
)
{
var
childItem
=
new
GoodsDetailsItem2
();
var
tempGood
=
tempGoodsList
?.
Where
(
qitem
=>
qitem
.
Id
==
goodItem
.
id
)?.
FirstOrDefault
();
if
(
tempGood
!=
null
&&
tempGood
.
Id
>
0
)
{
childItem
.
id
=
tempGood
.
Id
;
childItem
.
name
=
tempGood
?.
Name
??
""
;
childItem
.
price
=
Math
.
Round
((
tempGood
?.
SellingPrice
??
0
),
2
);
childItem
.
picUrl
=
tempGood
?.
CoverImage
!=
null
?
Common
.
Config
.
GetFileUrl
(
tempGood
.
CoverImage
)
:
""
;
childItem
.
OriginalPrice
=
Math
.
Round
((
tempGood
?.
OriginalPrice
??
0
),
2
);
childItem
.
courseScore
=
(
tempGood
.
CourseScore
??
0
);
newGoodsList
.
Add
(
childItem
);
}
}
goodsData
.
list
=
newGoodsList
;
}
}
}
}
obj
=
new
obj
=
new
{
{
id
=
subItem
.
Id
,
id
=
subItem
.
Id
,
...
@@ -2143,6 +1825,352 @@ namespace Mall.WebApi.Controllers
...
@@ -2143,6 +1825,352 @@ namespace Mall.WebApi.Controllers
return
obj
;
return
obj
;
}
}
/// <summary>
/// 常规商品数据解析
/// </summary>
/// <param name="goodsData"></param>
/// <param name="TenantId"></param>
/// <param name="MallBaseId"></param>
/// <param name="IsOpenSchool"></param>
/// <param name="SmallShopsId"></param>
/// <returns></returns>
private
static
void
GetGoodData
(
goodsItem
goodsData
,
int
TenantId
,
int
MallBaseId
,
int
IsOpenSchool
,
int
SmallShopsId
)
{
if
(
goodsData
!=
null
)
{
//显示商品分类
if
(
goodsData
.
showCat
)
{
if
(
goodsData
.
catList
!=
null
&&
goodsData
.
catList
.
Count
>
0
)
{
foreach
(
var
childItem
in
goodsData
.
catList
)
{
//自定义商品
if
(
childItem
.
staticGoods
)
{
if
(
childItem
.
goodsList
!=
null
&&
childItem
.
goodsList
.
Count
>
0
)
{
var
Ids
=
"0,"
+
string
.
Join
(
","
,
childItem
.
goodsList
.
Select
(
qitem
=>
qitem
.
id
));
var
tempGoodsList
=
productModule
.
GetProductGoodsList
(
new
Model
.
Extend
.
Product
.
RB_Goods_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
GoodsIds
=
Ids
,
GoodsStatus
=
1
,
CreateBy
=
-
1
,
GoodsClassify
=
1
,
//查询非司导
GoodsPageType
=
IsOpenSchool
==
1
?
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
School
:
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
Mall
},
SmallShopsId
:
SmallShopsId
);
List
<
GoodsDetailsItem2
>
newGoodsList
=
new
List
<
GoodsDetailsItem2
>();
foreach
(
var
goodItem
in
childItem
.
goodsList
)
{
var
lastItem
=
new
GoodsDetailsItem2
();
var
tempGood
=
tempGoodsList
?.
Where
(
qitem
=>
qitem
.
Id
==
goodItem
.
id
)?.
FirstOrDefault
();
if
(
tempGood
!=
null
&&
tempGood
.
Id
>
0
)
{
lastItem
.
id
=
tempGood
.
Id
;
lastItem
.
name
=
tempGood
.
Name
;
lastItem
.
price
=
Math
.
Round
((
tempGood
?.
SellingPrice
??
0
),
2
);
lastItem
.
picUrl
=
tempGood
?.
CoverImage
!=
null
?
Common
.
Config
.
GetFileUrl
(
tempGood
.
CoverImage
)
:
""
;
lastItem
.
OriginalPrice
=
Math
.
Round
((
tempGood
?.
OriginalPrice
??
0
),
2
);
lastItem
.
courseScore
=
(
tempGood
.
CourseScore
??
0
);
newGoodsList
.
Add
(
lastItem
);
}
}
childItem
.
goodsList
=
newGoodsList
;
}
}
//自动添加商品
else
{
childItem
.
goodsList
=
new
List
<
GoodsDetailsItem2
>();
var
catGoodsList
=
productModule
.
GetProductGoodsPageList_V2
(
1
,
childItem
.
goodsNum
,
out
long
rowsCount
,
new
Model
.
Extend
.
Product
.
RB_Goods_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
CategoryIds
=
childItem
.
id
.
ToString
(),
GoodsStatus
=
1
,
GoodsClassify
=
1
,
//查询非司导
OrderBy
=
2
,
CreateBy
=
-
1
,
GoodsPageType
=
IsOpenSchool
==
1
?
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
School
:
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
Mall
},
SmallShopsId
:
SmallShopsId
);
if
(
catGoodsList
!=
null
&&
catGoodsList
.
Count
>
0
)
{
foreach
(
var
gItem
in
catGoodsList
)
{
childItem
.
goodsList
.
Add
(
new
GoodsDetailsItem2
()
{
id
=
gItem
.
Id
,
price
=
Math
.
Round
((
gItem
?.
SellingPrice
??
0
),
2
),
name
=
gItem
.
Name
,
picUrl
=
Common
.
Config
.
GetFileUrl
(
gItem
.
CoverImage
),
OriginalPrice
=
Math
.
Round
((
gItem
?.
OriginalPrice
??
0
),
2
),
courseScore
=
gItem
.
CourseScore
??
0
});
}
}
}
}
}
}
//不显示商品分类
else
{
//自动添加商品
if
(
goodsData
.
addGoodsType
==
0
)
{
goodsData
.
list
=
new
List
<
GoodsDetailsItem2
>();
var
goodsList
=
productModule
.
GetProductGoodsPageList_V2
(
1
,
goodsData
.
goodsLength
,
out
long
rowsCount
,
new
Model
.
Extend
.
Product
.
RB_Goods_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
GoodsStatus
=
1
,
GoodsClassify
=
1
,
//查询非司导
OrderBy
=
2
,
CreateBy
=
-
1
,
GoodsPageType
=
IsOpenSchool
==
1
?
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
School
:
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
Mall
});
#
region
微店价格
RB_SmallShops_Info_Extend
smallModel
=
new
RB_SmallShops_Info_Extend
();
List
<
RB_SmallShops_Price_Extend
>
smallPList
=
new
List
<
RB_SmallShops_Price_Extend
>();
if
(
SmallShopsId
>
0
&&
goodsList
.
Any
())
{
string
goodsId
=
string
.
Join
(
","
,
goodsList
.
Select
(
x
=>
x
.
Id
));
smallModel
=
smallShops_InfoRepository
.
GetEntity
<
RB_SmallShops_Info_Extend
>(
SmallShopsId
);
smallPList
=
smallShops_PriceRepository
.
GetList
(
new
RB_SmallShops_Price_Extend
()
{
SmallShopsId
=
SmallShopsId
,
GoodsIds
=
goodsId
});
var
spriceList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsId
});
foreach
(
var
item
in
goodsList
)
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
||
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
UpPrice
>
0
).
Any
())
{
var
spList
=
spriceList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
if
(
spList
.
Any
())
{
foreach
(
var
qitem
in
spList
)
{
var
sspModel
=
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
SpecificationKey
==
qitem
.
SpecificationSort
).
FirstOrDefault
();
if
(
sspModel
!=
null
)
{
//单商品设置的
if
(
sspModel
.
PriceType
==
1
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
qitem
.
SellingPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
sspModel
.
PriceType
==
2
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
}
}
else
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
)
{
if
(
smallModel
.
PriceType
==
1
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
qitem
.
SellingPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
smallModel
.
PriceType
==
2
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
}
}
}
}
item
.
SellingPrice
=
spList
.
Min
(
x
=>
x
.
SellingPrice
??
0
);
decimal
MaxPrice
=
spList
.
Max
(
x
=>
x
.
SellingPrice
??
0
);
MaxPrice
+=
Math
.
Ceiling
(
MaxPrice
/
10
);
if
(
MaxPrice
>
item
.
OriginalPrice
)
{
item
.
OriginalPrice
=
MaxPrice
;
}
}
else
{
var
sspModel
=
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
SpecificationKey
==
""
).
FirstOrDefault
();
if
(
sspModel
!=
null
)
{
//单商品设置的
if
(
sspModel
.
PriceType
==
1
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
item
.
SellingPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
Math
.
Ceiling
((
item
.
OriginalPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
sspModel
.
PriceType
==
2
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
}
}
else
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
)
{
if
(
smallModel
.
PriceType
==
1
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
item
.
SellingPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
Math
.
Ceiling
((
item
.
OriginalPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
smallModel
.
PriceType
==
2
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
}
}
}
}
}
}
}
#
endregion
if
(
goodsList
!=
null
&&
goodsList
.
Count
>
0
)
{
foreach
(
var
gItem
in
goodsList
)
{
goodsData
.
list
.
Add
(
new
GoodsDetailsItem2
()
{
id
=
gItem
.
Id
,
price
=
Math
.
Round
((
gItem
?.
SellingPrice
??
0
),
2
),
name
=
gItem
.
Name
,
picUrl
=
Common
.
Config
.
GetFileUrl
(
gItem
.
CoverImage
),
OriginalPrice
=
Math
.
Round
((
gItem
?.
OriginalPrice
??
0
),
2
),
courseScore
=
gItem
.
CourseScore
??
0
});
}
}
}
//手动添加商品
else
{
if
(
goodsData
.
list
!=
null
&&
goodsData
.
list
.
Count
>
0
)
{
var
Ids
=
"0,"
+
string
.
Join
(
","
,
goodsData
.
list
.
Select
(
qitem
=>
qitem
.
id
));
var
tempGoodsList
=
productModule
.
GetProductGoodsList
(
new
Model
.
Extend
.
Product
.
RB_Goods_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
GoodsIds
=
Ids
,
GoodsStatus
=
1
,
GoodsClassify
=
1
,
//查询非司导
CreateBy
=
-
1
,
GoodsPageType
=
IsOpenSchool
==
1
?
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
School
:
Common
.
Enum
.
Goods
.
GoodsPageTypeEnum
.
Mall
});
#
region
微店价格
RB_SmallShops_Info_Extend
smallModel
=
new
RB_SmallShops_Info_Extend
();
List
<
RB_SmallShops_Price_Extend
>
smallPList
=
new
List
<
RB_SmallShops_Price_Extend
>();
if
(
SmallShopsId
>
0
&&
tempGoodsList
.
Any
())
{
string
goodsId
=
string
.
Join
(
","
,
tempGoodsList
.
Select
(
x
=>
x
.
Id
));
smallModel
=
smallShops_InfoRepository
.
GetEntity
<
RB_SmallShops_Info_Extend
>(
SmallShopsId
);
smallPList
=
smallShops_PriceRepository
.
GetList
(
new
RB_SmallShops_Price_Extend
()
{
SmallShopsId
=
SmallShopsId
,
GoodsIds
=
goodsId
});
var
spriceList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsId
});
foreach
(
var
item
in
tempGoodsList
)
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
||
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
UpPrice
>
0
).
Any
())
{
var
spList
=
spriceList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
if
(
spList
.
Any
())
{
foreach
(
var
qitem
in
spList
)
{
var
sspModel
=
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
SpecificationKey
==
qitem
.
SpecificationSort
).
FirstOrDefault
();
if
(
sspModel
!=
null
)
{
//单商品设置的
if
(
sspModel
.
PriceType
==
1
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
qitem
.
SellingPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
sspModel
.
PriceType
==
2
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
}
}
else
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
)
{
if
(
smallModel
.
PriceType
==
1
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
qitem
.
SellingPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
smallModel
.
PriceType
==
2
)
{
qitem
.
SellingPrice
=
(
qitem
.
SellingPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
}
}
}
}
item
.
SellingPrice
=
spList
.
Min
(
x
=>
x
.
SellingPrice
??
0
);
decimal
MaxPrice
=
spList
.
Max
(
x
=>
x
.
SellingPrice
??
0
);
MaxPrice
+=
Math
.
Ceiling
(
MaxPrice
/
10
);
if
(
MaxPrice
>
item
.
OriginalPrice
)
{
item
.
OriginalPrice
=
MaxPrice
;
}
}
else
{
var
sspModel
=
smallPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
&&
x
.
SpecificationKey
==
""
).
FirstOrDefault
();
if
(
sspModel
!=
null
)
{
//单商品设置的
if
(
sspModel
.
PriceType
==
1
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
item
.
SellingPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
Math
.
Ceiling
((
item
.
OriginalPrice
??
0
)
*
(
sspModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
sspModel
.
PriceType
==
2
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
(
sspModel
.
UpPrice
??
0
);
}
}
else
{
if
((
smallModel
.
UpPrice
??
0
)
>
0
)
{
if
(
smallModel
.
PriceType
==
1
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
Math
.
Ceiling
((
item
.
SellingPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
Math
.
Ceiling
((
item
.
OriginalPrice
??
0
)
*
(
smallModel
.
UpPrice
??
0
)
/
100
);
}
else
if
(
smallModel
.
PriceType
==
2
)
{
item
.
SellingPrice
=
(
item
.
SellingPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
item
.
OriginalPrice
=
(
item
.
OriginalPrice
??
0
)
+
(
smallModel
.
UpPrice
??
0
);
}
}
}
}
}
}
}
#
endregion
List
<
GoodsDetailsItem2
>
newGoodsList
=
new
List
<
GoodsDetailsItem2
>();
foreach
(
var
goodItem
in
goodsData
.
list
)
{
var
childItem
=
new
GoodsDetailsItem2
();
var
tempGood
=
tempGoodsList
?.
Where
(
qitem
=>
qitem
.
Id
==
goodItem
.
id
)?.
FirstOrDefault
();
if
(
tempGood
!=
null
&&
tempGood
.
Id
>
0
)
{
childItem
.
id
=
tempGood
.
Id
;
childItem
.
name
=
tempGood
?.
Name
??
""
;
childItem
.
price
=
Math
.
Round
((
tempGood
?.
SellingPrice
??
0
),
2
);
childItem
.
picUrl
=
tempGood
?.
CoverImage
!=
null
?
Common
.
Config
.
GetFileUrl
(
tempGood
.
CoverImage
)
:
""
;
childItem
.
OriginalPrice
=
Math
.
Round
((
tempGood
?.
OriginalPrice
??
0
),
2
);
childItem
.
courseScore
=
(
tempGood
.
CourseScore
??
0
);
newGoodsList
.
Add
(
childItem
);
}
}
goodsData
.
list
=
newGoodsList
;
}
}
}
}
}
/// <summary>
/// <summary>
/// 自定义首页布局
/// 自定义首页布局
...
...
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