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
dffc788e
Commit
dffc788e
authored
Dec 25, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
退款审核
parent
e51ea860
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
122 additions
and
0 deletions
+122
-0
Finance.php
application/index/controller/Finance.php
+65
-0
ORefundLogModel.php
application/model/ORefundLogModel.php
+33
-0
ORefundModel.php
application/model/ORefundModel.php
+23
-0
route.php
application/route.php
+1
-0
No files found.
application/index/controller/Finance.php
View file @
dffc788e
...
...
@@ -26,6 +26,7 @@ use app\model\OMarchInModel;
use
app\model\OPayLogAdjustment
;
use
app\model\OrderModel
;
use
app\model\ORealIncome
;
use
app\model\ORefundLogModel
;
use
app\model\OReportModel
;
use
app\model\OTaxes
;
use
app\model\OFinancialAudit
;
...
...
@@ -3555,4 +3556,68 @@ class Finance extends Basic
}
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
checkRefund
()
{
$code
=
101
;
$msg
=
''
;
if
(
empty
(
$this
->
params
[
'refund_id'
])
||
empty
(
$this
->
params
[
'status'
]))
{
return
$this
->
response
(
$code
,
'参数错误'
);
}
$m_refund
=
new
ORefundModel
();
$refund_where
[
'id'
]
=
$this
->
params
[
'refund_id'
];
$refund_where
[
'status'
]
=
[
'in'
,
'0,1,4'
];
// 0申请 1审核中 2退款成功 3已审核4驳回
$refund_where
[
'is_del'
]
=
0
;
$refund_data
=
$m_refund
->
selectRefundByOrderNo
(
'id,status'
,
$refund_where
);
if
(
empty
(
$refund_data
[
0
][
'id'
]))
{
return
$this
->
response
(
$code
,
'没有该退款详情'
);
}
if
((
$refund_data
[
0
][
'status'
]
==
4
)
&&
(
$this
->
params
[
'status'
]
==
4
))
{
return
$this
->
response
(
$code
,
'该退款已驳回'
);
}
$m_refund_log
=
new
ORefundLogModel
();
$save_data
[
'refund_id'
]
=
$this
->
params
[
'refund_id'
];
$save_data
[
'remark'
]
=
trim
(
$this
->
params
[
'remark'
]);
$save_data
[
'operation_id'
]
=
$this
->
userId
;
$save_data
[
'operation_name'
]
=
$this
->
userName
;
if
(
$this
->
params
[
'status'
]
==
1
)
{
$log_where
[
'refund_id'
]
=
$this
->
params
[
'refund_id'
];
$log_where
[
'status'
]
=
1
;
$log_where
[
'is_del'
]
=
0
;
$check_num
=
$m_refund_log
->
getTotal
(
$log_where
);
if
(
$check_num
<
3
)
{
$save_data
[
'status'
]
=
1
;
//审核中
}
else
{
$save_data
[
'status'
]
=
3
;
//已审核
}
$num
=
$m_refund_log
->
insertData
(
$save_data
);
}
else
{
$m_refund_log
->
updateData
([
'is_del'
=>
1
],
[
'refund_id'
=>
$this
->
params
[
'refund_id'
],
'status'
=>
1
]);
$save_data
[
'status'
]
=
4
;
//驳回
$num
=
$m_refund_log
->
insertData
(
$save_data
);
}
if
(
$num
)
{
if
(
$refund_data
[
0
][
'status'
]
!=
$save_data
[
'status'
])
{
$m_refund
->
updateData
([
'id'
=>
$this
->
params
[
'refund_id'
],
'status'
=>
$save_data
[
'status'
]]);
}
$code
=
200
;
}
else
{
$msg
=
'审核失败'
;
}
return
$this
->
response
(
$code
,
$msg
);
}
}
application/model/ORefundLogModel.php
0 → 100644
View file @
dffc788e
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2018/12/25
* Time: 13:54
*/
namespace
app\model
;
use
think\Db
;
class
ORefundLogModel
extends
BaseModel
{
protected
$table
=
"o_refund_log"
;
private
$db_
;
public
function
__construct
(
$data
=
[])
{
parent
::
__construct
(
$data
);
$this
->
db_
=
Db
::
name
(
$this
->
table
);
}
public
function
insertData
(
$data
)
{
return
$this
->
db_
->
insert
(
$data
);
}
public
function
updateData
(
$data
,
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
update
(
$data
);
}
}
\ No newline at end of file
application/model/ORefundModel.php
View file @
dffc788e
...
...
@@ -102,6 +102,15 @@ class ORefundModel extends Model{
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"id"
]))
{
$where_
[
"id"
]
=
$params
[
"id"
];
}
if
(
isset
(
$params
[
"is_del"
]))
{
$where_
[
"is_del"
]
=
$params
[
"is_del"
];
}
if
(
isset
(
$params
[
"status"
]))
{
$where_
[
"status"
]
=
$params
[
"status"
];
}
return
$this
->
db_
->
field
(
$filed
)
...
...
@@ -230,6 +239,10 @@ class ORefundModel extends Model{
->
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'
)
...
...
@@ -238,4 +251,13 @@ class ORefundModel extends Model{
->
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 @
dffc788e
...
...
@@ -280,6 +280,7 @@ Route::group('index', [
'getPayLogTotalPrice'
=>
[
'index/Finance/getPayLogTotalPrice'
,
[
'method'
=>
'get'
]],
//佣金统计
'delPayLog'
=>
[
'index/Finance/delPayLog'
,
[
'method'
=>
'POST'
]],
//删除收款
'refundPayLog'
=>
[
'index/Finance/refundPayLog'
,
[
'method'
=>
'POST'
]],
//退款
'checkRefund'
=>
[
'index/Finance/checkRefund'
,
[
'method'
=>
'POST'
]],
//退款审核
'performanceInfo'
=>
[
'index/PerformanceInfo/performanceInfo'
,
[
'method'
=>
'post|get'
]],
//业绩明细
'getPerformanceInfoExcel'
=>
[
'index/PerformanceInfo/getPerformanceInfoExcel'
,
[
'method'
=>
'post|get'
]],
//业绩明细
...
...
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