Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
92c08160
authored
Jul 27, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整线下支付记录
parent
4b5f0628
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
9 deletions
app/Http/Controllers/CronController.php
app/Http/Controllers/CronController.php
View file @
92c08160
...
...
@@ -35,14 +35,23 @@ class CronController extends Controller
$OrderRefundModel
=
new
OrderRefundModel
();
$OrderReturnModel
=
new
OrderReturnModel
();
// // 查询联营、自营线上支付记录
// $pay_log_list = $PayLogModel->getPayLog($start_time, $end_time);
// $pay_log_amount = $this->countByCurrency($pay_log_list); // 统计金额
// // 联营线下支付记录
// $joint_offline_list = $ErpPayLogModel->getErpPayLog($start_time, $end_time);
// $joint_offline = $this->filterData($joint_offline_list); // 过滤数据
// $joint_offline_amount = $this->countByCurrency($joint_offline, 'receipt_amount'); // 统计金额
// 查询联营、自营线上支付记录
$pay_log_list
=
$PayLogModel
->
getPayLog
(
$start_time
,
$end_time
);
$pay_log_amount
=
$this
->
countByCurrency
(
$pay_log_list
);
// 统计金额
$pay_log
=
$this
->
filterData
(
$pay_log_list
);
// 过滤数据
$pay_log_amount
=
$this
->
countByCurrency
(
$pay_log
);
// 统计金额
// 联营线下支付记录
$joint_offline_list
=
$ErpPayLogModel
->
getErpPayLog
(
$start_time
,
$end_time
);
$joint_offline
=
$this
->
filterData
(
$joint_offline_list
);
// 过滤数据
$joint_offline_amount
=
$this
->
countByCurrency
(
$joint_offline
,
'receipt_amount'
);
// 统计金额
$joint_offline_amount
=
$this
->
countByCurrency
(
$joint_offline_list
,
'receipt_amount'
);
// 统计金额
// 自营账期支付记录
$self_accounts_list
=
$RemovalModel
->
getSelfAccounts
(
$start_time
,
$end_time
);
...
...
@@ -87,9 +96,9 @@ class CronController extends Controller
if
(
$self_return_amount
)
{
foreach
(
$self_return_amount
as
$self
)
{
if
(
$self
[
'currency'
]
==
1
)
{
$data
[
'rmb_amount'
]
=
$data
[
'rmb_amount'
]
-
$
joint
[
'return_amount'
];
$data
[
'rmb_amount'
]
=
$data
[
'rmb_amount'
]
-
$
self
[
'return_amount'
];
}
else
{
$data
[
'usd_amount'
]
=
$data
[
'usd_amount'
]
-
$
joint
[
'return_amount'
];
$data
[
'usd_amount'
]
=
$data
[
'usd_amount'
]
-
$
self
[
'return_amount'
];
}
}
}
...
...
@@ -119,13 +128,13 @@ class CronController extends Controller
{
if
(
!
$data
)
return
false
;
$
PayLogModel
=
new
PayLogModel
();
$
ErpPayLogModel
=
new
Erp
PayLogModel
();
foreach
(
$data
as
$k
=>
$v
)
{
$
pay_log
=
$PayLogModel
->
where
([
'order_id'
=>
$v
[
'order_id'
]])
->
select
(
'pay_
log_id'
)
->
first
();
$
erp_pay_log
=
$ErpPayLogModel
->
where
([
'order_id'
=>
$v
[
'order_id'
]])
->
select
(
'
log_id'
)
->
first
();
//
若pay_log表里已存在订单支付记录,则说明该订单已收款完成,
需要清除
if
(
$pay_log
)
{
//
以ERP推送过来的收款金额为准,若erp_pay_log表里已存在支付记录,则pay_log
需要清除
if
(
$
erp_
pay_log
)
{
unset
(
$data
[
$k
]);
continue
;
}
...
...
@@ -134,6 +143,26 @@ class CronController extends Controller
return
$data
;
}
// // 过滤联营线下支付数据
// public function filterData($data)
// {
// if (!$data) return false;
// $PayLogModel = new PayLogModel();
// foreach ($data as $k=>$v) {
// $pay_log = $PayLogModel->where(['order_id'=>$v['order_id']])->select('pay_log_id')->first();
// // 若pay_log表里已存在订单支付记录,则说明该订单已收款完成,需要清除
// if ($pay_log) {
// unset($data[$k]);
// continue;
// }
// }
// return $data;
// }
// 根据币种统计用户金额
public
function
countByCurrency
(
$data
,
$field
=
'pay_amount'
)
{
...
...
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