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
3163f6eb
Commit
3163f6eb
authored
Apr 28, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品其他功能
parent
ffefac88
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
2006 additions
and
4 deletions
+2006
-4
RB_Product_QuickBuy.cs
Mall.Model/Entity/Product/RB_Product_QuickBuy.cs
+82
-0
RB_Product_Recommend.cs
Mall.Model/Entity/Product/RB_Product_Recommend.cs
+122
-0
RB_Product_Service.cs
Mall.Model/Entity/Product/RB_Product_Service.cs
+98
-0
RB_Product_Specification.cs
Mall.Model/Entity/Product/RB_Product_Specification.cs
+82
-0
RB_Product_QuickBuy_Extend.cs
Mall.Model/Extend/Product/RB_Product_QuickBuy_Extend.cs
+29
-0
RB_Product_Recommend_Extend.cs
Mall.Model/Extend/Product/RB_Product_Recommend_Extend.cs
+44
-0
RB_Product_Service_Extend.cs
Mall.Model/Extend/Product/RB_Product_Service_Extend.cs
+21
-0
RB_Product_Specification_Extend.cs
Mall.Model/Extend/Product/RB_Product_Specification_Extend.cs
+21
-0
RB_Distributor_Info_Extend.cs
Mall.Model/Extend/User/RB_Distributor_Info_Extend.cs
+4
-0
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+479
-1
UserCommonModule.cs
Mall.Module.User/UserCommonModule.cs
+36
-0
UserModule.cs
Mall.Module.User/UserModule.cs
+77
-0
RB_Product_QuickBuyRepository.cs
Mall.Repository/Product/RB_Product_QuickBuyRepository.cs
+117
-0
RB_Product_RecommendRepository.cs
Mall.Repository/Product/RB_Product_RecommendRepository.cs
+40
-0
RB_Product_ServiceRepository.cs
Mall.Repository/Product/RB_Product_ServiceRepository.cs
+80
-0
RB_Product_SpecificationRepository.cs
....Repository/Product/RB_Product_SpecificationRepository.cs
+80
-0
RB_Member_UserRepository.cs
Mall.Repository/User/RB_Member_UserRepository.cs
+37
-3
ProductController.cs
Mall.WebApi/Controllers/Product/ProductController.cs
+456
-0
UserController.cs
Mall.WebApi/Controllers/User/UserController.cs
+101
-0
No files found.
Mall.Model/Entity/Product/RB_Product_QuickBuy.cs
0 → 100644
View file @
3163f6eb
using
Mall.Common.AOP
;
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_Product_QuickBuy
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 分类id
/// </summary>
public
int
?
CategoryId
{
get
;
set
;
}
/// <summary>
/// 排序
/// </summary>
public
int
?
Sort
{
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/Entity/Product/RB_Product_Recommend.cs
0 → 100644
View file @
3163f6eb
using
Mall.Common.AOP
;
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_Product_Recommend
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 商品详情页面推荐状态 1开启 2禁止
/// </summary>
public
int
?
DetailRecommendStatus
{
get
;
set
;
}
/// <summary>
/// 推荐数量
/// </summary>
public
int
?
DetailRecommendNum
{
get
;
set
;
}
/// <summary>
/// 订单完成后推荐状态 1开启 2禁止
/// </summary>
public
int
?
OrderCompleteStatus
{
get
;
set
;
}
/// <summary>
/// 是否自定义 1是 2否
/// </summary>
public
int
?
IsOrderRecommend
{
get
;
set
;
}
/// <summary>
/// 自定义商品ids 逗号分隔
/// </summary>
public
string
OrderProductIds
{
get
;
set
;
}
/// <summary>
/// 评论后推荐商品状态 1开启 2禁止
/// </summary>
public
int
?
CommentRecommentStatus
{
get
;
set
;
}
/// <summary>
/// 评论后自定义推荐商品 1是 2否
/// </summary>
public
int
?
IsCommentRecommend
{
get
;
set
;
}
/// <summary>
/// 评论后推荐商品ids 逗号分隔
/// </summary>
public
string
CommentProductIds
{
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/Entity/Product/RB_Product_Service.cs
0 → 100644
View file @
3163f6eb
using
Mall.Common.AOP
;
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_Product_Service
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 服务名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 排序
/// </summary>
public
int
?
Sort
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
public
string
Remark
{
get
;
set
;
}
/// <summary>
/// 是否默认 1是 2否
/// </summary>
public
int
?
IsDefault
{
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/Entity/Product/RB_Product_Specification.cs
0 → 100644
View file @
3163f6eb
using
Mall.Common.AOP
;
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_Product_Specification
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 规格名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 规格内容 json格式
/// </summary>
public
string
Content
{
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/Product/RB_Product_QuickBuy_Extend.cs
0 → 100644
View file @
3163f6eb
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_Product_QuickBuy_Extend
:
RB_Product_QuickBuy
{
/// <summary>
/// 图标
/// </summary>
public
string
IconPath
{
get
;
set
;
}
/// <summary>
/// 分类名称
/// </summary>
public
string
CategoryName
{
get
;
set
;
}
/// <summary>
/// 图标id
/// </summary>
public
int
?
Icon
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Product_Recommend_Extend.cs
0 → 100644
View file @
3163f6eb
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_Product_Recommend_Extend
:
RB_Product_Recommend
{
/// <summary>
/// 订单完成后自定义推荐商品
/// </summary>
public
List
<
RB_ProductRecommendModel
>
OrderProductList
{
get
;
set
;
}
/// <summary>
/// 评论后自定义推荐商品
/// </summary>
public
List
<
RB_ProductRecommendModel
>
CommentProductList
{
get
;
set
;
}
}
/// <summary>
/// 商品选择
/// </summary>
public
class
RB_ProductRecommendModel
{
/// <summary>
/// 商品id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 商品名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 商品图片
/// </summary>
public
string
Image
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Product_Service_Extend.cs
0 → 100644
View file @
3163f6eb
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_Product_Service_Extend
:
RB_Product_Service
{
/// <summary>
/// 更新类型
/// </summary>
public
int
?
UpdateType
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Product_Specification_Extend.cs
0 → 100644
View file @
3163f6eb
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_Product_Specification_Extend
:
RB_Product_Specification
{
/// <summary>
/// 规格值列表
/// </summary>
public
List
<
string
>
SpecList
{
get
;
set
;
}
}
}
Mall.Model/Extend/User/RB_Distributor_Info_Extend.cs
View file @
3163f6eb
...
...
@@ -73,5 +73,9 @@ namespace Mall.Model.Extend.User
/// 下载枚举ids
/// </summary>
public
List
<
int
>
ExcelEnumIds
{
get
;
set
;
}
/// <summary>
/// 第几级
/// </summary>
public
int
?
ReferralsType
{
get
;
set
;
}
}
}
Mall.Module.Product/ProductModule.cs
View file @
3163f6eb
...
...
@@ -9,6 +9,7 @@ using Mall.Model.Entity.Product;
using
Mall.Model.Extend.Product
;
using
Mall.Repository
;
using
Mall.Repository.Product
;
using
Newtonsoft.Json
;
namespace
Mall.Module.Product
{
...
...
@@ -33,6 +34,22 @@ namespace Mall.Module.Product
/// 商品分类样式
/// </summary>
private
readonly
RB_Product_CategoryStyleRepository
product_CategoryStyleRepository
=
new
RB_Product_CategoryStyleRepository
();
/// <summary>
/// 商品规格
/// </summary>
private
readonly
RB_Product_SpecificationRepository
product_SpecificationRepository
=
new
RB_Product_SpecificationRepository
();
/// <summary>
/// 快速购买
/// </summary>
private
readonly
RB_Product_QuickBuyRepository
product_QuickBuyRepository
=
new
RB_Product_QuickBuyRepository
();
/// <summary>
/// 推荐设置
/// </summary>
private
readonly
RB_Product_RecommendRepository
product_RecommendRepository
=
new
RB_Product_RecommendRepository
();
/// <summary>
/// 商品服务
/// </summary>
private
readonly
RB_Product_ServiceRepository
product_ServiceRepository
=
new
RB_Product_ServiceRepository
();
#
region
素材管理
...
...
@@ -540,7 +557,6 @@ namespace Mall.Module.Product
}
}
/// <summary>
/// 获取树形结构列表
/// </summary>
...
...
@@ -652,6 +668,30 @@ namespace Mall.Module.Product
}
}
/// <summary>
/// 获取商品分类
/// </summary>
/// <param name="categoryId"></param>
/// <returns></returns>
public
RB_Product_Category_Extend
GetProductCategoryInfo
(
int
categoryId
)
{
var
model
=
product_CategoryRepository
.
GetEntity
(
categoryId
).
RefMapperTo
<
RB_Product_Category_Extend
>();
List
<
int
>
ImgIds
=
new
List
<
int
>();
ImgIds
.
Add
(
model
.
Icon
??
0
);
ImgIds
.
Add
(
model
.
BigIcon
??
0
);
ImgIds
.
Add
(
model
.
AdvertisingImage
??
0
);
List
<
RB_Material_Info_Extend
>
mlist
=
new
List
<
RB_Material_Info_Extend
>();
if
(
ImgIds
.
Any
())
{
mlist
=
material_InfoRepository
.
GetList
(
new
RB_Material_Info_Extend
()
{
MaterialIds
=
string
.
Join
(
","
,
ImgIds
)});
}
model
.
IconPath
=
mlist
.
Where
(
x
=>
x
.
Id
==
model
.
Icon
).
FirstOrDefault
()?.
Path
??
""
;
model
.
BigIconPath
=
mlist
.
Where
(
x
=>
x
.
Id
==
model
.
BigIcon
).
FirstOrDefault
()?.
Path
??
""
;
model
.
AdvertisingImagePath
=
mlist
.
Where
(
x
=>
x
.
Id
==
model
.
AdvertisingImage
).
FirstOrDefault
()?.
Path
??
""
;
return
model
;
}
/// <summary>
/// 获取当前分类的所有子集分类
/// </summary>
...
...
@@ -756,5 +796,443 @@ namespace Mall.Module.Product
}
#
endregion
#
region
商品规格
/// <summary>
/// 获取商品规格分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Product_Specification_Extend
>
GetProducSpecificationPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Product_Specification_Extend
demodel
)
{
var
list
=
product_SpecificationRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
foreach
(
var
item
in
list
)
{
item
.
SpecList
=
new
List
<
string
>();
if
(!
string
.
IsNullOrEmpty
(
item
.
Content
))
{
item
.
SpecList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
item
.
Content
);
}
}
return
list
;
}
/// <summary>
/// 获取规格列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Product_Specification_Extend
>
GetProducSpecificationList
(
RB_Product_Specification_Extend
demodel
)
{
var
list
=
product_SpecificationRepository
.
GetList
(
demodel
);
foreach
(
var
item
in
list
)
{
item
.
SpecList
=
new
List
<
string
>();
if
(!
string
.
IsNullOrEmpty
(
item
.
Content
))
{
item
.
SpecList
=
JsonConvert
.
DeserializeObject
<
List
<
string
>>(
item
.
Content
);
}
}
return
list
;
}
/// <summary>
/// 保存修改规格
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
SetProductSpecificationInfo
(
RB_Product_Specification_Extend
demodel
)
{
if
(
demodel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Specification
.
Name
),
demodel
.
Name
},
{
nameof
(
RB_Product_Specification
.
Content
),
demodel
.
Content
},
{
nameof
(
RB_Product_Specification
.
UpdateDate
),
demodel
.
UpdateDate
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Specification
.
Id
),
FiledValue
=
demodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
product_SpecificationRepository
.
Update
(
keyValues
,
wheres
);
}
else
{
return
product_SpecificationRepository
.
Insert
(
demodel
)
>
0
;
}
}
/// <summary>
/// 删除商品规格
/// </summary>
/// <param name="specificationId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
DelProductSpecificationInfo
(
int
specificationId
,
int
tenantId
,
int
mallBaseId
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Specification
.
Status
),
1
},
{
nameof
(
RB_Product_Specification
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Specification
.
Id
),
FiledValue
=
specificationId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Specification
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Specification
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
product_SpecificationRepository
.
Update
(
keyValues
,
wheres
);
}
#
endregion
#
region
快速购买
/// <summary>
/// 快速购买分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Product_QuickBuy_Extend
>
GetProductQuickBuyPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Product_QuickBuy_Extend
demodel
)
{
var
list
=
product_QuickBuyRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
if
(
list
.
Any
())
{
string
imgids
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
Icon
>
0
).
Select
(
x
=>
x
.
Icon
));
List
<
RB_Material_Info_Extend
>
mlist
=
new
List
<
RB_Material_Info_Extend
>();
if
(!
string
.
IsNullOrEmpty
(
imgids
))
{
mlist
=
material_InfoRepository
.
GetList
(
new
RB_Material_Info_Extend
()
{
MaterialIds
=
imgids
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
}
foreach
(
var
item
in
list
)
{
item
.
IconPath
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
Icon
).
FirstOrDefault
()?.
Path
??
""
;
}
}
return
list
;
}
/// <summary>
/// 获取快速购买列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Product_QuickBuy_Extend
>
GetProductQuickBuyList
(
RB_Product_QuickBuy_Extend
demodel
)
{
var
list
=
product_QuickBuyRepository
.
GetAllList
(
demodel
);
if
(
list
.
Any
())
{
string
imgids
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
Icon
>
0
).
Select
(
x
=>
x
.
Icon
));
List
<
RB_Material_Info_Extend
>
mlist
=
new
List
<
RB_Material_Info_Extend
>();
if
(!
string
.
IsNullOrEmpty
(
imgids
))
{
mlist
=
material_InfoRepository
.
GetList
(
new
RB_Material_Info_Extend
()
{
MaterialIds
=
imgids
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
}
foreach
(
var
item
in
list
)
{
item
.
IconPath
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
Icon
).
FirstOrDefault
()?.
Path
??
""
;
}
}
return
list
;
}
/// <summary>
/// 验证快速购买分类
/// </summary>
/// <param name="id"></param>
/// <param name="categoryId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
ValidateQuickBuyCategory
(
int
id
,
int
?
categoryId
,
int
tenantId
,
int
mallBaseId
)
{
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_QuickBuy
.
CategoryId
),
FiledValue
=
categoryId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_QuickBuy
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_QuickBuy
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_QuickBuy
.
Status
),
FiledValue
=
0
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
if
(
id
>
0
)
{
wheres
.
Add
(
new
WhereHelper
()
{
FiledName
=
nameof
(
RB_Product_QuickBuy
.
Id
),
FiledValue
=
id
,
OperatorEnum
=
OperatorEnum
.
NotEqual
});
}
return
product_QuickBuyRepository
.
Exists
(
wheres
);
}
/// <summary>
/// 新增修改快速购买
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
SetProductQuickBuyInfo
(
RB_Product_QuickBuy_Extend
demodel
)
{
if
(
demodel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_QuickBuy
.
CategoryId
),
demodel
.
CategoryId
},
{
nameof
(
RB_Product_QuickBuy
.
Sort
),
demodel
.
Sort
},
{
nameof
(
RB_Product_QuickBuy
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_QuickBuy
.
Id
),
FiledValue
=
demodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_QuickBuy
.
TenantId
),
FiledValue
=
demodel
.
TenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_QuickBuy
.
MallBaseId
),
FiledValue
=
demodel
.
MallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
};
return
product_QuickBuyRepository
.
Update
(
keyValues
,
wheres
);
}
else
{
return
product_QuickBuyRepository
.
Insert
(
demodel
)
>
0
;
}
}
/// <summary>
/// 删除快速购买
/// </summary>
/// <param name="quickBuyId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
DelProductQuickBuyInfo
(
int
quickBuyId
,
int
tenantId
,
int
mallBaseId
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_QuickBuy
.
Status
),
1
},
{
nameof
(
RB_Product_QuickBuy
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_QuickBuy
.
Id
),
FiledValue
=
quickBuyId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_QuickBuy
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_QuickBuy
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
};
return
product_SpecificationRepository
.
Update
(
keyValues
,
wheres
);
}
#
endregion
#
region
推荐设置
/// <summary>
/// 获取推荐设置详情
/// </summary>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
RB_Product_Recommend_Extend
GetProductRecommendSetInfo
(
int
tenantId
,
int
mallBaseId
)
{
var
model
=
product_RecommendRepository
.
GetList
(
new
RB_Product_Recommend_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
}).
FirstOrDefault
();
if
(
model
==
null
)
{
return
new
RB_Product_Recommend_Extend
();
}
model
.
OrderProductList
=
new
List
<
RB_ProductRecommendModel
>();
if
(
model
.
IsOrderRecommend
==
1
)
{
//查询商品
}
model
.
CommentProductList
=
new
List
<
RB_ProductRecommendModel
>();
if
(
model
.
IsCommentRecommend
==
1
)
{
}
return
model
;
}
/// <summary>
/// 保存推荐设置
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
SetProductRecommendSetInfo
(
RB_Product_Recommend_Extend
demodel
)
{
if
(
demodel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Recommend
.
CommentProductIds
),
demodel
.
CommentProductIds
},
{
nameof
(
RB_Product_Recommend
.
CommentRecommentStatus
),
demodel
.
CommentProductIds
},
{
nameof
(
RB_Product_Recommend
.
DetailRecommendNum
),
demodel
.
CommentProductIds
},
{
nameof
(
RB_Product_Recommend
.
DetailRecommendStatus
),
demodel
.
CommentProductIds
},
{
nameof
(
RB_Product_Recommend
.
IsCommentRecommend
),
demodel
.
CommentProductIds
},
{
nameof
(
RB_Product_Recommend
.
IsOrderRecommend
),
demodel
.
CommentProductIds
},
{
nameof
(
RB_Product_Recommend
.
OrderCompleteStatus
),
demodel
.
CommentProductIds
},
{
nameof
(
RB_Product_Recommend
.
OrderProductIds
),
demodel
.
CommentProductIds
},
{
nameof
(
RB_Product_Recommend
.
UpdateDate
),
demodel
.
CommentProductIds
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Recommend
.
Id
),
FiledValue
=
demodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
product_RecommendRepository
.
Update
(
keyValues
,
wheres
);
}
else
{
return
product_RecommendRepository
.
Insert
(
demodel
)
>
0
;
}
}
#
endregion
#
region
商品服务
/// <summary>
/// 获取商品服务分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Product_Service_Extend
>
GetProductServicePageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Product_Service_Extend
demodel
)
{
return
product_ServiceRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
}
/// <summary>
/// 获取商品服务列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Product_Service_Extend
>
GetProductServiceList
(
RB_Product_Service_Extend
demodel
)
{
return
product_ServiceRepository
.
GetList
(
demodel
);
}
/// <summary>
/// 新增修改商品服务
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
SetProductServiceInfo
(
RB_Product_Service_Extend
demodel
)
{
if
(
demodel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Service
.
Name
),
demodel
.
Name
},
{
nameof
(
RB_Product_Service
.
Sort
),
demodel
.
Sort
},
{
nameof
(
RB_Product_Service
.
Remark
),
demodel
.
Remark
},
{
nameof
(
RB_Product_Service
.
IsDefault
),
demodel
.
IsDefault
},
{
nameof
(
RB_Product_Service
.
UpdateDate
),
demodel
.
UpdateDate
}
};
if
(
demodel
.
UpdateType
==
1
)
{
//只更新默认状态
var
model
=
product_ServiceRepository
.
GetEntity
(
demodel
.
Id
);
if
(
model
==
null
)
{
return
false
;
}
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Service
.
IsDefault
),
model
.
IsDefault
==
1
?
2
:
1
},
{
nameof
(
RB_Product_Service
.
UpdateDate
),
demodel
.
UpdateDate
}
};
}
else
if
(
demodel
.
UpdateType
==
2
)
{
//只更新排序
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Service
.
Sort
),
demodel
.
Sort
},
{
nameof
(
RB_Product_Service
.
UpdateDate
),
demodel
.
UpdateDate
}
};
}
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Service
.
Id
),
FiledValue
=
demodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
product_ServiceRepository
.
Update
(
keyValues
,
wheres
);
}
else
{
return
product_ServiceRepository
.
Insert
(
demodel
)
>
0
;
}
}
/// <summary>
/// 删除商品服务
/// </summary>
/// <param name="serviceId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
DelProductServiceInfo
(
int
serviceId
,
int
tenantId
,
int
mallBaseId
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Service
.
Status
),
1
},
{
nameof
(
RB_Product_Service
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Service
.
Id
),
FiledValue
=
serviceId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Service
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Service
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
};
return
product_ServiceRepository
.
Update
(
keyValues
,
wheres
);
}
#
endregion
}
}
Mall.Module.User/UserCommonModule.cs
View file @
3163f6eb
...
...
@@ -32,6 +32,10 @@ namespace Mall.Module.User
/// 分类样式
/// </summary>
private
readonly
RB_Product_CategoryStyleRepository
product_CategoryStyleRepository
=
new
RB_Product_CategoryStyleRepository
();
/// <summary>
/// 推荐设置
/// </summary>
private
readonly
RB_Product_RecommendRepository
product_RecommendRepository
=
new
RB_Product_RecommendRepository
();
/// <summary>
/// 初始化分销基础配置
...
...
@@ -162,5 +166,37 @@ namespace Mall.Module.User
return
true
;
}
}
/// <summary>
/// 初始化商品推荐设置
/// </summary>
/// <param name="TenantId"></param>
/// <param name="MallBaseId"></param>
/// <returns></returns>
public
bool
InitializeProductRecommendInfo
(
int
TenantId
,
int
MallBaseId
)
{
var
oModel
=
product_RecommendRepository
.
GetList
(
new
RB_Product_Recommend_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
}).
FirstOrDefault
();
if
(
oModel
==
null
)
{
return
product_RecommendRepository
.
Insert
(
new
Model
.
Entity
.
Product
.
RB_Product_Recommend
()
{
Id
=
0
,
CommentProductIds
=
""
,
CommentRecommentStatus
=
1
,
CreateDate
=
DateTime
.
Now
,
DetailRecommendNum
=
6
,
DetailRecommendStatus
=
1
,
IsCommentRecommend
=
2
,
IsOrderRecommend
=
2
,
MallBaseId
=
MallBaseId
,
OrderCompleteStatus
=
1
,
OrderProductIds
=
""
,
TenantId
=
TenantId
,
UpdateDate
=
DateTime
.
Now
})
>
0
;
}
else
{
return
true
;
}
}
}
}
Mall.Module.User/UserModule.cs
View file @
3163f6eb
...
...
@@ -769,6 +769,13 @@ namespace Mall.Module.User
{
return
false
;
}
if
(
model
.
Enabled
==
1
&&
demodel
.
Enabled
==
2
)
{
//验证是否有分销商在使用该等级
if
(
ValidateDistributorGradeEnabled
(
model
.
Id
))
{
return
false
;
}
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Grade
.
CommissionWithdrawn
),
demodel
.
CommissionWithdrawn
},
...
...
@@ -808,6 +815,17 @@ namespace Mall.Module.User
}
}
/// <summary>
/// 获取分销等级下拉列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Distributor_Grade_Extend
>
GetDistributorGradeDropdownList
(
RB_Distributor_Grade_Extend
demodel
)
{
var
list
=
distributor_GradeRepository
.
GetList
(
demodel
);
return
list
;
}
/// <summary>
/// 删除
/// </summary>
...
...
@@ -844,6 +862,54 @@ namespace Mall.Module.User
return
distributor_GradeRepository
.
Update
(
keyValues
,
whereHelpers
);
}
/// <summary>
/// 验证分销商等级使用
/// </summary>
/// <param name="gradeId"></param>
/// <returns></returns>
public
bool
ValidateDistributorGradeEnabled
(
int
gradeId
)
{
List
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Info
.
GradeId
),
FiledValue
=
gradeId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Info
.
Status
),
FiledValue
=
0
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Info
.
AuditStatus
),
FiledValue
=
2
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
distributor_InfoRepository
.
Exists
(
whereHelpers
);
}
/// <summary>
/// 修改分销商等级启用
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetDistributorGradeEnabledStatus
(
RB_Distributor_Grade
model
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Grade
.
Enabled
),
model
.
Enabled
==
1
?
2
:
1
},
{
nameof
(
RB_Distributor_Grade
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Grade
.
Id
),
FiledValue
=
model
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
distributor_GradeRepository
.
Update
(
keyValues
,
whereHelpers
);
}
/// <summary>
/// 获取分销商等级信息
/// </summary>
...
...
@@ -982,6 +1048,17 @@ namespace Mall.Module.User
return
""
;
}
/// <summary>
/// 获取下级用户列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Member_User_Extend
>
GetDistributorInfoReferralsPageList
(
RB_Distributor_Info_Extend
demodel
)
{
var
list
=
member_UserRepository
.
GetDistributorReferralsPageList
(
demodel
.
UserId
,
demodel
.
ReferralsType
,
demodel
.
TenantId
,
demodel
.
MallBaseId
);
return
list
;
}
/// <summary>
/// 分销商审核+修改等级
/// </summary>
...
...
Mall.Repository/Product/RB_Product_QuickBuyRepository.cs
0 → 100644
View file @
3163f6eb
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_Product_QuickBuyRepository
:
RepositoryBase
<
RB_Product_QuickBuy
>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Product_QuickBuy_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Product_QuickBuy_Extend
dmodel
)
{
string
where
=
$" 1=1 and qb.
{
nameof
(
RB_Product_QuickBuy_Extend
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and qb.
{
nameof
(
RB_Product_QuickBuy_Extend
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and qb.
{
nameof
(
RB_Product_QuickBuy_Extend
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and qb.
{
nameof
(
RB_Product_QuickBuy_Extend
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(
dmodel
.
CategoryId
>
0
)
{
where
+=
$@" and qb.
{
nameof
(
RB_Product_QuickBuy_Extend
.
CategoryId
)}
=
{
dmodel
.
CategoryId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
CategoryName
))
{
where
+=
$@" and c.
{
nameof
(
RB_Product_Category
.
Name
)}
like '%
{
dmodel
.
CategoryName
}
%'"
;
}
string
sql
=
$@"select qb.*,c.Name as CategoryName,c.Icon from RB_Product_QuickBuy qb
inner join rb_product_category c on qb.CategoryId=c.Id
where
{
where
}
order by qb.Sort asc,Id desc"
;
return
GetPage
<
RB_Product_QuickBuy_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Product_QuickBuy_Extend
>
GetAllList
(
RB_Product_QuickBuy_Extend
dmodel
)
{
string
where
=
$" 1=1 and qb.
{
nameof
(
RB_Product_QuickBuy_Extend
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and qb.
{
nameof
(
RB_Product_QuickBuy_Extend
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and qb.
{
nameof
(
RB_Product_QuickBuy_Extend
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and qb.
{
nameof
(
RB_Product_QuickBuy_Extend
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(
dmodel
.
CategoryId
>
0
)
{
where
+=
$@" and qb.
{
nameof
(
RB_Product_QuickBuy_Extend
.
CategoryId
)}
=
{
dmodel
.
CategoryId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
CategoryName
))
{
where
+=
$@" and c.
{
nameof
(
RB_Product_Category
.
Name
)}
like '%
{
dmodel
.
CategoryName
}
%'"
;
}
string
sql
=
$@"select qb.*,c.Name as CategoryName,c.Icon from RB_Product_QuickBuy qb
inner join rb_product_category c on qb.CategoryId=c.Id
where
{
where
}
order by qb.Sort asc,Id desc"
;
return
Get
<
RB_Product_QuickBuy_Extend
>(
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Product_QuickBuy_Extend
>
GetList
(
RB_Product_QuickBuy_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Product_QuickBuy_Extend
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_QuickBuy_Extend
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_QuickBuy_Extend
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_QuickBuy_Extend
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(
dmodel
.
CategoryId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_QuickBuy_Extend
.
CategoryId
)}
=
{
dmodel
.
CategoryId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
CategoryName
))
{
where
+=
$@" and
{
nameof
(
RB_Product_QuickBuy_Extend
.
CategoryName
)}
like '%
{
dmodel
.
CategoryName
}
%'"
;
}
string
sql
=
$@"select * from RB_Product_QuickBuy where
{
where
}
order by Id desc"
;
return
Get
<
RB_Product_QuickBuy_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/Product/RB_Product_RecommendRepository.cs
0 → 100644
View file @
3163f6eb
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_Product_RecommendRepository
:
RepositoryBase
<
RB_Product_Recommend
>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Product_Recommend_Extend
>
GetList
(
RB_Product_Recommend_Extend
dmodel
)
{
string
where
=
$" 1=1 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Recommend_Extend
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Recommend_Extend
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Recommend_Extend
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
string
sql
=
$@"select * from RB_Product_Recommend where
{
where
}
order by Id desc"
;
return
Get
<
RB_Product_Recommend_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/Product/RB_Product_ServiceRepository.cs
0 → 100644
View file @
3163f6eb
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_Product_ServiceRepository
:
RepositoryBase
<
RB_Product_Service
>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Product_Service_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Product_Service_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Product_Service
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Service
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Service
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Service
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and
{
nameof
(
RB_Product_Service
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(
dmodel
.
IsDefault
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Service
.
IsDefault
)}
=
{
dmodel
.
IsDefault
}
"
;
}
string
sql
=
$@"select * from RB_Product_Service where
{
where
}
order by Sort asc,Id desc"
;
return
GetPage
<
RB_Product_Service_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Product_Service_Extend
>
GetList
(
RB_Product_Service_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Product_Service
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Service
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Service
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Service
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and
{
nameof
(
RB_Product_Service
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(
dmodel
.
IsDefault
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Service
.
IsDefault
)}
=
{
dmodel
.
IsDefault
}
"
;
}
string
sql
=
$@"select * from RB_Product_Service where
{
where
}
order by Sort asc,Id desc"
;
return
Get
<
RB_Product_Service_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/Product/RB_Product_SpecificationRepository.cs
0 → 100644
View file @
3163f6eb
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_Product_SpecificationRepository
:
RepositoryBase
<
RB_Product_Specification
>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Product_Specification_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Product_Specification_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Product_Specification
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Specification
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Specification
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Specification
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and
{
nameof
(
RB_Product_Specification
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Content
))
{
where
+=
$@" and
{
nameof
(
RB_Product_Specification
.
Content
)}
like '%
{
dmodel
.
Content
}
%'"
;
}
string
sql
=
$@"select * from RB_Product_Specification where
{
where
}
order by Id desc"
;
return
GetPage
<
RB_Product_Specification_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Product_Specification_Extend
>
GetList
(
RB_Product_Specification_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Product_Specification
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Specification
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Specification
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Specification
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and
{
nameof
(
RB_Product_Specification
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Content
))
{
where
+=
$@" and
{
nameof
(
RB_Product_Specification
.
Content
)}
like '%
{
dmodel
.
Content
}
%'"
;
}
string
sql
=
$@"select * from RB_Product_Specification where
{
where
}
order by Id desc"
;
return
Get
<
RB_Product_Specification_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/User/RB_Member_UserRepository.cs
View file @
3163f6eb
...
...
@@ -188,21 +188,55 @@ select * from RB_Member_User where {where} order by CreateDate desc
if
(
tier
==
1
)
{
string
sql
=
$@"SELECT u.SuperiorId,COUNT(0) AS ReferralsNum FROM rb_member_user u
WHERE u.
IsDistributor=1 and u.
TenantId=
{
tenantId
}
and u.MallBaseId=
{
mallBaseId
}
and u.SuperiorId in (
{
uids
}
) GROUP BY u.SuperiorId"
;
WHERE u.TenantId=
{
tenantId
}
and u.MallBaseId=
{
mallBaseId
}
and u.SuperiorId in (
{
uids
}
) GROUP BY u.SuperiorId"
;
return
Get
<
RB_Member_User_Extend
>(
sql
).
ToList
();
}
else
if
(
tier
==
2
)
{
string
sql
=
$@"SELECT u.SuperiorId,COUNT(0) AS ReferralsNum FROM rb_member_user u
INNER JOIN rb_member_user u1 on u.Id=u1.SuperiorId
WHERE u.
IsDistributor=1 and u.
TenantId=
{
tenantId
}
and u.MallBaseId=
{
mallBaseId
}
and u.SuperiorId in (
{
uids
}
) GROUP BY u.SuperiorId"
;
WHERE u.TenantId=
{
tenantId
}
and u.MallBaseId=
{
mallBaseId
}
and u.SuperiorId in (
{
uids
}
) GROUP BY u.SuperiorId"
;
return
Get
<
RB_Member_User_Extend
>(
sql
).
ToList
();
}
else
if
(
tier
==
3
)
{
string
sql
=
$@"SELECT u.SuperiorId,COUNT(0) AS ReferralsNum FROM rb_member_user u
INNER JOIN rb_member_user u1 on u.Id=u1.SuperiorId
INNER JOIN rb_member_user u2 on u1.Id=u2.SuperiorId
WHERE u.IsDistributor=1 and u.TenantId=
{
tenantId
}
and u.MallBaseId=
{
mallBaseId
}
and u.SuperiorId in (
{
uids
}
) GROUP BY u.SuperiorId"
;
WHERE u.TenantId=
{
tenantId
}
and u.MallBaseId=
{
mallBaseId
}
and u.SuperiorId in (
{
uids
}
) GROUP BY u.SuperiorId"
;
return
Get
<
RB_Member_User_Extend
>(
sql
).
ToList
();
}
return
new
List
<
RB_Member_User_Extend
>();
}
/// <summary>
/// 获取下级用户列表
/// </summary>
/// <param name="userId"></param>
/// <param name="referralsType"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
List
<
RB_Member_User_Extend
>
GetDistributorReferralsPageList
(
int
?
userId
,
int
?
referralsType
,
int
tenantId
,
int
mallBaseId
)
{
if
(
referralsType
==
1
)
{
string
sql
=
$@"SELECT u.* FROM rb_member_user u
WHERE u.TenantId=
{
tenantId
}
and u.MallBaseId=
{
mallBaseId
}
and u.SuperiorId =
{
userId
}
order by u.CreateDate asc"
;
return
Get
<
RB_Member_User_Extend
>(
sql
).
ToList
();
}
else
if
(
referralsType
==
2
)
{
string
sql
=
$@"SELECT u1.* FROM rb_member_user u
INNER JOIN rb_member_user u1 on u.Id=u1.SuperiorId
WHERE u.TenantId=
{
tenantId
}
and u.MallBaseId=
{
mallBaseId
}
and u.SuperiorId =
{
userId
}
order by u1.CreateDate asc"
;
return
Get
<
RB_Member_User_Extend
>(
sql
).
ToList
();
}
else
if
(
referralsType
==
3
)
{
string
sql
=
$@"SELECT u2.* FROM rb_member_user u
INNER JOIN rb_member_user u1 on u.Id=u1.SuperiorId
INNER JOIN rb_member_user u2 on u1.Id=u2.SuperiorId
WHERE u.TenantId=
{
tenantId
}
and u.MallBaseId=
{
mallBaseId
}
and u.SuperiorId =
{
userId
}
order by u2.CreateDate asc"
;
return
Get
<
RB_Member_User_Extend
>(
sql
).
ToList
();
}
return
new
List
<
RB_Member_User_Extend
>();
...
...
Mall.WebApi/Controllers/Product/ProductController.cs
View file @
3163f6eb
...
...
@@ -403,6 +403,42 @@ namespace Mall.WebApi.Controllers.MallBase
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 获取分类详情
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductCategoryInfo
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
CategoryId
=
parms
.
GetInt
(
"CategoryId"
,
0
);
if
(
CategoryId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
var
model
=
productModule
.
GetProductCategoryInfo
(
CategoryId
);
return
ApiResult
.
Success
(
""
,
new
{
model
.
Id
,
model
.
Name
,
model
.
Tier
,
model
.
ParentId
,
model
.
Sort
,
model
.
Icon
,
model
.
IconPath
,
model
.
BigIcon
,
model
.
BigIconPath
,
model
.
AdvertisingImage
,
model
.
AdvertisingImagePath
,
model
.
AdvertisingAddress
,
model
.
Enabled
,
model
.
IsShow
,
model
.
TenantId
,
model
.
MallBaseId
,
CreateDate
=
model
.
CreateDate
.
HasValue
?
model
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
});
}
/// <summary>
/// 保存分类
/// </summary>
...
...
@@ -583,6 +619,426 @@ namespace Mall.WebApi.Controllers.MallBase
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
#
region
商品规格
/// <summary>
/// 获取商品规格分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductSpecificationPageList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
RB_Product_Specification_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Specification_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetProducSpecificationPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
SpecList
,
x
.
TenantId
,
x
.
MallBaseId
,
UpdateDate
=
x
.
UpdateDate
.
HasValue
?
x
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取规格列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductSpecificationList
()
{
var
parms
=
RequestParm
;
RB_Product_Specification_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Specification_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetProducSpecificationList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
SpecList
,
x
.
TenantId
,
x
.
MallBaseId
,
UpdateDate
=
x
.
UpdateDate
.
HasValue
?
x
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
}));
}
/// <summary>
/// 保存修改规格
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetProductSpecificationInfo
()
{
var
req
=
RequestParm
;
RB_Product_Specification_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Specification_Extend
>(
req
.
msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
demodel
.
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请输入规格名"
);
}
if
(
demodel
.
SpecList
==
null
||
!
demodel
.
SpecList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请输入规格值"
);
}
demodel
.
Content
=
JsonConvert
.
SerializeObject
(
demodel
.
SpecList
);
demodel
.
TenantId
=
req
.
TenantId
;
demodel
.
MallBaseId
=
req
.
MallBaseId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
UpdateDate
=
DateTime
.
Now
;
demodel
.
Status
=
0
;
bool
flag
=
productModule
.
SetProductSpecificationInfo
(
demodel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 删除商品规格
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DelProductSpecificationInfo
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
SpecificationId
=
parms
.
GetInt
(
"SpecificationId"
,
0
);
if
(
SpecificationId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
productModule
.
DelProductSpecificationInfo
(
SpecificationId
,
req
.
TenantId
,
req
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
#
region
快速购买
/// <summary>
/// 获取商品快速购买分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductQuickBuyPageList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
RB_Product_QuickBuy_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_QuickBuy_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetProductQuickBuyPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
CategoryId
,
x
.
CategoryName
,
x
.
Icon
,
x
.
IconPath
,
x
.
Sort
,
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
GetProductQuickBuyList
()
{
var
parms
=
RequestParm
;
RB_Product_QuickBuy_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_QuickBuy_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetProductQuickBuyList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
CategoryId
,
x
.
CategoryName
,
x
.
Icon
,
x
.
IconPath
,
x
.
Sort
,
x
.
TenantId
,
x
.
MallBaseId
}));
}
/// <summary>
/// 保存修改快速购买
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetProductQuickBuyInfo
()
{
var
req
=
RequestParm
;
RB_Product_QuickBuy_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_QuickBuy_Extend
>(
req
.
msg
.
ToString
());
if
((
demodel
.
CategoryId
??
0
)<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择分类"
);
}
if
(!
demodel
.
Sort
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请输入排序"
);
}
if
(
productModule
.
ValidateQuickBuyCategory
(
demodel
.
Id
,
demodel
.
CategoryId
,
req
.
TenantId
,
req
.
MallBaseId
))
{
return
ApiResult
.
Failed
(
"该分类已存在,无法再次添加"
);
}
demodel
.
TenantId
=
req
.
TenantId
;
demodel
.
MallBaseId
=
req
.
MallBaseId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
UpdateDate
=
DateTime
.
Now
;
demodel
.
Status
=
0
;
bool
flag
=
productModule
.
SetProductQuickBuyInfo
(
demodel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 删除商品快速购买
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DelProductQuickBuyInfo
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
QuickBuyId
=
parms
.
GetInt
(
"QuickBuyId"
,
0
);
if
(
QuickBuyId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
productModule
.
DelProductQuickBuyInfo
(
QuickBuyId
,
req
.
TenantId
,
req
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
#
region
推荐设置
/// <summary>
/// 获取推荐设置详情
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductRecommendSetInfo
()
{
var
req
=
RequestParm
;
var
model
=
productModule
.
GetProductRecommendSetInfo
(
req
.
TenantId
,
req
.
MallBaseId
);
return
ApiResult
.
Success
(
""
,
new
{
model
.
Id
,
model
.
DetailRecommendStatus
,
model
.
DetailRecommendNum
,
model
.
OrderCompleteStatus
,
model
.
IsOrderRecommend
,
model
.
OrderProductIds
,
model
.
OrderProductList
,
model
.
CommentRecommentStatus
,
model
.
IsCommentRecommend
,
model
.
CommentProductIds
,
model
.
CommentProductList
});
}
/// <summary>
/// 保存推荐设置
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetProductRecommendSetInfo
()
{
var
req
=
RequestParm
;
RB_Product_Recommend_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Recommend_Extend
>(
req
.
msg
.
ToString
());
if
(
demodel
.
IsOrderRecommend
==
1
)
{
if
(
demodel
.
OrderProductList
==
null
||
!
demodel
.
OrderProductList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请选择自定义推荐商品"
);
}
demodel
.
OrderProductIds
=
string
.
Join
(
","
,
demodel
.
OrderProductList
.
Select
(
x
=>
x
.
Id
).
Distinct
());
}
if
(
demodel
.
IsCommentRecommend
==
1
)
{
if
(
demodel
.
CommentProductList
==
null
||
!
demodel
.
CommentProductList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请选择自定义推荐商品"
);
}
demodel
.
CommentProductIds
=
string
.
Join
(
","
,
demodel
.
CommentProductList
.
Select
(
x
=>
x
.
Id
).
Distinct
());
}
demodel
.
TenantId
=
req
.
TenantId
;
demodel
.
MallBaseId
=
req
.
MallBaseId
;
demodel
.
OrderProductIds
??=
""
;
demodel
.
CommentProductIds
??=
""
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
UpdateDate
=
DateTime
.
Now
;
bool
flag
=
productModule
.
SetProductRecommendSetInfo
(
demodel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
#
region
商品服务
/// <summary>
/// 获取商品服务分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductServicePageList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
RB_Product_Service_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Service_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetProductServicePageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
Sort
,
x
.
Remark
,
x
.
IsDefault
,
x
.
TenantId
,
x
.
MallBaseId
,
UpdateDate
=
x
.
UpdateDate
.
HasValue
?
x
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取服务列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductServiceList
()
{
var
parms
=
RequestParm
;
RB_Product_Service_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Service_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
parms
.
TenantId
;
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetProductServiceList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
Sort
,
x
.
Remark
,
x
.
IsDefault
}));
}
/// <summary>
/// 保存修改服务
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetProductServiceInfo
()
{
var
req
=
RequestParm
;
RB_Product_Service_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Service_Extend
>(
req
.
msg
.
ToString
());
if
(
string
.
IsNullOrEmpty
(
demodel
.
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请输入服务名称"
);
}
if
(!
demodel
.
Sort
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请输入排序"
);
}
demodel
.
TenantId
=
req
.
TenantId
;
demodel
.
MallBaseId
=
req
.
MallBaseId
;
demodel
.
IsDefault
??=
1
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
UpdateDate
=
DateTime
.
Now
;
demodel
.
Status
=
0
;
bool
flag
=
productModule
.
SetProductServiceInfo
(
demodel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 删除商品服务
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DelProductServiceInfo
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
ServiceId
=
parms
.
GetInt
(
"ServiceId"
,
0
);
if
(
ServiceId
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
productModule
.
DelProductServiceInfo
(
ServiceId
,
req
.
TenantId
,
req
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
endregion
#
region
商品列表
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/User/UserController.cs
View file @
3163f6eb
...
...
@@ -1090,6 +1090,28 @@ namespace Mall.WebApi.Controllers.MallBase
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取分销等级下拉列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDistributorGradeDropdownList
()
{
var
parms
=
RequestParm
;
RB_Distributor_Grade_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Distributor_Grade_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
userModule
.
GetDistributorGradeDropdownList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
Grade
}));
}
/// <summary>
/// 获取分销层级
/// </summary>
...
...
@@ -1220,6 +1242,42 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
/// <summary>
/// 新增修改分销商等级启用
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetDistributorGradeEnabledStatus
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
GradeId
=
parms
.
GetInt
(
"GradeId"
,
0
);
if
(
GradeId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递等级id"
);
}
var
model
=
userModule
.
GetDistributorGradeInfo
(
GradeId
);
if
(
model
==
null
)
{
return
ApiResult
.
ParamIsNull
(
"信息不存在,核实后再试"
);
}
if
(
model
.
Enabled
==
1
)
{
//验证是否有分销商在使用该等级
if
(
userModule
.
ValidateDistributorGradeEnabled
(
GradeId
))
{
return
ApiResult
.
ParamIsNull
(
"该等级由分销商正在使用,无法停用"
);
}
}
bool
flag
=
userModule
.
SetDistributorGradeEnabledStatus
(
model
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 删除会员等级
/// </summary>
...
...
@@ -1243,6 +1301,21 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
/// <summary>
/// 获取分销商升级条件枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDistrbutorGradeUpdateEnumList
()
{
var
list
=
EnumHelper
.
GetEnumList
(
typeof
(
DistrbutorGradeUpdateEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
Name
=
x
.
Key
,
Id
=
Convert
.
ToInt32
(
x
.
Value
)
}));
}
#
endregion
#
region
分销商申请管理
...
...
@@ -1291,6 +1364,34 @@ namespace Mall.WebApi.Controllers.MallBase
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取分销商下线
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDistributorInfoReferralsList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
RB_Distributor_Info_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Distributor_Info_Extend
>(
parms
.
msg
.
ToString
());
if
((
demodel
.
UserId
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
();
}
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
userModule
.
GetDistributorInfoReferralsPageList
(
demodel
);
var
model
=
userModule
.
GetMemberUserInfo
(
demodel
.
UserId
??
0
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
DistributorName
=
model
.
Name
,
demodel
.
ReferralsType
,
x
.
Name
,
CreateDate
=
x
.
CreateDate
.
HasValue
?
x
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
}));
}
/// <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