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
eb7f5609
Commit
eb7f5609
authored
Dec 13, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
cb42ed6e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
12 deletions
+42
-12
OrderLog.php
application/api_broker/controller/OrderLog.php
+1
-1
PayLog.php
application/api_broker/controller/PayLog.php
+18
-6
PayLogService.php
application/api_broker/service/PayLogService.php
+11
-5
OPayLogAdjustment.php
application/model/OPayLogAdjustment.php
+11
-0
route.php
application/route.php
+1
-0
No files found.
application/api_broker/controller/OrderLog.php
View file @
eb7f5609
...
...
@@ -217,7 +217,7 @@ class OrderLog extends Basic
// `type` '付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他',
//`pay_type` '支付方式 10支付宝 20 微信 30pos机器 40转账 50现金',
// `money` '入账金额
存分
',
// `money` '入账金额',
"collecting_bill" => [ { "type" : 10, "pay_type" : 10, "money" : 1100 }, { "type" :10, "pay_type" : 10, "money": 1200 } ],
"house_number" => "3301号",
"industry_type" => "asdasdasd",
...
...
application/api_broker/controller/PayLog.php
View file @
eb7f5609
...
...
@@ -16,6 +16,7 @@ use think\Request;
class
PayLog
extends
Basic
{
private
$service_
;
public
function
__construct
(
Request
$request
=
null
)
{
parent
::
__construct
(
$request
);
...
...
@@ -45,14 +46,24 @@ class PayLog extends Basic
}
public
function
adjustment
(){
/**
* 剩余可以调整或退款的钱
* @return \think\Response
*/
public
function
adjustment
()
{
$params
=
$this
->
params
;
$params
=
array
(
/*
$params = array(
"pay_id" => 1,
);
if
(
empty
(
$params
[
"pay_id"
])){
return
$this
->
response
(
"101"
,
"请求参数错误"
);
);*/
if
(
empty
(
$params
[
"pay_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$result
=
$this
->
service_
->
adjustment
(
$params
[
"pay_id"
]);
if
(
$result
==
-
1
)
{
return
$this
->
response
(
"101"
,
"不存在此条记录"
);
}
$this
->
service_
->
adjustment
(
$params
[
"pay_id"
]);
return
$this
->
response
(
"200"
,
"success"
,[
"residue_money"
=>
$result
]);
}
}
\ No newline at end of file
application/api_broker/service/PayLogService.php
View file @
eb7f5609
...
...
@@ -29,21 +29,27 @@ class PayLogService
return
$this
->
payLogModel
->
getBeforeBillInfo
(
$filed
,
[
"order_id"
=>
$order_id
]);
}
/**
* 计算可以分佣的金额
* @param $pay_id
* @return int
*/
public
function
adjustment
(
$pay_id
){
//todo 1.计算剩余金额 查询调整表 2.减去退款 3.减去转账
$filed
=
"
house_number,industry_type
"
;
$filed
=
"
id,money
"
;
$pay_log_arr
=
$this
->
payLogModel
->
getBeforeBillInfo
(
$filed
,
[
"id"
=>
$pay_id
]);
if
(
count
(
$pay_log_arr
)
<
0
){
return
[
"code"
=>
101
,
"msg"
=>
"不存在此条收款记录"
]
;
return
-
1
;
}
$pay_log_arr
=
$pay_log_arr
[
0
];
$where_
[
"paylog_id"
]
=
$pay_id
;
$where_
[
"is_del"
]
=
0
;
$adjustment_arr
=
$this
->
payLogAdjustmentModel
->
getAdjustmentList
(
$where_
,
"id,money"
);
if
(
count
(
$adjustment_arr
)
>
0
){
//调整
$adjustment_sum
=
$this
->
payLogAdjustmentModel
->
getAdjustmentSum
(
"money"
,
$where_
);
}
$residue_money
=
$pay_log_arr
[
"money"
]
-
$adjustment_sum
[
"money"
];
return
$residue_money
;
}
...
...
application/model/OPayLogAdjustment.php
View file @
eb7f5609
...
...
@@ -35,6 +35,17 @@ class OPayLogAdjustment extends Model{
->
select
();
}
public
function
getAdjustmentSum
(
$field
,
$params
)
{
$data
=
$this
->
db_
->
where
(
$params
)
->
sum
(
"money"
);
//echo $this->getLastSql();
return
$data
;
}
/**
* @param $field
* @param $params
...
...
application/route.php
View file @
eb7f5609
...
...
@@ -728,6 +728,7 @@ Route::group('broker', [
'editExclusive'
=>
[
'api_broker/Shop/editExclusive'
,
[
'method'
=>
'get|post'
]
],
'getBeForNum'
=>
[
'api_broker/PayLog/getBeForNum'
,
[
'method'
=>
'get|post'
]],
'adjustment'
=>
[
'api_broker/PayLog/adjustment'
,
[
'method'
=>
'get|post'
]],
]);
...
...
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