Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
Jz-Php
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
PHP
Jz-Php
Commits
5f211570
提交
5f211570
authored
7月 16, 2020
作者:
chengye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test
上级
3d2ae57c
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
16 行增加
和
16 行删除
+16
-16
WriteOff.php
application/em/controller/WriteOff.php
+16
-16
没有找到文件。
application/em/controller/WriteOff.php
浏览文件 @
5f211570
...
@@ -13,27 +13,23 @@ use think\facade\Log;
...
@@ -13,27 +13,23 @@ use think\facade\Log;
class
WriteOff
extends
Controller
class
WriteOff
extends
Controller
{
{
public
function
writeOffFromPayment
(
$
account_id
,
$
payment_id
){
public
function
writeOffFromPayment
(
$payment_id
){
Log
::
info
(
'触发销账:'
.
$
account_id
.
' | '
.
$
payment_id
);
Log
::
info
(
'触发销账:'
.
$payment_id
);
//获取缴费单对象
//获取缴费单对象
$payment
=
EmPayment
::
where
(
'payment_id'
,
'='
,
$payment_id
)
->
find
();
$payment
=
EmPayment
::
where
(
'payment_id'
,
'='
,
$payment_id
)
->
find
();
//获取关联的账单对象
//获取关联的账单对象
$invs
=
(
new
EmInvoice
())
->
alias
(
'
ei'
)
->
field
(
'ei
.invoice_id'
)
$invs
=
(
new
EmInvoice
())
->
alias
(
'
a'
)
->
field
(
'a
.invoice_id'
)
->
leftJoin
([
'em_payment_invoice'
=>
'epi'
],
'epi.invoice_id = ei
.invoice_id'
)
->
join
([
'em_payment_invoice'
=>
'b'
],
'b.invoice_id = a
.invoice_id'
)
->
where
(
'
epi
.payment_id'
,
'='
,
$payment_id
)
->
where
(
'
b
.payment_id'
,
'='
,
$payment_id
)
->
where
(
'
ei
.payment_balance'
,
'neq'
,
0
)
->
where
(
'
a
.payment_balance'
,
'neq'
,
0
)
->
order
(
'
ei
.invoice_id asc'
)
->
order
(
'
a
.invoice_id asc'
)
->
select
();
->
select
();
$invsArr
=
[];
$invsArr
=
[];
//更新缴费单状态
//如果存在账单关联对象
if
(
$invs
->
isEmpty
()){
if
(
!
$invs
->
isEmpty
()){
$payment
->
status
=
4
;
$payment
->
save
();
return
'审核成功'
;
}
else
{
foreach
(
$invs
as
$inv
){
foreach
(
$invs
as
$inv
){
$invsArr
[]
=
$inv
->
invoice_id
;
$invsArr
[]
=
$inv
->
invoice_id
;
}
}
...
@@ -45,8 +41,9 @@ class WriteOff extends Controller
...
@@ -45,8 +41,9 @@ class WriteOff extends Controller
//如果可以完全销账 则继续销账
//如果可以完全销账 则继续销账
if
(
$payment
->
balance
>
$payments_balance
){
if
(
$payment
->
balance
>
$payments_balance
){
$invs
=
(
new
EmInvoice
())
->
field
(
'invoice_id'
)
$invs
=
(
new
EmInvoice
())
->
field
(
'invoice_id'
)
->
where
(
'account_id'
,
'='
,
$account_id
)
->
where
(
'account_id'
,
'='
,
$
payment
->
account_id
)
->
where
(
'payment_balance'
,
'neq'
,
0
)
->
where
(
'payment_balance'
,
'neq'
,
0
)
->
whereNotIn
(
'invoice_id'
,
$invsArr
)
->
order
(
'invoice_id asc'
)
->
order
(
'invoice_id asc'
)
->
select
();
->
select
();
if
(
!
$invs
->
isEmpty
())
{
if
(
!
$invs
->
isEmpty
())
{
...
@@ -56,6 +53,7 @@ class WriteOff extends Controller
...
@@ -56,6 +53,7 @@ class WriteOff extends Controller
}
}
}
}
$paymentIds
[]
=
$payment
->
payment_id
;
$paymentIds
[]
=
$payment
->
payment_id
;
//处理账户金额
//处理账户金额
...
@@ -82,10 +80,12 @@ class WriteOff extends Controller
...
@@ -82,10 +80,12 @@ class WriteOff extends Controller
foreach
(
$payments
as
$key
=>
$payment
){
foreach
(
$payments
as
$key
=>
$payment
){
if
(
$payment
->
balance
==
0
)
continue
;
if
(
$payment
->
balance
==
0
)
continue
;
foreach
(
$invs
as
$index
=>
$inv
)
{
foreach
(
$invs
as
$index
=>
$inv
)
{
$balanceMode
=
new
EmPaymentInvoiceBalance
();
$balanceMode
->
payment_id
=
$payment
->
payment_id
;
if
(
$inv
->
payment_balance
==
0
)
continue
;
if
(
$inv
->
payment_balance
==
0
)
continue
;
$balanceMode
=
new
EmPaymentInvoiceBalance
();
$balanceMode
->
payment_id
=
$payment
->
payment_id
;
$balanceMode
->
invoice_id
=
$inv
->
invoice_id
;
$balanceMode
->
invoice_id
=
$inv
->
invoice_id
;
//如果该缴费单可以完全消除当前账单额度
//如果该缴费单可以完全消除当前账单额度
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论