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
da1f08c1
Commit
da1f08c1
authored
Dec 25, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
退款申请
parent
9c61b943
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
39 deletions
+69
-39
PayLog.php
application/api_broker/controller/PayLog.php
+29
-3
PayLogService.php
application/api_broker/service/PayLogService.php
+31
-3
ORefundModel.php
application/model/ORefundModel.php
+8
-33
route.php
application/route.php
+1
-0
No files found.
application/api_broker/controller/PayLog.php
View file @
da1f08c1
...
@@ -122,13 +122,38 @@ class PayLog extends Basic
...
@@ -122,13 +122,38 @@ class PayLog extends Basic
$remark
=
isset
(
$params
[
"remark"
])
?
$params
[
"remark"
]
:
""
;
$remark
=
isset
(
$params
[
"remark"
])
?
$params
[
"remark"
]
:
""
;
$remark_img
=
isset
(
$params
[
"remark_img"
])
?
json_decode
(
$params
[
"remark_img"
],
true
)
:
""
;
$remark_img
=
isset
(
$params
[
"remark_img"
])
?
json_decode
(
$params
[
"remark_img"
],
true
)
:
""
;
//todo 判断此单是否有付款
//todo 判断此单是否有付款
$is_ok
=
$this
->
service_
->
addRefund
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$refund_money
,
$name
,
$is_ok
=
$this
->
service_
->
addRefund
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$refund_money
,
$name
,
$phone
,
$bank
,
$card_no
,
$receipt_number
,
$type
,
$refund_cause
,
$pay_log_id
,
$refund_way
,
$remark
,
$remark_img
);
$phone
,
$bank
,
$card_no
,
$receipt_number
,
$type
,
$refund_cause
,
$pay_log_id
,
$refund_way
,
$remark
,
$remark_img
);
if
(
$is_ok
>
0
)
{
if
(
$is_ok
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
[]);
return
$this
->
response
(
"200"
,
"request success"
,
[]);
}
elseif
(
$is_ok
==
-
2
)
{
}
elseif
(
$is_ok
==
-
2
)
{
return
$this
->
response
(
"101"
,
"退款金不能大于剩余的支付金额"
);
return
$this
->
response
(
"101"
,
"退款金不能大于剩余的支付金额"
);
}
}
return
$this
->
response
(
"101"
,
"request faild"
);
return
$this
->
response
(
"101"
,
"request faild"
);
}
}
/**
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getRefund
(){
$params
=
$this
->
params
;
/* $params = array(
"refund_id" =>1
);*/
if
(
!
isset
(
$params
[
"refund_id"
])){
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$result
=
$this
->
service_
->
getRefundDetail
(
$params
[
"refund_id"
]);
if
(
$result
[
"code"
]
==
200
){
return
$this
->
response
(
"200"
,
"success"
,
$result
[
"data"
]);
}
elseif
(
$result
[
"code"
]
==
101
){
return
$this
->
response
(
"101"
,
$result
[
"msg"
]);
}
}
}
}
\ No newline at end of file
application/api_broker/service/PayLogService.php
View file @
da1f08c1
...
@@ -18,11 +18,13 @@ class PayLogService
...
@@ -18,11 +18,13 @@ class PayLogService
{
{
private
$payLogModel
;
private
$payLogModel
;
private
$payLogAdjustmentModel
;
private
$payLogAdjustmentModel
;
private
$oRefundModel
;
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
payLogModel
=
new
OPayLogModel
();
$this
->
payLogAdjustmentModel
=
new
OPayLogAdjustment
();
$this
->
payLogAdjustmentModel
=
new
OPayLogAdjustment
();
$this
->
oRefundModel
=
new
ORefundModel
();
}
}
public
function
getBeForNum
(
$order_id
)
public
function
getBeForNum
(
$order_id
)
...
@@ -50,8 +52,12 @@ class PayLogService
...
@@ -50,8 +52,12 @@ class PayLogService
$where_
[
"is_del"
]
=
0
;
$where_
[
"is_del"
]
=
0
;
//调整
//调整
$adjustment_sum
=
$this
->
payLogAdjustmentModel
->
getAdjustmentSum
(
"money"
,
$where_
);
$adjustment_sum
=
$this
->
payLogAdjustmentModel
->
getAdjustmentSum
(
"money"
,
$where_
);
//减去退款
$refund_params
[
"pay_log_id"
]
=
$pay_id
;
$refund_params
[
"status"
]
=
array
(
"neq"
,
4
);
$refund_sum
=
$this
->
oRefundModel
->
getRefundSum
(
"refund_money"
,
$refund_params
);
$residue_money
=
$pay_log_arr
[
"money"
]
-
$adjustment_sum
;
$residue_money
=
$pay_log_arr
[
"money"
]
-
$adjustment_sum
-
$refund_sum
;
return
$residue_money
;
return
$residue_money
;
}
}
...
@@ -163,8 +169,7 @@ class PayLogService
...
@@ -163,8 +169,7 @@ class PayLogService
return
-
2
;
return
-
2
;
}
}
$oRefundModel
=
new
ORefundModel
();
$insert_id
=
$this
->
oRefundModel
->
addRefund
(
$this
->
refundBin
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$refund_money
,
$name
,
$insert_id
=
$oRefundModel
->
addRefund
(
$this
->
refundBin
(
$agent_id
,
$agent_name
,
$report_id
,
$order_id
,
$order_no
,
$refund_money
,
$name
,
$phone
,
$bank
,
$card_no
,
$receipt_number
,
$type
,
$refund_cause
,
$pay_log_id
,
$phone
,
$bank
,
$card_no
,
$receipt_number
,
$type
,
$refund_cause
,
$pay_log_id
,
$refund_way
,
$remark
)
$refund_way
,
$remark
)
);
);
...
@@ -221,4 +226,26 @@ class PayLogService
...
@@ -221,4 +226,26 @@ class PayLogService
}
}
/**
* @param $refund_id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getRefundDetail
(
$refund_id
)
{
$field
=
"id,report_id,agent_id,agent_name,order_no,order_id,refund_money,status,name,phone,bank,card_no,
remark,receipt_number,type,refund_cause,pay_log_id,refund_way"
;
$params
[
"id"
]
=
$refund_id
;
$params
[
"is_del"
]
=
0
;
$result
=
$this
->
oRefundModel
->
selectRefundByOrderNo
(
$field
,
$params
);
if
(
count
(
$result
)
>
0
)
{
return
[
"code"
=>
200
,
"data"
=>
$result
[
0
]];
}
else
{
return
[
"code"
=>
101
,
"msg"
=>
"没有找到此条退款数据"
];
}
}
}
}
\ No newline at end of file
application/model/ORefundModel.php
View file @
da1f08c1
...
@@ -212,12 +212,11 @@ class ORefundModel extends Model{
...
@@ -212,12 +212,11 @@ class ORefundModel extends Model{
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getCheckRefundList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
public
function
getCheckRefundList
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
return
$this
->
db_
->
alias
(
'a'
)
return
Db
::
table
(
$this
->
table
)
->
alias
(
'a'
)
->
field
(
$field
)
->
field
(
$field
)
->
join
(
'o_order b'
,
'a.order_id = b.id'
,
'left'
)
->
join
(
'o_report b'
,
'a.report_id = b.id'
,
'left'
)
->
join
(
'a_agents c'
,
'a.agent_id = c.id'
,
'left'
)
->
join
(
'o_financial_audit c'
,
'a.order_id=c.order_id'
,
'left'
)
->
join
(
'o_paylog d'
,
'a.pay_log_id = d.id'
,
'left'
)
->
where
(
$params
)
->
limit
(
$pageSize
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
page
(
$pageNo
)
->
order
(
$order_
)
->
order
(
$order_
)
...
@@ -231,33 +230,10 @@ class ORefundModel extends Model{
...
@@ -231,33 +230,10 @@ class ORefundModel extends Model{
* @return int|string
* @return int|string
*/
*/
public
function
getCheckRefundListTotal
(
$params
)
{
public
function
getCheckRefundListTotal
(
$params
)
{
return
$this
->
db_
->
alias
(
'a'
)
return
Db
::
table
(
$this
->
table
)
->
join
(
'o_order b'
,
'a.order_id = b.id'
,
'left'
)
->
alias
(
'a'
)
->
join
(
'a_agents c'
,
'a.agent_id = c.id'
,
'left'
)
->
join
(
'o_report b'
,
'a.report_id = b.id'
,
'left'
)
->
join
(
'o_paylog d'
,
'a.pay_log_id = d.id'
,
'left'
)
->
join
(
'o_financial_audit c'
,
'a.order_id=c.order_id'
,
'left'
)
->
where
(
$params
)
->
count
();
->
count
();
}
}
/**
* @param $params
* @return float|int
*/
public
function
getSumMoney
(
$params
)
{
return
$this
->
db_
->
alias
(
'a'
)
->
join
(
'o_order b'
,
'a.order_id = b.id'
,
'left'
)
->
join
(
'a_agents c'
,
'a.agent_id = c.id'
,
'left'
)
->
join
(
'o_paylog d'
,
'a.pay_log_id = d.id'
,
'left'
)
->
where
(
$params
)
->
sum
(
'a.refund_money'
);
}
/**
* @param $data
* @param $where
* @return ORefundModel
*/
public
function
updateData
(
$data
,
$where
)
{
return
$this
->
where
(
$where
)
->
update
(
$data
);
}
}
}
\ No newline at end of file
application/route.php
View file @
da1f08c1
...
@@ -563,6 +563,7 @@ Route::group('broker', [
...
@@ -563,6 +563,7 @@ Route::group('broker', [
'collectingBill'
=>
[
'api_broker/OrderLog/collectingBill'
,
[
'method'
=>
'get|post'
]],
'collectingBill'
=>
[
'api_broker/OrderLog/collectingBill'
,
[
'method'
=>
'get|post'
]],
'collectingBillV2'
=>
[
'api_broker/OrderLog/collectingBillV2'
,
[
'method'
=>
'get|post'
]],
'collectingBillV2'
=>
[
'api_broker/OrderLog/collectingBillV2'
,
[
'method'
=>
'get|post'
]],
'refund'
=>
[
'api_broker/PayLog/refund'
,
[
'method'
=>
'get|post'
]],
'refund'
=>
[
'api_broker/PayLog/refund'
,
[
'method'
=>
'get|post'
]],
'getRefund'
=>
[
'api_broker/PayLog/getRefund'
,
[
'method'
=>
'get|post'
]],
'bargain'
=>
[
'api_broker/OrderLog/bargain'
,
[
'method'
=>
'get|post'
]],
'bargain'
=>
[
'api_broker/OrderLog/bargain'
,
[
'method'
=>
'get|post'
]],
'statusBargain'
=>
[
'api_broker/OrderLog/statusBargain'
,
[
'method'
=>
'get|post'
]],
'statusBargain'
=>
[
'api_broker/OrderLog/statusBargain'
,
[
'method'
=>
'get|post'
]],
'getIsAccountStatement'
=>
[
'api_broker/OrderLog/getIsAccountStatement'
,
[
'method'
=>
'get|post'
]],
'getIsAccountStatement'
=>
[
'api_broker/OrderLog/getIsAccountStatement'
,
[
'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