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
68a0e950
Commit
68a0e950
authored
May 13, 2020
by
吴春
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/mall.oytour.com
parents
1e0c950a
85b7290a
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1692 additions
and
54 deletions
+1692
-54
RB_Goods.cs
Mall.Model/Entity/Product/RB_Goods.cs
+2
-2
RB_Goods_OrderDetail.cs
Mall.Model/Entity/Product/RB_Goods_OrderDetail.cs
+4
-0
RB_Goods_ShoppingCart.cs
Mall.Model/Entity/Product/RB_Goods_ShoppingCart.cs
+99
-0
RB_Logistics_RulesPrice_Extend.cs
....Model/Extend/BaseSetUp/RB_Logistics_RulesPrice_Extend.cs
+5
-0
RB_Logistics_Rules_Extend.cs
Mall.Model/Extend/BaseSetUp/RB_Logistics_Rules_Extend.cs
+4
-0
RB_Goods_Extend.cs
Mall.Model/Extend/Product/RB_Goods_Extend.cs
+25
-0
RB_Goods_Order_Extend.cs
Mall.Model/Extend/Product/RB_Goods_Order_Extend.cs
+8
-0
RB_Goods_ShoppingCart_Extend.cs
Mall.Model/Extend/Product/RB_Goods_ShoppingCart_Extend.cs
+70
-0
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+495
-0
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+269
-16
RB_Logistics_RulesRepository.cs
Mall.Repository/BaseSetUp/RB_Logistics_RulesRepository.cs
+7
-1
RB_GoodsRepository.cs
Mall.Repository/Product/RB_GoodsRepository.cs
+16
-0
RB_Goods_OrderRepository.cs
Mall.Repository/Product/RB_Goods_OrderRepository.cs
+57
-1
RB_Goods_ShoppingCartRepository.cs
Mall.Repository/Product/RB_Goods_ShoppingCartRepository.cs
+81
-0
RB_Goods_SpecificationRepository.cs
Mall.Repository/Product/RB_Goods_SpecificationRepository.cs
+1
-1
RB_Goods_SpecificationValueRepository.cs
...pository/Product/RB_Goods_SpecificationValueRepository.cs
+1
-1
AppletGoodsController.cs
Mall.WebApi/Controllers/Product/AppletGoodsController.cs
+324
-30
AppletOrderController.cs
Mall.WebApi/Controllers/Product/AppletOrderController.cs
+222
-0
mall.oytour.com.pubxml
....WebApi/Properties/PublishProfiles/mall.oytour.com.pubxml
+1
-1
mall.oytour.com.pubxml.user
...pi/Properties/PublishProfiles/mall.oytour.com.pubxml.user
+1
-1
No files found.
Mall.Model/Entity/Product/RB_Goods.cs
View file @
68a0e950
...
...
@@ -248,7 +248,7 @@ namespace Mall.Model.Entity.Product
set
;
}
/// <summary>
/// 赠送类型
1固定值 2
百分比
/// 赠送类型
2固定值 1
百分比
/// </summary>
public
int
?
IntegralPresentType
{
...
...
@@ -264,7 +264,7 @@ namespace Mall.Model.Entity.Product
set
;
}
/// <summary>
/// 抵扣类型
1固定值 2
百分比
/// 抵扣类型
2固定值 1
百分比
/// </summary>
public
int
?
PointsDeductionType
{
...
...
Mall.Model/Entity/Product/RB_Goods_OrderDetail.cs
View file @
68a0e950
...
...
@@ -72,6 +72,10 @@ namespace Mall.Model.Entity.Product
set
;
}
/// <summary>
/// 规格key
/// </summary>
public
string
SpecificationSort
{
get
;
set
;
}
/// <summary>
/// 货号
/// </summary>
public
string
ProductCode
...
...
Mall.Model/Entity/Product/RB_Goods_ShoppingCart.cs
0 → 100644
View file @
68a0e950
using
Mall.Common.AOP
;
using
Mall.Common.Enum.Goods
;
using
Mall.Common.Enum.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Mall.Model.Entity.Product
{
/// <summary>
/// 商品购物车表实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_ShoppingCart
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 用户id
/// </summary>
public
int
?
UserId
{
get
;
set
;
}
/// <summary>
/// 商品id
/// </summary>
public
int
?
GoodsId
{
get
;
set
;
}
/// <summary>
/// 商品数量
/// </summary>
public
int
?
Number
{
get
;
set
;
}
/// <summary>
/// SpecificationSort
/// </summary>
public
string
SpecificationSort
{
get
;
set
;
}
/// <summary>
/// 状态
/// </summary>
public
int
?
Status
{
get
;
set
;
}
/// <summary>
/// 商户号
/// </summary>
public
int
TenantId
{
get
;
set
;
}
/// <summary>
/// 小程序id
/// </summary>
public
int
MallBaseId
{
get
;
set
;
}
/// <summary>
/// CreateDate
/// </summary>
public
DateTime
?
CreateDate
{
get
;
set
;
}
/// <summary>
/// UpdateDate
/// </summary>
public
DateTime
?
UpdateDate
{
get
;
set
;
}
}
}
Mall.Model/Extend/BaseSetUp/RB_Logistics_RulesPrice_Extend.cs
View file @
68a0e950
...
...
@@ -14,5 +14,10 @@ namespace Mall.Model.Extend.BaseSetUp
public
class
RB_Logistics_RulesPrice_Extend
:
RB_Logistics_RulesPrice
{
public
List
<
RB_Logistics_RulesRegion_Extend
>
List
{
get
;
set
;
}
/// <summary>
/// 规格ids
/// </summary>
public
string
RulesIds
{
get
;
set
;
}
}
}
Mall.Model/Extend/BaseSetUp/RB_Logistics_Rules_Extend.cs
View file @
68a0e950
...
...
@@ -16,5 +16,9 @@ namespace Mall.Model.Extend.BaseSetUp
{
public
List
<
RB_Logistics_RulesPrice_Extend
>
Detail
{
get
;
set
;
}
public
List
<
RB_Logistics_RulesRegion_Extend
>
List
{
get
;
set
;
}
/// <summary>
/// 规格的ids
/// </summary>
public
string
RulesIds
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Goods_Extend.cs
View file @
68a0e950
...
...
@@ -13,6 +13,18 @@ namespace Mall.Model.Extend.Product
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_Extend
:
RB_Goods
{
/// <summary>
/// 推荐商品类型 1商品详情页 2订单完成后 3评论后
/// </summary>
public
int
?
RecommendType
{
get
;
set
;
}
/// <summary>
/// 商品id
/// </summary>
public
int
?
GoodsId
{
get
;
set
;
}
/// <summary>
/// 视频播放方向 1向下 2向上
/// </summary>
public
int
?
SelectVideoDirection
{
get
;
set
;
}
/// <summary>
/// 小程序名称
/// </summary>
...
...
@@ -22,6 +34,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public
int
?
UserId
{
get
;
set
;
}
/// <summary>
/// 值查询有视频的
/// </summary>
public
int
?
IsSelectVideo
{
get
;
set
;
}
/// <summary>
/// 排序
/// </summary>
public
int
?
OrderBy
{
get
;
set
;
}
...
...
@@ -82,6 +98,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public
List
<
RB_Goods_Specification_Extend
>
SpecificationList
{
get
;
set
;
}
/// <summary>
/// 规格值名称列表
/// </summary>
public
List
<
string
>
SpecificationNameList
{
get
;
set
;
}
/// <summary>
/// 规格价格列表
/// </summary>
public
List
<
RB_Goods_SpecificationPrice_Extend
>
SpecificationPriceList
{
get
;
set
;
}
...
...
@@ -107,5 +127,10 @@ namespace Mall.Model.Extend.Product
/// </summary>
public
decimal
MaxShare
{
get
;
set
;
}
/// <summary>
/// 会员价格
/// </summary>
public
decimal
MemberPrice
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Goods_Order_Extend.cs
View file @
68a0e950
...
...
@@ -13,6 +13,14 @@ namespace Mall.Model.Extend.Product
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_Order_Extend
:
RB_Goods_Order
{
/// <summary>
/// 商品id
/// </summary>
public
int
?
GoodsId
{
get
;
set
;
}
/// <summary>
/// 商品订单数量
/// </summary>
public
int
?
OrderNum
{
get
;
set
;
}
/// <summary>
/// 开始时间
/// </summary>
...
...
Mall.Model/Extend/Product/RB_Goods_ShoppingCart_Extend.cs
0 → 100644
View file @
68a0e950
using
Mall.Common.AOP
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.Product
;
namespace
Mall.Model.Extend.Product
{
/// <summary>
/// 商品购物车表扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Goods_ShoppingCart_Extend
:
RB_Goods_ShoppingCart
{
/// <summary>
/// 商品名称
/// </summary>
public
string
GoodsName
{
get
;
set
;
}
/// <summary>
/// 商品状态 1销售中 2下架中 3 失效
/// </summary>
public
int
?
GoodsStatus
{
get
;
set
;
}
/// <summary>
/// 轮播图 json 格式 第一张为封面图
/// </summary>
public
string
CarouselImage
{
get
;
set
;
}
/// <summary>
/// 规格列表
/// </summary>
public
List
<
string
>
SpecificationList
{
get
;
set
;
}
/// <summary>
/// 售价
/// </summary>
public
decimal
Price
{
get
;
set
;
}
/// <summary>
/// 默认规格名称
/// </summary>
public
string
DefaultSpecificationName
{
get
;
set
;
}
/// <summary>
/// 是否开启自定义规格
/// </summary>
public
int
?
IsCustomSpecification
{
get
;
set
;
}
/// <summary>
/// 封面图
/// </summary>
public
string
CoverImage
{
get
;
set
;
}
/// <summary>
/// 是否享受会员
/// </summary>
public
int
?
EnjoyMember
{
get
;
set
;
}
/// <summary>
/// 是否制定会员价格
/// </summary>
public
int
?
SeparateSetMember
{
get
;
set
;
}
/// <summary>
/// 库存数量
/// </summary>
public
int
?
InventoryNum
{
get
;
set
;
}
}
}
Mall.Module.Product/OrderModule.cs
View file @
68a0e950
...
...
@@ -39,6 +39,14 @@ namespace Mall.Module.Product
/// </summary>
private
readonly
RB_Goods_CategoryRepository
goods_CategoryRepository
=
new
RB_Goods_CategoryRepository
();
/// <summary>
/// 商品规格
/// </summary>
private
readonly
RB_Goods_SpecificationRepository
goods_SpecificationRepository
=
new
RB_Goods_SpecificationRepository
();
/// <summary>
/// 商品规格值
/// </summary>
private
readonly
RB_Goods_SpecificationValueRepository
goods_SpecificationValueRepository
=
new
RB_Goods_SpecificationValueRepository
();
/// <summary>
/// 商品规格价格
/// </summary>
private
readonly
RB_Goods_SpecificationPriceRepository
goods_SpecificationPriceRepository
=
new
RB_Goods_SpecificationPriceRepository
();
...
...
@@ -62,6 +70,8 @@ namespace Mall.Module.Product
/// 运费
/// </summary>
private
readonly
RB_Logistics_RulesRepository
logistics_RulesRepository
=
new
RB_Logistics_RulesRepository
();
private
readonly
RB_Logistics_RulesRegionRepository
logistics_RulesRegionRepository
=
new
RB_Logistics_RulesRegionRepository
();
private
readonly
RB_Logistics_RulesPriceRepository
logistics_RulesPriceRepository
=
new
RB_Logistics_RulesPriceRepository
();
/// <summary>
/// 订单商品
/// </summary>
...
...
@@ -102,8 +112,493 @@ namespace Mall.Module.Product
/// 日志
/// </summary>
private
readonly
RB_Goods_LogRepository
goods_LogRepository
=
new
RB_Goods_LogRepository
();
/// <summary>
/// 购物车
/// </summary>
private
readonly
RB_Goods_ShoppingCartRepository
goods_ShoppingCartRepository
=
new
RB_Goods_ShoppingCartRepository
();
/// <summary>
/// 收货地址
/// </summary>
private
readonly
RB_Member_ShippingAddressRepository
member_ShippingAddressRepository
=
new
RB_Member_ShippingAddressRepository
();
#
region
购物车
/// <summary>
/// 获取购物车分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Goods_ShoppingCart_Extend
>
GetGoodsShoppingCartPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Goods_Extend
demodel
)
{
var
umodel
=
member_UserRepository
.
GetEntity
(
demodel
.
UserId
);
if
(
umodel
==
null
)
{
count
=
0
;
return
new
List
<
RB_Goods_ShoppingCart_Extend
>();
}
var
list
=
goods_ShoppingCartRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
if
(
list
.
Any
())
{
string
goodsIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
GoodsId
));
var
speciList
=
goods_SpecificationRepository
.
GetList
(
new
RB_Goods_Specification_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
speciVList
=
goods_SpecificationValueRepository
.
GetList
(
new
RB_Goods_SpecificationValue_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
speciPList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
mpriceList
=
goods_MemberPriceRepository
.
GetList
(
new
RB_Goods_MemberPrice_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
foreach
(
var
item
in
list
)
{
item
.
CoverImage
=
""
;
if
(!
string
.
IsNullOrEmpty
(
item
.
CarouselImage
)
&&
item
.
CarouselImage
!=
"[]"
)
{
List
<
int
>
CarouselIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
item
.
CarouselImage
);
//封面图
item
.
CoverImage
=
material_InfoRepository
.
GetEntity
(
CarouselIdList
[
0
])?.
Path
??
""
;
}
//验证规格是否已失效
if
(
item
.
IsCustomSpecification
==
1
)
{
if
(
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
item
.
GoodsStatus
=
3
;
}
if
(!
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
SpecificationSort
).
Any
())
{
item
.
GoodsStatus
=
3
;
}
}
else
{
if
(!
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
item
.
GoodsStatus
=
3
;
}
}
//规格赋值
item
.
SpecificationList
=
new
List
<
string
>();
if
(
item
.
GoodsStatus
!=
3
)
{
if
(
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
item
.
SpecificationList
.
Add
(
"规格:"
+
item
.
DefaultSpecificationName
);
}
else
{
var
KeyArr
=
item
.
SpecificationSort
.
Split
(
':'
);
for
(
var
i
=
0
;
i
<
KeyArr
.
Length
;
i
++)
{
if
(!
string
.
IsNullOrEmpty
(
KeyArr
[
i
]))
{
var
sModel
=
speciList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
).
ToList
()[
i
];
var
svModel
=
speciVList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationId
==
sModel
.
Id
&&
x
.
Sort
==
Convert
.
ToInt32
(
KeyArr
[
i
])).
FirstOrDefault
();
item
.
SpecificationList
.
Add
(
sModel
.
Name
+
":"
+
svModel
.
Name
);
}
}
var
speciPModel
=
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
SpecificationSort
).
FirstOrDefault
();
item
.
Price
=
speciPModel
?.
SellingPrice
??
0
;
item
.
InventoryNum
=
speciPModel
?.
InventoryNum
??
0
;
}
//会员价格
if
(
umodel
.
MemberGrade
>
0
)
{
if
(
item
.
EnjoyMember
==
1
&&
item
.
SeparateSetMember
==
1
)
{
item
.
Price
=
mpriceList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
MemberGrade
==
umodel
.
MemberGrade
&&
x
.
SpecificationSort
==
item
.
SpecificationSort
).
FirstOrDefault
()?.
MemberPrice
??
0
;
}
else
{
//求会员等级折扣
var
gradeModel
=
member_GradeRepository
.
GetList
(
new
RB_Member_Grade_Extend
()
{
Grade
=
umodel
.
MemberGrade
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
}).
FirstOrDefault
();
item
.
Price
=
Math
.
Round
(
item
.
Price
*
(
gradeModel
?.
Discount
??
10
)
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
}
}
}
}
}
return
list
;
}
/// <summary>
/// 加入购物车
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
ApiResult
SetGoodsShoppingCartGetInfo
(
RB_Goods_ShoppingCart_Extend
demodel
)
{
bool
flag
=
false
;
var
gmodel
=
goodsRepository
.
GetEntity
(
demodel
.
GoodsId
);
if
(
gmodel
.
IsCustomSpecification
==
1
)
{
var
speciPList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsId
=
demodel
.
GoodsId
,
SpecificationSort
=
demodel
.
SpecificationSort
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
if
(!
speciPList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"商品规格不正确"
);
}
}
else
{
if
(
demodel
.
SpecificationSort
!=
""
)
{
return
ApiResult
.
ParamIsNull
(
"商品规格不正确"
);
}
}
var
scList
=
goods_ShoppingCartRepository
.
GetList
(
new
RB_Goods_ShoppingCart_Extend
()
{
UserId
=
demodel
.
UserId
,
SpecificationSort
=
demodel
.
SpecificationSort
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
if
(
scList
.
Any
())
{
//更新数量
var
scModel
=
scList
.
FirstOrDefault
();
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_ShoppingCart
.
Number
),
scModel
.
Number
+
demodel
.
Number
},
{
nameof
(
RB_Goods_ShoppingCart
.
UpdateDate
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
Id
),
FiledValue
=
scModel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
flag
=
goods_ShoppingCartRepository
.
Update
(
keyValues
,
wheres
);
}
else
{
flag
=
goods_ShoppingCartRepository
.
Insert
(
new
RB_Goods_ShoppingCart
()
{
Id
=
0
,
MallBaseId
=
demodel
.
MallBaseId
,
CreateDate
=
DateTime
.
Now
,
GoodsId
=
demodel
.
GoodsId
,
Number
=
demodel
.
Number
,
SpecificationSort
=
demodel
.
SpecificationSort
,
Status
=
0
,
TenantId
=
demodel
.
TenantId
,
UpdateDate
=
DateTime
.
Now
,
UserId
=
demodel
.
UserId
})
>
0
;
}
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 设置购物车数量
/// </summary>
/// <param name="shoppingCartId"></param>
/// <param name="number"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
SetGoodsShoppingCartNumGetInfo
(
int
shoppingCartId
,
int
number
,
int
tenantId
,
int
mallBaseId
)
{
//更新数量
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_ShoppingCart
.
Number
),
number
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
Id
),
FiledValue
=
shoppingCartId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
goods_ShoppingCartRepository
.
Update
(
keyValues
,
wheres
);
}
/// <summary>
/// 删除购物车
/// </summary>
/// <param name="shoppingCartIds"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
DelGoodsShoppingCartInfo
(
string
shoppingCartIds
,
int
tenantId
,
int
mallBaseId
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_ShoppingCart
.
Status
),
1
},
{
nameof
(
RB_Goods_ShoppingCart
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
Id
),
FiledValue
=
shoppingCartIds
,
OperatorEnum
=
OperatorEnum
.
IN
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_ShoppingCart
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
goods_ShoppingCartRepository
.
Update
(
keyValues
,
wheres
);
}
#
endregion
#
region
小程序
下单
/// <summary>
/// 获取小程序结算页面详情
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
ApiResult
GetAppletGoodsSettlementInfo
(
RB_Goods_Order_Extend
demodel
)
{
var
umodel
=
member_UserRepository
.
GetEntity
(
demodel
.
UserId
);
if
(
umodel
==
null
)
{
return
ApiResult
.
Failed
(
"用户不存在"
);
}
//获取用户的默认收货地址
var
defModel
=
member_ShippingAddressRepository
.
GetList
(
new
RB_Member_ShippingAddress_Extend
()
{
UserId
=
demodel
.
UserId
,
IsDefault
=
1
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
}).
FirstOrDefault
();
List
<
int
>
disList
=
new
List
<
int
>();
if
(
defModel
==
null
)
{
defModel
=
new
RB_Member_ShippingAddress_Extend
();
}
else
{
string
areaIds
=
(
defModel
.
Province
??
0
)
+
","
+
(
defModel
.
City
??
0
)
+
","
+
(
defModel
.
District
??
0
);
var
arealist
=
destinationRepository
.
GetDictvalueListForIds
(
areaIds
);
defModel
.
DistrictAddress
=
(
arealist
.
Where
(
x
=>
x
.
ID
==
defModel
.
Province
).
FirstOrDefault
()?.
Name
??
""
)
+
" "
+
(
arealist
.
Where
(
x
=>
x
.
ID
==
defModel
.
City
).
FirstOrDefault
()?.
Name
??
""
)
+
" "
+
(
arealist
.
Where
(
x
=>
x
.
ID
==
defModel
.
District
).
FirstOrDefault
()?.
Name
??
""
);
disList
.
Add
(
defModel
.
Province
??
0
);
disList
.
Add
(
defModel
.
City
??
0
);
disList
.
Add
(
defModel
.
District
??
0
);
}
List
<
object
>
DList
=
new
List
<
object
>();
decimal
TotalExpress
=
0
;
int
DefFreightId
=
0
;
if
(
demodel
.
DetailList
.
Any
())
{
string
GoodsIds
=
string
.
Join
(
","
,
demodel
.
DetailList
.
Select
(
x
=>
x
.
GoodsId
));
var
gList
=
goodsRepository
.
GetList
(
new
RB_Goods_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
speciList
=
goods_SpecificationRepository
.
GetList
(
new
RB_Goods_Specification_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
speciVList
=
goods_SpecificationValueRepository
.
GetList
(
new
RB_Goods_SpecificationValue_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
speciPList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
mpriceList
=
goods_MemberPriceRepository
.
GetList
(
new
RB_Goods_MemberPrice_Extend
()
{
GoodsIds
=
GoodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
List
<
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_Rules_Extend
>
rulesList
=
new
List
<
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_Rules_Extend
>();
List
<
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesPrice_Extend
>
priceList
=
new
List
<
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesPrice_Extend
>();
List
<
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesRegion_Extend
>
regionList
=
new
List
<
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesRegion_Extend
>();
if
(
gList
.
Any
()
&&
defModel
.
Id
>
0
)
{
List
<
int
>
FreightIdList
=
new
List
<
int
>();
if
(
gList
.
Where
(
x
=>
x
.
FreightId
>
0
).
Any
())
{
FreightIdList
.
AddRange
(
gList
.
Where
(
x
=>
x
.
FreightId
>
0
).
Select
(
x
=>
x
.
FreightId
??
0
).
ToList
());
}
if
(
gList
.
Where
(
x
=>
x
.
FreightId
==
0
).
Any
())
{
//查询默认
DefFreightId
=
logistics_RulesRepository
.
GetLogisticsRulesList
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_Rules_Extend
()
{
IsDefault
=
1
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
}).
FirstOrDefault
()?.
ID
??
0
;
FreightIdList
.
Add
(
DefFreightId
);
}
if
(
FreightIdList
.
Any
())
{
rulesList
=
logistics_RulesRepository
.
GetLogisticsRulesList
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_Rules_Extend
()
{
RulesIds
=
string
.
Join
(
","
,
FreightIdList
),
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
priceList
=
logistics_RulesPriceRepository
.
GetListRepository
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesPrice_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
RulesIds
=
string
.
Join
(
","
,
FreightIdList
)
});
if
(
priceList
.
Any
())
{
string
priceIds
=
string
.
Join
(
","
,
priceList
.
Select
(
x
=>
x
.
ID
));
regionList
=
logistics_RulesRegionRepository
.
GetListRepository
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesRegion_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
PriceIds
=
priceIds
});
}
}
}
foreach
(
var
item
in
demodel
.
DetailList
)
{
var
gmodel
=
gList
.
Where
(
x
=>
x
.
Id
==
item
.
GoodsId
).
FirstOrDefault
();
if
(
gmodel
==
null
||
gmodel
.
GoodsStatus
!=
1
)
{
continue
;
}
gmodel
.
CoverImage
=
""
;
if
(!
string
.
IsNullOrEmpty
(
gmodel
.
CarouselImage
)
&&
gmodel
.
CarouselImage
!=
"[]"
)
{
List
<
int
>
CarouselIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
gmodel
.
CarouselImage
);
//封面图
gmodel
.
CoverImage
=
material_InfoRepository
.
GetEntity
(
CarouselIdList
[
0
])?.
Path
??
""
;
}
int
GoodsWeight
=
gmodel
.
GoodsWeight
??
0
;
//商品重量
#
region
规格
//验证规格是否已失效
if
(
gmodel
.
IsCustomSpecification
==
1
)
{
if
(
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
continue
;
}
if
(!
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
SpecificationSort
).
Any
())
{
continue
;
}
}
else
{
if
(!
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
continue
;
}
}
//规格赋值
gmodel
.
SpecificationNameList
=
new
List
<
string
>();
if
(
string
.
IsNullOrEmpty
(
item
.
SpecificationSort
))
{
gmodel
.
SpecificationNameList
.
Add
(
"规格:"
+
gmodel
.
DefaultSpecificationName
);
}
else
{
var
KeyArr
=
item
.
SpecificationSort
.
Split
(
':'
);
for
(
var
i
=
0
;
i
<
KeyArr
.
Length
;
i
++)
{
if
(!
string
.
IsNullOrEmpty
(
KeyArr
[
i
]))
{
var
sModel
=
speciList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
).
ToList
()[
i
];
var
svModel
=
speciVList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationId
==
sModel
.
Id
&&
x
.
Sort
==
Convert
.
ToInt32
(
KeyArr
[
i
])).
FirstOrDefault
();
gmodel
.
SpecificationNameList
.
Add
(
sModel
.
Name
+
":"
+
svModel
.
Name
);
}
}
var
speciPModel
=
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
SpecificationSort
==
item
.
SpecificationSort
).
FirstOrDefault
();
gmodel
.
SellingPrice
=
speciPModel
?.
SellingPrice
??
0
;
gmodel
.
InventoryNum
=
speciPModel
?.
InventoryNum
??
0
;
GoodsWeight
=
speciPModel
?.
GoodsWeight
??
0
;
}
#
endregion
//会员价格
gmodel
.
MemberPrice
=
gmodel
.
SellingPrice
??
0
;
if
(
umodel
.
MemberGrade
>
0
)
{
if
(
gmodel
.
EnjoyMember
==
1
&&
gmodel
.
SeparateSetMember
==
1
)
{
gmodel
.
MemberPrice
=
mpriceList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
GoodsId
&&
x
.
MemberGrade
==
umodel
.
MemberGrade
&&
x
.
SpecificationSort
==
item
.
SpecificationSort
).
FirstOrDefault
()?.
MemberPrice
??
0
;
}
else
{
//求会员等级折扣
var
gradeModel
=
member_GradeRepository
.
GetList
(
new
RB_Member_Grade_Extend
()
{
Grade
=
umodel
.
MemberGrade
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
}).
FirstOrDefault
();
gmodel
.
MemberPrice
=
Math
.
Round
((
gmodel
.
SellingPrice
??
0
)
*
(
gradeModel
?.
Discount
??
10
)
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
}
}
//运费
decimal
Express
=
0
;
if
(
defModel
.
Id
>
0
)
{
int
FreightId2
=
gmodel
.
FreightId
??
0
;
if
(
gmodel
.
FreightId
==
0
)
{
FreightId2
=
DefFreightId
;
}
if
(
FreightId2
>
0
)
{
var
rulesModel
=
rulesList
.
Where
(
x
=>
x
.
ID
==
FreightId2
).
FirstOrDefault
();
List
<
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesPrice_Extend
>
priceList2
=
priceList
.
Where
(
x
=>
x
.
RulesId
==
FreightId2
).
ToList
();
if
(
priceList2
.
Any
())
{
var
priceIds
=
priceList2
.
Select
(
x
=>
x
.
ID
).
ToList
();
var
regionList2
=
regionList
.
Where
(
x
=>
priceIds
.
Contains
(
x
.
RulesPriceId
)).
ToList
();
var
regionModel
=
regionList2
.
Where
(
x
=>
disList
.
Contains
(
x
.
RegionId
)).
FirstOrDefault
();
if
(
regionModel
!=
null
)
{
var
pmodel
=
priceList2
.
Where
(
x
=>
x
.
ID
==
regionModel
.
RulesPriceId
).
FirstOrDefault
();
if
(
pmodel
!=
null
&&
rulesModel
!=
null
)
{
if
(
rulesModel
.
ChargeMode
==
Common
.
Enum
.
MallBase
.
ChargeModeEnum
.
Num
)
{
//按件计费
if
(
item
.
Number
<=
pmodel
.
First
)
{
Express
=
pmodel
.
FirstPrice
;
}
else
{
if
(
pmodel
.
Second
>
0
)
{
if
(((
item
.
Number
??
0
)
-
pmodel
.
First
)
%
pmodel
.
Second
==
0
)
{
Express
=
pmodel
.
FirstPrice
+
(((
item
.
Number
??
0
)
-
pmodel
.
First
)
/
pmodel
.
Second
)
*
pmodel
.
SecondPrice
;
}
else
{
Express
=
pmodel
.
FirstPrice
+
(((
item
.
Number
??
0
)
-
pmodel
.
First
)
/
pmodel
.
Second
+
1
)
*
pmodel
.
SecondPrice
;
}
}
else
{
Express
=
pmodel
.
FirstPrice
;
}
}
}
else
{
//重量计费
int
TotalW
=
(
item
.
Number
??
0
)
*
GoodsWeight
;
if
(
TotalW
<=
pmodel
.
First
)
{
Express
=
pmodel
.
FirstPrice
;
}
else
{
if
(
pmodel
.
Second
>
0
)
{
if
((
TotalW
-
pmodel
.
First
)
%
pmodel
.
Second
==
0
)
{
Express
=
pmodel
.
FirstPrice
+
((
TotalW
-
pmodel
.
First
)
/
pmodel
.
Second
)
*
pmodel
.
SecondPrice
;
}
else
{
Express
=
pmodel
.
FirstPrice
+
((
TotalW
-
pmodel
.
First
)
/
pmodel
.
Second
+
1
)
*
pmodel
.
SecondPrice
;
}
}
else
{
Express
=
pmodel
.
FirstPrice
;
}
}
}
}
}
}
}
}
DList
.
Add
(
new
{
item
.
GoodsId
,
GoodsName
=
gmodel
.
Name
,
gmodel
.
CoverImage
,
SpecificationList
=
gmodel
.
SpecificationNameList
,
item
.
Number
,
SellingPrice
=
(
gmodel
.
SellingPrice
??
0
)
*
(
item
.
Number
??
0
),
MemberPrice
=
gmodel
.
MemberPrice
*
(
item
.
Number
??
0
),
MemberDiscount
=
gmodel
.
MemberPrice
*
(
item
.
Number
??
0
)
-
(
gmodel
.
SellingPrice
??
0
)
*
(
item
.
Number
??
0
),
Express
});
TotalExpress
+=
Express
;
}
}
return
ApiResult
.
Success
(
""
,
new
{
ShippingAddressModel
=
new
{
defModel
.
Id
,
defModel
.
Name
,
defModel
.
Mobile
,
defModel
.
DistrictAddress
,
defModel
.
Address
,
defModel
.
Province
,
defModel
.
City
,
defModel
.
District
},
DetailList
=
DList
,
TotalExpress
,
umodel
.
MemberGrade
,
Level_Show
=
umodel
.
MemberGrade
>
0
?
1
:
2
});
}
#
endregion
#
region
订单管理
...
...
Mall.Module.Product/ProductModule.cs
View file @
68a0e950
...
...
@@ -123,6 +123,10 @@ namespace Mall.Module.Product
/// 收货地址
/// </summary>
private
readonly
RB_Member_ShippingAddressRepository
member_ShippingAddressRepository
=
new
RB_Member_ShippingAddressRepository
();
/// <summary>
/// 订单商品
/// </summary>
private
readonly
RB_Goods_OrderRepository
goods_OrderRepository
=
new
RB_Goods_OrderRepository
();
...
...
@@ -165,6 +169,104 @@ namespace Mall.Module.Product
return
list
;
}
/// <summary>
/// 获取商品推荐列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="RecommendStatus"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Goods_Extend
>
GetAppletGoodsRecommendList
(
int
pageIndex
,
int
pageSize
,
out
int
RecommendStatus
,
RB_Goods_Extend
demodel
)
{
var
rmodel
=
product_RecommendRepository
.
GetList
(
new
RB_Product_Recommend_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
}).
FirstOrDefault
();
RecommendStatus
=
2
;
if
(
rmodel
==
null
)
{
return
new
List
<
RB_Goods_Extend
>();
}
pageSize
=
rmodel
.
DetailRecommendNum
??
0
;
if
(
demodel
.
RecommendType
==
1
)
{
RecommendStatus
=
rmodel
.
DetailRecommendStatus
??
2
;
if
(
rmodel
.
DetailRecommendStatus
!=
1
)
{
return
new
List
<
RB_Goods_Extend
>();
}
}
else
if
(
demodel
.
RecommendType
==
2
)
{
RecommendStatus
=
rmodel
.
OrderCompleteStatus
??
2
;
if
(
rmodel
.
OrderCompleteStatus
!=
1
)
{
return
new
List
<
RB_Goods_Extend
>();
}
if
(
rmodel
.
IsOrderRecommend
==
1
)
{
pageSize
=
20
;
if
(!
string
.
IsNullOrEmpty
(
rmodel
.
OrderProductIds
))
{
demodel
.
GoodsIds
=
rmodel
.
OrderProductIds
;
}
}
}
else
if
(
demodel
.
RecommendType
==
3
)
{
RecommendStatus
=
rmodel
.
CommentRecommentStatus
??
2
;
if
(
rmodel
.
CommentRecommentStatus
!=
1
)
{
return
new
List
<
RB_Goods_Extend
>();
}
if
(
rmodel
.
IsCommentRecommend
==
1
)
{
pageSize
=
20
;
if
(!
string
.
IsNullOrEmpty
(
rmodel
.
CommentProductIds
))
{
demodel
.
GoodsIds
=
rmodel
.
CommentProductIds
;
}
}
}
var
list
=
goodsRepository
.
GetAppletGoodsPageList
(
pageIndex
,
pageSize
,
out
long
count
,
demodel
);
List
<
RB_Goods_Extend
>
RList
=
list
;
if
(
list
.
Any
())
{
if
(
demodel
.
RecommendType
==
2
&&
rmodel
.
IsOrderRecommend
==
1
&&
!
string
.
IsNullOrEmpty
(
rmodel
.
OrderProductIds
))
{
List
<
int
>
gidList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
rmodel
.
OrderProductIds
);
var
gList
=
gidList
.
Where
(
x
=>
list
.
Select
(
y
=>
y
.
Id
).
Contains
(
x
)).
Take
(
10
).
ToList
();
if
(
gList
.
Any
())
{
RList
=
new
List
<
RB_Goods_Extend
>();
foreach
(
var
item
in
gList
)
{
RList
.
Add
(
list
.
Where
(
x
=>
x
.
Id
==
item
).
FirstOrDefault
());
}
}
}
else
if
(
demodel
.
RecommendType
==
3
&&
rmodel
.
IsCommentRecommend
==
1
&&
!
string
.
IsNullOrEmpty
(
rmodel
.
CommentProductIds
))
{
List
<
int
>
gidList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
rmodel
.
CommentProductIds
);
var
gList
=
gidList
.
Where
(
x
=>
list
.
Select
(
y
=>
y
.
Id
).
Contains
(
x
)).
Take
(
10
).
ToList
();
if
(
gList
.
Any
())
{
RList
=
new
List
<
RB_Goods_Extend
>();
foreach
(
var
item
in
gList
)
{
RList
.
Add
(
list
.
Where
(
x
=>
x
.
Id
==
item
).
FirstOrDefault
());
}
}
}
foreach
(
var
item
in
RList
)
{
item
.
CoverImage
=
""
;
if
(!
string
.
IsNullOrEmpty
(
item
.
CarouselImage
)
&&
item
.
CarouselImage
!=
"[]"
)
{
List
<
int
>
CarouselIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
item
.
CarouselImage
);
//封面图
item
.
CoverImage
=
material_InfoRepository
.
GetEntity
(
CarouselIdList
[
0
])?.
Path
??
""
;
}
}
}
return
RList
;
}
/// <summary>
/// 获取小程序商品详情
/// </summary>
...
...
@@ -184,6 +286,9 @@ namespace Mall.Module.Product
model
.
MallName
=
programRepository
.
GetEntity
(
model
.
MallBaseId
)?.
MallName
??
""
;
#
region
基本信息
//查询分类
model
.
CategoryList
=
goods_CategoryRepository
.
GetList
(
new
RB_Goods_Category_Extend
()
{
GoodsId
=
goodsId
,
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
});
//最大售价
decimal
MaxSellMoney
=
model
.
SellingPrice
??
0
;
model
.
SpecificationList
=
new
List
<
RB_Goods_Specification_Extend
>();
model
.
SpecificationPriceList
=
new
List
<
RB_Goods_SpecificationPrice_Extend
>();
...
...
@@ -336,24 +441,62 @@ namespace Mall.Module.Product
model
.
FreightName
=
"默认运费"
;
}
model
.
Express
=
0
;
if
(
UserId
>
0
&&
model
.
FreightId
>
0
)
{
var
samodel
=
member_ShippingAddressRepository
.
GetList
(
new
RB_Member_ShippingAddress_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
UserId
=
UserId
,
IsDefault
=
1
}).
FirstOrDefault
();
var
priceList
=
logistics_RulesPriceRepository
.
GetListRepository
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesPrice_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
RulesId
=
model
.
FreightId
??
0
});
if
(
priceList
.
Any
()
&&
samodel
!=
null
)
{
string
priceIds
=
string
.
Join
(
","
,
priceList
.
Select
(
x
=>
x
.
ID
));
var
regionList
=
logistics_RulesRegionRepository
.
GetListRepository
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesRegion_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
PriceIds
=
priceIds
});
List
<
int
>
disList
=
new
List
<
int
>();
disList
.
Add
(
samodel
.
Province
??
0
);
disList
.
Add
(
samodel
.
City
??
0
);
disList
.
Add
(
samodel
.
District
??
0
);
var
regionModel
=
regionList
.
Where
(
x
=>
disList
.
Contains
(
x
.
RegionId
)).
FirstOrDefault
();
if
(
regionModel
!=
null
)
{
var
pmodel
=
priceList
.
Where
(
x
=>
x
.
ID
==
regionModel
.
RulesPriceId
).
FirstOrDefault
();
if
(
pmodel
!=
null
&&
rulesModel
!=
null
)
if
(
UserId
>
0
&&
model
.
FreightId
>=
0
)
{
int
FreightId
=
0
;
if
(
model
.
FreightId
==
0
)
{
//查询默认
FreightId
=
logistics_RulesRepository
.
GetLogisticsRulesList
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_Rules_Extend
()
{
IsDefault
=
1
,
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
}).
FirstOrDefault
()?.
ID
??
0
;
}
if
(
FreightId
>
0
)
{
var
samodel
=
member_ShippingAddressRepository
.
GetList
(
new
RB_Member_ShippingAddress_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
UserId
=
UserId
,
IsDefault
=
1
}).
FirstOrDefault
();
List
<
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesPrice_Extend
>
priceList
=
logistics_RulesPriceRepository
.
GetListRepository
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesPrice_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
RulesId
=
FreightId
});
if
(
priceList
.
Any
()
&&
samodel
!=
null
)
{
string
priceIds
=
string
.
Join
(
","
,
priceList
.
Select
(
x
=>
x
.
ID
));
var
regionList
=
logistics_RulesRegionRepository
.
GetListRepository
(
new
Model
.
Extend
.
BaseSetUp
.
RB_Logistics_RulesRegion_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
,
PriceIds
=
priceIds
});
List
<
int
>
disList
=
new
List
<
int
>();
disList
.
Add
(
samodel
.
Province
??
0
);
disList
.
Add
(
samodel
.
City
??
0
);
disList
.
Add
(
samodel
.
District
??
0
);
var
regionModel
=
regionList
.
Where
(
x
=>
disList
.
Contains
(
x
.
RegionId
)).
FirstOrDefault
();
if
(
regionModel
!=
null
)
{
if
(
rulesModel
.
ChargeMode
==
Common
.
Enum
.
MallBase
.
ChargeModeEnum
.
Num
)
var
pmodel
=
priceList
.
Where
(
x
=>
x
.
ID
==
regionModel
.
RulesPriceId
).
FirstOrDefault
();
if
(
pmodel
!=
null
&&
rulesModel
!=
null
)
{
model
.
Express
=
pmodel
.
FirstPrice
;
if
(
rulesModel
.
ChargeMode
==
Common
.
Enum
.
MallBase
.
ChargeModeEnum
.
Num
)
{
model
.
Express
=
pmodel
.
FirstPrice
;
}
else
{
//重量计费
int
TotalW
=
model
.
GoodsWeight
??
0
;
if
(
TotalW
<=
pmodel
.
First
)
{
model
.
Express
=
pmodel
.
FirstPrice
;
}
else
{
if
(
pmodel
.
Second
>
0
)
{
if
((
TotalW
-
pmodel
.
First
)
%
pmodel
.
Second
==
0
)
{
model
.
Express
=
pmodel
.
FirstPrice
+
((
TotalW
-
pmodel
.
First
)
/
pmodel
.
Second
)
*
pmodel
.
SecondPrice
;
}
else
{
model
.
Express
=
pmodel
.
FirstPrice
+
((
TotalW
-
pmodel
.
First
)
/
pmodel
.
Second
+
1
)
*
pmodel
.
SecondPrice
;
}
}
else
{
model
.
Express
=
pmodel
.
FirstPrice
;
}
}
}
}
}
}
...
...
@@ -423,6 +566,116 @@ namespace Mall.Module.Product
#
endregion
return
model
;
}
/// <summary>
/// 获取小程序商品视频分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Goods_Extend
>
GetAppletGoodsVideoPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Goods_Extend
demodel
)
{
var
list
=
goodsRepository
.
GetAppletGoodsPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
if
(
list
.
Any
())
{
List
<
int
>
MaterialIds
=
new
List
<
int
>();
foreach
(
var
item
in
list
)
{
if
(!
string
.
IsNullOrEmpty
(
item
.
CarouselImage
)
&&
item
.
CarouselImage
!=
"[]"
)
{
List
<
int
>
CarouselIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
item
.
CarouselImage
);
MaterialIds
.
AddRange
(
CarouselIdList
);
}
}
List
<
RB_Material_Info_Extend
>
MaterialList
=
new
List
<
RB_Material_Info_Extend
>();
string
goodsIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
var
categoryList
=
goods_CategoryRepository
.
GetList
(
new
RB_Goods_Category_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
speciList
=
goods_SpecificationRepository
.
GetList
(
new
RB_Goods_Specification_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
var
speciVList
=
goods_SpecificationValueRepository
.
GetList
(
new
RB_Goods_SpecificationValue_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
if
(
speciVList
.
Any
())
{
MaterialIds
.
AddRange
(
speciVList
.
Where
(
x
=>
x
.
Image
>
0
).
Select
(
x
=>
x
.
Image
??
0
));
}
if
(
MaterialIds
.
Any
())
{
MaterialList
=
material_InfoRepository
.
GetList
(
new
RB_Material_Info_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
MaterialIds
=
string
.
Join
(
","
,
MaterialIds
)
});
}
var
speciPList
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
List
<
RB_Goods_Order_Extend
>
orderlist
=
goods_OrderRepository
.
GetGoodsOrderNum
(
goodsIds
:
goodsIds
);
foreach
(
var
item
in
list
)
{
item
.
CoverImage
=
""
;
item
.
CarouselImageList
=
new
List
<
RB_ImageCommonModel
>();
if
(!
string
.
IsNullOrEmpty
(
item
.
CarouselImage
)
&&
item
.
CarouselImage
!=
"[]"
)
{
List
<
int
>
CarouselIdList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
item
.
CarouselImage
);
//封面图
item
.
CoverImage
=
MaterialList
.
Where
(
x
=>
x
.
Id
==
CarouselIdList
[
0
]).
FirstOrDefault
()?.
Path
??
""
;
item
.
CarouselImageList
=
MaterialList
.
Where
(
x
=>
x
.
Id
!=
CarouselIdList
[
0
]).
Select
(
x
=>
new
RB_ImageCommonModel
()
{
Id
=
x
.
Id
,
Name
=
x
.
Name
,
Path
=
x
.
Path
}).
ToList
();
}
#
region
基本信息
//查询分类
item
.
CategoryList
=
categoryList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
//最大售价
decimal
MaxSellMoney
=
item
.
SellingPrice
??
0
;
item
.
SpecificationList
=
new
List
<
RB_Goods_Specification_Extend
>();
item
.
SpecificationPriceList
=
new
List
<
RB_Goods_SpecificationPrice_Extend
>();
if
(
item
.
IsCustomSpecification
==
1
)
{
item
.
SpecificationList
=
speciList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
if
(
item
.
SpecificationList
.
Any
())
{
var
svlist
=
speciVList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
if
(
svlist
.
Where
(
x
=>
x
.
Image
>
0
).
Any
())
{
var
imgIds
=
svlist
.
Where
(
x
=>
x
.
Image
>
0
).
Select
(
x
=>
x
.
Image
??
0
).
Distinct
().
ToList
();
var
mlist
=
MaterialList
.
Where
(
x
=>
imgIds
.
Contains
(
x
.
Id
)).
ToList
();
foreach
(
var
qitem
in
svlist
.
Where
(
x
=>
x
.
Image
>
0
))
{
qitem
.
ImagePath
=
mlist
.
Where
(
x
=>
x
.
Id
==
qitem
.
Image
).
FirstOrDefault
()?.
Path
??
""
;
}
}
foreach
(
var
qitem
in
item
.
SpecificationList
)
{
qitem
.
SpecificationValueList
=
svlist
.
Where
(
x
=>
x
.
SpecificationId
==
qitem
.
Id
).
ToList
();
}
}
item
.
SpecificationPriceList
=
speciPList
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
MaxSellMoney
=
item
.
SpecificationPriceList
.
Max
(
x
=>
x
.
SellingPrice
??
0
);
}
if
(
item
.
CustomShareImage
>
0
)
{
item
.
CustomShareImagePath
=
material_InfoRepository
.
GetEntity
(
item
.
CustomShareImage
)?.
Path
??
""
;
}
#
endregion
item
.
SalesNum
+=
(
orderlist
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
FirstOrDefault
()?.
OrderNum
??
0
);
}
}
return
list
;
}
/// <summary>
/// 获取商品详情 订单相关统计
/// </summary>
/// <param name="payment_amount"></param>
/// <param name="payment_num"></param>
/// <param name="payment_order"></param>
/// <param name="payment_people"></param>
/// <param name="goodsId"></param>
public
void
GetGoodsOrderPeopleInfo
(
out
decimal
payment_amount
,
out
int
payment_num
,
out
int
payment_order
,
out
int
payment_people
,
int
goodsId
)
{
goods_OrderRepository
.
GetGoodsOrderPeopleInfo
(
out
payment_amount
,
out
payment_num
,
out
payment_order
,
out
payment_people
,
goodsId
);
}
#
endregion
...
...
Mall.Repository/BaseSetUp/RB_Logistics_RulesRepository.cs
View file @
68a0e950
...
...
@@ -71,7 +71,7 @@ namespace Mall.Repository.BaseSetUp
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Logistics_Rules_Extend
.
TenantId
)}
=
{
query
.
TenantId
}
"
);
}
if
(
query
.
Tenant
Id
>
0
)
if
(
query
.
MallBase
Id
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Logistics_Rules_Extend
.
MallBaseId
)}
=
{
query
.
MallBaseId
}
"
);
}
...
...
@@ -83,6 +83,12 @@ namespace Mall.Repository.BaseSetUp
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Logistics_Rules_Extend
.
RulesType
)}
=
{(
int
)
query
.
RulesType
}
"
);
}
if
(
query
.
IsDefault
>
0
)
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Logistics_Rules_Extend
.
IsDefault
)}
=
{
query
.
IsDefault
}
"
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
RulesIds
))
{
builder
.
Append
(
$" AND
{
nameof
(
RB_Logistics_Rules_Extend
.
ID
)}
in(
{
query
.
RulesIds
}
)"
);
}
}
return
Get
<
RB_Logistics_Rules_Extend
>(
builder
.
ToString
()).
ToList
();
}
...
...
Mall.Repository/Product/RB_GoodsRepository.cs
View file @
68a0e950
...
...
@@ -190,6 +190,22 @@ where {where} group by g.Id order by g.CreateDate desc";
//销量高-低
orderBy
=
$" order by g.
{
nameof
(
RB_Goods_Extend
.
SalesNum
)}
desc"
;
}
if
(
dmodel
.
IsSelectVideo
==
1
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
VideoAddress
)}
!=''"
;
}
if
(
dmodel
.
GoodsId
>
0
)
{
if
(
dmodel
.
SelectVideoDirection
==
1
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
Id
)}
>=
{
dmodel
.
Id
}
"
;
orderBy
=
$" order by g.
{
nameof
(
RB_Goods_Extend
.
Id
)}
asc"
;
}
else
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
Id
)}
<=
{
dmodel
.
Id
}
"
;
orderBy
=
$" order by g.
{
nameof
(
RB_Goods_Extend
.
Id
)}
desc"
;
}
}
string
sql
=
$@"select g.* from RB_Goods g
inner join rb_goods_category c on g.Id=c.GoodsId
...
...
Mall.Repository/Product/RB_Goods_OrderRepository.cs
View file @
68a0e950
...
...
@@ -304,6 +304,63 @@ where {where} group by o.OrderId order by o.CreateDate desc";
return
Execute
(
sql
)
>
0
;
}
/// <summary>
/// 根据商品id 获取其订单相关统计
/// </summary>
/// <param name="payment_amount"></param>
/// <param name="payment_num"></param>
/// <param name="payment_order"></param>
/// <param name="payment_people"></param>
/// <param name="goodsId"></param>
public
void
GetGoodsOrderPeopleInfo
(
out
decimal
payment_amount
,
out
int
payment_num
,
out
int
payment_order
,
out
int
payment_people
,
int
goodsId
)
{
payment_amount
=
0
;
payment_num
=
payment_order
=
payment_people
=
0
;
string
sql1
=
$@"SELECT SUM(t.Income) as Income,COUNT(0) as OrderNum FROM(
SELECT o.OrderId,o.Income FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId=
{
goodsId
}
and o.`Status`=0 and o.OrderStatus <> 7 GROUP BY o.OrderId)t"
;
string
sql2
=
$@"
SELECT SUM(od.Number) as GoodsNum FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId=
{
goodsId
}
and o.`Status`=0 and o.OrderStatus <> 7"
;
string
sql3
=
$@"SELECT COUNT(UserId) AS OrderNum FROM(
SELECT o.UserId FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId=
{
goodsId
}
and o.`Status`=0 and o.OrderStatus <> 7 GROUP BY o.UserId)t"
;
var
model1
=
Get
<
RB_Goods_Order_Extend
>(
sql1
).
FirstOrDefault
();
var
model2
=
Get
<
RB_Goods_Order_Extend
>(
sql2
).
FirstOrDefault
();
var
model3
=
Get
<
RB_Goods_Order_Extend
>(
sql3
).
FirstOrDefault
();
if
(
model1
!=
null
)
{
payment_amount
=
model1
.
Income
??
0
;
payment_order
=
model1
.
OrderNum
??
0
;
}
if
(
model2
!=
null
)
{
payment_num
=
model2
.
OrderNum
??
0
;
}
if
(
model3
!=
null
)
{
payment_people
=
model3
.
OrderNum
??
0
;
}
}
/// <summary>
/// 根据商品ids 获取商品的订单销量
/// </summary>
/// <param name="goodsIds"></param>
/// <returns></returns>
public
List
<
RB_Goods_Order_Extend
>
GetGoodsOrderNum
(
string
goodsIds
)
{
string
sql2
=
$@"
SELECT od.GoodsId ,SUM(od.Number) as GoodsNum FROM rb_goods_order o
INNER JOIN rb_goods_orderdetail od on o.OrderId=od.OrderId
WHERE od.GoodsId in(
{
goodsIds
}
) and o.`Status`=0 and o.OrderStatus <> 7 group by od.GoodsId"
;
return
Get
<
RB_Goods_Order_Extend
>(
sql2
).
ToList
();
}
#
region
数据统计
-
数据概况
...
...
@@ -541,7 +598,6 @@ as t GROUP BY t.CreateDate desc";
return
GetPage
<
DataStatistics_Query
>(
pageIndex
,
pageSize
,
out
count
,
sql
).
ToList
();
}
/// <summary>
/// 销售统计导出
/// </summary>
...
...
Mall.Repository/Product/RB_Goods_ShoppingCartRepository.cs
0 → 100644
View file @
68a0e950
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.Product
;
using
Mall.Model.Extend.Product
;
using
System.Linq
;
namespace
Mall.Repository.Product
{
/// <summary>
/// 商品购物车仓储层
/// </summary>
public
class
RB_Goods_ShoppingCartRepository
:
RepositoryBase
<
RB_Goods_ShoppingCart
>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Goods_ShoppingCart_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Goods_Extend
dmodel
)
{
string
where
=
$" 1=1 and sc.
{
nameof
(
RB_Goods_ShoppingCart
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and sc.
{
nameof
(
RB_Goods_ShoppingCart
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and sc.
{
nameof
(
RB_Goods_ShoppingCart
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$@" and sc.
{
nameof
(
RB_Goods_ShoppingCart
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
GoodsIds
))
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
Id
)}
in(
{
dmodel
.
GoodsIds
}
)"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(
dmodel
.
GoodsStatus
>
0
)
{
where
+=
$@" and g.
{
nameof
(
RB_Goods_Extend
.
GoodsStatus
)}
=
{
dmodel
.
GoodsStatus
}
"
;
}
string
sql
=
$@"select sc.*,g.Name,g.GoodsStatus,g.CarouselImage,g.SellingPrice as Price,g.IsCustomSpecification,g.DefaultSpecificationName,
g.EnjoyMember,g.SeparateSetMember,g.InventoryNum from RB_Goods_ShoppingCart sc
inner join RB_Goods g on sc.GoodsId=g.Id
where
{
where
}
order by g.GoodsStatus asc,sc.CreateDate desc"
;
return
GetPage
<
RB_Goods_ShoppingCart_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
public
List
<
RB_Goods_ShoppingCart_Extend
>
GetList
(
RB_Goods_ShoppingCart_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Goods_ShoppingCart
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Goods_ShoppingCart
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Goods_ShoppingCart
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Goods_ShoppingCart
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(
dmodel
.
GoodsId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Goods_ShoppingCart
.
GoodsId
)}
=
{
dmodel
.
GoodsId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
SpecificationSort
))
{
where
+=
$@" and
{
nameof
(
RB_Goods_ShoppingCart
.
SpecificationSort
)}
='
{
dmodel
.
SpecificationSort
}
'"
;
}
string
sql
=
$@"SELECT * FROM RB_Goods_ShoppingCart where
{
where
}
order by Id asc"
;
return
Get
<
RB_Goods_ShoppingCart_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/Product/RB_Goods_SpecificationRepository.cs
View file @
68a0e950
...
...
@@ -37,7 +37,7 @@ namespace Mall.Repository.Product
where
+=
$@" and
{
nameof
(
RB_Goods_Specification
.
GoodsId
)}
in(
{
dmodel
.
GoodsIds
}
)"
;
}
string
sql
=
$@"select * from RB_Goods_Specification where
{
where
}
order by Id
de
sc"
;
string
sql
=
$@"select * from RB_Goods_Specification where
{
where
}
order by Id
a
sc"
;
return
Get
<
RB_Goods_Specification_Extend
>(
sql
).
ToList
();
}
}
...
...
Mall.Repository/Product/RB_Goods_SpecificationValueRepository.cs
View file @
68a0e950
...
...
@@ -40,7 +40,7 @@ namespace Mall.Repository.Product
where
+=
$@" and
{
nameof
(
RB_Goods_SpecificationValue
.
GoodsId
)}
in(
{
dmodel
.
GoodsIds
}
)"
;
}
string
sql
=
$@"select * from RB_Goods_SpecificationValue where
{
where
}
order by Id
de
sc"
;
string
sql
=
$@"select * from RB_Goods_SpecificationValue where
{
where
}
order by Id
a
sc"
;
return
Get
<
RB_Goods_SpecificationValue_Extend
>(
sql
).
ToList
();
}
}
...
...
Mall.WebApi/Controllers/Product/AppletGoodsController.cs
View file @
68a0e950
...
...
@@ -143,6 +143,7 @@ namespace Mall.WebApi.Controllers.MallBase
x
.
Name
,
x
.
Sort
,
x
.
CoverImage
,
x
.
VideoAddress
,
x
.
SellingPrice
,
x
.
SalesNum
,
x
.
IsQuickBuy
,
...
...
@@ -169,25 +170,34 @@ namespace Mall.WebApi.Controllers.MallBase
}
int
UserId
=
prams
.
GetInt
(
"UserId"
,
0
);
RB_Member_User_Extend
userModel
=
new
RB_Member_User_Extend
();
List
<
RB_Member_Grade_Extend
>
memeberList
=
new
List
<
RB_Member_Grade_Extend
>();
if
(
UserId
>
0
)
{
userModel
=
productModule
.
GetMemberUserInfo
(
UserId
);
if
(
userModel
.
MemberGrade
>
0
)
{
memeberList
=
productModule
.
GetMemberGradeList
(
new
RB_Member_Grade_Extend
()
{
TenantId
=
req
.
TenantId
,
MallBaseId
=
req
.
MallBaseId
});
}
}
RB_Goods_Extend
model
=
productModule
.
GetAppletGoodsInfo
(
GoodsId
,
UserId
,
req
.
TenantId
,
req
.
MallBaseId
);
#
region
组装价格
List
<
object
>
priceList
=
new
List
<
object
>();
if
(
model
.
IsCustomSpecification
==
1
)
{
if
(
model
.
SpecificationPriceList
.
Any
()
&&
model
.
SpecificationList
.
Any
())
{
foreach
(
var
item
in
model
.
SpecificationPriceList
)
{
if
(
model
.
IsCustomSpecification
==
1
)
{
if
(
model
.
SpecificationPriceList
.
Any
()
&&
model
.
SpecificationList
.
Any
())
{
foreach
(
var
item
in
model
.
SpecificationPriceList
)
{
var
ssarr
=
item
.
SpecificationSort
.
Split
(
':'
);
int
Sort
=
Convert
.
ToInt32
(
ssarr
[
0
]);
string
pic_url
=
model
.
SpecificationList
[
0
].
SpecificationValueList
.
Where
(
x
=>
x
.
Sort
==
Sort
).
FirstOrDefault
()?.
ImagePath
;
List
<
object
>
attr_list
=
new
List
<
object
>();
for
(
int
i
=
0
;
i
<
ssarr
.
Length
;
i
++)
{
for
(
int
i
=
0
;
i
<
ssarr
.
Length
;
i
++)
{
var
smodel
=
model
.
SpecificationList
[
i
];
var
svmodel
=
smodel
.
SpecificationValueList
.
Where
(
x
=>
x
.
Sort
==
Convert
.
ToInt32
(
ssarr
[
i
])).
FirstOrDefault
();
attr_list
.
Add
(
new
{
attr_list
.
Add
(
new
{
attr_group_name
=
smodel
.
Name
,
attr_group_id
=
smodel
.
Sort
,
attr_id
=
svmodel
.
Id
,
...
...
@@ -196,21 +206,52 @@ namespace Mall.WebApi.Controllers.MallBase
}
decimal
price_member
=
item
.
SellingPrice
??
0
;
//未设会员价格的话 就为销售价格
List
<
object
>
member_price_list
=
new
List
<
object
>();
if
(
model
.
EnjoyMember
==
1
&&
model
.
SeparateSetMember
==
1
&&
UserId
>
0
&&
userModel
.
MemberGrade
>
0
)
{
if
(
model
.
MemberPriceList
.
Any
())
{
if
(
model
.
EnjoyMember
==
1
&&
model
.
SeparateSetMember
==
1
)
{
if
(
model
.
MemberPriceList
.
Any
())
{
var
mlist
=
model
.
MemberPriceList
.
Where
(
x
=>
x
.
SpecificationSort
==
item
.
SpecificationSort
).
ToList
();
foreach
(
var
qitem
in
mlist
)
{
member_price_list
.
Add
(
new
{
foreach
(
var
qitem
in
mlist
)
{
member_price_list
.
Add
(
new
{
member_grade
=
qitem
.
MemberGrade
,
member_price
=
qitem
.
MemberPrice
member_price
=
qitem
.
MemberPrice
});
if
(
qitem
.
MemberGrade
==
userModel
.
MemberGrade
)
{
price_member
=
qitem
.
MemberPrice
??
0
;
}
}
if
(
UserId
>
0
&&
userModel
.
MemberGrade
>
0
)
{
var
gmodel
=
mlist
.
Where
(
x
=>
x
.
MemberGrade
==
userModel
.
MemberGrade
).
FirstOrDefault
();
price_member
=
gmodel
.
MemberPrice
??
0
;
}
else
{
price_member
=
mlist
.
Max
(
x
=>
x
.
MemberPrice
??
0
);
}
}
}
priceList
.
Add
(
new
{
else
{
//根据会员等级查找会员价格
foreach
(
var
qitem
in
memeberList
)
{
var
mprice
=
Math
.
Round
((
item
.
SellingPrice
??
0
)
*
(
qitem
.
Discount
??
0
)
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
member_price_list
.
Add
(
new
{
member_grade
=
qitem
.
Grade
,
member_price
=
mprice
});
}
if
(
UserId
>
0
&&
userModel
.
MemberGrade
>
0
&&
memeberList
.
Any
())
{
var
gmodel
=
memeberList
.
Where
(
x
=>
x
.
Grade
==
userModel
.
MemberGrade
).
FirstOrDefault
();
price_member
=
Math
.
Round
((
model
.
SellingPrice
??
0
)
*
(
gmodel
?.
Discount
??
10
)
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
}
else
if
(
memeberList
.
Any
())
{
price_member
=
Math
.
Round
((
model
.
SellingPrice
??
0
)
*
(
memeberList
.
Max
(
x
=>
x
.
Discount
)
??
10
)
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
}
}
priceList
.
Add
(
new
{
id
=
item
.
Id
,
goods_id
=
model
.
Id
,
sign_id
=
item
.
SpecificationSort
,
...
...
@@ -227,6 +268,78 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
}
else
{
decimal
price_member
=
model
.
SellingPrice
??
0
;
//未设会员价格的话 就为销售价格
List
<
object
>
member_price_list
=
new
List
<
object
>();
if
(
model
.
EnjoyMember
==
1
&&
model
.
SeparateSetMember
==
1
)
{
if
(
model
.
MemberPriceList
.
Any
())
{
var
mlist
=
model
.
MemberPriceList
;
foreach
(
var
qitem
in
mlist
)
{
member_price_list
.
Add
(
new
{
member_grade
=
qitem
.
MemberGrade
,
member_price
=
qitem
.
MemberPrice
});
}
if
(
UserId
>
0
&&
userModel
.
MemberGrade
>
0
)
{
var
gmodel
=
mlist
.
Where
(
x
=>
x
.
MemberGrade
==
userModel
.
MemberGrade
).
FirstOrDefault
();
price_member
=
gmodel
.
MemberPrice
??
0
;
}
else
{
price_member
=
mlist
.
Max
(
x
=>
x
.
MemberPrice
??
0
);
}
}
}
else
{
//根据会员等级查找会员价格
foreach
(
var
qitem
in
memeberList
)
{
var
mprice
=
Math
.
Round
((
model
.
SellingPrice
??
0
)
*
(
qitem
.
Discount
??
10
)
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
member_price_list
.
Add
(
new
{
member_grade
=
qitem
.
Grade
,
member_price
=
mprice
});
}
if
(
UserId
>
0
&&
userModel
.
MemberGrade
>
0
&&
memeberList
.
Any
())
{
var
gmodel
=
memeberList
.
Where
(
x
=>
x
.
Grade
==
userModel
.
MemberGrade
).
FirstOrDefault
();
price_member
=
Math
.
Round
((
model
.
SellingPrice
??
0
)
*
(
gmodel
?.
Discount
??
10
)
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
}
else
if
(
memeberList
.
Any
())
{
price_member
=
Math
.
Round
((
model
.
SellingPrice
??
0
)
*
(
memeberList
.
Max
(
x
=>
x
.
Discount
)
??
10
)
/
10
,
2
,
MidpointRounding
.
AwayFromZero
);
}
}
priceList
.
Add
(
new
{
id
=
0
,
goods_id
=
model
.
Id
,
sign_id
=
""
,
stock
=
model
.
InventoryNum
,
price
=
model
.
SellingPrice
??
0
,
no
=
model
.
GoodsNumbers
,
weight
=
model
.
GoodsWeight
,
pic_url
=
""
,
is_delete
=
0
,
attr_list
=
new
{
attr_group_name
=
"规格"
,
attr_group_id
=
0
,
attr_id
=
0
,
attr_name
=
model
.
DefaultSpecificationName
},
price_member
,
member_price_list
});
}
#
endregion
#
region
赠送积分
int
Integral
=
0
;
...
...
@@ -250,7 +363,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
else
{
var
memeberList
=
productModule
.
GetMemberGradeList
(
new
RB_Member_Grade_Extend
()
{
TenantId
=
req
.
TenantId
,
MallBaseId
=
req
.
MallBaseId
});
if
(
model
.
IsCustomSpecification
==
1
)
{
price_member_min
=
price_min
=
model
.
SpecificationPriceList
.
Min
(
x
=>
x
.
SellingPrice
??
0
);
...
...
@@ -283,6 +396,12 @@ namespace Mall.WebApi.Controllers.MallBase
price_min
=
Math
.
Round
(
price_min
,
2
,
MidpointRounding
.
AwayFromZero
);
price_max
=
Math
.
Round
(
price_max
,
2
,
MidpointRounding
.
AwayFromZero
);
#
endregion
#
region
订单信息
int
payment_people
=
0
,
payment_num
=
0
,
payment_order
=
0
;
//订单用户 商品数量 订单数量
decimal
payment_amount
=
0
;
//订单总金额
productModule
.
GetGoodsOrderPeopleInfo
(
out
payment_amount
,
out
payment_num
,
out
payment_order
,
out
payment_people
,
GoodsId
);
#
endregion
return
ApiResult
.
Success
(
"success"
,
new
{
...
...
@@ -309,8 +428,8 @@ namespace Mall.WebApi.Controllers.MallBase
goods_stock
=
model
.
InventoryNum
,
virtual_sales
=
model
.
SalesNum
,
confine_count
=
model
.
LimitBuyGoodsNum
,
//pieces = 0,//
//forehead = 0,//
pieces
=
model
.
FullNumPinkage
,
//满件包邮
forehead
=
model
.
FullMoneyPinkage
,
//满额包邮
freight_id
=
model
.
FreightId
,
give_integral
=
model
.
IntegralPresent
,
give_integral_type
=
model
.
IntegralPresentType
,
...
...
@@ -318,10 +437,10 @@ namespace Mall.WebApi.Controllers.MallBase
forehead_integral_type
=
model
.
PointsDeductionType
,
//暂 积分抵扣类型
//accumulative = 0,//
individual_share
=
userModel
?.
IsDistributor
??
2
,
// 是否分销商
//attr_setting_type = 0,//
//is_level = 1,//
//is_level_alone = 0,//
//share_type = 0,
attr_setting_type
=
model
.
SeparateDistributionType
,
//分销类型
is_level
=
model
.
EnjoyMember
,
//是否销售会员价格
is_level_alone
=
model
.
SeparateSetMember
,
//是否单独设置会员价
share_type
=
model
.
SeparateDistributionMoneyType
,
//分销佣金类型
//sign = "",
app_share_pic
=
model
.
CustomShareImagePath
,
app_share_title
=
model
.
CustomShareTitles
,
...
...
@@ -329,12 +448,12 @@ namespace Mall.WebApi.Controllers.MallBase
sort
=
model
.
Sort
,
created_at
=
model
.
CreateDate
.
HasValue
?
model
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
updated_at
=
model
.
UpdateDate
.
HasValue
?
model
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
deleted_at
=
""
,
//
deleted_at = "",
is_delete
=
model
.
Status
,
payment_people
=
0
,
//销售信息
payment_num
=
0
,
//
payment_amount
=
0
,
//
payment_order
=
0
,
//
payment_people
,
//用户数量
payment_num
,
//商品数量
payment_amount
,
//销售总额
payment_order
,
//订单数量
confine_order_count
=
model
.
LimitBuyOrderNum
,
is_area_limit
=
model
.
IsAreaBuy
,
area_limit
=
new
List
<
object
>()
{
new
{
list
=
model
.
AreaList
.
Select
(
x
=>
new
{
...
...
@@ -343,17 +462,17 @@ namespace Mall.WebApi.Controllers.MallBase
area_type
=
x
.
AreaType
})
}
},
form_id
=
model
.
FormsId
,
sales
=
model
.
SalesNum
+
0
,
//已售出数量 + 订单
数量//
sales
=
model
.
SalesNum
+
payment_num
,
//已售出数量 + 订单商品
数量//
name
=
model
.
Name
,
original_price
=
model
.
OriginalPrice
,
cover_pic
=
model
.
CoverImage
,
unit
=
model
.
Unit
,
detail
=
model
.
GoodsDetails
,
video_url
=
model
.
VideoAddress
,
//level_show = 2,//
level_show
=
(
userModel
?.
MemberGrade
??
0
)>
0
?
1
:
2
,
//是否显示会员价
is_sales
=
model
.
GoodsStatus
==
1
&&
model
.
InventoryNum
>
0
?
1
:
2
,
//是否可购买
attr
=
priceList
,
goods_num
=
model
.
InventoryNum
,
//
goods_num = model.InventoryNum,
goods_no
=
model
.
GoodsNumbers
,
goods_weight
=
model
.
GoodsWeight
,
services
=
model
.
ServiceList
.
Select
(
x
=>
new
...
...
@@ -401,12 +520,187 @@ namespace Mall.WebApi.Controllers.MallBase
is_quick_shop
=
model
.
IsQuickBuy
,
is_sell_well
=
model
.
IsSellWell
,
is_negotiable
=
model
.
IsGoodsNegotiable
,
//cats = new List<string>()
cats
=
model
.
CategoryList
.
Select
(
x
=>
new
{
x
.
CategoryId
,
x
.
CategoryName
})
//分类
},
delivery
=
""
});
}
/// <summary>
/// 小程序商品视频分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetAppletGoodsVideoPageList
(
object
requestMsg
)
{
var
parms
=
JsonConvert
.
DeserializeObject
<
RequestParm
>(
requestMsg
.
ToString
());
if
(
parms
.
MallBaseId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
RB_Goods_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
demodel
.
GoodsStatus
=
1
;
//只查询销售中的
demodel
.
IsSelectVideo
=
1
;
//值查询有视频的
var
list
=
productModule
.
GetAppletGoodsVideoPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
id
=
40887
,
//goods_warehouse_id= 19813,
mch_id
=
demodel
.
TenantId
,
//sign= "",
name
=
x
.
Name
,
cover_pic
=
x
.
CoverImage
,
video_url
=
x
.
VideoAddress
,
original_price
=
x
.
OriginalPrice
,
unit
=
x
.
Unit
,
page_url
=
"/pages/goods/goods?id="
+
x
.
Id
,
is_negotiable
=
x
.
IsGoodsNegotiable
,
is_level
=
x
.
EnjoyMember
,
//是否销售会员价格
//level_price = -1,
price
=
x
.
SellingPrice
,
price_content
=
"¥"
+
x
.
SellingPrice
,
is_sales
=
x
.
GoodsStatus
==
1
&&
x
.
InventoryNum
>
0
?
1
:
2
,
//是否可购买
sales
=
x
.
SalesNum
,
attr_groups
=
x
.
SpecificationList
.
Select
(
x
=>
new
{
attr_group_id
=
x
.
Sort
,
attr_group_name
=
x
.
Name
,
attr_list
=
x
.
SpecificationValueList
.
Select
(
z
=>
new
{
attr_id
=
z
.
Sort
,
attr_name
=
z
.
Name
,
pic_url
=
z
.
ImagePath
})
}),
attr
=
GetGoodsAttr
(
x
),
goods_stock
=
x
.
InventoryNum
,
//goods_num= x.InventoryNum,
app_share_title
=
x
.
CustomShareTitles
,
app_share_pic
=
x
.
CustomShareImagePath
??
""
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取规格价格
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
private
object
GetGoodsAttr
(
RB_Goods_Extend
model
)
{
List
<
object
>
priceList
=
new
List
<
object
>();
if
(
model
.
IsCustomSpecification
==
1
)
{
if
(
model
.
SpecificationPriceList
.
Any
()
&&
model
.
SpecificationList
.
Any
())
{
foreach
(
var
item
in
model
.
SpecificationPriceList
)
{
var
ssarr
=
item
.
SpecificationSort
.
Split
(
':'
);
int
Sort
=
Convert
.
ToInt32
(
ssarr
[
0
]);
string
pic_url
=
model
.
SpecificationList
[
0
].
SpecificationValueList
.
Where
(
x
=>
x
.
Sort
==
Sort
).
FirstOrDefault
()?.
ImagePath
;
List
<
object
>
attr_list
=
new
List
<
object
>();
for
(
int
i
=
0
;
i
<
ssarr
.
Length
;
i
++)
{
var
smodel
=
model
.
SpecificationList
[
i
];
var
svmodel
=
smodel
.
SpecificationValueList
.
Where
(
x
=>
x
.
Sort
==
Convert
.
ToInt32
(
ssarr
[
i
])).
FirstOrDefault
();
attr_list
.
Add
(
new
{
attr_group_name
=
smodel
.
Name
,
attr_group_id
=
smodel
.
Sort
,
attr_id
=
svmodel
.
Id
,
attr_name
=
svmodel
.
Name
});
}
priceList
.
Add
(
new
{
id
=
item
.
Id
,
goods_id
=
model
.
Id
,
sign_id
=
item
.
SpecificationSort
,
stock
=
item
.
InventoryNum
,
price
=
item
.
SellingPrice
,
no
=
item
.
GoodsNumbers
,
weight
=
item
.
GoodsWeight
,
pic_url
,
is_delete
=
item
.
Status
,
attr_list
});
}
}
}
else
{
priceList
.
Add
(
new
{
id
=
0
,
goods_id
=
model
.
Id
,
sign_id
=
""
,
stock
=
model
.
InventoryNum
,
price
=
model
.
SellingPrice
??
0
,
no
=
model
.
GoodsNumbers
,
weight
=
model
.
GoodsWeight
,
pic_url
=
""
,
is_delete
=
0
,
attr_list
=
new
{
attr_group_name
=
"规格"
,
attr_group_id
=
0
,
attr_id
=
0
,
attr_name
=
model
.
DefaultSpecificationName
}
});
}
return
priceList
;
}
/// <summary>
/// 小程序获取推荐商品列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetAppletGoodsRecommendList
(
object
requestMsg
)
{
var
parms
=
JsonConvert
.
DeserializeObject
<
RequestParm
>(
requestMsg
.
ToString
());
if
(
parms
.
MallBaseId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
RB_Goods_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_Extend
>(
parms
.
msg
.
ToString
());
if
(!
demodel
.
RecommendType
.
HasValue
&&
demodel
.
RecommendType
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递推荐类型"
);
}
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
demodel
.
GoodsStatus
=
1
;
//只查询销售中的
var
list
=
productModule
.
GetAppletGoodsRecommendList
(
1
,
10
,
out
int
RecommendStatus
,
demodel
);
return
ApiResult
.
Success
(
""
,
new
{
RecommendStatus
,
List
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
Sort
,
x
.
CoverImage
,
x
.
VideoAddress
,
x
.
SellingPrice
,
x
.
SalesNum
,
x
.
IsQuickBuy
,
CreateDate
=
x
.
CreateDate
.
HasValue
?
x
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
})
});
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/Product/AppletOrderController.cs
0 → 100644
View file @
68a0e950
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Mall.Common.API
;
using
Mall.Model.Extend.Product
;
using
Mall.Module.User
;
using
Mall.WebApi.Filter
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json
;
using
Mall.Common.Plugin
;
using
Mall.Common.Enum.User
;
using
Mall.CacheManager.User
;
using
Newtonsoft.Json.Linq
;
using
Mall.Common
;
using
Mall.Module.Product
;
using
Mall.Model.Extend.User
;
namespace
Mall.WebApi.Controllers.MallBase
{
[
Route
(
"api/[controller]/[action]"
)]
[
ApiExceptionFilter
]
[
ApiController
]
[
EnableCors
(
"AllowCors"
)]
public
class
AppletOrderController
:
BaseController
{
private
readonly
OrderModule
orderModule
=
new
OrderModule
();
#
region
购物车
/// <summary>
/// 获取用户购物车
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetGoodsShoppingCartPageList
()
{
var
parms
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
RB_Goods_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
UserId
=
userInfo
.
UserId
;
var
list
=
orderModule
.
GetGoodsShoppingCartPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
GoodsId
,
x
.
GoodsName
,
x
.
CoverImage
,
x
.
Price
,
x
.
InventoryNum
,
x
.
SpecificationList
,
x
.
Number
,
x
.
GoodsStatus
,
x
.
TenantId
,
x
.
MallBaseId
,
CreateDate
=
x
.
CreateDate
.
HasValue
?
x
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 加入购物车
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetGoodsShoppingCartInfo
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
RB_Goods_ShoppingCart_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_ShoppingCart_Extend
>(
req
.
msg
.
ToString
());
if
((
demodel
.
GoodsId
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递商品id"
);
}
if
((
demodel
.
Number
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"数量必须大于0"
);
}
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
UserId
=
userInfo
.
UserId
;
demodel
.
SpecificationSort
??=
""
;
return
orderModule
.
SetGoodsShoppingCartGetInfo
(
demodel
);
}
/// <summary>
/// 设置购物车数量
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetGoodsShoppingCartNumGetInfo
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
prams
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
ShoppingCartId
=
prams
.
GetInt
(
"ShoppingCartId"
,
0
);
int
Number
=
prams
.
GetInt
(
"Number"
,
0
);
if
(
ShoppingCartId
<=
0
||
Number
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
orderModule
.
SetGoodsShoppingCartNumGetInfo
(
ShoppingCartId
,
Number
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 删除购物车
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DelGoodsShoppingCartInfo
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
JObject
prams
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
string
ShoppingCartIds
=
prams
.
GetStringValue
(
"ShoppingCartIdList"
);
if
(
string
.
IsNullOrEmpty
(
ShoppingCartIds
))
{
return
ApiResult
.
ParamIsNull
();
}
try
{
List
<
int
>
scList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
ShoppingCartIds
);
ShoppingCartIds
=
string
.
Join
(
","
,
scList
);
}
catch
(
Exception
)
{
return
ApiResult
.
ParamIsNull
(
""
);
}
bool
flag
=
orderModule
.
DelGoodsShoppingCartInfo
(
ShoppingCartIds
,
userInfo
.
TenantId
,
userInfo
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
#
region
订单管理
/// <summary>
/// 结算页面详情
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetAppletGoodsSettlementInfo
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
RB_Goods_Order_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_Order_Extend
>(
req
.
msg
.
ToString
());
if
(
demodel
.
DetailList
==
null
||
!
demodel
.
DetailList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请传递商品信息"
);
}
foreach
(
var
item
in
demodel
.
DetailList
)
{
if
((
item
.
GoodsId
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递商品id"
);
}
if
((
item
.
Number
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递商品数量"
);
}
}
demodel
.
TenantId
=
userInfo
.
TenantId
;
demodel
.
MallBaseId
=
userInfo
.
MallBaseId
;
demodel
.
UserId
=
userInfo
.
UserId
;
return
orderModule
.
GetAppletGoodsSettlementInfo
(
demodel
);
}
/// <summary>
/// 下单
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetAppletGoodsOrderInfo
()
{
var
req
=
RequestParm
;
var
userInfo
=
AppletUserInfo
;
RB_Goods_Order_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Goods_Order_Extend
>(
req
.
msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
demodel
.
Consignee
))
{
return
ApiResult
.
ParamIsNull
(
"请传递收件人"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
Mobile
))
{
return
ApiResult
.
ParamIsNull
(
"请传递收件人手机号码"
);
}
if
(
demodel
.
DeliveryMethod
!=
Common
.
Enum
.
Goods
.
OrderDeliveryMethodEnum
.
VerificationShop
)
{
if
((
demodel
.
District
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"收货地址有误"
);
}
}
if
(
demodel
.
DetailList
==
null
||
!
demodel
.
DetailList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请传递商品信息"
);
}
foreach
(
var
item
in
demodel
.
DetailList
)
{
if
((
item
.
GoodsId
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递商品id"
);
}
if
((
item
.
Number
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递商品数量"
);
}
}
return
ApiResult
.
Success
();
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Properties/PublishProfiles/mall.oytour.com.pubxml
View file @
68a0e950
...
...
@@ -14,7 +14,7 @@
<TargetFramework>
netcoreapp3.0
</TargetFramework>
<ProjectGuid>
ad842a33-b1df-4360-ae06-536353f0276c
</ProjectGuid>
<SelfContained>
false
</SelfContained>
<publishUrl>
F:\网站发布\Mall.oytour.com
</publishUrl>
<publishUrl>
E:\LDWork\LiuDongWork\MallFB
</publishUrl>
<DeleteExistingFiles>
False
</DeleteExistingFiles>
<RuntimeIdentifier>
win-x64
</RuntimeIdentifier>
</PropertyGroup>
...
...
Mall.WebApi/Properties/PublishProfiles/mall.oytour.com.pubxml.user
View file @
68a0e950
...
...
@@ -6,7 +6,7 @@
<Project
ToolsVersion=
"4.0"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile
/>
<_PublishTargetUrl>
F:\网站发布\Mall.oytour.com
</_PublishTargetUrl>
<_PublishTargetUrl>
E:\LDWork\LiuDongWork\MallFB
</_PublishTargetUrl>
</PropertyGroup>
<ItemGroup>
<File
Include=
"run.cmd"
>
...
...
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