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
5b970c95
Commit
5b970c95
authored
Jul 22, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化 粉象返佣
parent
dd9e5d36
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
120 additions
and
0 deletions
+120
-0
ProductModule.cs
Mall.Module.Product/ProductModule.cs
+91
-0
ProductController.cs
Mall.WebApi/Controllers/Product/ProductController.cs
+29
-0
No files found.
Mall.Module.Product/ProductModule.cs
View file @
5b970c95
...
@@ -5725,7 +5725,98 @@ namespace Mall.Module.Product
...
@@ -5725,7 +5725,98 @@ namespace Mall.Module.Product
#
endregion
#
endregion
#
region
同步粉象商品规格佣金
/// <summary>
/// 同步粉象佣金
/// </summary>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public
bool
SyncGoodsSpecificationCommission
(
int
tenantId
,
int
mallBaseId
)
{
var
goodsList
=
goodsRepository
.
GetSingleList
(
new
RB_Goods_Extend
()
{
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
if
(
goodsList
.
Any
())
{
//查询所有的分销价格
string
goodsIds
=
string
.
Join
(
","
,
goodsList
.
Select
(
x
=>
x
.
Id
));
var
dclist
=
goods_DistributionCommissionRepository
.
GetList
(
new
RB_Goods_DistributionCommission_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
//查询所有的规格价格
var
splist
=
goods_SpecificationPriceRepository
.
GetList
(
new
RB_Goods_SpecificationPrice_Extend
()
{
GoodsIds
=
goodsIds
,
TenantId
=
tenantId
,
MallBaseId
=
mallBaseId
});
foreach
(
var
item
in
goodsList
)
{
if
(
item
.
SeparateDistribution
==
1
&&
item
.
SeparateDistributionMoneyType
==
2
)
{
var
dc1list
=
dclist
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
if
(
item
.
IsCustomSpecification
==
1
)
{
var
sp1list
=
splist
.
Where
(
x
=>
x
.
GoodsId
==
item
.
Id
).
ToList
();
if
(
item
.
SeparateDistributionType
==
1
)
{
//普通设置 直接查 分销商等级的 返佣和
var
dcmodel
=
dc1list
.
Where
(
x
=>
x
.
DistributorGrade
==
74
).
FirstOrDefault
();
decimal
TotalMoney
=
(
dcmodel
.
OneCommission
??
0
)
+
(
dcmodel
.
TwoCommission
??
0
)
+
(
dcmodel
.
ThreeCommission
??
0
);
foreach
(
var
qitem
in
sp1list
)
{
//每个规格都设置为这么多fanyong
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_SpecificationPrice
.
Commission
),
TotalMoney
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_SpecificationPrice
.
Id
),
FiledValue
=
qitem
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_SpecificationPriceRepository
.
Update
(
keyValues
,
wheres
);
}
}
else
{
//详细设置咯 对比规格更新
foreach
(
var
qitem
in
dc1list
.
Where
(
x
=>
x
.
DistributorGrade
==
74
))
{
decimal
TotalMoney
=
(
qitem
.
OneCommission
??
0
)
+
(
qitem
.
TwoCommission
??
0
)
+
(
qitem
.
ThreeCommission
??
0
);
var
spmodel
=
sp1list
.
Where
(
x
=>
x
.
SpecificationSort
==
qitem
.
SpecificationSort
).
FirstOrDefault
();
if
(
spmodel
!=
null
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods_SpecificationPrice
.
Commission
),
TotalMoney
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods_SpecificationPrice
.
Id
),
FiledValue
=
spmodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goods_SpecificationPriceRepository
.
Update
(
keyValues
,
wheres
);
}
}
}
}
else
{
//没有自定义规格 直接弄主表返佣金额
var
dcmodel
=
dc1list
.
Where
(
x
=>
x
.
DistributorGrade
==
74
).
FirstOrDefault
();
decimal
TotalMoney
=
(
dcmodel
.
OneCommission
??
0
)
+
(
dcmodel
.
TwoCommission
??
0
)
+
(
dcmodel
.
ThreeCommission
??
0
);
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Goods
.
Commission
),
TotalMoney
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Goods
.
Id
),
FiledValue
=
item
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
goodsRepository
.
Update
(
keyValues
,
wheres
);
}
}
}
}
return
true
;
}
#
endregion
#
region
分销商
#
region
分销商
/// <summary>
/// <summary>
...
...
Mall.WebApi/Controllers/Product/ProductController.cs
View file @
5b970c95
...
@@ -2268,5 +2268,34 @@ namespace Mall.WebApi.Controllers.MallBase
...
@@ -2268,5 +2268,34 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
#
endregion
#
endregion
#
region
同步商品规格返佣
/// <summary>
/// 同步商品规格佣金
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SyncGoodsSpecificationCommission
()
{
var
req
=
RequestParm
;
JObject
parms
=
JObject
.
Parse
(
req
.
msg
.
ToString
());
int
TenantId
=
parms
.
GetInt
(
"TenantId"
,
0
);
int
MallBaseId
=
parms
.
GetInt
(
"MallBaseId"
,
0
);
if
(
TenantId
<=
0
||
MallBaseId
<=
0
)
{
return
ApiResult
.
Failed
();
}
bool
flag
=
productModule
.
SyncGoodsSpecificationCommission
(
TenantId
,
MallBaseId
);
if
(
flag
)
{
return
ApiResult
.
Success
();
}
else
{
return
ApiResult
.
Failed
();
}
}
#
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