Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
Jz-Php
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
PHP
Jz-Php
Commits
b34196ad
提交
b34196ad
authored
7月 23, 2020
作者:
chengye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整账号额度变化逻辑
上级
77fa9af6
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
23 行增加
和
28 行删除
+23
-28
Payment.php
application/api/controller/v2/common/Payment.php
+1
-0
Account.php
application/em/controller/Account.php
+8
-0
Invoice.php
application/em/controller/Invoice.php
+10
-5
WriteOff.php
application/em/controller/WriteOff.php
+4
-23
没有找到文件。
application/api/controller/v2/common/Payment.php
浏览文件 @
b34196ad
...
...
@@ -7,6 +7,7 @@
*/
namespace
app\api\controller\v2\common
;
use
app\em\controller\Account
;
use
app\em\controller\WriteOff
;
use
app\em\model\EmAccount
;
use
app\em\model\EmPayment
;
...
...
application/em/controller/Account.php
浏览文件 @
b34196ad
...
...
@@ -93,4 +93,11 @@ class Account extends Base
}
return
$account
->
save
();
}
public
function
computerAmount
(
$em_id
,
$balance
){
//更新账户余额
$account
=
self
::
get
([
'em_id'
=>
$em_id
]);
$account
->
amount
+=
$balance
;
return
$account
->
save
();
}
}
\ No newline at end of file
application/em/controller/Invoice.php
浏览文件 @
b34196ad
...
...
@@ -178,11 +178,12 @@ class Invoice extends Base
$eiu
->
save
();
}
// //更新电表账户
// $useage = \app\em\model\Useage::get(['useage_id' => $uData['useage_id']]);
//
// $account = new Account();
// $account->updateAmount($useage->em_id,$inv->payment_amount,0);
//更新电表账户
$useage
=
\app\em\model\Useage
::
get
([
'useage_id'
=>
$uData
[
'useage_id'
]]);
$account
=
new
Account
();
$pay_amount
=
0
-
$inv
->
payment_amount
;
$account
->
computerAmount
(
$useage
->
em_id
,
$pay_amount
);
return
$inv
;
}
...
...
@@ -236,6 +237,10 @@ class Invoice extends Base
$eiu
->
useage_id
=
$uData
[
'useage_id'
];
$eiu
->
save
();
}
$account
=
new
Account
();
$pay_amount
=
0
-
$inv
->
payment_amount
;
$account
->
computerAmount
(
$useage
->
em_id
,
$pay_amount
);
return
$inv
;
}
...
...
application/em/controller/WriteOff.php
浏览文件 @
b34196ad
...
...
@@ -2,7 +2,6 @@
namespace
app\em\controller
;
use
app\em\model\EmAccount
;
use
app\em\model\EmInvoice
;
use
app\em\model\EmPayment
;
use
app\em\model\EmPaymentInvoice
;
...
...
@@ -89,15 +88,7 @@ class WriteOff extends Controller
->
whereIn
(
'status'
,
'3,4,5'
)
->
order
(
'payment_id asc'
)
->
select
();
if
(
$payments
->
isEmpty
())
{
$account
=
EmAccount
::
get
([
'account_id'
=>
$invoice
->
account_id
]);
$account
->
amount
-=
$invoice
->
payment_balance
;
$account
->
save
();
$invoice
->
is_pay
=
1
;
$invoice
->
save
();
return
'没有找到可销账的缴费单!'
;
}
if
(
$payments
->
isEmpty
())
return
'没有找到可销账的缴费单!'
;
}
$paymentIds
=
[];
foreach
(
$payments
as
$payment
){
...
...
@@ -107,7 +98,6 @@ class WriteOff extends Controller
'invoice_id'
=>
$invoice
->
invoice_id
];
//销账日志
$logMsg
=
date
(
'Y-m-d H-i-s'
)
.
'paymentIds :'
.
implode
(
'-'
,
$paymentIds
)
.
'invoiceIds :'
.
implode
(
'-'
,
$invsIds
);
Log
::
info
(
$logMsg
);
...
...
@@ -137,7 +127,6 @@ class WriteOff extends Controller
foreach
(
$invs
as
$index
=>
$inv
)
{
if
(
$inv
->
payment_balance
==
0
)
continue
;
$dk_balance
=
0
;
$balanceMode
=
new
EmPaymentInvoiceBalance
();
$balanceMode
->
payment_id
=
$payment
->
payment_id
;
$balanceMode
->
invoice_id
=
$inv
->
invoice_id
;
...
...
@@ -145,7 +134,7 @@ class WriteOff extends Controller
//如果该缴费单可以完全消除当前账单额度
if
(
$payment
->
balance
>=
$inv
->
payment_balance
)
{
//单笔销账多少
$balanceMode
->
balance
=
$
dk_balance
=
$
inv
->
payment_balance
;
$balanceMode
->
balance
=
$inv
->
payment_balance
;
$payment
->
balance
=
$payment
->
balance
-
$inv
->
payment_balance
;
//账单额度变化
...
...
@@ -161,7 +150,7 @@ class WriteOff extends Controller
$inv
->
payment_balance
=
$inv
->
payment_balance
-
$payment
->
balance
;
//缴费额度变化
$payment
->
balance
=
0
;
$dk_balance
=
$inv
->
payment_balance
;
}
//更新账单状态
...
...
@@ -180,17 +169,10 @@ class WriteOff extends Controller
$result
++
;
$balanceMode
->
isUpdate
(
false
)
->
save
();
if
(
$inv
->
is_pay
!=
1
)
$this
->
computerAmount
(
$inv
->
account_id
,
$dk_balance
);
//
if($inv->is_pay != 1) $this->computerAmount($inv->account_id,$dk_balance);
}
}
$msg
=
$result
==
0
?
'已审核,没有找到可销账的缴费单.'
:
'已审核,成功销账 '
.
$result
.
' 笔账单.'
;
return
$msg
;
}
protected
function
computerAmount
(
$account_id
,
$balance
){
//更新账户余额
$account
=
EmAccount
::
get
([
'account_id'
=>
$account_id
]);
$account
->
amount
-=
$balance
;
$account
->
save
();
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论