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
16690a20
Commit
16690a20
authored
Aug 05, 2020
by
吴春
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/mall.oytour.com
parents
f51e7cb4
80f3c96f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
192 additions
and
189 deletions
+192
-189
OrderModule.cs
Mall.Module.Product/OrderModule.cs
+185
-182
UserModule.cs
Mall.Module.User/UserModule.cs
+1
-1
PayUtil.cs
Mall.WebApi/App_Code/PayUtil.cs
+2
-2
ERPOrderCommissionController.cs
...ebApi/Controllers/Finance/ERPOrderCommissionController.cs
+2
-2
UserController.cs
Mall.WebApi/Controllers/User/UserController.cs
+2
-2
No files found.
Mall.Module.Product/OrderModule.cs
View file @
16690a20
...
...
@@ -3279,179 +3279,98 @@ namespace Mall.Module.Product
try
{
var
basicModel
=
distributor_BasicsRepository
.
GetList
(
new
RB_Distributor_Basics_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
}).
FirstOrDefault
();
if
((
basicModel
?.
IsEnableFXGrade
??
2
)
==
1
&&
(((
basicModel
?.
IsEnableNoSuperiorFY
??
1
)
==
1
)
||
((
basicModel
?.
IsEnableNoSuperiorFY
??
1
)
==
2
&&
(
umodel
.
SuperiorId
??
0
)
>
0
))
)
if
((
basicModel
?.
IsEnableFXGrade
??
2
)
==
1
)
{
//粉象返佣
var
FXList
=
distributor_FXGradeRepository
.
GetList
(
new
RB_Distributor_FXGrade_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
if
(
FXList
.
Any
()
&&
FXList
.
Where
(
x
=>
x
.
IsGuest
==
1
).
Any
())
if
(((
basicModel
?.
IsEnableNoSuperiorFY
??
1
)
==
1
)
||
((
basicModel
?.
IsEnableNoSuperiorFY
??
1
)
==
2
&&
(
umodel
.
SuperiorId
??
0
)
>
0
))
{
var
FXPModel
=
FXList
.
Where
(
x
=>
x
.
IsGuest
==
1
).
FirstOrDefault
();
//验证用户必须是分销商 最低普通会员 不是以普通会员处理
var
disModel
=
distributor_InfoRepository
.
GetList
(
new
RB_Distributor_Info_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
UserId
=
umodel
.
Id
,
AuditStatus
=
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Audited
}).
FirstOrDefault
();
var
FXModel
=
FXPModel
;
if
(
disModel
!=
null
)
//粉象返佣
var
FXList
=
distributor_FXGradeRepository
.
GetList
(
new
RB_Distributor_FXGrade_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
if
(
FXList
.
Any
()
&&
FXList
.
Where
(
x
=>
x
.
IsGuest
==
1
).
Any
())
{
if
(
disModel
.
FXGradeId
>
0
)
var
FXPModel
=
FXList
.
Where
(
x
=>
x
.
IsGuest
==
1
).
FirstOrDefault
();
//验证用户必须是分销商 最低普通会员 不是以普通会员处理
var
disModel
=
distributor_InfoRepository
.
GetList
(
new
RB_Distributor_Info_Extend
()
{
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
,
UserId
=
umodel
.
Id
,
AuditStatus
=
Common
.
Enum
.
User
.
DistributorAuditStatusEnum
.
Audited
}).
FirstOrDefault
();
var
FXModel
=
FXPModel
;
if
(
disModel
!=
null
)
{
FXModel
=
FXList
.
Where
(
x
=>
x
.
Id
==
disModel
.
FXGradeId
).
FirstOrDefault
();
if
(
disModel
.
FXGradeId
>
0
)
{
FXModel
=
FXList
.
Where
(
x
=>
x
.
Id
==
disModel
.
FXGradeId
).
FirstOrDefault
();
}
}
}
else
{
LogHelper
.
Write
(
"粉象返佣 用户分销商信息不存在:UserId:"
+
umodel
.
Id
);
}
if
(
FXModel
!=
null
)
{
//查询出当前用户的所有上级
string
UserIds
=
member_UserRepository
.
GetMemberParentIdStr
(
umodel
.
Id
);
var
ulist
=
member_UserRepository
.
GetList
(
new
RB_Member_User_Extend
()
{
UserIds
=
UserIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
//查询出用户的所有分销信息
var
dlist
=
distributor_InfoRepository
.
GetListForSingle
(
new
RB_Distributor_Info_Extend
()
{
UserIds
=
UserIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
foreach
(
var
item
in
dlist
)
else
{
item
.
Grade
=
FXList
.
Where
(
x
=>
x
.
Id
==
item
.
FXGradeId
).
FirstOrDefault
()?.
Grade
??
0
;
LogHelper
.
Write
(
"粉象返佣 用户分销商信息不存在:UserId:"
+
umodel
.
Id
)
;
}
//开始慢慢找 注 同级返佣数量 返佣建子表可以无限级返佣了
var
DetailList
=
demodel
.
DetailList
.
Where
(
x
=>
x
.
CommissionPrice
>
0
).
ToList
();
foreach
(
var
item
in
DetailList
)
if
(
FXModel
!=
null
)
{
if
((
item
.
PresentFXGrade
??
0
)
>
0
)
//查询出当前用户的所有上级
string
UserIds
=
member_UserRepository
.
GetMemberParentIdStr
(
umodel
.
Id
);
var
ulist
=
member_UserRepository
.
GetList
(
new
RB_Member_User_Extend
()
{
UserIds
=
UserIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
//查询出用户的所有分销信息
var
dlist
=
distributor_InfoRepository
.
GetListForSingle
(
new
RB_Distributor_Info_Extend
()
{
UserIds
=
UserIds
,
TenantId
=
demodel
.
TenantId
,
MallBaseId
=
demodel
.
MallBaseId
});
foreach
(
var
item
in
dlist
)
{
//是赠送VIP等级的 暂直接表示 反购买VIP佣金 2020-08-03 ld
continue
;
item
.
Grade
=
FXList
.
Where
(
x
=>
x
.
Id
==
item
.
FXGradeId
).
FirstOrDefault
()?.
Grade
??
0
;
}
//返佣
List
<
RB_Goods_OrderCommission
>
gocList
=
new
List
<
RB_Goods_OrderCommission
>();
List
<
FXOrderCommissionNumModel
>
fxNumList
=
new
List
<
FXOrderCommissionNumModel
>();
decimal
TotalCommission
=
item
.
CommissionPrice
;
int
UserId
=
umodel
.
Id
;
int
Num
=
1
;
while
(
UserId
>
0
&&
TotalCommission
>
0
)
//开始慢慢找 注 同级返佣数量 返佣建子表可以无限级返佣了
var
DetailList
=
demodel
.
DetailList
.
Where
(
x
=>
x
.
CommissionPrice
>
0
).
ToList
();
foreach
(
var
item
in
DetailList
)
{
var
numodel
=
ulist
.
Where
(
x
=>
x
.
Id
==
UserId
).
FirstOrDefault
();
if
(
numodel
==
null
)
{
UserId
=
0
;
break
;
}
if
(
numodel
.
Id
==
umodel
.
Id
)
if
((
item
.
PresentFXGrade
??
0
)
>
0
)
{
//第一个进来 按等级的返佣比例给佣金
UserId
=
numodel
.
SuperiorId
??
0
;
decimal
DcommionMoney
=
0
;
if
(
FXModel
.
DecimalType
==
1
)
{
DcommionMoney
=
Math
.
Ceiling
(
item
.
CommissionPrice
*
(
FXModel
.
CommissionRatio
??
0
)
/
100
);
}
else
{
DcommionMoney
=
Math
.
Ceiling
(
item
.
CommissionPrice
*
(
FXModel
.
CommissionRatio
??
0
))
/
100
;
}
fxNumList
.
Add
(
new
FXOrderCommissionNumModel
()
{
GradeId
=
FXModel
.
Id
,
Grade
=
FXModel
.
Grade
??
0
,
Money
=
DcommionMoney
,
Sort
=
Num
,
IsSelfBuy
=
1
});
Num
++;
TotalCommission
-=
DcommionMoney
;
RB_Goods_OrderCommission
gocModel
=
new
RB_Goods_OrderCommission
()
{
Id
=
0
,
Commission
=
DcommionMoney
,
CommissionState
=
1
,
CreateDate
=
DateTime
.
Now
,
Grade
=
FXModel
.
Id
,
IsGoodsDistribution
=
2
,
MallBaseId
=
demodel
.
MallBaseId
,
OrderDetailId
=
item
.
Id
,
OrderId
=
OrderId
,
Remark
=
"粉象 "
+
FXModel
.
GradeName
+
"下单返佣,返佣比例:"
+
(
FXModel
.
CommissionRatio
??
0
)
+
"%"
,
TenantId
=
demodel
.
TenantId
,
UpdateDate
=
DateTime
.
Now
,
UserId
=
numodel
.
Id
,
Type
=
3
,
IsRemit
=
0
};
gocList
.
Add
(
gocModel
);
//是赠送VIP等级的 暂直接表示 反购买VIP佣金 2020-08-03 ld
continue
;
}
else
//返佣
List
<
RB_Goods_OrderCommission
>
gocList
=
new
List
<
RB_Goods_OrderCommission
>();
List
<
FXOrderCommissionNumModel
>
fxNumList
=
new
List
<
FXOrderCommissionNumModel
>();
decimal
TotalCommission
=
item
.
CommissionPrice
;
int
UserId
=
umodel
.
Id
;
int
Num
=
1
;
while
(
UserId
>
0
&&
TotalCommission
>
0
)
{
var
d2Model
=
dlist
.
Where
(
x
=>
x
.
UserId
==
numodel
.
Id
).
FirstOrDefault
();
var
FXGModel
=
new
RB_Distributor_FXGrade_Extend
();
if
(
d2Model
==
null
)
{
LogHelper
.
Write
(
"粉象返佣 用户分销商信息不存在:UserId:"
+
numodel
.
Id
);
FXGModel
=
FXPModel
;
}
else
{
FXGModel
=
FXList
.
Where
(
x
=>
x
.
Id
==
d2Model
.
FXGradeId
).
FirstOrDefault
();
if
(
FXGModel
==
null
)
{
FXGModel
=
FXPModel
;
}
}
int
MaxGrade
=
fxNumList
.
Max
(
x
=>
x
.
Grade
);
if
(
FXGModel
.
Grade
<
MaxGrade
)
var
numodel
=
ulist
.
Where
(
x
=>
x
.
Id
==
UserId
).
FirstOrDefault
();
if
(
numodel
==
null
)
{
//后面的全部不返佣
UserId
=
0
;
break
;
}
int
MaxGradeNum
=
fxNumList
.
Where
(
x
=>
x
.
Grade
==
FXGModel
.
Grade
).
Count
();
int
MaxGradeId
=
fxNumList
.
Where
(
x
=>
x
.
Grade
==
MaxGrade
).
FirstOrDefault
()?.
GradeId
??
0
;
if
((
FXGModel
.
SiblingRebatesNum
??
0
)
+
1
>
MaxGradeNum
)
if
(
numodel
.
Id
==
umodel
.
Id
)
{
//第一个进来 按等级的返佣比例给佣金
UserId
=
numodel
.
SuperiorId
??
0
;
decimal
DcommionMoney
=
0
;
decimal
CommissionRatio
=
0
;
if
(
FXGModel
.
Grade
>
MaxGrade
&&
fxNumList
.
Where
(
x
=>
x
.
GradeId
==
FXPModel
.
Id
).
Count
()
==
2
&&
MaxGrade
==
FXPModel
.
Grade
)
{
//需要提间接普会
CommissionRatio
=
GetFXGradeRatioCommon
(
FXList
,
FXGModel
.
Id
,
FXPModel
.
Id
,
2
);
}
else
{
CommissionRatio
=
GetFXGradeRatioCommon
(
FXList
,
FXGModel
.
Id
,
MaxGradeId
,
1
);
}
if
(
FXGModel
.
DecimalType
==
1
)
if
(
FXModel
.
DecimalType
==
1
)
{
DcommionMoney
=
Math
.
Ceiling
(
item
.
CommissionPrice
*
CommissionRatio
/
100
);
DcommionMoney
=
Math
.
Ceiling
(
item
.
CommissionPrice
*
(
FXModel
.
CommissionRatio
??
0
)
/
100
);
}
else
{
DcommionMoney
=
Math
.
Ceiling
(
item
.
CommissionPrice
*
CommissionRatio
)
/
100
;
DcommionMoney
=
Math
.
Ceiling
(
item
.
CommissionPrice
*
(
FXModel
.
CommissionRatio
??
0
)
)
/
100
;
}
fxNumList
.
Add
(
new
FXOrderCommissionNumModel
()
{
GradeId
=
FX
G
Model
.
Id
,
Grade
=
FX
G
Model
.
Grade
??
0
,
GradeId
=
FXModel
.
Id
,
Grade
=
FXModel
.
Grade
??
0
,
Money
=
DcommionMoney
,
Sort
=
Num
,
IsSelfBuy
=
2
IsSelfBuy
=
1
});
Num
++;
bool
IsMoneyLack
=
false
;
if
(
TotalCommission
<
DcommionMoney
)
{
DcommionMoney
=
TotalCommission
;
IsMoneyLack
=
true
;
}
TotalCommission
-=
DcommionMoney
;
RB_Goods_OrderCommission
gocModel
=
new
RB_Goods_OrderCommission
()
{
Id
=
0
,
Commission
=
DcommionMoney
,
CommissionState
=
1
,
CreateDate
=
DateTime
.
Now
,
Grade
=
FX
G
Model
.
Id
,
Grade
=
FXModel
.
Id
,
IsGoodsDistribution
=
2
,
MallBaseId
=
demodel
.
MallBaseId
,
OrderDetailId
=
item
.
Id
,
OrderId
=
OrderId
,
Remark
=
"粉象 "
+
FX
GModel
.
GradeName
+
"返佣,返佣比例:"
+
CommissionRatio
+
"%"
+
(
IsMoneyLack
?
" 佣金不够、未返完"
:
""
)
,
Remark
=
"粉象 "
+
FX
Model
.
GradeName
+
"下单返佣,返佣比例:"
+
(
FXModel
.
CommissionRatio
??
0
)
+
"%"
,
TenantId
=
demodel
.
TenantId
,
UpdateDate
=
DateTime
.
Now
,
UserId
=
numodel
.
Id
,
...
...
@@ -3459,67 +3378,151 @@ namespace Mall.Module.Product
IsRemit
=
0
};
gocList
.
Add
(
gocModel
);
TotalCommission
-=
DcommionMoney
;
}
else
{
UserId
=
0
;
//该等级的已提完了 看是否可以直接找到下一个等级的
var
fx2List
=
dlist
.
Where
(
x
=>
x
.
Grade
>
MaxGrade
).
ToList
();
if
(
fx2List
.
Any
())
var
d2Model
=
dlist
.
Where
(
x
=>
x
.
UserId
==
numodel
.
Id
).
FirstOrDefault
();
var
FXGModel
=
new
RB_Distributor_FXGrade_Extend
();
if
(
d2Model
==
null
)
{
LogHelper
.
Write
(
"粉象返佣 用户分销商信息不存在:UserId:"
+
numodel
.
Id
);
FXGModel
=
FXPModel
;
}
else
{
//说明是有下一级的
for
(
var
i
=
0
;
i
<
ulist
.
Count
;
i
++
)
FXGModel
=
FXList
.
Where
(
x
=>
x
.
Id
==
d2Model
.
FXGradeId
).
FirstOrDefault
();
if
(
FXGModel
==
null
)
{
var
n1umodel
=
ulist
.
Where
(
x
=>
x
.
Id
==
(
numodel
.
SuperiorId
??
0
)).
FirstOrDefault
();
if
(
n1umodel
==
null
)
{
UserId
=
0
;
break
;
}
var
dis1Model
=
dlist
.
Where
(
x
=>
x
.
UserId
==
n1umodel
.
Id
).
FirstOrDefault
();
var
FXG2Model
=
new
RB_Distributor_FXGrade_Extend
();
if
(
dis1Model
==
null
)
{
LogHelper
.
Write
(
"粉象返佣 用户分销商信息不存在:UserId:"
+
n1umodel
.
Id
);
FXG2Model
=
FXPModel
;
}
else
FXGModel
=
FXPModel
;
}
}
int
MaxGrade
=
fxNumList
.
Max
(
x
=>
x
.
Grade
);
if
(
FXGModel
.
Grade
<
MaxGrade
)
{
//后面的全部不返佣
UserId
=
0
;
break
;
}
int
MaxGradeNum
=
fxNumList
.
Where
(
x
=>
x
.
Grade
==
FXGModel
.
Grade
).
Count
();
int
MaxGradeId
=
fxNumList
.
Where
(
x
=>
x
.
Grade
==
MaxGrade
).
FirstOrDefault
()?.
GradeId
??
0
;
if
((
FXGModel
.
SiblingRebatesNum
??
0
)
+
1
>
MaxGradeNum
)
{
UserId
=
numodel
.
SuperiorId
??
0
;
decimal
DcommionMoney
=
0
;
decimal
CommissionRatio
=
0
;
if
(
FXGModel
.
Grade
>
MaxGrade
&&
fxNumList
.
Where
(
x
=>
x
.
GradeId
==
FXPModel
.
Id
).
Count
()
==
2
&&
MaxGrade
==
FXPModel
.
Grade
)
{
//需要提间接普会
CommissionRatio
=
GetFXGradeRatioCommon
(
FXList
,
FXGModel
.
Id
,
FXPModel
.
Id
,
2
);
}
else
{
CommissionRatio
=
GetFXGradeRatioCommon
(
FXList
,
FXGModel
.
Id
,
MaxGradeId
,
1
);
}
if
(
FXGModel
.
DecimalType
==
1
)
{
DcommionMoney
=
Math
.
Ceiling
(
item
.
CommissionPrice
*
CommissionRatio
/
100
);
}
else
{
DcommionMoney
=
Math
.
Ceiling
(
item
.
CommissionPrice
*
CommissionRatio
)
/
100
;
}
fxNumList
.
Add
(
new
FXOrderCommissionNumModel
()
{
GradeId
=
FXGModel
.
Id
,
Grade
=
FXGModel
.
Grade
??
0
,
Money
=
DcommionMoney
,
Sort
=
Num
,
IsSelfBuy
=
2
});
Num
++;
bool
IsMoneyLack
=
false
;
if
(
TotalCommission
<
DcommionMoney
)
{
DcommionMoney
=
TotalCommission
;
IsMoneyLack
=
true
;
}
RB_Goods_OrderCommission
gocModel
=
new
RB_Goods_OrderCommission
()
{
Id
=
0
,
Commission
=
DcommionMoney
,
CommissionState
=
1
,
CreateDate
=
DateTime
.
Now
,
Grade
=
FXGModel
.
Id
,
IsGoodsDistribution
=
2
,
MallBaseId
=
demodel
.
MallBaseId
,
OrderDetailId
=
item
.
Id
,
OrderId
=
OrderId
,
Remark
=
"粉象 "
+
FXGModel
.
GradeName
+
"返佣,返佣比例:"
+
CommissionRatio
+
"%"
+
(
IsMoneyLack
?
" 佣金不够、未返完"
:
""
),
TenantId
=
demodel
.
TenantId
,
UpdateDate
=
DateTime
.
Now
,
UserId
=
numodel
.
Id
,
Type
=
3
,
IsRemit
=
0
};
gocList
.
Add
(
gocModel
);
TotalCommission
-=
DcommionMoney
;
}
else
{
UserId
=
0
;
//该等级的已提完了 看是否可以直接找到下一个等级的
var
fx2List
=
dlist
.
Where
(
x
=>
x
.
Grade
>
MaxGrade
).
ToList
();
if
(
fx2List
.
Any
())
{
//说明是有下一级的
for
(
var
i
=
0
;
i
<
ulist
.
Count
;
i
++)
{
FXG2Model
=
FXList
.
Where
(
x
=>
x
.
Id
==
dis1Model
.
FXGradeId
).
FirstOrDefault
();
if
(
FXG2Model
==
null
)
var
n1umodel
=
ulist
.
Where
(
x
=>
x
.
Id
==
(
numodel
.
SuperiorId
??
0
)).
FirstOrDefault
();
if
(
n1umodel
==
null
)
{
UserId
=
0
;
break
;
}
var
dis1Model
=
dlist
.
Where
(
x
=>
x
.
UserId
==
n1umodel
.
Id
).
FirstOrDefault
();
var
FXG2Model
=
new
RB_Distributor_FXGrade_Extend
();
if
(
dis1Model
==
null
)
{
LogHelper
.
Write
(
"粉象返佣 用户分销商信息不存在:UserId:"
+
n1umodel
.
Id
);
FXG2Model
=
FXPModel
;
}
}
if
(
FXG2Model
.
Grade
<
MaxGrade
)
{
//后面的全部不返佣
UserId
=
0
;
break
;
}
else
if
(
FXG2Model
.
Grade
>
MaxGrade
)
{
//已找到上级 继续返佣
UserId
=
n1umodel
.
Id
;
break
;
}
else
{
UserId
=
0
;
numodel
=
n1umodel
;
//继续查找下一级
else
{
FXG2Model
=
FXList
.
Where
(
x
=>
x
.
Id
==
dis1Model
.
FXGradeId
).
FirstOrDefault
();
if
(
FXG2Model
==
null
)
{
FXG2Model
=
FXPModel
;
}
}
if
(
FXG2Model
.
Grade
<
MaxGrade
)
{
//后面的全部不返佣
UserId
=
0
;
break
;
}
else
if
(
FXG2Model
.
Grade
>
MaxGrade
)
{
//已找到上级 继续返佣
UserId
=
n1umodel
.
Id
;
break
;
}
else
{
UserId
=
0
;
numodel
=
n1umodel
;
//继续查找下一级
}
}
}
}
}
}
}
item
.
TCommissionMoney
=
0
;
foreach
(
var
qitem
in
gocList
)
{
qitem
.
Commission
=
(
qitem
.
Commission
??
0
)
*
(
item
.
Number
??
0
);
item
.
TCommissionMoney
+=
(
qitem
.
Commission
??
0
);
goods_OrderCommissionRepository
.
Insert
(
qitem
,
trans
);
item
.
TCommissionMoney
=
0
;
foreach
(
var
qitem
in
gocList
)
{
qitem
.
Commission
=
(
qitem
.
Commission
??
0
)
*
(
item
.
Number
??
0
);
item
.
TCommissionMoney
+=
(
qitem
.
Commission
??
0
);
goods_OrderCommissionRepository
.
Insert
(
qitem
,
trans
);
}
}
}
}
...
...
@@ -4110,11 +4113,11 @@ namespace Mall.Module.Product
{
var
supplierModel
=
supplist
.
Where
(
x
=>
x
.
ID
==
item
.
SupplierId
).
FirstOrDefault
();
var
qscList
=
scList
.
Where
(
x
=>
x
.
SupplierId
==
item
.
SupplierId
).
ToList
();
if
(
item
.
CostMoney
>
0
&&
((
item
.
Final_Price
??
0
)
-
(
item
.
CostMoney
??
0
)
-
item
.
TCommissionMoney
)
>
0
&&
qscList
.
Any
())
if
(
item
.
CostMoney
>
0
&&
((
item
.
Final_Price
??
0
)
-
(
item
.
CostMoney
??
0
)
*
(
item
.
Number
??
0
)
-
item
.
TCommissionMoney
)>
0
&&
qscList
.
Any
())
{
decimal
Profit
=
(
item
.
Final_Price
??
0
)
*
(
item
.
Number
??
0
)
-
(
item
.
CostMoney
??
0
)
*
(
item
.
Number
??
0
)
-
item
.
TCommissionMoney
;
decimal
GrossMargin
=
Math
.
Round
(
Profit
/
(
(
item
.
Final_Price
??
0
)
*
(
item
.
Number
??
0
)
),
2
,
MidpointRounding
.
AwayFromZero
);
var
scModel
=
qscList
.
Where
(
x
=>
(
x
.
CommissionType
*
10
)
>
GrossMargin
).
OrderBy
(
x
=>
x
.
CommissionType
).
FirstOrDefault
();
decimal
Profit
=
(
item
.
Final_Price
??
0
)
-
(
item
.
CostMoney
??
0
)
*
(
item
.
Number
??
0
)
-
item
.
TCommissionMoney
;
decimal
GrossMargin
=
Math
.
Round
(
Profit
/
(
item
.
Final_Price
??
0
),
2
,
MidpointRounding
.
AwayFromZero
);
var
scModel
=
qscList
.
Where
(
x
=>
(
x
.
CommissionType
*
10
)
>
=
(
GrossMargin
*
100
)
).
OrderBy
(
x
=>
x
.
CommissionType
).
FirstOrDefault
();
decimal
Commission
=
Math
.
Round
(
Profit
*
scModel
.
CommissionRate
/
100
,
2
,
MidpointRounding
.
AwayFromZero
);
if
(
Commission
>
0
)
{
...
...
Mall.Module.User/UserModule.cs
View file @
16690a20
...
...
@@ -5482,7 +5482,7 @@ namespace Mall.Module.User
Id
=
0
,
MallBaseId
=
mallBaseId
,
Money
=
totalMoney
,
Periods
=
DateTime
.
Now
.
ToString
(
"yyyyMM
dd
"
),
Periods
=
DateTime
.
Now
.
ToString
(
"yyyyMM"
),
Remark
=
""
,
Status
=
0
,
SupplierId
=
supplierId
,
...
...
Mall.WebApi/App_Code/PayUtil.cs
View file @
16690a20
...
...
@@ -473,7 +473,7 @@ namespace Mall.WebApi.App_Code
/// <param name="CustomerId"></param>
/// <param name="openid"></param>
/// <returns></returns>
public
static
bool
GetTransfersOrder
(
string
sOrderNo
,
decimal
dPrice
,
string
CustomerId
,
string
openid
,
RB_MiniProgram_Extend
model
,
IHttpContextAccessor
_accessor
)
public
static
bool
GetTransfersOrder
(
string
sOrderNo
,
decimal
dPrice
,
string
CustomerId
,
string
openid
,
RB_MiniProgram_Extend
model
,
IHttpContextAccessor
_accessor
,
string
Remark
=
""
)
{
if
(!
System
.
IO
.
File
.
Exists
(
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"App_Data/Certs/WeChatApp/"
+
model
.
WeChatPayCertificateUrl
)))
{
...
...
@@ -489,7 +489,7 @@ namespace Mall.WebApi.App_Code
req
.
SetParameter
(
"openid"
,
openid
);
req
.
SetParameter
(
"check_name"
,
"NO_CHECK"
);
req
.
SetParameter
(
"amount"
,
(
dPrice
*
100
).
ToString
(
"f0"
));
req
.
SetParameter
(
"desc"
,
"赞羊商城佣金提现"
);
req
.
SetParameter
(
"desc"
,
Remark
==
""
?
"赞羊商城佣金提现"
:
Remark
);
req
.
SetParameter
(
"sign"
,
req
.
CreateMd5Sign
(
_accessor
,
model
.
WeChatApiSecret
));
var
reqXml
=
req
.
ParseXml
();
var
result
=
Common
.
Pay
.
WeChatPat
.
HttpHelper
.
Post
(
new
HttpParam
()
...
...
Mall.WebApi/Controllers/Finance/ERPOrderCommissionController.cs
View file @
16690a20
...
...
@@ -224,7 +224,7 @@ namespace Mall.WebApi.Controllers.Finance
{
var
mallModel
=
userModule
.
GetMiniProgramExtend
(
MallBaseId
);
var
umodel
=
userModule
.
GetMemberUserInfo
(
bmodel
.
UserId
??
0
);
var
flag
=
App_Code
.
PayUtil
.
GetTransfersOrder
((
bmodel
.
Periods
??
""
)
+
bmodel
.
Id
,
bmodel
.
Money
??
0
,
(
bmodel
.
UserId
??
0
).
ToString
(),
umodel
.
OpenId
,
mallModel
,
_accessor
);
var
flag
=
App_Code
.
PayUtil
.
GetTransfersOrder
((
bmodel
.
Periods
??
""
)
+
bmodel
.
Id
,
bmodel
.
Money
??
0
,
(
bmodel
.
UserId
??
0
).
ToString
(),
umodel
.
OpenId
,
mallModel
,
_accessor
,
"赞羊供应商佣金打款"
);
if
(
flag
)
{
string
msg
=
userModule
.
SetRecommendOrdersBillRemit
(
BillId
,
TenantId
,
MallBaseId
,
0
,
"单据审核通过,已自动打款"
);
...
...
@@ -233,7 +233,7 @@ namespace Mall.WebApi.Controllers.Finance
LogHelper
.
Write
(
"企业付款失败 账单BillId:"
+
BillId
);
}
new
MiniProgramMsgModule
().
SendWithdrawSucceedMsg
(
TenantId
,
MallBaseId
,
umodel
.
OpenId
,
(
bmodel
.
Money
??
0
).
ToString
(),
"0"
,
"自动打款"
,
"已发放
推荐
佣金,请注意查收"
);
new
MiniProgramMsgModule
().
SendWithdrawSucceedMsg
(
TenantId
,
MallBaseId
,
umodel
.
OpenId
,
(
bmodel
.
Money
??
0
).
ToString
(),
"0"
,
"自动打款"
,
"已发放
供应商
佣金,请注意查收"
);
return
ApiResult
.
Success
();
}
else
...
...
Mall.WebApi/Controllers/User/UserController.cs
View file @
16690a20
...
...
@@ -3013,7 +3013,7 @@ namespace Mall.WebApi.Controllers.User
{
var
mallModel
=
userModule
.
GetMiniProgramExtend
(
req
.
MallBaseId
);
var
umodel
=
userModule
.
GetMemberUserInfo
(
bmodel
.
UserId
??
0
);
var
flag
=
App_Code
.
PayUtil
.
GetTransfersOrder
((
bmodel
.
Periods
??
""
)
+
bmodel
.
Id
,
bmodel
.
Money
??
0
,
(
bmodel
.
UserId
??
0
).
ToString
(),
umodel
.
OpenId
,
mallModel
,
_accessor
);
var
flag
=
App_Code
.
PayUtil
.
GetTransfersOrder
((
bmodel
.
Periods
??
""
)
+
bmodel
.
Id
,
bmodel
.
Money
??
0
,
(
bmodel
.
UserId
??
0
).
ToString
(),
umodel
.
OpenId
,
mallModel
,
_accessor
,
"赞羊供应商佣金打款"
);
if
(
flag
)
{
string
msg
=
userModule
.
SetRecommendOrdersBillRemit
(
BillId
,
req
.
TenantId
,
req
.
MallBaseId
,
req
.
EmpId
);
...
...
@@ -3022,7 +3022,7 @@ namespace Mall.WebApi.Controllers.User
LogHelper
.
Write
(
"企业付款失败 账单BillId:"
+
BillId
);
}
new
MiniProgramMsgModule
().
SendWithdrawSucceedMsg
(
req
.
TenantId
,
req
.
MallBaseId
,
umodel
.
OpenId
,
(
bmodel
.
Money
??
0
).
ToString
(),
"0"
,
"自动打款"
,
"已发放
推荐
佣金,请注意查收"
);
new
MiniProgramMsgModule
().
SendWithdrawSucceedMsg
(
req
.
TenantId
,
req
.
MallBaseId
,
umodel
.
OpenId
,
(
bmodel
.
Money
??
0
).
ToString
(),
"0"
,
"自动打款"
,
"已发放
供应商
佣金,请注意查收"
);
return
ApiResult
.
Success
();
}
else
...
...
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