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
7feacaf9
Commit
7feacaf9
authored
Dec 25, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑退款
parent
78d145d5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
109 additions
and
16 deletions
+109
-16
PayLog.php
application/api_broker/controller/PayLog.php
+5
-3
PayLogService.php
application/api_broker/service/PayLogService.php
+68
-13
OImg.php
application/model/OImg.php
+18
-0
ORefundModel.php
application/model/ORefundModel.php
+18
-0
No files found.
application/api_broker/controller/PayLog.php
View file @
7feacaf9
...
...
@@ -68,7 +68,7 @@ class PayLog extends Basic
}
/**
* 新增退款申请
* 新增
或编辑
退款申请
* @return \think\Response
* @throws \think\Exception
*/
...
...
@@ -103,7 +103,7 @@ class PayLog extends Basic
"pay_log_id" => 1, //支付id
"refund_way" => 0, //退款方式:0银行卡
);*/
$refund_id
=
isset
(
$params
[
"refund_id"
])
?
$params
[
"refund_id"
]
:
0
;
$agent_id
=
$params
[
"agent_id"
];
$agent_name
=
$params
[
"agent_name"
];
$report_id
=
$params
[
"report_id"
];
...
...
@@ -121,9 +121,11 @@ class PayLog extends Basic
$refund_way
=
$params
[
"refund_way"
];
$remark
=
isset
(
$params
[
"remark"
])
?
$params
[
"remark"
]
:
""
;
$remark_img
=
isset
(
$params
[
"remark_img"
])
?
json_decode
(
$params
[
"remark_img"
],
true
)
:
""
;
$del_img
=
isset
(
$params
[
"del_img"
])
?
$params
[
"del_img"
]
:
null
;
//todo 判断此单是否有付款
$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
,
$refund_id
,
$del_img
);
if
(
$is_ok
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
[]);
}
elseif
(
$is_ok
==
-
2
)
{
...
...
application/api_broker/service/PayLogService.php
View file @
7feacaf9
...
...
@@ -159,7 +159,7 @@ class PayLogService
*/
public
function
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
)
$refund_way
,
$remark
,
$remark_img
,
$refund_id
,
$del_img
)
{
//验证金额是否合法
...
...
@@ -168,14 +168,22 @@ class PayLogService
if
(
$residue_money
<
$refund_money
)
{
return
-
2
;
}
$insert_id
=
0
;
if
(
$refund_id
<=
0
)
{
$insert_id
=
$this
->
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
,
$refund_way
,
$remark
,
$refund_id
)
);
}
else
{
$insert_id
=
$this
->
oRefundModel
->
updateRefund
(
$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
,
$refund_way
,
$remark
,
$refund_id
)
);
}
$insert_id
=
$this
->
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
,
$refund_way
,
$remark
)
);
if
(
$insert_id
>
0
)
{
$oImgModel
=
new
OImg
();
$oImgModel
->
addImgAll
(
$insert_id
,
3
,
$remark_img
);
if
(
$insert_id
>
0
&&
$remark_img
)
{
$this
->
addOImg
(
$insert_id
,
3
,
$remark_img
);
if
(
$del_img
){
$this
->
delOImg
(
3
,
$del_img
);
}
}
return
$insert_id
;
}
...
...
@@ -201,17 +209,22 @@ class PayLogService
*/
private
function
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
,
$refund_way
,
$remark
)
$refund_way
,
$remark
,
$refund_id
)
{
if
(
$refund_id
>
0
){
//修改
$arr
[
"id"
]
=
$refund_id
;
}
else
{
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
}
$arr
[
"report_id"
]
=
$report_id
;
$arr
[
"agent_id"
]
=
$agent_id
;
$arr
[
"agent_name"
]
=
$agent_name
;
$arr
[
"order_no"
]
=
$order_no
;
$arr
[
"order_id"
]
=
$order_id
;
$arr
[
"refund_money"
]
=
$refund_money
;
$arr
[
"status"
]
=
0
;
$arr
[
"name"
]
=
$name
;
$arr
[
"phone"
]
=
$phone
;
$arr
[
"status"
]
=
0
;
$arr
[
"bank"
]
=
$bank
;
$arr
[
"card_no"
]
=
$card_no
;
$arr
[
"remark"
]
=
$remark
;
...
...
@@ -220,13 +233,52 @@ class PayLogService
$arr
[
"refund_cause"
]
=
$refund_cause
;
$arr
[
"pay_log_id"
]
=
$pay_log_id
;
$arr
[
"refund_way"
]
=
$refund_way
;
$arr
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$arr
[
"update_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
return
$arr
;
}
/**
* @param $id
* @param $type
* @param $transfer_img
* @throws \think\Exception
*/
private
function
addOImg
(
$id
,
$type
,
$transfer_img
)
{
$oImgModel
=
new
OImg
();
$oImgModel
->
addImgAll
(
$id
,
$type
,
$transfer_img
);
}
/**
* @param $id
* @param $img_type
* @return false|\PDOStatement|string|\think\Collection
*/
private
function
getOImg
(
$id
,
$img_type
)
{
//查询图片
$oImgModel
=
new
OImg
();
$params
[
"img_id"
]
=
$id
;
$params
[
"img_type"
]
=
$img_type
;
$img_arr
=
$oImgModel
->
getImgList
(
$params
);
return
$img_arr
;
}
/**
* @param $type
* @param $del_img
*/
private
function
delOImg
(
$type
,
$del_img
){
$oImgModel
=
new
OImg
();
$where_
[
"id"
]
=
array
(
"in"
,
$del_img
);
$where_
[
"img_type"
]
=
$type
;
$params
[
"img_status"
]
=
1
;
$oImgModel
->
updateImgs
(
$where_
,
$params
);
}
/**
* @param $refund_id
* @return array
...
...
@@ -238,11 +290,14 @@ class PayLogService
{
$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
[
"id"
]
=
$refund_id
;
$params
[
"is_del"
]
=
0
;
$result
=
$this
->
oRefundModel
->
selectRefundByOrderNo
(
$field
,
$params
);
if
(
count
(
$result
)
>
0
)
{
return
[
"code"
=>
200
,
"data"
=>
$result
[
0
]];
$item
=
$result
[
0
];
$item
[
"img_path"
]
=
CHAT_IMG_URL
;
$item
[
"img_arr"
]
=
$this
->
getOImg
(
$item
[
"id"
],
3
);
return
[
"code"
=>
200
,
"data"
=>
$item
];
}
else
{
return
[
"code"
=>
101
,
"msg"
=>
"没有找到此条退款数据"
];
}
...
...
application/model/OImg.php
View file @
7feacaf9
...
...
@@ -97,6 +97,24 @@ class OImg extends BaseModel
}
}
/**
* 批量删除
* @param $where
* @param $params
* @return int|string
*/
public
function
updateImgs
(
$where
,
$params
)
{
Db
::
startTrans
();
try
{
$id
=
$this
->
db_
->
where
(
$where
)
->
update
(
$params
);
Db
::
commit
();
return
$id
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
/**
* 根据id和类型获取图片
...
...
application/model/ORefundModel.php
View file @
7feacaf9
...
...
@@ -77,6 +77,24 @@ class ORefundModel extends Model{
}
}
/**
* @param $params
* @return int|string
*/
public
function
updateRefund
(
$params
){
$where_
[
"id"
]
=
$params
[
"id"
];
unset
(
$params
[
"id"
]);
Db
::
startTrans
();
try
{
$id
=
$this
->
db_
->
where
(
$where_
)
->
update
(
$params
);
Db
::
commit
();
return
$id
;
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
return
0
;
}
}
/**
* 查询退款记录
*
...
...
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