Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
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
hujun
tl_estate
Commits
315d365d
Commit
315d365d
authored
Jan 30, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
撤销
parent
ae296507
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
4 deletions
+45
-4
PayLogService.php
application/api_broker/service/PayLogService.php
+26
-0
Finance.php
application/index/controller/Finance.php
+4
-4
OPayLogModel.php
application/model/OPayLogModel.php
+12
-0
ORefundModel.php
application/model/ORefundModel.php
+3
-0
No files found.
application/api_broker/service/PayLogService.php
View file @
315d365d
...
@@ -312,4 +312,29 @@ class PayLogService
...
@@ -312,4 +312,29 @@ class PayLogService
}
}
}
}
/**
* 计算收款-退款
*
* @param $bargain_id
* @return bool|float|int
*/
public
function
getPayLogRefundSurplusMoney
(
$bargain_id
)
{
if
(
empty
(
$bargain_id
))
{
return
false
;
}
$pay_id
=
$this
->
payLogModel
->
getFieldValue
(
'id'
,
[
'bargain_id'
=>
$bargain_id
]);
if
(
empty
(
$pay_id
))
{
return
false
;
}
$money
=
$this
->
payLogModel
->
getSum
(
'money'
,
[
'id'
=>
$pay_id
]);
if
(
$money
>
0
)
{
$refund_money
=
$this
->
oRefundModel
->
getRefundSum
(
'refund_money'
,
[
'pay_log_id'
=>
$pay_id
]);
$result
=
$money
-
$refund_money
;
}
else
{
$result
=
0
;
}
return
$result
;
}
}
}
\ No newline at end of file
application/index/controller/Finance.php
View file @
315d365d
...
@@ -2282,10 +2282,10 @@ class Finance extends Basic
...
@@ -2282,10 +2282,10 @@ class Finance extends Basic
return
$this
->
response
(
101
,
'参数错误'
);
return
$this
->
response
(
101
,
'参数错误'
);
}
}
$
m_pay
=
new
OPayLogModel
();
$
service_pay
=
new
PayLogService
();
$
num
=
$m_pay
->
getCount
([
'bargain_id'
=>
$this
->
params
[
'bargain_id'
],
'is_del'
=>
0
]);
$
money
=
$service_pay
->
getPayLogRefundSurplusMoney
(
$this
->
params
[
'bargain_id'
]);
if
(
$
num
>
0
)
{
if
(
$
money
>
0
)
{
return
$this
->
response
(
101
,
'存在收款
,不能删除
!'
);
return
$this
->
response
(
101
,
'存在收款
或退款,不能撤销
!'
);
}
}
$check
=
$this
->
updatePerformanceAll
(
$this
->
params
[
'bargain_id'
]);
$check
=
$this
->
updatePerformanceAll
(
$this
->
params
[
'bargain_id'
]);
...
...
application/model/OPayLogModel.php
View file @
315d365d
...
@@ -490,6 +490,10 @@ class OPayLogModel extends Model
...
@@ -490,6 +490,10 @@ class OPayLogModel extends Model
* @return float|int
* @return float|int
*/
*/
public
function
getSum
(
$filed
,
$params
){
public
function
getSum
(
$filed
,
$params
){
if
(
!
isset
(
$params
[
'is_del'
]))
{
$params
[
'is_del'
]
=
0
;
}
return
$this
->
db_
return
$this
->
db_
->
where
(
$params
)
->
where
(
$params
)
->
sum
(
$filed
);
->
sum
(
$filed
);
...
@@ -561,4 +565,11 @@ class OPayLogModel extends Model
...
@@ -561,4 +565,11 @@ class OPayLogModel extends Model
public
function
getCount
(
$where
)
{
public
function
getCount
(
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
count
(
'id'
);
return
$this
->
db_
->
where
(
$where
)
->
count
(
'id'
);
}
}
public
function
getFieldValue
(
$field
,
$where
)
{
if
(
!
isset
(
$params
[
'is_del'
]))
{
$params
[
'is_del'
]
=
0
;
}
return
$this
->
db_
->
where
(
$where
)
->
value
(
$field
);
}
}
}
\ No newline at end of file
application/model/ORefundModel.php
View file @
315d365d
...
@@ -253,6 +253,9 @@ class ORefundModel extends Model{
...
@@ -253,6 +253,9 @@ class ORefundModel extends Model{
public
function
getRefundSum
(
$field
,
$params
)
public
function
getRefundSum
(
$field
,
$params
)
{
{
if
(
!
isset
(
$params
[
'is_del'
]))
{
$params
[
'is_del'
]
=
0
;
}
$data
=
$this
->
db_
$data
=
$this
->
db_
->
where
(
$params
)
->
where
(
$params
)
->
sum
(
$field
);
->
sum
(
$field
);
...
...
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