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
f2dc83b5
Commit
f2dc83b5
authored
May 26, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品解析
parent
adf45be8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
14 deletions
+115
-14
RB_Miniprogram_Template_Extend.cs
.../Extend/MarketingCenter/RB_Miniprogram_Template_Extend.cs
+2
-2
RB_Goods_Extend.cs
Mall.Model/Extend/Product/RB_Goods_Extend.cs
+2
-0
MallController.cs
Mall.WebApi/Controllers/Mall/MallController.cs
+111
-12
No files found.
Mall.Model/Extend/MarketingCenter/RB_Miniprogram_Template_Extend.cs
View file @
f2dc83b5
...
...
@@ -744,7 +744,7 @@ namespace Mall.Model.Extend.MarketingCenter
public
int
catStyle
{
get
;
set
;
}
/// <summary>
/// 商品添加方式
/// 商品添加方式
【0-自动添加,1-手动添加】
/// </summary>
public
int
addGoodsType
{
get
;
set
;
}
...
...
@@ -850,7 +850,7 @@ namespace Mall.Model.Extend.MarketingCenter
/// <summary>
///
///
图片位置
/// </summary>
public
int
mode
{
get
;
set
;
}
...
...
Mall.Model/Extend/Product/RB_Goods_Extend.cs
View file @
f2dc83b5
...
...
@@ -65,6 +65,8 @@ namespace Mall.Model.Extend.Product
/// 封面图
/// </summary>
public
string
CoverImage
{
get
;
set
;
}
/// <summary>
/// 自定义分享图片
/// </summary>
...
...
Mall.WebApi/Controllers/Mall/MallController.cs
View file @
f2dc83b5
...
...
@@ -8,8 +8,10 @@ using Mall.Model.Entity.BaseSetUp;
using
Mall.Model.Entity.MarketingCenter
;
using
Mall.Model.Extend.BaseSetUp
;
using
Mall.Model.Extend.MarketingCenter
;
using
Mall.Model.Extend.User
;
using
Mall.Module.BaseSetUp
;
using
Mall.Module.MarketingCenter
;
using
Mall.Module.Product
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Cors
;
...
...
@@ -51,6 +53,11 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
private
readonly
MiniprogramTemplateModule
miniprogramTemplateModule
=
new
MiniprogramTemplateModule
();
/// <summary>
/// 产品处理类
/// </summary>
private
readonly
ProductModule
productModule
=
new
ProductModule
();
/// <summary>
/// 小程序首页
/// </summary>
...
...
@@ -99,7 +106,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
foreach
(
var
subItem
in
item
.
ComponentDataList
)
{
templateData
.
data
.
Add
(
PlusDataToObject
(
subItem
));
templateData
.
data
.
Add
(
PlusDataToObject
(
subItem
,
(
miniProgram
?.
TenantId
??
0
),
miniProgram
.
MallBaseId
));
}
}
...
...
@@ -296,22 +303,24 @@ namespace Mall.WebApi.Controllers.MallBase
is_home_page
=
1
,
navs
=
list
};
}
}
}
var
objResult
=
new
{
var
objResult
=
new
{
home_pages
=
homePage
};
return
ApiResult
.
Success
(
data
:
objResult
);
}
/// <summary>
/// 解析插件数据为对象
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public
object
PlusDataToObject
(
ComponentItem
subItem
)
public
object
PlusDataToObject
(
ComponentItem
subItem
,
int
TenantId
,
int
MallBaseId
)
{
var
obj
=
new
object
();
switch
(
subItem
.
Id
)
...
...
@@ -402,22 +411,112 @@ namespace Mall.WebApi.Controllers.MallBase
var
goodsData
=
subItem
.
data
as
goodsItem
;
if
(
goodsData
!=
null
)
{
if
(
goodsData
.
list
!=
null
&&
goodsData
.
list
.
Count
>
0
)
//显示商品分类
if
(
goodsData
.
showCat
)
{
foreach
(
var
childItem
in
goodsData
.
list
)
{
childItem
.
picUrl
=
Common
.
Config
.
GetFileUrl
(
childItem
.
picUrl
);
}
}
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
});
foreach
(
var
lastItem
in
childItem
.
goodsList
)
{
lastItem
.
picUrl
=
Common
.
Config
.
GetFileUrl
(
lastItem
.
picUrl
);
var
tempGood
=
tempGoodsList
?.
Where
(
qitem
=>
qitem
.
GoodsId
==
lastItem
.
id
)?.
FirstOrDefault
();
if
(
tempGood
!=
null
&&
tempGood
.
Id
>
0
)
{
lastItem
.
name
=
tempGood
?.
Name
??
lastItem
.
name
;
lastItem
.
price
=
tempGood
?.
SellingPrice
??
lastItem
.
price
;
lastItem
.
picUrl
=
tempGood
?.
CoverImage
!=
null
?
Common
.
Config
.
GetFileUrl
(
tempGood
.
CoverImage
)
:
Common
.
Config
.
GetFileUrl
(
lastItem
.
picUrl
);
}
}
}
}
//自动添加商品
else
{
childItem
.
goodsList
=
new
List
<
GoodsDetailsItem2
>();
var
catGoodsList
=
productModule
.
GetProductGoodsPageList
(
1
,
childItem
.
goodsNum
,
out
long
rowsCount
,
new
Model
.
Extend
.
Product
.
RB_Goods_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
CategoryIds
=
childItem
.
id
.
ToString
()
});
if
(
catGoodsList
!=
null
&&
catGoodsList
.
Count
>
0
)
{
foreach
(
var
gItem
in
catGoodsList
)
{
childItem
.
goodsList
.
Add
(
new
GoodsDetailsItem2
()
{
id
=
gItem
.
Id
,
price
=
gItem
?.
SellingPrice
??
0
,
name
=
gItem
.
Name
,
picUrl
=
Common
.
Config
.
GetFileUrl
(
gItem
.
CoverImage
)
});
}
}
}
}
}
}
//不显示商品分类
else
{
//自动添加商品
if
(
goodsData
.
addGoodsType
==
0
)
{
goodsData
.
list
=
new
List
<
GoodsDetailsItem2
>();
var
goodsList
=
productModule
.
GetProductGoodsPageList
(
1
,
goodsData
.
goodsLength
,
out
long
rowsCount
,
new
Model
.
Extend
.
Product
.
RB_Goods_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
});
if
(
goodsList
!=
null
&&
goodsList
.
Count
>
0
)
{
foreach
(
var
gItem
in
goodsList
)
{
goodsData
.
list
.
Add
(
new
GoodsDetailsItem2
()
{
id
=
gItem
.
Id
,
price
=
gItem
?.
SellingPrice
??
0
,
name
=
gItem
.
Name
,
picUrl
=
Common
.
Config
.
GetFileUrl
(
gItem
.
CoverImage
)
});
}
}
}
//手动添加商品
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
});
foreach
(
var
childItem
in
goodsData
.
list
)
{
var
tempGood
=
tempGoodsList
?.
Where
(
qitem
=>
qitem
.
GoodsId
==
childItem
.
id
)?.
FirstOrDefault
();
if
(
tempGood
!=
null
&&
tempGood
.
Id
>
0
)
{
childItem
.
name
=
tempGood
?.
Name
??
childItem
.
name
;
childItem
.
price
=
tempGood
?.
SellingPrice
??
childItem
.
price
;
childItem
.
picUrl
=
tempGood
?.
CoverImage
!=
null
?
Common
.
Config
.
GetFileUrl
(
tempGood
.
CoverImage
)
:
Common
.
Config
.
GetFileUrl
(
childItem
.
picUrl
);
}
}
}
}
...
...
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