切换导航条
此项目
正在载入...
登录
mmm-go
/
partnermg
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
yangfu
5 years ago
提交
e7bfab4a8a41c9c0cbd7f3fab95318aa675416cc
1 个父辈
b497fa5b
分红编辑修改
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
8 行增加
和
9 行删除
pkg/application/order_payment/service/order_payment.go
pkg/infrastructure/dao/pg_order_payment_dao.go
pkg/application/order_payment/service/order_payment.go
查看文件 @
e7bfab4
...
...
@@ -59,6 +59,7 @@ func (OrderPaymentService *OrderPaymentService) CreateOrderPayment(command *comm
return
}
var
excludeIdList
[]
int
var
bonusStatus
int
=
domain
.
BonusPaid
//分红状态
excludeIdList
=
append
(
excludeIdList
,
0
)
for
i
:=
range
command
.
DivdendPaymentItem
{
paymentItem
:=
command
.
DivdendPaymentItem
[
i
]
...
...
@@ -67,13 +68,15 @@ func (OrderPaymentService *OrderPaymentService) CreateOrderPayment(command *comm
CreateAt
:
time
.
Now
(),
UpdateAt
:
time
.
Now
(),
}
if
paymentItem
.
PaymentId
>
0
&&
paymentItem
.
StateOfPayment
==
domain
.
BonusPaid
{
continue
if
bonusStatus
==
domain
.
BonusPaid
&&
paymentItem
.
StateOfPayment
==
domain
.
BonusWaitPay
{
bonusStatus
=
domain
.
BonusWaitPay
}
if
paymentItem
.
PaymentId
>
0
{
//检查货款 已存在 / 未存在
if
findDm
,
e
:=
OrderPaymentRepository
.
FindOne
(
domain
.
OrderPaymentFindOneQuery
{
OrderId
:
command
.
OrderId
,
PaymentId
:
paymentItem
.
PaymentId
});
e
==
nil
{
if
findDm
.
BonusStatus
==
domain
.
BonusPaid
{
//状态更金额一样的时候 不做更新
if
findDm
.
BonusStatus
==
paymentItem
.
StateOfPayment
&&
findDm
.
PaymentAmount
==
paymentItem
.
PaymentForGoods
{
excludeIdList
=
append
(
excludeIdList
,
paymentItem
.
PaymentId
)
continue
}
dm
=
findDm
...
...
@@ -81,7 +84,7 @@ func (OrderPaymentService *OrderPaymentService) CreateOrderPayment(command *comm
}
dm
.
PartnerId
=
orderBase
[
"PartnerId"
]
.
(
int64
)
bonusPercent
:=
orderBase
[
"PartnerBonusPercent"
]
.
(
float64
)
dm
.
BonusAmount
=
paymentItem
.
PaymentForGoods
*
(
bonusPercent
/
100.0
)
dm
.
BonusAmount
=
utils
.
Decimal
(
paymentItem
.
PaymentForGoods
*
(
bonusPercent
/
100.0
)
)
dm
.
PaymentAmount
=
paymentItem
.
PaymentForGoods
dm
.
BonusStatus
=
paymentItem
.
StateOfPayment
dm
.
UpdateAt
=
time
.
Now
()
...
...
@@ -90,10 +93,7 @@ func (OrderPaymentService *OrderPaymentService) CreateOrderPayment(command *comm
}
excludeIdList
=
append
(
excludeIdList
,
int
(
dm
.
Id
))
}
var
bonusStatus
int
=
1
if
len
(
command
.
DivdendPaymentItem
)
>
0
{
bonusStatus
=
command
.
DivdendPaymentItem
[
len
(
command
.
DivdendPaymentItem
)
-
1
]
.
StateOfPayment
}
if
err
=
OrderPaymentDao
.
Remove
(
command
.
OrderId
,
domain
.
BonusWaitPay
,
excludeIdList
);
err
!=
nil
{
return
}
...
...
pkg/infrastructure/dao/pg_order_payment_dao.go
查看文件 @
e7bfab4
...
...
@@ -19,7 +19,6 @@ func (o *OrderPayment) Remove(orderId int64, status int, idList []int) error {
tx
:=
o
.
transactionContext
.
PgTx
m
:=
new
(
models
.
OrderPayment
)
q
:=
tx
.
Model
(
m
)
.
Where
(
"order_id=?"
,
orderId
)
.
Where
(
"bonus_status=?"
,
status
)
.
WhereIn
(
"id not in(?)"
,
idList
)
_
,
err
:=
q
.
Delete
()
return
err
...
...
请
注册
或
登录
后发表评论