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
0faccf69
Commit
0faccf69
authored
Apr 27, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分销+商品分类
parent
54981cbb
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
2444 additions
and
30 deletions
+2444
-30
DistributorAuditStatusEnum.cs
Mall.Common/Enum/User/DistributorAuditStatusEnum.cs
+31
-0
DistributorExportEnum.cs
Mall.Common/Enum/User/DistributorExportEnum.cs
+81
-0
DistributorRemitAuditStatusEnum.cs
Mall.Common/Enum/User/DistributorRemitAuditStatusEnum.cs
+36
-0
DistributorRemitExportEnum.cs
Mall.Common/Enum/User/DistributorRemitExportEnum.cs
+71
-0
RB_Product_Category.cs
Mall.Model/Entity/Product/RB_Product_Category.cs
+154
-0
RB_Product_CategoryStyle.cs
Mall.Model/Entity/Product/RB_Product_CategoryStyle.cs
+90
-0
RB_Distributor_Basics.cs
Mall.Model/Entity/User/RB_Distributor_Basics.cs
+2
-2
RB_Distributor_Info.cs
Mall.Model/Entity/User/RB_Distributor_Info.cs
+1
-1
RB_Distributor_Remit.cs
Mall.Model/Entity/User/RB_Distributor_Remit.cs
+19
-3
RB_Product_CategoryStyle_Extend.cs
Mall.Model/Extend/Product/RB_Product_CategoryStyle_Extend.cs
+18
-0
RB_Product_Category_Extend.cs
Mall.Model/Extend/Product/RB_Product_Category_Extend.cs
+84
-0
RB_Distributor_Basics_Extend.cs
Mall.Model/Extend/User/RB_Distributor_Basics_Extend.cs
+4
-0
RB_Distributor_Info_Extend.cs
Mall.Model/Extend/User/RB_Distributor_Info_Extend.cs
+10
-0
RB_Distributor_Remit_Extend.cs
Mall.Model/Extend/User/RB_Distributor_Remit_Extend.cs
+34
-0
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+392
-0
UserCommonModule.cs
Mall.Module.User/UserCommonModule.cs
+34
-2
UserModule.cs
Mall.Module.User/UserModule.cs
+381
-10
RB_Material_InfoRepository.cs
Mall.Repository/Product/RB_Material_InfoRepository.cs
+10
-5
RB_Product_CategoryRepository.cs
Mall.Repository/Product/RB_Product_CategoryRepository.cs
+111
-0
RB_Product_CategoryStyleRepository.cs
....Repository/Product/RB_Product_CategoryStyleRepository.cs
+66
-0
RB_Distributor_InfoRepository.cs
Mall.Repository/User/RB_Distributor_InfoRepository.cs
+62
-0
RB_Distributor_RemitRepository.cs
Mall.Repository/User/RB_Distributor_RemitRepository.cs
+106
-0
BaseController.cs
Mall.WebApi/Controllers/BaseController.cs
+1
-0
ProductController.cs
Mall.WebApi/Controllers/Product/ProductController.cs
+239
-0
UserController.cs
Mall.WebApi/Controllers/User/UserController.cs
+407
-7
No files found.
Mall.Common/Enum/User/DistributorAuditStatusEnum.cs
0 → 100644
View file @
0faccf69
using
Mall.Common.Plugin
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Mall.Common.Enum.User
{
/// <summary>
/// 分销商审核状态枚举
/// </summary>
public
enum
DistributorAuditStatusEnum
{
/// <summary>
/// 审核中
/// </summary>
[
EnumField
(
"未审核"
)]
Auditing
=
1
,
/// <summary>
/// 审核通过
/// </summary>
[
EnumField
(
"已通过"
)]
Audited
=
2
,
/// <summary>
/// 审核拒绝
/// </summary>
[
EnumField
(
"已拒绝"
)]
Reject
=
3
}
}
Mall.Common/Enum/User/DistributorExportEnum.cs
0 → 100644
View file @
0faccf69
using
Mall.Common.Plugin
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Mall.Common.Enum.User
{
/// <summary>
/// 分销商导出选项枚举
/// </summary>
public
enum
DistributorExportEnum
{
/// <summary>
/// 所属平台
/// </summary>
[
EnumField
(
"所属平台"
)]
SSPT
=
1
,
/// <summary>
/// 用户ID
/// </summary>
[
EnumField
(
"用户ID"
)]
YHID
=
2
,
/// <summary>
/// 昵称
/// </summary>
[
EnumField
(
"昵称"
)]
NC
=
3
,
/// <summary>
/// 姓名
/// </summary>
[
EnumField
(
"姓名"
)]
Name
=
4
,
/// <summary>
/// 绑定手机号
/// </summary>
[
EnumField
(
"手机号"
)]
BDSJH
=
5
,
/// <summary>
/// 申请时间
/// </summary>
[
EnumField
(
"申请时间"
)]
Time
=
6
,
/// <summary>
/// 审核状态
/// </summary>
[
EnumField
(
"审核状态"
)]
AuditStatus
=
7
,
/// <summary>
/// 累计佣金
/// </summary>
[
EnumField
(
"累计佣金"
)]
LJYJ
=
8
,
/// <summary>
/// 可提现佣金
/// </summary>
[
EnumField
(
"可提现佣金"
)]
KTXYJ
=
9
,
/// <summary>
/// 订单数
/// </summary>
[
EnumField
(
"订单数"
)]
DDS
=
10
,
/// <summary>
/// 下级用户
/// </summary>
[
EnumField
(
"下级用户"
)]
XJYH
=
11
,
/// <summary>
/// 推荐人
/// </summary>
[
EnumField
(
"推荐人"
)]
TJR
=
12
,
/// <summary>
/// 备注信息
/// </summary>
[
EnumField
(
"备注信息"
)]
BZ
=
13
}
}
Mall.Common/Enum/User/DistributorRemitAuditStatusEnum.cs
0 → 100644
View file @
0faccf69
using
Mall.Common.Plugin
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Mall.Common.Enum.User
{
/// <summary>
/// 分销商提现审核状态枚举
/// </summary>
public
enum
DistributorRemitAuditStatusEnum
{
/// <summary>
/// 未审核
/// </summary>
[
EnumField
(
"未审核"
)]
Auditing
=
1
,
/// <summary>
/// 待打款
/// </summary>
[
EnumField
(
"待打款"
)]
ToPlayWith
=
2
,
/// <summary>
/// 已打款
/// </summary>
[
EnumField
(
"已打款"
)]
HaveMoney
=
3
,
/// <summary>
/// 驳回
/// </summary>
[
EnumField
(
"驳回"
)]
Reject
=
4
}
}
Mall.Common/Enum/User/DistributorRemitExportEnum.cs
0 → 100644
View file @
0faccf69
using
Mall.Common.Plugin
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Mall.Common.Enum.User
{
/// <summary>
/// 分销提现导出选项枚举
/// </summary>
public
enum
DistributorRemitExportEnum
{
/// <summary>
/// 所属平台
/// </summary>
[
EnumField
(
"所属平台"
)]
SSPT
=
1
,
/// <summary>
/// 订单号
/// </summary>
[
EnumField
(
"订单号"
)]
OrderNum
=
2
,
/// <summary>
/// 昵称
/// </summary>
[
EnumField
(
"昵称"
)]
NC
=
3
,
/// <summary>
/// 提现金额
/// </summary>
[
EnumField
(
"提现金额"
)]
TXJE
=
4
,
/// <summary>
/// 申请日期
/// </summary>
[
EnumField
(
"申请日期"
)]
SQRQ
=
5
,
/// <summary>
/// 银行名称
/// </summary>
[
EnumField
(
"银行名称"
)]
Bank
=
6
,
/// <summary>
/// 打款账户
/// </summary>
[
EnumField
(
"打款账户"
)]
DKZH
=
7
,
/// <summary>
/// 真实姓名
/// </summary>
[
EnumField
(
"真实姓名"
)]
ZSXM
=
8
,
/// <summary>
/// 状态
/// </summary>
[
EnumField
(
"状态"
)]
Status
=
9
,
/// <summary>
/// 打款方式
/// </summary>
[
EnumField
(
"打款方式"
)]
DKFS
=
10
,
/// <summary>
/// 打款时间
/// </summary>
[
EnumField
(
"打款时间"
)]
DKSJ
=
11
}
}
Mall.Model/Entity/Product/RB_Product_Category.cs
0 → 100644
View file @
0faccf69
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_Category
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 分类名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 层级
/// </summary>
public
int
?
Tier
{
get
;
set
;
}
/// <summary>
/// 父级id
/// </summary>
public
int
?
ParentId
{
get
;
set
;
}
/// <summary>
/// 根节点id
/// </summary>
public
int
?
RootId
{
get
;
set
;
}
/// <summary>
/// 排序
/// </summary>
public
int
?
Sort
{
get
;
set
;
}
/// <summary>
/// 分类图标
/// </summary>
public
int
?
Icon
{
get
;
set
;
}
/// <summary>
/// 分类大图
/// </summary>
public
int
?
BigIcon
{
get
;
set
;
}
/// <summary>
/// 分类广告图
/// </summary>
public
int
?
AdvertisingImage
{
get
;
set
;
}
/// <summary>
/// 分类广告链接
/// </summary>
public
string
AdvertisingAddress
{
get
;
set
;
}
/// <summary>
/// 启用 1是 2否
/// </summary>
public
int
?
Enabled
{
get
;
set
;
}
/// <summary>
/// 是否显示 1是 2否
/// </summary>
public
int
?
IsShow
{
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_CategoryStyle.cs
0 → 100644
View file @
0faccf69
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_CategoryStyle
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 分类 1一级样式 2二级样式 3三级样式
/// </summary>
public
int
?
Type
{
get
;
set
;
}
/// <summary>
/// 样式id
/// </summary>
public
int
?
Style
{
get
;
set
;
}
/// <summary>
/// 每个分类商品显示总数
/// </summary>
public
int
?
CategoryNum
{
get
;
set
;
}
/// <summary>
/// 商品每行显示的数量
/// </summary>
public
int
?
RowNum
{
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/User/RB_Distributor_Basics.cs
View file @
0faccf69
...
...
@@ -107,9 +107,9 @@ namespace Mall.Model.Entity.User
/// </summary>
public
string
GradeEntranceImage
{
get
;
set
;
}
/// <summary>
/// 提现方式 枚举
/// 提现方式 枚举
json格式
/// </summary>
public
DistrbutorWithdrawWayEnum
?
WithdrawWay
public
string
WithdrawWay
{
get
;
set
;
...
...
Mall.Model/Entity/User/RB_Distributor_Info.cs
View file @
0faccf69
...
...
@@ -65,7 +65,7 @@ namespace Mall.Model.Entity.User
/// <summary>
/// 审核状态 1审核中 2通过 3拒绝
/// </summary>
public
int
?
AuditStatus
public
DistributorAuditStatusEnum
?
AuditStatus
{
get
;
set
;
...
...
Mall.Model/Entity/User/RB_Distributor_Remit.cs
View file @
0faccf69
...
...
@@ -33,7 +33,7 @@ namespace Mall.Model.Entity.User
/// <summary>
/// 提现方式 枚举
/// </summary>
public
int
?
WithdrawalWay
public
DistrbutorWithdrawWayEnum
?
WithdrawalWay
{
get
;
set
;
...
...
@@ -65,7 +65,7 @@ namespace Mall.Model.Entity.User
/// <summary>
/// 审核状态 1申请中 2同意申请,待打款 3已打款 4拒绝
/// </summary>
public
int
?
AuditStatus
public
DistributorRemitAuditStatusEnum
?
AuditStatus
{
get
;
set
;
...
...
@@ -87,6 +87,10 @@ namespace Mall.Model.Entity.User
set
;
}
/// <summary>
/// 拒绝时间
/// </summary>
public
DateTime
?
RejectDate
{
get
;
set
;
}
/// <summary>
/// 审核备注
/// </summary>
public
string
AuditRemark
...
...
@@ -103,6 +107,10 @@ namespace Mall.Model.Entity.User
set
;
}
/// <summary>
/// 拒绝备注
/// </summary>
public
string
RejectRemark
{
get
;
set
;
}
/// <summary>
/// 商户号
/// </summary>
public
int
TenantId
...
...
@@ -127,7 +135,7 @@ namespace Mall.Model.Entity.User
set
;
}
/// <summary>
///
账户
名称
///
真实
名称
/// </summary>
public
string
AccountName
{
...
...
@@ -142,5 +150,13 @@ namespace Mall.Model.Entity.User
get
;
set
;
}
/// <summary>
/// 银行名称
/// </summary>
public
string
BankName
{
get
;
set
;
}
/// <summary>
/// 提现订单号
/// </summary>
public
string
OrderNum
{
get
;
set
;
}
}
}
Mall.Model/Extend/Product/RB_Product_CategoryStyle_Extend.cs
0 → 100644
View file @
0faccf69
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_CategoryStyle_Extend
:
RB_Product_CategoryStyle
{
}
}
Mall.Model/Extend/Product/RB_Product_Category_Extend.cs
0 → 100644
View file @
0faccf69
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_Category_Extend
:
RB_Product_Category
{
/// <summary>
/// 分类ids
/// </summary>
public
string
CategoryIds
{
get
;
set
;
}
/// <summary>
/// 分类图标
/// </summary>
public
string
IconPath
{
get
;
set
;
}
/// <summary>
/// 分类大图
/// </summary>
public
string
BigIconPath
{
get
;
set
;
}
/// <summary>
/// 分类广告图
/// </summary>
public
string
AdvertisingImagePath
{
get
;
set
;
}
}
/// <summary>
/// 树形结构
/// </summary>
public
class
RB_Product_CategoryTree
{
/// <summary>
/// id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 分类名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 分类图标
/// </summary>
public
int
Icon
{
get
;
set
;
}
/// <summary>
/// 地址
/// </summary>
public
string
IconPath
{
get
;
set
;
}
/// <summary>
/// 子集列表
/// </summary>
public
List
<
RB_Product_CategoryTree
>
ChildList
{
get
;
set
;
}
}
/// <summary>
/// 分类排序
/// </summary>
public
class
RB_Product_CategorySort
{
/// <summary>
/// id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 排序
/// </summary>
public
int
Sort
{
get
;
set
;
}
}
}
Mall.Model/Extend/User/RB_Distributor_Basics_Extend.cs
View file @
0faccf69
...
...
@@ -21,5 +21,9 @@ namespace Mall.Model.Extend.User
/// 路径
/// </summary>
public
string
BackgroundImagePath
{
get
;
set
;
}
/// <summary>
/// 提现方式枚举
/// </summary>
public
List
<
int
>
WithdrawWayList
{
get
;
set
;
}
}
}
Mall.Model/Extend/User/RB_Distributor_Info_Extend.cs
View file @
0faccf69
...
...
@@ -63,5 +63,15 @@ namespace Mall.Model.Extend.User
/// 用户ids
/// </summary>
public
string
UserIds
{
get
;
set
;
}
/// <summary>
/// 订单数量
/// </summary>
public
int
?
OrderNum
{
get
;
set
;
}
/// <summary>
/// 下载枚举ids
/// </summary>
public
List
<
int
>
ExcelEnumIds
{
get
;
set
;
}
}
}
Mall.Model/Extend/User/RB_Distributor_Remit_Extend.cs
0 → 100644
View file @
0faccf69
using
Mall.Common.AOP
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.User
;
using
Mall.Common.Enum.User
;
namespace
Mall.Model.Extend.User
{
/// <summary>
/// 商户分销提现表扩展实体
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Distributor_Remit_Extend
:
RB_Distributor_Remit
{
/// <summary>
/// 用户名称
/// </summary>
public
string
UserName
{
get
;
set
;
}
/// <summary>
/// 头像
/// </summary>
public
string
Photo
{
get
;
set
;
}
/// <summary>
/// 来源
/// </summary>
public
UserSourceEnum
?
Source
{
get
;
set
;
}
/// <summary>
/// 下载枚举
/// </summary>
public
List
<
int
>
ExcelEnumIds
{
get
;
set
;
}
}
}
Mall.Module.Product/ProductModule.cs
View file @
0faccf69
...
...
@@ -25,8 +25,17 @@ namespace Mall.Module.Product
/// 素材管理
/// </summary>
private
readonly
RB_Material_InfoRepository
material_InfoRepository
=
new
RB_Material_InfoRepository
();
/// <summary>
/// 商品分类
/// </summary>
private
readonly
RB_Product_CategoryRepository
product_CategoryRepository
=
new
RB_Product_CategoryRepository
();
/// <summary>
/// 商品分类样式
/// </summary>
private
readonly
RB_Product_CategoryStyleRepository
product_CategoryStyleRepository
=
new
RB_Product_CategoryStyleRepository
();
#
region
素材管理
/// <summary>
/// 获取素材分组列表
/// </summary>
...
...
@@ -364,5 +373,388 @@ namespace Mall.Module.Product
}
return
material_InfoRepository
.
SetMaterialInfoTransfer
(
materialIds
,
groupId
,
uid
,
mallBaseId
);
}
#
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_Category_Extend
>
GetProductCategoryPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Product_Category_Extend
demodel
)
{
var
list
=
product_CategoryRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
if
(
list
.
Any
())
{
List
<
int
>
ImgIds
=
new
List
<
int
>();
ImgIds
.
AddRange
(
list
.
Select
(
x
=>
x
.
Icon
??
0
).
Distinct
());
ImgIds
.
AddRange
(
list
.
Select
(
x
=>
x
.
BigIcon
??
0
).
Distinct
());
ImgIds
.
AddRange
(
list
.
Select
(
x
=>
x
.
AdvertisingImage
??
0
).
Distinct
());
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
),
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
}
foreach
(
var
item
in
list
)
{
item
.
IconPath
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
Icon
).
FirstOrDefault
()?.
Path
??
""
;
item
.
BigIconPath
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
BigIcon
).
FirstOrDefault
()?.
Path
??
""
;
item
.
AdvertisingImagePath
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
AdvertisingImage
).
FirstOrDefault
()?.
Path
??
""
;
}
}
return
list
;
}
/// <summary>
/// 删除分类
/// </summary>
/// <param name="categoryId"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
DelProductCategoryInfo
(
int
categoryId
,
int
tenantId
,
int
mallBaseId
)
{
var
trans
=
product_CategoryRepository
.
DbTransaction
;
try
{
var
list
=
GetProductCategoryForALLChlid
(
categoryId
,
tenantId
,
mallBaseId
);
foreach
(
var
item
in
list
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Category
.
Status
),
1
},
{
nameof
(
RB_Product_Category
.
UpdateDate
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Category
.
Id
),
FiledValue
=
categoryId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Category
.
TenantId
),
FiledValue
=
tenantId
,
OperatorEnum
=
OperatorEnum
.
Equal
},
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Category
.
MallBaseId
),
FiledValue
=
mallBaseId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
product_CategoryRepository
.
Update
(
keyValues
,
wheres
,
trans
);
}
product_CategoryRepository
.
DBSession
.
Commit
();
return
true
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"DelProductCategoryInfo"
);
product_CategoryRepository
.
DBSession
.
Rollback
();
return
false
;
}
}
/// <summary>
/// 获取分类样式
/// </summary>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
RB_Product_CategoryStyle_Extend
GetProductCategoryStyleInfo
(
int
tenantId
,
int
mallBaseId
)
{
return
product_CategoryStyleRepository
.
GetList
(
new
RB_Product_CategoryStyle_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
}).
FirstOrDefault
();
}
/// <summary>
/// 保存分类样式
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
SetProductCategoryStyleInfo
(
RB_Product_CategoryStyle_Extend
demodel
)
{
if
(
demodel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_CategoryStyle
.
Type
),
demodel
.
Type
},
{
nameof
(
RB_Product_CategoryStyle
.
Style
),
demodel
.
Style
},
{
nameof
(
RB_Product_CategoryStyle
.
CategoryNum
),
demodel
.
CategoryNum
},
{
nameof
(
RB_Product_CategoryStyle
.
RowNum
),
demodel
.
RowNum
},
{
nameof
(
RB_Product_CategoryStyle
.
UpdateDate
),
demodel
.
UpdateDate
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Category
.
Id
),
FiledValue
=
demodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
product_CategoryStyleRepository
.
Update
(
keyValues
,
wheres
);
}
else
{
return
product_CategoryStyleRepository
.
Insert
(
demodel
)
>
0
;
}
}
/// <summary>
/// 保存排序
/// </summary>
/// <param name="delist"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
SetProductCategorySort
(
List
<
RB_Product_CategorySort
>
delist
,
int
tenantId
,
int
mallBaseId
)
{
var
trans
=
product_CategoryRepository
.
DbTransaction
;
try
{
string
ids
=
string
.
Join
(
","
,
delist
.
Select
(
x
=>
x
.
Id
));
var
list
=
product_CategoryRepository
.
GetList
(
new
RB_Product_Category_Extend
()
{
CategoryIds
=
ids
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
if
(
list
.
Any
())
{
foreach
(
var
item
in
list
)
{
var
demodel
=
delist
.
Where
(
x
=>
x
.
Id
==
item
.
Id
).
FirstOrDefault
();
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Category
.
Sort
),
demodel
.
Sort
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Category
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
product_CategoryRepository
.
Update
(
keyValues
,
wheres
,
trans
);
}
}
product_CategoryRepository
.
DBSession
.
Commit
();
return
true
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetProductCategorySort"
);
product_CategoryRepository
.
DBSession
.
Rollback
();
return
false
;
}
}
/// <summary>
/// 获取树形结构列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Product_CategoryTree
>
GetProductCategoryTreeList
(
RB_Product_Category_Extend
demodel
)
{
List
<
RB_Product_CategoryTree
>
treeList
=
new
List
<
RB_Product_CategoryTree
>();
var
list
=
product_CategoryRepository
.
GetList
(
demodel
);
if
(
list
.
Any
())
{
List
<
int
>
ImgIds
=
new
List
<
int
>();
ImgIds
.
AddRange
(
list
.
Select
(
x
=>
x
.
Icon
??
0
).
Distinct
());
ImgIds
.
AddRange
(
list
.
Select
(
x
=>
x
.
BigIcon
??
0
).
Distinct
());
ImgIds
.
AddRange
(
list
.
Select
(
x
=>
x
.
AdvertisingImage
??
0
).
Distinct
());
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
),
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
}
foreach
(
var
item
in
list
)
{
item
.
IconPath
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
Icon
).
FirstOrDefault
()?.
Path
??
""
;
item
.
BigIconPath
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
BigIcon
).
FirstOrDefault
()?.
Path
??
""
;
item
.
AdvertisingImagePath
=
mlist
.
Where
(
x
=>
x
.
Id
==
item
.
AdvertisingImage
).
FirstOrDefault
()?.
Path
??
""
;
}
list
=
list
.
OrderBy
(
x
=>
x
.
Sort
).
ThenBy
(
x
=>
x
.
Id
).
ToList
();
treeList
=
GetProductCategoryChildTree
(
list
,
0
);
}
return
treeList
;
}
/// <summary>
/// 获取子集列表
/// </summary>
/// <param name="list"></param>
/// <param name="parentId"></param>
/// <returns></returns>
public
List
<
RB_Product_CategoryTree
>
GetProductCategoryChildTree
(
List
<
RB_Product_Category_Extend
>
list
,
int
parentId
)
{
List
<
RB_Product_CategoryTree
>
RList
=
new
List
<
RB_Product_CategoryTree
>();
var
CList
=
list
.
Where
(
x
=>
x
.
ParentId
==
parentId
).
ToList
();
foreach
(
var
item
in
CList
)
{
var
cmodel
=
new
RB_Product_CategoryTree
{
Id
=
item
.
Id
,
Name
=
item
.
Name
,
Icon
=
item
.
Icon
??
0
,
IconPath
=
item
.
IconPath
};
cmodel
.
ChildList
=
GetProductCategoryChildTree
(
list
,
item
.
Id
);
RList
.
Add
(
cmodel
);
}
return
RList
;
}
/// <summary>
/// 保存商品分类
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
SetProductCategoryInfo
(
RB_Product_Category_Extend
demodel
)
{
if
(
demodel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Category
.
AdvertisingAddress
),
demodel
.
AdvertisingAddress
},
{
nameof
(
RB_Product_Category
.
AdvertisingImage
),
demodel
.
AdvertisingImage
},
{
nameof
(
RB_Product_Category
.
BigIcon
),
demodel
.
BigIcon
},
{
nameof
(
RB_Product_Category
.
Enabled
),
demodel
.
Enabled
},
{
nameof
(
RB_Product_Category
.
Icon
),
demodel
.
Icon
},
{
nameof
(
RB_Product_Category
.
IsShow
),
demodel
.
IsShow
},
{
nameof
(
RB_Product_Category
.
Name
),
demodel
.
Name
},
{
nameof
(
RB_Product_Category
.
Sort
),
demodel
.
Sort
},
{
nameof
(
RB_Product_Category
.
UpdateDate
),
demodel
.
UpdateDate
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Category
.
Id
),
FiledValue
=
demodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
product_CategoryRepository
.
Update
(
keyValues
,
wheres
);
}
else
{
int
Id
=
product_CategoryRepository
.
Insert
(
demodel
);
if
(
Id
>
0
)
{
int
RootId
=
Id
;
if
(
demodel
.
ParentId
>
0
)
{
var
pmodel
=
product_CategoryRepository
.
GetEntity
(
demodel
.
ParentId
);
RootId
=
pmodel
?.
RootId
??
0
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Category
.
RootId
),
RootId
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Category
.
Id
),
FiledValue
=
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
product_CategoryRepository
.
Update
(
keyValues
,
wheres
);
}
return
Id
>
0
;
}
}
/// <summary>
/// 获取当前分类的所有子集分类
/// </summary>
/// <param name="categoryId"></param>
/// <param name="tid"></param>
/// <param name="mid"></param>
/// <returns></returns>
public
List
<
RB_Product_Category_Extend
>
GetProductCategoryForALLChlid
(
int
categoryId
,
int
tid
,
int
mid
)
{
var
model
=
product_CategoryRepository
.
GetEntity
(
categoryId
);
var
list
=
product_CategoryRepository
.
GetList
(
new
RB_Product_Category_Extend
()
{
RootId
=
model
.
RootId
,
TenantId
=
tid
,
MallBaseId
=
mid
});
List
<
RB_Product_Category_Extend
>
RList
=
GetProductCategoryALLChild
(
list
,
model
.
Id
);
RList
.
AddRange
(
list
.
Where
(
x
=>
x
.
Id
==
model
.
Id
).
ToList
());
return
RList
;
}
/// <summary>
/// 获取所有子集
/// </summary>
/// <param name="list"></param>
/// <param name="id"></param>
/// <returns></returns>
private
List
<
RB_Product_Category_Extend
>
GetProductCategoryALLChild
(
List
<
RB_Product_Category_Extend
>
list
,
int
id
)
{
List
<
RB_Product_Category_Extend
>
RList
=
new
List
<
RB_Product_Category_Extend
>();
var
list2
=
list
.
Where
(
x
=>
x
.
ParentId
==
id
).
ToList
();
RList
.
AddRange
(
list2
);
foreach
(
var
item
in
list2
)
{
RList
.
AddRange
(
GetProductCategoryALLChild
(
list
,
item
.
Id
));
}
return
RList
;
}
/// <summary>
/// 分类转移
/// </summary>
/// <param name="cmodel"></param>
/// <param name="parentId"></param>
/// <param name="list"></param>
/// <returns></returns>
public
bool
SetProductCategoryTransfer
(
RB_Product_Category_Extend
cmodel
,
int
parentId
,
List
<
RB_Product_Category_Extend
>
list
)
{
var
trans
=
product_CategoryRepository
.
DbTransaction
;
try
{
int
RootId
=
cmodel
.
Id
;
int
Tier
=
0
;
if
(
parentId
>
0
)
{
var
pmodel
=
product_CategoryRepository
.
GetEntity
(
parentId
);
if
(
pmodel
==
null
)
{
return
false
;
}
RootId
=
pmodel
.
RootId
??
0
;
Tier
=
(
pmodel
.
Tier
??
0
)
+
1
;
}
else
{
Tier
=
1
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Category
.
ParentId
),
parentId
},
{
nameof
(
RB_Product_Category
.
UpdateDate
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Category
.
Id
),
FiledValue
=
cmodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
product_CategoryRepository
.
Update
(
keyValues
,
wheres
,
trans
);
if
(
flag
)
{
//更新所有子集rootid=
foreach
(
var
item
in
list
)
{
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Product_Category
.
RootId
),
RootId
},
{
nameof
(
RB_Product_Category
.
Tier
),
Tier
+(
item
.
Tier
??
0
)-(
cmodel
.
Tier
??
0
)
}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Product_Category
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
product_CategoryRepository
.
Update
(
keyValues1
,
wheres1
,
trans
);
}
}
product_CategoryRepository
.
DBSession
.
Commit
();
return
flag
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetProductCategoryTransfer"
);
product_CategoryRepository
.
DBSession
.
Rollback
();
return
false
;
}
}
#
endregion
}
}
Mall.Module.User/UserCommonModule.cs
View file @
0faccf69
...
...
@@ -28,6 +28,10 @@ namespace Mall.Module.User
/// 分销自定义设置
/// </summary>
private
readonly
RB_Distributor_CustomRepository
distributor_CustomRepository
=
new
RB_Distributor_CustomRepository
();
/// <summary>
/// 分类样式
/// </summary>
private
readonly
RB_Product_CategoryStyleRepository
product_CategoryStyleRepository
=
new
RB_Product_CategoryStyleRepository
();
/// <summary>
/// 初始化分销基础配置
...
...
@@ -66,7 +70,7 @@ namespace Mall.Module.User
UpdateDate
=
DateTime
.
Now
,
UserNotes
=
""
,
WithdrawFee
=
0
,
WithdrawWay
=
Common
.
Enum
.
User
.
DistrbutorWithdrawWayEnum
.
ZDDK
,
WithdrawWay
=
"["
+
(
int
)
Common
.
Enum
.
User
.
DistrbutorWithdrawWayEnum
.
ZDDK
+
"]"
,
IsCommissionResidue
=
2
})
>
0
;
}
...
...
@@ -83,7 +87,7 @@ namespace Mall.Module.User
public
bool
InitializeDistributorCustomInfo
(
int
TenantId
,
int
MallBaseId
)
{
var
OModel
=
distributor_CustomRepository
.
GetList
(
new
RB_Distributor_Custom_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
}).
FirstOrDefault
();
if
(
OModel
!
=
null
)
if
(
OModel
=
=
null
)
{
return
distributor_CustomRepository
.
Insert
(
new
RB_Distributor_Custom
()
{
...
...
@@ -130,5 +134,33 @@ namespace Mall.Module.User
return
true
;
}
}
/// <summary>
/// 初始化分类样式
/// </summary>
/// <param name="TenantId"></param>
/// <param name="MallBaseId"></param>
/// <returns></returns>
public
bool
InitializeCategoryStyleInfo
(
int
TenantId
,
int
MallBaseId
)
{
var
OModel
=
product_CategoryStyleRepository
.
GetList
(
new
RB_Product_CategoryStyle_Extend
()
{
TenantId
=
TenantId
,
MallBaseId
=
MallBaseId
}).
FirstOrDefault
();
if
(
OModel
==
null
)
{
return
product_CategoryStyleRepository
.
Insert
(
new
Model
.
Entity
.
Product
.
RB_Product_CategoryStyle
()
{
CategoryNum
=
1
,
CreateDate
=
DateTime
.
Now
,
Id
=
0
,
MallBaseId
=
MallBaseId
,
RowNum
=
1
,
Style
=
1
,
TenantId
=
TenantId
,
Type
=
1
,
UpdateDate
=
DateTime
.
Now
})
>
0
;
}
else
{
return
true
;
}
}
}
}
Mall.Module.User/UserModule.cs
View file @
0faccf69
...
...
@@ -12,6 +12,7 @@ using Mall.Repository.Product;
using
Mall.Model.Extend.Product
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Configuration.Json
;
using
Newtonsoft.Json
;
namespace
Mall.Module.User
{
...
...
@@ -60,6 +61,10 @@ namespace Mall.Module.User
/// 分销商
/// </summary>
private
readonly
RB_Distributor_InfoRepository
distributor_InfoRepository
=
new
RB_Distributor_InfoRepository
();
/// <summary>
/// 分销提现
/// </summary>
private
readonly
RB_Distributor_RemitRepository
distributor_RemitRepository
=
new
RB_Distributor_RemitRepository
();
/// <summary>
...
...
@@ -430,7 +435,7 @@ namespace Mall.Module.User
public
bool
SetMemberIntegralInfo
(
RB_Member_Integral_Extend
demodel
)
{
var
umodel
=
member_UserRepository
.
GetEntity
(
demodel
.
UserId
);
int
Integral
=
0
;
int
Integral
;
if
(
demodel
.
Type
==
1
)
{
Integral
=
(
umodel
.
Integral
??
0
)
+
(
demodel
.
Integral
??
0
);
...
...
@@ -480,7 +485,7 @@ namespace Mall.Module.User
public
bool
SetMemberBalanceInfo
(
RB_Member_Balance_Extend
demodel
)
{
var
umodel
=
member_UserRepository
.
GetEntity
(
demodel
.
UserId
);
decimal
Balance
=
0
;
decimal
Balance
;
if
(
demodel
.
Type
==
1
)
{
Balance
=
(
umodel
.
Balance
??
0
)
+
(
demodel
.
Balance
??
0
);
...
...
@@ -601,6 +606,9 @@ namespace Mall.Module.User
}
model
.
IndexImagePath
=
material_InfoRepository
.
GetEntity
(
model
.
IndexImage
)?.
Path
??
""
;
model
.
BackgroundImagePath
=
material_InfoRepository
.
GetEntity
(
model
.
BackgroundImage
)?.
Path
??
""
;
if
(!
string
.
IsNullOrEmpty
(
model
.
WithdrawWay
))
{
model
.
WithdrawWayList
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
model
.
WithdrawWay
);
}
return
model
;
}
...
...
@@ -926,8 +934,23 @@ namespace Mall.Module.User
demodel
.
CommissionWithdrawal
??=
0
;
demodel
.
Name
??=
""
;
demodel
.
GradeId
??=
0
;
demodel
.
AuditStatus
=
1
;
return
distributor_InfoRepository
.
Insert
(
demodel
)
>
0
;
demodel
.
AuditStatus
=
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Auditing
;
bool
flag
=
distributor_InfoRepository
.
Insert
(
demodel
)
>
0
;
if
(
flag
)
{
//更新手机号码
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User
.
Moblie
),
demodel
.
Mobile
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_User
.
Id
),
FiledValue
=
demodel
.
UserId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
member_UserRepository
.
Update
(
keyValues
,
wheres
);
}
return
flag
;
}
/// <summary>
...
...
@@ -944,15 +967,15 @@ namespace Mall.Module.User
{
return
""
;
}
if
(
model
.
AuditStatus
==
3
)
if
(
model
.
AuditStatus
==
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Reject
)
{
return
"已被拒绝,无法再次申请"
;
}
else
if
(
model
.
AuditStatus
==
1
)
else
if
(
model
.
AuditStatus
==
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Auditing
)
{
return
"申请正在审核中,无法再次申请"
;
}
else
if
(
model
.
AuditStatus
==
2
)
else
if
(
model
.
AuditStatus
==
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Audited
)
{
return
"已经成为分销商,无法再次申请"
;
}
...
...
@@ -979,7 +1002,7 @@ namespace Mall.Module.User
var
list
=
distributor_InfoRepository
.
GetList
(
new
RB_Distributor_Info_Extend
()
{
UserIds
=
userIds
,
TenantId
=
Convert
.
ToInt32
(
uid
),
MallBaseId
=
mallBaseId
});
foreach
(
var
item
in
list
)
{
if
(
item
.
AuditStatus
!=
1
)
if
(
item
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Auditing
)
{
return
"用户ID:"
+
item
.
UserId
+
" 不是未审核状态,无法通过"
;
}
...
...
@@ -989,6 +1012,7 @@ namespace Mall.Module.User
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Info
.
AuditStatus
),
2
},
{
nameof
(
RB_Distributor_Info
.
Remark
),
remark
},
{
nameof
(
RB_Distributor_Info
.
AuditDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
...
...
@@ -1016,13 +1040,360 @@ namespace Mall.Module.User
}
}
}
else
if
(
type
==
2
)
{
var
list
=
distributor_InfoRepository
.
GetList
(
new
RB_Distributor_Info_Extend
()
{
UserIds
=
userIds
,
TenantId
=
Convert
.
ToInt32
(
uid
),
MallBaseId
=
mallBaseId
});
foreach
(
var
item
in
list
)
{
if
(
item
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Auditing
)
{
return
"用户ID:"
+
item
.
UserId
+
" 不是未审核状态,无法拒绝"
;
}
}
//批量修改状态
foreach
(
var
item
in
list
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Info
.
AuditStatus
),
3
},
{
nameof
(
RB_Distributor_Info
.
Remark
),
remark
},
{
nameof
(
RB_Distributor_Info
.
AuditDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Info
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
distributor_InfoRepository
.
Update
(
keyValues
,
wheres
,
trans
);
}
}
else
if
(
type
==
3
)
{
var
list
=
distributor_InfoRepository
.
GetList
(
new
RB_Distributor_Info_Extend
()
{
UserIds
=
userIds
,
TenantId
=
Convert
.
ToInt32
(
uid
),
MallBaseId
=
mallBaseId
});
foreach
(
var
item
in
list
)
{
if
(
item
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Audited
)
{
return
"用户ID:"
+
item
.
UserId
+
" 不是审核通过状态,无法删除"
;
}
}
catch
(
Exception
)
//批量修改状态
foreach
(
var
item
in
list
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Info
.
AuditStatus
),
3
},
{
nameof
(
RB_Distributor_Info
.
Remark
),
remark
},
{
nameof
(
RB_Distributor_Info
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Info
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
distributor_InfoRepository
.
Update
(
keyValues
,
wheres
,
trans
);
if
(
flag
)
{
//修改用户表状态
Dictionary
<
string
,
object
>
keyValues1
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Member_User
.
IsDistributor
),
2
}
};
List
<
WhereHelper
>
wheres1
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Member_User
.
Id
),
FiledValue
=
item
.
UserId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
member_UserRepository
.
Update
(
keyValues1
,
wheres1
,
trans
);
}
}
}
else
if
(
type
==
4
)
{
var
list
=
distributor_InfoRepository
.
GetList
(
new
RB_Distributor_Info_Extend
()
{
UserIds
=
userIds
,
TenantId
=
Convert
.
ToInt32
(
uid
),
MallBaseId
=
mallBaseId
});
foreach
(
var
item
in
list
)
{
if
(
item
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Audited
)
{
return
"用户ID:"
+
item
.
UserId
+
" 不是审核通过状态,无法修改等级"
;
}
}
//批量修改状态
foreach
(
var
item
in
list
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Info
.
GradeId
),
newGradeId
},
{
nameof
(
RB_Distributor_Info
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Info
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
distributor_InfoRepository
.
Update
(
keyValues
,
wheres
,
trans
);
}
}
else
if
(
type
==
5
)
{
var
list
=
distributor_InfoRepository
.
GetList
(
new
RB_Distributor_Info_Extend
()
{
UserIds
=
userIds
,
TenantId
=
Convert
.
ToInt32
(
uid
),
MallBaseId
=
mallBaseId
});
foreach
(
var
item
in
list
)
{
if
(
item
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Audited
)
{
return
"用户ID:"
+
item
.
UserId
+
" 不是审核通过状态,无法修改备注"
;
}
}
//批量修改状态
foreach
(
var
item
in
list
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Info
.
Remark
),
remark
},
{
nameof
(
RB_Distributor_Info
.
UpdateDate
),
DateTime
.
Now
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Info
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
distributor_InfoRepository
.
Update
(
keyValues
,
wheres
,
trans
);
}
}
else
{
return
"Type传递有误"
;
}
distributor_InfoRepository
.
DBSession
.
Commit
();
return
""
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetDistributorAudit"
);
distributor_InfoRepository
.
DBSession
.
Rollback
();
return
"出错了,请联系管理员"
;
}
}
throw
;
/// <summary>
/// 获取分销提现分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Distributor_Remit_Extend
>
GetDistributorRemitPageList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
RB_Distributor_Remit_Extend
demodel
)
{
return
distributor_RemitRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
count
,
demodel
);
}
/// <summary>
/// 获取下载列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Distributor_Info_Extend
>
GetDistributorInfoList
(
RB_Distributor_Info_Extend
demodel
)
{
var
list
=
distributor_InfoRepository
.
GetToExcelList
(
demodel
);
if
(
list
.
Any
())
{
//查询分销商等级
string
gradeIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
GradeId
>
0
).
Select
(
x
=>
x
.
GradeId
??
0
).
Distinct
());
List
<
RB_Distributor_Grade_Extend
>
GradeList
=
new
List
<
RB_Distributor_Grade_Extend
>();
if
(!
string
.
IsNullOrEmpty
(
gradeIds
))
{
GradeList
=
distributor_GradeRepository
.
GetList
(
new
RB_Distributor_Grade_Extend
()
{
GradeIds
=
gradeIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
}
//查询推荐人列表
string
tjrIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
SuperiorId
>
0
).
Select
(
x
=>
x
.
SuperiorId
??
0
).
Distinct
());
List
<
RB_Member_User_Extend
>
UserList
=
new
List
<
RB_Member_User_Extend
>();
if
(!
string
.
IsNullOrEmpty
(
tjrIds
))
{
UserList
=
member_UserRepository
.
GetList
(
new
RB_Member_User_Extend
()
{
UserIds
=
tjrIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
}
//根据基础配置层级查询下级数量 暂放弃
//var basmdoel = GetDistributorBasicsInfo(demodel.TenantId.ToString(), demodel.MallBaseId);
//if (basmdoel != null && basmdoel.DistributorTier > 0) {
string
uids
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
UserId
??
0
));
List
<
RB_Member_User_Extend
>
UserNum1List
=
member_UserRepository
.
GetDistributorReferralsNum
(
uids
,
tier
:
1
,
tenantId
:
demodel
.
TenantId
,
mallBaseId
:
demodel
.
MallBaseId
);
//直接查询三级
List
<
RB_Member_User_Extend
>
UserNum2List
=
member_UserRepository
.
GetDistributorReferralsNum
(
uids
,
tier
:
2
,
tenantId
:
demodel
.
TenantId
,
mallBaseId
:
demodel
.
MallBaseId
);
//直接查询三级
List
<
RB_Member_User_Extend
>
UserNum3List
=
member_UserRepository
.
GetDistributorReferralsNum
(
uids
,
tier
:
3
,
tenantId
:
demodel
.
TenantId
,
mallBaseId
:
demodel
.
MallBaseId
);
//直接查询三级
foreach
(
var
item
in
list
)
{
if
(
item
.
GradeId
==
0
)
{
item
.
GradeName
=
"默认等级"
;
}
else
if
(
item
.
GradeId
>
0
)
{
item
.
GradeName
=
GradeList
.
Where
(
x
=>
x
.
Id
==
item
.
GradeId
).
FirstOrDefault
()?.
Name
??
""
;
}
if
(
item
.
SuperiorId
==
0
)
{
item
.
SuperiorName
=
"总店"
;
}
else
if
(
item
.
SuperiorId
>
0
)
{
item
.
SuperiorName
=
UserList
.
Where
(
x
=>
x
.
Id
==
item
.
SuperiorId
).
FirstOrDefault
()?.
Name
??
""
;
}
item
.
OneNum
=
0
;
if
(
UserNum1List
.
Any
())
{
item
.
OneNum
=
UserNum1List
.
Where
(
x
=>
x
.
SuperiorId
==
item
.
UserId
).
FirstOrDefault
()?.
ReferralsNum
??
0
;
}
item
.
TwoNum
=
0
;
if
(
UserNum1List
.
Any
())
{
item
.
TwoNum
=
UserNum2List
.
Where
(
x
=>
x
.
SuperiorId
==
item
.
UserId
).
FirstOrDefault
()?.
ReferralsNum
??
0
;
}
item
.
ThreeNum
=
0
;
if
(
UserNum1List
.
Any
())
{
item
.
ThreeNum
=
UserNum3List
.
Where
(
x
=>
x
.
SuperiorId
==
item
.
UserId
).
FirstOrDefault
()?.
ReferralsNum
??
0
;
}
}
}
return
list
;
}
/// <summary>
/// 分销提现审核
/// </summary>
/// <param name="remitId"></param>
/// <param name="type"></param>
/// <param name="remark"></param>
/// <param name="uid"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
string
SetDistributorRemitAudit
(
int
remitId
,
int
type
,
string
remark
,
string
uid
,
int
mallBaseId
)
{
var
model
=
distributor_RemitRepository
.
GetEntity
(
remitId
);
if
(
model
==
null
)
{
return
"该提现不存在,请核实后再试"
;
}
if
(
model
.
TenantId
!=
Convert
.
ToInt32
(
uid
))
{
return
"未查询到提现信息"
;
}
if
(
model
.
MallBaseId
!=
mallBaseId
)
{
return
"未查询到提现信息"
;
}
if
(
type
==
1
)
{
if
(
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
Auditing
)
{
return
"状态不对,请核实后再试"
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Remit
.
AuditStatus
),
(
int
)
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
ToPlayWith
},
{
nameof
(
RB_Distributor_Remit
.
AuditDate
),
DateTime
.
Now
},
{
nameof
(
RB_Distributor_Remit
.
AuditRemark
),
remark
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Remit
.
Id
),
FiledValue
=
remitId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
distributor_RemitRepository
.
Update
(
keyValues
,
wheres
);
}
else
if
(
type
==
2
)
{
if
(
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
ToPlayWith
)
{
return
"状态不对,请核实后再试"
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Remit
.
AuditStatus
),
(
int
)
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
HaveMoney
},
{
nameof
(
RB_Distributor_Remit
.
RemitDate
),
DateTime
.
Now
},
{
nameof
(
RB_Distributor_Remit
.
RemitRemark
),
remark
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Remit
.
Id
),
FiledValue
=
remitId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
distributor_RemitRepository
.
Update
(
keyValues
,
wheres
);
}
else
if
(
type
==
3
)
{
if
(
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
Auditing
&&
model
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
ToPlayWith
)
{
return
"状态不对,请核实后再试"
;
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Remit
.
AuditStatus
),
(
int
)
Common
.
Enum
.
User
.
DistributorRemitAuditStatusEnum
.
Reject
},
{
nameof
(
RB_Distributor_Remit
.
RejectDate
),
DateTime
.
Now
},
{
nameof
(
RB_Distributor_Remit
.
RejectRemark
),
remark
},
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Remit
.
Id
),
FiledValue
=
remitId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
distributor_RemitRepository
.
Update
(
keyValues
,
wheres
);
}
else
{
return
"type有误,请核实后再试"
;
}
return
""
;
}
/// <summary>
/// 分销提现列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
List
<
RB_Distributor_Remit_Extend
>
GetDistributorRemitList
(
RB_Distributor_Remit_Extend
demodel
)
{
return
distributor_RemitRepository
.
GetDistributorRemitList
(
demodel
);
}
/// <summary>
/// 分销提现申请
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
string
SetDistributorRemitInfo
(
RB_Distributor_Remit_Extend
demodel
)
{
var
dmodel
=
distributor_InfoRepository
.
GetList
(
new
RB_Distributor_Info_Extend
()
{
UserId
=
demodel
.
UserId
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
}).
FirstOrDefault
();
if
(
dmodel
==
null
||
dmodel
.
AuditStatus
!=
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Audited
&&
dmodel
.
Status
==
1
)
{
return
"分销商不存在或者分销商未审核通过"
;
}
if
((
dmodel
.
CommissionWithdrawal
??
0
)
<
demodel
.
AppliedMoney
)
{
return
"分销商剩余可提现佣金金额不足"
;
}
bool
flag
=
distributor_RemitRepository
.
Insert
(
demodel
)
>
0
;
if
(
flag
)
{
//扣除分销可提现佣金
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Distributor_Info
.
CommissionWithdrawal
),
(
dmodel
.
CommissionWithdrawal
??
0
)
-
(
demodel
.
AppliedMoney
??
0
)}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Distributor_Info
.
Id
),
FiledValue
=
dmodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
distributor_InfoRepository
.
Update
(
keyValues
,
wheres
);
}
return
flag
?
""
:
"操作失败"
;
}
}
}
Mall.Repository/Product/RB_Material_InfoRepository.cs
View file @
0faccf69
...
...
@@ -24,12 +24,17 @@ namespace Mall.Repository.Product
public
List
<
RB_Material_Info_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Material_Info_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Material_Info
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
if
(
dmodel
.
Id
>=
100
)
{
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Material_Info
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Material_Info
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Material_Info
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
...
...
Mall.Repository/Product/RB_Product_CategoryRepository.cs
0 → 100644
View file @
0faccf69
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_CategoryRepository
:
RepositoryBase
<
RB_Product_Category
>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Product_Category_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Product_Category_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Product_Category_Extend
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(
dmodel
.
Tier
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
Tier
)}
=
{
dmodel
.
Tier
}
"
;
}
if
(
dmodel
.
ParentId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
ParentId
)}
=
{
dmodel
.
ParentId
}
"
;
}
if
(
dmodel
.
RootId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
RootId
)}
=
{
dmodel
.
RootId
}
"
;
}
if
(
dmodel
.
Enabled
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
Enabled
)}
=
{
dmodel
.
Enabled
}
"
;
}
if
(
dmodel
.
IsShow
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
IsShow
)}
=
{
dmodel
.
IsShow
}
"
;
}
string
sql
=
$@"select * from RB_Product_Category where
{
where
}
order by Id asc"
;
return
GetPage
<
RB_Product_Category_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Product_Category_Extend
>
GetList
(
RB_Product_Category_Extend
dmodel
)
{
string
where
=
$" 1=1 and
{
nameof
(
RB_Product_Category_Extend
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
CategoryIds
))
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
Id
)}
in(
{
dmodel
.
CategoryIds
}
)"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(
dmodel
.
Tier
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
Tier
)}
=
{
dmodel
.
Tier
}
"
;
}
if
(
dmodel
.
ParentId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
ParentId
)}
=
{
dmodel
.
ParentId
}
"
;
}
if
(
dmodel
.
RootId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
RootId
)}
=
{
dmodel
.
RootId
}
"
;
}
if
(
dmodel
.
Enabled
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
Enabled
)}
=
{
dmodel
.
Enabled
}
"
;
}
if
(
dmodel
.
IsShow
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_Category_Extend
.
IsShow
)}
=
{
dmodel
.
IsShow
}
"
;
}
string
sql
=
$@"select * from RB_Product_Category where
{
where
}
order by Id asc"
;
return
Get
<
RB_Product_Category_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/Product/RB_Product_CategoryStyleRepository.cs
0 → 100644
View file @
0faccf69
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_CategoryStyleRepository
:
RepositoryBase
<
RB_Product_CategoryStyle
>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Product_CategoryStyle_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Product_CategoryStyle_Extend
dmodel
)
{
string
where
=
$" 1=1 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_CategoryStyle
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_CategoryStyle
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_CategoryStyle
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
string
sql
=
$@"select * from RB_Product_CategoryStyle where
{
where
}
order by Id asc"
;
return
GetPage
<
RB_Product_CategoryStyle_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Product_CategoryStyle_Extend
>
GetList
(
RB_Product_CategoryStyle_Extend
dmodel
)
{
string
where
=
$" 1=1 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_CategoryStyle_Extend
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_CategoryStyle_Extend
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Product_CategoryStyle_Extend
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
string
sql
=
$@"select * from RB_Product_CategoryStyle where
{
where
}
order by Id asc"
;
return
Get
<
RB_Product_CategoryStyle_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/User/RB_Distributor_InfoRepository.cs
View file @
0faccf69
...
...
@@ -33,6 +33,10 @@ namespace Mall.Repository.User
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(
dmodel
.
AuditStatus
>
0
)
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
AuditStatus
)}
=
{(
int
)
dmodel
.
AuditStatus
}
"
;
}
if
(
dmodel
.
GradeId
>=
0
)
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
GradeId
)}
=
{
dmodel
.
GradeId
}
"
;
}
...
...
@@ -77,6 +81,10 @@ where {where} order by di.CreateDate desc";
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(
dmodel
.
AuditStatus
>
0
)
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
AuditStatus
)}
=
{(
int
)
dmodel
.
AuditStatus
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
UserIds
))
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
UserId
)}
in(
{
dmodel
.
UserIds
}
)"
;
}
...
...
@@ -92,5 +100,59 @@ where {where} order by di.CreateDate desc";
string
sql
=
$@"select di.* from RB_Distributor_Info di where
{
where
}
order by di.CreateDate desc"
;
return
Get
<
RB_Distributor_Info_Extend
>(
sql
).
ToList
();
}
/// <summary>
/// 获取下载列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Distributor_Info_Extend
>
GetToExcelList
(
RB_Distributor_Info_Extend
dmodel
)
{
string
where
=
$@" 1=1 and di.
{
nameof
(
RB_Distributor_Info
.
Status
)}
=0"
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
UserId
>
0
)
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
UserId
)}
=
{
dmodel
.
UserId
}
"
;
}
if
(
dmodel
.
AuditStatus
>
0
)
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
AuditStatus
)}
=
{(
int
)
dmodel
.
AuditStatus
}
"
;
}
if
(
dmodel
.
GradeId
>=
0
)
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
GradeId
)}
=
{
dmodel
.
GradeId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Name
))
{
where
+=
$@" and di.
{
nameof
(
RB_Distributor_Info
.
Name
)}
like '%
{
dmodel
.
Name
}
%'"
;
}
if
(
dmodel
.
Source
>
0
)
{
where
+=
$@" and u.
{
nameof
(
RB_Member_User
.
Source
)}
=
{
dmodel
.
Source
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
NickName
))
{
where
+=
$@" and u.
{
nameof
(
RB_Member_User
.
Name
)}
like '%
{
dmodel
.
NickName
}
%'"
;
}
if
(!
string
.
IsNullOrEmpty
(
dmodel
.
Mobile
))
{
where
+=
$@" and u.
{
nameof
(
RB_Member_User
.
Moblie
)}
like '%
{
dmodel
.
Mobile
}
%'"
;
}
string
sql
=
$@"select di.*,u.Name as NickName,u.Photo,u.Source,u.Moblie as Mobile,u.OrderNum from RB_Distributor_Info di
inner join rb_member_user u on di.UserId=u.Id
where
{
where
}
order by di.CreateDate desc"
;
return
Get
<
RB_Distributor_Info_Extend
>(
sql
).
ToList
();
}
}
}
Mall.Repository/User/RB_Distributor_RemitRepository.cs
0 → 100644
View file @
0faccf69
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
Mall.Model.Entity.User
;
using
Mall.Model.Extend.User
;
using
System.Linq
;
namespace
Mall.Repository.User
{
/// <summary>
/// 分销商提现仓储层
/// </summary>
public
class
RB_Distributor_RemitRepository
:
RepositoryBase
<
RB_Distributor_Remit
>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public
List
<
RB_Distributor_Remit_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowCount
,
RB_Distributor_Remit_Extend
dmodel
)
{
string
where
=
$@" 1=1 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Distributor_Remit
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Distributor_Remit
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Distributor_Remit
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(
dmodel
.
AuditStatus
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Distributor_Remit
.
AuditStatus
)}
=
{(
int
)
dmodel
.
AuditStatus
}
"
;
}
string
sql
=
$@"select r.*,u.Name as UserName,u.Photo,u.Source from RB_Distributor_Remit r
left join rb_member_user u on r.UserId = u.Id
where
{
where
}
order by r.Id desc"
;
return
GetPage
<
RB_Distributor_Remit_Extend
>(
pageIndex
,
pageSize
,
out
rowCount
,
sql
).
ToList
();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Distributor_Remit_Extend
>
GetList
(
RB_Distributor_Remit_Extend
dmodel
)
{
string
where
=
$@" 1=1 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Distributor_Remit
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Distributor_Remit
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Distributor_Remit
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(
dmodel
.
AuditStatus
>
0
)
{
where
+=
$@" and
{
nameof
(
RB_Distributor_Remit
.
AuditStatus
)}
=
{
dmodel
.
AuditStatus
}
"
;
}
string
sql
=
$@"select * from RB_Distributor_Remit where
{
where
}
order by Id desc"
;
return
Get
<
RB_Distributor_Remit_Extend
>(
sql
).
ToList
();
}
/// <summary>
/// 获取导出列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Distributor_Remit_Extend
>
GetDistributorRemitList
(
RB_Distributor_Remit_Extend
dmodel
)
{
string
where
=
$@" 1=1 "
;
if
(
dmodel
.
TenantId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Distributor_Remit
.
TenantId
)}
=
{
dmodel
.
TenantId
}
"
;
}
if
(
dmodel
.
MallBaseId
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Distributor_Remit
.
MallBaseId
)}
=
{
dmodel
.
MallBaseId
}
"
;
}
if
(
dmodel
.
Id
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Distributor_Remit
.
Id
)}
=
{
dmodel
.
Id
}
"
;
}
if
(
dmodel
.
AuditStatus
>
0
)
{
where
+=
$@" and r.
{
nameof
(
RB_Distributor_Remit
.
AuditStatus
)}
=
{(
int
)
dmodel
.
AuditStatus
}
"
;
}
string
sql
=
$@"select r.*,u.Name as UserName,u.Photo,u.Source from RB_Distributor_Remit r
left join rb_member_user u on r.UserId = u.Id
where
{
where
}
order by r.Id desc"
;
return
Get
<
RB_Distributor_Remit_Extend
>(
sql
).
ToList
();
}
}
}
Mall.WebApi/Controllers/BaseController.cs
View file @
0faccf69
...
...
@@ -38,6 +38,7 @@ namespace Mall.WebApi.Controllers
{
JObject
parms
=
JObject
.
Parse
(
Request
.
HttpContext
.
Items
[
GlobalKey
.
TokenUserInfo
].
ToString
());
requestParm
.
uid
=
parms
.
GetStringValue
(
"uid"
);
requestParm
.
TenantId
=
Convert
.
ToInt32
(
requestParm
.
uid
);
}
#
endregion
//根据token 获取uid
...
...
Mall.WebApi/Controllers/Product/ProductController.cs
View file @
0faccf69
...
...
@@ -40,6 +40,7 @@ namespace Mall.WebApi.Controllers.MallBase
RB_Material_Info_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Material_Info_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetMaterialInfoPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
...
...
@@ -113,6 +114,7 @@ namespace Mall.WebApi.Controllers.MallBase
RB_Material_Group_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Material_Group_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetMaterialGroupList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
...
...
@@ -345,5 +347,242 @@ namespace Mall.WebApi.Controllers.MallBase
}
#
endregion
#
region
商品分类
/// <summary>
/// 获取商品分类树形列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductCategoryPageList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
RB_Product_Category_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Category_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetProductCategoryPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
Name
,
x
.
Tier
,
x
.
ParentId
,
x
.
Sort
,
x
.
Icon
,
x
.
IconPath
,
x
.
BigIcon
,
x
.
BigIconPath
,
x
.
AdvertisingImage
,
x
.
AdvertisingImagePath
,
x
.
AdvertisingAddress
,
x
.
Enabled
,
x
.
IsShow
,
x
.
TenantId
,
x
.
MallBaseId
,
CreateDate
=
x
.
CreateDate
.
HasValue
?
x
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取分类树形结构
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductCategoryTreeList
()
{
var
parms
=
RequestParm
;
RB_Product_Category_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Category_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
productModule
.
GetProductCategoryTreeList
(
demodel
);
return
ApiResult
.
Success
(
""
,
list
);
}
/// <summary>
/// 保存分类
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetProductCategoryInfo
()
{
var
req
=
RequestParm
;
RB_Product_Category_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_Category_Extend
>(
req
.
msg
.
ToString
());
if
((
demodel
.
Tier
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择层级"
);
}
if
(
string
.
IsNullOrEmpty
(
demodel
.
Name
))
{
return
ApiResult
.
ParamIsNull
(
"请输入分类名称"
);
}
if
(!
demodel
.
Sort
.
HasValue
)
{
return
ApiResult
.
ParamIsNull
(
"请输入排序"
);
}
if
(
demodel
.
Tier
==
1
)
{
demodel
.
ParentId
=
0
;
}
else
if
(
demodel
.
Tier
>
1
)
{
if
((
demodel
.
ParentId
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择上级"
);
}
}
demodel
.
TenantId
=
Convert
.
ToInt32
(
req
.
uid
);
demodel
.
MallBaseId
=
req
.
MallBaseId
;
demodel
.
Icon
??=
0
;
demodel
.
BigIcon
??=
0
;
demodel
.
AdvertisingImage
??=
0
;
demodel
.
AdvertisingAddress
??=
""
;
demodel
.
Enabled
??=
1
;
demodel
.
IsShow
??=
1
;
demodel
.
Status
??=
0
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
UpdateDate
=
DateTime
.
Now
;
bool
flag
=
productModule
.
SetProductCategoryInfo
(
demodel
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 删除分类
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DelProductCategoryInfo
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
CategoryId
=
parms
.
GetInt
(
"CategoryId"
,
0
);
if
(
CategoryId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择需删除分类id"
);
}
bool
flag
=
productModule
.
DelProductCategoryInfo
(
CategoryId
,
req
.
TenantId
,
req
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 保存分类转移
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetProductCategoryTransfer
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
CategoryId
=
parms
.
GetInt
(
"CategoryId"
,
0
);
int
ParentId
=
parms
.
GetInt
(
"ParentId"
,
0
);
if
(
CategoryId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择需转移分类id"
);
}
if
(
ParentId
<
0
)
{
return
ApiResult
.
ParamIsNull
(
"请选择转入分类id"
);
}
if
(
CategoryId
==
ParentId
)
{
return
ApiResult
.
ParamIsNull
(
"不能转入同一分类下"
);
}
var
list
=
productModule
.
GetProductCategoryForALLChlid
(
CategoryId
,
Convert
.
ToInt32
(
req
.
uid
),
req
.
MallBaseId
);
if
(
list
.
Where
(
x
=>
x
.
Id
==
ParentId
).
Any
())
{
return
ApiResult
.
ParamIsNull
(
"不能转入当前分类的子集分类"
);
}
var
model
=
list
.
Where
(
x
=>
x
.
Id
==
CategoryId
).
FirstOrDefault
();
if
(
model
==
null
)
{
return
ApiResult
.
ParamIsNull
(
"分类不存在,请核实后再试"
);
}
if
(
model
.
ParentId
==
ParentId
)
{
return
ApiResult
.
ParamIsNull
(
"已在当前分类下,未转移"
);
}
bool
flag
=
productModule
.
SetProductCategoryTransfer
(
model
,
ParentId
,
list
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 保存分类排序
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetProductCategorySort
()
{
var
req
=
RequestParm
;
List
<
RB_Product_CategorySort
>
delist
=
JsonConvert
.
DeserializeObject
<
List
<
RB_Product_CategorySort
>>(
req
.
msg
.
ToString
());
if
(
delist
==
null
||
!
delist
.
Any
())
{
return
ApiResult
.
ParamIsNull
();
}
bool
flag
=
productModule
.
SetProductCategorySort
(
delist
,
req
.
TenantId
,
req
.
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
/// <summary>
/// 获取分类样式
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetProductCategoryStyleInfo
()
{
var
parms
=
RequestParm
;
var
model
=
productModule
.
GetProductCategoryStyleInfo
(
parms
.
TenantId
,
parms
.
MallBaseId
);
return
ApiResult
.
Success
(
""
,
new
{
model
.
Id
,
model
.
Type
,
model
.
Style
,
model
.
CategoryNum
,
model
.
RowNum
,
UpdateDate
=
model
.
UpdateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
});
}
/// <summary>
/// 保存分类样式
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetProductCategoryStyleInfo
()
{
var
req
=
RequestParm
;
RB_Product_CategoryStyle_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Product_CategoryStyle_Extend
>(
req
.
msg
.
ToString
());
demodel
.
CategoryNum
??=
1
;
demodel
.
CreateDate
=
DateTime
.
Now
;
demodel
.
MallBaseId
=
req
.
MallBaseId
;
demodel
.
RowNum
??=
1
;
demodel
.
Style
??=
1
;
demodel
.
TenantId
=
req
.
TenantId
;
demodel
.
Type
??=
1
;
demodel
.
UpdateDate
=
DateTime
.
Now
;
bool
flag
=
productModule
.
SetProductCategoryStyleInfo
(
demodel
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
#
endregion
}
}
\ No newline at end of file
Mall.WebApi/Controllers/User/UserController.cs
View file @
0faccf69
...
...
@@ -581,8 +581,8 @@ namespace Mall.WebApi.Controllers.MallBase
return
ApiResult
.
ParamIsNull
(
"请输入积分数"
);
}
demodel
.
Description
=
demodel
.
Description
??
""
;
demodel
.
Image
=
demodel
.
Image
??
0
;
demodel
.
Description
??=
""
;
demodel
.
Image
??=
0
;
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
...
...
@@ -654,8 +654,8 @@ namespace Mall.WebApi.Controllers.MallBase
return
ApiResult
.
ParamIsNull
(
"请输入金额"
);
}
demodel
.
Description
=
demodel
.
Description
??
""
;
demodel
.
Image
=
demodel
.
Image
??
0
;
demodel
.
Description
??=
""
;
demodel
.
Image
??=
0
;
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
demodel
.
CreateDate
=
DateTime
.
Now
;
...
...
@@ -703,6 +703,11 @@ namespace Mall.WebApi.Controllers.MallBase
break
;
}
if
(
demodel
.
WithdrawWayList
==
null
||
!
demodel
.
WithdrawWayList
.
Any
())
{
return
ApiResult
.
ParamIsNull
(
"请选择提现方式"
);
}
demodel
.
WithdrawWay
=
JsonConvert
.
SerializeObject
(
demodel
.
WithdrawWayList
);
demodel
.
OneCommission
??=
0
;
demodel
.
TwoCommission
??=
0
;
demodel
.
ThreeCommission
??=
0
;
...
...
@@ -751,6 +756,7 @@ namespace Mall.WebApi.Controllers.MallBase
model
.
GradeEntrance
,
model
.
GradeEntranceImage
,
model
.
WithdrawWay
,
model
.
WithdrawWayList
,
model
.
MinimumWithdrawalLimit
,
model
.
DailyWithdrawalLimit
,
model
.
WithdrawFee
,
...
...
@@ -1239,7 +1245,7 @@ namespace Mall.WebApi.Controllers.MallBase
#
endregion
#
region
分销商管理
#
region
分销商
申请
管理
/// <summary>
/// 获取分销商分页列表
...
...
@@ -1275,6 +1281,7 @@ namespace Mall.WebApi.Controllers.MallBase
x
.
GradeId
,
x
.
GradeName
,
x
.
AuditStatus
,
AuditStatusName
=
x
.
AuditStatus
.
GetEnumName
(),
x
.
Remark
,
SourceName
=
x
.
Source
.
GetEnumName
(),
x
.
TenantId
,
...
...
@@ -1285,7 +1292,22 @@ namespace Mall.WebApi.Controllers.MallBase
}
/// <summary>
/// 新增分销商
/// 获取分销商审核状态枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDistributorAuditStatusEnumList
()
{
var
list
=
EnumHelper
.
GetEnumList
(
typeof
(
DistributorAuditStatusEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
Name
=
x
.
Key
,
Id
=
Convert
.
ToInt32
(
x
.
Value
)
}));
}
/// <summary>
/// 新增分销商申请
/// </summary>
/// <returns></returns>
[
HttpPost
]
...
...
@@ -1334,7 +1356,7 @@ namespace Mall.WebApi.Controllers.MallBase
var
re
=
RequestParm
;
var
parms
=
JObject
.
Parse
(
re
.
msg
.
ToString
());
string
UserIds
=
parms
.
GetStringValue
(
"UserIds"
);
int
Type
=
parms
.
GetInt
(
"Type"
,
0
);
//1审核通过 2审核拒绝 3删除分销 4修改等级
int
Type
=
parms
.
GetInt
(
"Type"
,
0
);
//1审核通过 2审核拒绝 3删除分销 4修改等级
5修改备注
int
NewGradeId
=
parms
.
GetInt
(
"NewGradeId"
,
0
);
string
Remark
=
parms
.
GetStringValue
(
"Remark"
);
if
(
string
.
IsNullOrEmpty
(
UserIds
))
{
...
...
@@ -1357,6 +1379,384 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
/// <summary>
/// 获取分销二维码
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDistributorQRCode
()
{
//小程序接口
return
ApiResult
.
Success
();
}
/// <summary>
/// 获取分销商下载枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDistributorExportEnumList
()
{
var
list
=
EnumHelper
.
GetEnumList
(
typeof
(
DistributorExportEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
Name
=
x
.
Key
,
Id
=
Convert
.
ToInt32
(
x
.
Value
)
}));
}
/// <summary>
/// 分销商信息下载
/// </summary>
[
HttpPost
]
public
FileContentResult
GetDistributorListToExcel
()
{
var
parms
=
RequestParm
;
RB_Distributor_Info_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Distributor_Info_Extend
>(
parms
.
msg
.
ToString
());
string
ExcelName
=
"分销商列表"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
if
(
demodel
.
ExcelEnumIds
==
null
||
!
demodel
.
ExcelEnumIds
.
Any
())
{
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
var
Enumlist
=
EnumHelper
.
GetEnumList
(
typeof
(
DistributorExportEnum
));
ExcelDataSource
header
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
"序号"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
}
}
};
foreach
(
var
item
in
demodel
.
ExcelEnumIds
)
{
var
Name
=
Enumlist
.
Where
(
x
=>
x
.
Value
==
item
.
ToString
()).
FirstOrDefault
().
Key
??
""
;
header
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
Name
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
}
slist
.
Add
(
header
);
try
{
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
userModule
.
GetDistributorInfoList
(
demodel
);
#
region
组装数据
int
Num
=
0
;
foreach
(
var
item
in
list
)
{
Num
++;
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
Num
.
ToString
()){
},
}
};
foreach
(
var
qitem
in
demodel
.
ExcelEnumIds
)
{
switch
(
qitem
)
{
case
1
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Source
.
GetEnumName
())
{
});
break
;
case
2
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
(
item
.
UserId
??
0
).
ToString
())
{
});
break
;
case
3
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
NickName
??
""
)
{
});
break
;
case
4
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Name
??
""
)
{
});
break
;
case
5
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Mobile
??
""
)
{
});
break
;
case
6
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
))
{
});
break
;
case
7
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
AuditStatus
.
GetEnumName
())
{
});
break
;
case
8
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
(
item
.
TotalCommission
??
0
).
ToString
())
{
});
break
;
case
9
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
(
item
.
CommissionWithdrawal
??
0
).
ToString
())
{
});
break
;
case
10
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
(
item
.
OrderNum
??
0
).
ToString
())
{
});
break
;
case
11
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
"一级:"
+
(
item
.
OneNum
??
0
)
+
" 二级:"
+
(
item
.
TwoNum
??
0
)
+
" 三级:"
+
(
item
.
ThreeNum
??
0
))
{
});
break
;
case
12
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
SuperiorName
??
""
)
{
});
break
;
case
13
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Remark
??
""
)
{
});
break
;
}
}
slist
.
Add
(
datarow
);
}
#
endregion
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
string
.
Format
(
"GetFileFromWebApi_requestData: {0}"
,
JsonHelper
.
Serialize
(
RequestParm
)));
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
}
#
endregion
#
region
分销商提现
/// <summary>
/// 获取分销商提现分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDistributorRemitPageList
()
{
var
parms
=
RequestParm
;
ResultPageModel
pagelist
=
JsonConvert
.
DeserializeObject
<
ResultPageModel
>(
parms
.
msg
.
ToString
());
RB_Distributor_Remit_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Distributor_Remit_Extend
>(
parms
.
msg
.
ToString
());
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
userModule
.
GetDistributorRemitPageList
(
pagelist
.
pageIndex
,
pagelist
.
pageSize
,
out
long
count
,
demodel
);
pagelist
.
count
=
Convert
.
ToInt32
(
count
);
pagelist
.
pageData
=
list
.
Select
(
x
=>
new
{
x
.
Id
,
x
.
OrderNum
,
x
.
UserId
,
x
.
UserName
,
x
.
Photo
,
x
.
Source
,
x
.
WithdrawalWay
,
WithdrawalWayName
=
x
.
WithdrawalWay
.
GetEnumName
(),
x
.
AccountName
,
x
.
AccountNumber
,
x
.
BankName
,
x
.
AppliedMoney
,
x
.
Fee
,
x
.
RemitMoney
,
x
.
AuditRemark
,
x
.
RemitRemark
,
x
.
RejectRemark
,
x
.
AuditStatus
,
AuditStatusName
=
x
.
AuditStatus
.
GetEnumName
(),
SourceName
=
x
.
Source
.
GetEnumName
(),
x
.
TenantId
,
CreateDate
=
x
.
CreateDate
.
HasValue
?
x
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
AuditDate
=
x
.
AuditDate
.
HasValue
?
x
.
AuditDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
RemitDate
=
x
.
RemitDate
.
HasValue
?
x
.
RemitDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
RejectDate
=
x
.
RejectDate
.
HasValue
?
x
.
RejectDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
:
""
,
});
return
ApiResult
.
Success
(
""
,
pagelist
);
}
/// <summary>
/// 获取分销提现手续费
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDistributorFeeInfo
()
{
var
requestParm
=
RequestParm
;
var
model
=
userModule
.
GetDistributorBasicsInfo
(
requestParm
.
uid
,
requestParm
.
MallBaseId
);
return
ApiResult
.
Success
(
""
,
new
{
model
.
Id
,
model
.
WithdrawFee
});
}
/// <summary>
/// 申请分销提现
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetDistributorRemitInfo
()
{
var
req
=
RequestParm
;
RB_Distributor_Remit_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Distributor_Remit_Extend
>(
req
.
msg
.
ToString
());
if
((
demodel
.
UserId
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递用户id"
);
}
if
((
demodel
.
WithdrawalWay
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递提现方式"
);
}
if
((
demodel
.
AppliedMoney
??
0
)
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请输入提现金额"
);
}
var
basmodel
=
userModule
.
GetDistributorBasicsInfo
(
req
.
uid
,
req
.
MallBaseId
);
decimal
fee
=
(
demodel
.
AppliedMoney
??
0
)
*
(
basmodel
?.
WithdrawFee
??
0
)
/
100
;
if
(
demodel
.
Fee
!=
fee
)
{
return
ApiResult
.
ParamIsNull
(
"手续费计算有误,请刷新后再试"
);
}
demodel
.
RemitMoney
=
(
demodel
.
AppliedMoney
??
0
)
-
(
demodel
.
Fee
??
0
);
demodel
.
TenantId
=
Convert
.
ToInt32
(
req
.
uid
);
demodel
.
MallBaseId
=
req
.
MallBaseId
;
demodel
.
AuditStatus
=
DistributorRemitAuditStatusEnum
.
Auditing
;
demodel
.
RemitMoney
??=
0
;
demodel
.
OrderNum
=
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssffff"
);
demodel
.
CreateDate
=
DateTime
.
Now
;
string
msg
=
userModule
.
SetDistributorRemitInfo
(
demodel
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
/// <summary>
/// 分销提现申请审核
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetDistributorRemitAudit
()
{
var
re
=
RequestParm
;
var
parms
=
JObject
.
Parse
(
re
.
msg
.
ToString
());
int
RemitId
=
parms
.
GetInt
(
"RemitId"
,
0
);
int
Type
=
parms
.
GetInt
(
"Type"
,
0
);
//1审核通过 2打款 3驳回
string
Remark
=
parms
.
GetStringValue
(
"Remark"
);
if
(
RemitId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递分销提现id"
);
}
string
msg
=
userModule
.
SetDistributorRemitAudit
(
RemitId
,
Type
,
Remark
,
re
.
uid
,
re
.
MallBaseId
);
if
(
msg
==
""
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
(
msg
);
}
}
/// <summary>
/// 获取分销提现审核状态枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDistributorRemitAuditStatusEnumList
()
{
var
list
=
EnumHelper
.
GetEnumList
(
typeof
(
DistributorRemitAuditStatusEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
Name
=
x
.
Key
,
Id
=
Convert
.
ToInt32
(
x
.
Value
)
}));
}
/// <summary>
/// 获取分销提现下载枚举列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetDistributorRemitExportEnumList
()
{
var
list
=
EnumHelper
.
GetEnumList
(
typeof
(
DistributorRemitExportEnum
));
return
ApiResult
.
Success
(
""
,
list
.
Select
(
x
=>
new
{
Name
=
x
.
Key
,
Id
=
Convert
.
ToInt32
(
x
.
Value
)
}));
}
/// <summary>
/// 分销提现信息下载
/// </summary>
[
HttpPost
]
public
FileContentResult
GetDistributorRemitListToExcel
()
{
var
parms
=
RequestParm
;
RB_Distributor_Remit_Extend
demodel
=
JsonConvert
.
DeserializeObject
<
RB_Distributor_Remit_Extend
>(
parms
.
msg
.
ToString
());
string
ExcelName
=
"提现列表"
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)
+
".xls"
;
List
<
ExcelDataSource
>
slist
=
new
List
<
ExcelDataSource
>();
if
(
demodel
.
ExcelEnumIds
==
null
||
!
demodel
.
ExcelEnumIds
.
Any
())
{
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
var
Enumlist
=
EnumHelper
.
GetEnumList
(
typeof
(
DistributorRemitExportEnum
));
ExcelDataSource
header
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
"序号"
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
}
}
};
foreach
(
var
item
in
demodel
.
ExcelEnumIds
)
{
var
Name
=
Enumlist
.
Where
(
x
=>
x
.
Value
==
item
.
ToString
()).
FirstOrDefault
().
Key
??
""
;
header
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
Name
)
{
CellWidth
=
15
,
HAlignmentEnum
=
HAlignmentEnum
.
CENTER
,
VAlignmentEnum
=
VAlignmentEnum
.
CENTER
});
}
slist
.
Add
(
header
);
try
{
demodel
.
TenantId
=
Convert
.
ToInt32
(
parms
.
uid
);
demodel
.
MallBaseId
=
parms
.
MallBaseId
;
var
list
=
userModule
.
GetDistributorRemitList
(
demodel
);
#
region
组装数据
int
Num
=
0
;
foreach
(
var
item
in
list
)
{
Num
++;
ExcelDataSource
datarow
=
new
ExcelDataSource
()
{
ExcelRows
=
new
List
<
ExcelColumn
>(
30
)
{
new
ExcelColumn
(
value
:
Num
.
ToString
()){
},
}
};
foreach
(
var
qitem
in
demodel
.
ExcelEnumIds
)
{
switch
(
qitem
)
{
case
1
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
Source
.
GetEnumName
())
{
});
break
;
case
2
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
OrderNum
??
""
)
{
});
break
;
case
3
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
UserName
??
""
)
{
});
break
;
case
4
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
(
item
.
AppliedMoney
??
0
).
ToString
())
{
});
break
;
case
5
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
CreateDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
))
{
});
break
;
case
6
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
BankName
??
""
)
{
});
break
;
case
7
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
AccountNumber
)
{
});
break
;
case
8
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
AccountName
)
{
});
break
;
case
9
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
AuditStatus
.
GetEnumName
())
{
});
break
;
case
10
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
WithdrawalWay
.
GetEnumName
())
{
});
break
;
case
11
:
datarow
.
ExcelRows
.
Add
(
new
ExcelColumn
(
value
:
item
.
RemitDate
.
Value
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
))
{
});
break
;
}
}
slist
.
Add
(
datarow
);
}
#
endregion
var
byteData
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData
,
"application/octet-stream"
,
ExcelName
);
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
string
.
Format
(
"GetFileFromWebApi_requestData: {0}"
,
JsonHelper
.
Serialize
(
RequestParm
)));
var
byteData1
=
ExcelTempLateHelper
.
ToExcelExtend
(
slist
);
return
File
(
byteData1
,
"application/octet-stream"
,
ExcelName
);
}
}
#
endregion
}
}
\ No newline at end of file
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