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
4b5f0628
authored
Jul 27, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1.过滤测试账号;
2.添加钉钉通知;
parent
1fc20662
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
40 deletions
app/Http/Controllers/CronController.php
app/Http/routes.php
app/Model/PayLogModel.php
app/Model/RemovalModel.php
app/Http/Controllers/CronController.php
View file @
4b5f0628
...
...
@@ -14,6 +14,7 @@ use App\Model\UserAmountModel;
use
App\Model\RedisModel
;
use
App\Model\OrderRefundModel
;
use
App\Model\OrderReturnModel
;
use
MonitorDing
;
class
CronController
extends
Controller
{
...
...
@@ -35,22 +36,17 @@ class CronController extends Controller
$OrderReturnModel
=
new
OrderReturnModel
();
// 查询联营、自营线上支付记录
$pay_log_list
=
$PayLogModel
->
getPayLog
(
$start_time
,
$end_time
);
// $pay_log = $this->filterFake($pay_log_list); // 过滤数据
$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_list
=
$ErpPayLogModel
->
getErpPayLog
(
$start_time
,
$end_time
);
$joint_offline
=
$this
->
filterData
(
$joint_offline_list
);
// 过滤数据
$joint_offline_amount
=
$this
->
countByCurrency
(
$joint_offline
,
'receipt_amount'
);
// 统计金额
// 自营账期支付记录
$self_accounts_list
=
$RemovalModel
->
getSelfAccounts
(
$start_time
,
$end_time
);
$self_accounts
=
$this
->
filterFake
(
$self_accounts_list
);
// 过滤数据
$self_accounts_amount
=
$this
->
countByCurrency
(
$self_accounts
,
'checkout_paid_amount'
);
// 统计金额
$self_accounts_list
=
$RemovalModel
->
getSelfAccounts
(
$start_time
,
$end_time
);
$self_accounts_amount
=
$this
->
countByCurrency
(
$self_accounts_list
,
'checkout_paid_amount'
);
// 统计金额
$resp
=
[];
...
...
@@ -98,13 +94,13 @@ class CronController extends Controller
}
}
$data
[
'cur_rate'
]
=
$cur_rate
;
$data
[
'amount'
]
=
$data
[
'rmb_amount'
]
+
$data
[
'usd_amount'
]
*
$data
[
'cur_rate'
];
$data
[
'cur_rate'
]
=
$cur_rate
;
$data
[
'amount'
]
=
$data
[
'rmb_amount'
]
+
$data
[
'usd_amount'
]
*
$data
[
'cur_rate'
];
$res
=
$UserAmountModel
->
updateOrCreate
([
'user_id'
=>
$k
],
$data
);
if
(
$res
===
false
)
{
MonitorDing
::
sendText
(
'活动用户汇总表---新增或更新失败,用户ID:'
.
$k
);
echo
'新增或更新失败,用户ID:'
.
$k
;
die
;
}
}
...
...
@@ -114,30 +110,10 @@ class CronController extends Controller
$rank
=
$UserAmountModel
->
getUserAmount
();
$RedisModel
->
set
(
'api_lx_activity_user_rank'
,
json_encode
(
$rank
));
MonitorDing
::
sendText
(
date
(
'Y-m-d'
)
.
'活动用户排行榜:'
.
json_encode
(
$rank
));
return
$RedisModel
->
get
(
'api_lx_activity_user_rank'
);
}
// 过滤尽调数据、添加币种
public
function
filterFake
(
$data
)
{
if
(
!
$data
)
return
false
;
$OrderModel
=
new
OrderModel
();
foreach
(
$data
as
$k
=>&
$v
)
{
$order
=
$OrderModel
->
where
([
'order_id'
=>
$v
[
'order_id'
]])
->
select
(
'order_id'
,
'user_id'
,
'currency'
,
'is_type'
)
->
first
();
if
(
$order
[
'is_type'
])
{
unset
(
$data
[
$k
]);
continue
;
}
$v
[
'currency'
]
=
$order
[
'currency'
];
}
return
$data
;
}
// 过滤联营线下支付数据
public
function
filterData
(
$data
)
{
...
...
app/Http/routes.php
View file @
4b5f0628
...
...
@@ -142,7 +142,7 @@ Route::group(['middleware' => 'api'], function () {
Route
::
get
(
'/api/check/changeprice'
,
'SpecialController@changeOrderPrice'
);
Route
::
get
(
'/api/check/exportdimission'
,
'SpecialController@exportDimission'
);
Route
::
match
([
'get'
,
'post'
],
'/api/check/importdimission'
,
'SpecialController@importDimission'
);
Route
::
get
(
'/act/useramou
m
t'
,
'CronController@userAmount'
);
// 活动统计用户实付金额
Route
::
get
(
'/act/useramou
n
t'
,
'CronController@userAmount'
);
// 活动统计用户实付金额
Route
::
get
(
'/act/clear'
,
'CronController@clearData'
);
// 清除活动统计用户表和缓存
Route
::
get
(
'/handle/paylog'
,
'SpecialController@handlePayLog'
);
// 处理支付记录
});
...
...
app/Model/PayLogModel.php
View file @
4b5f0628
...
...
@@ -13,16 +13,18 @@ class PayLogModel extends Model
protected
$primaryKey
=
'pay_log_id'
;
public
$timestamps
=
false
;
// 获取联营、自营线上支付记录
// 获取联营、自营线上支付记录
(过滤尽调订单、测试账号)
public
function
getPayLog
(
$start_time
,
$end_time
)
{
$field
=
[
'p.pay_log_id'
,
'p.order_id'
,
'p.order_sn'
,
'p.user_id'
,
'p.pay_type'
,
'p.is_paid'
,
'p.pay_amount'
,
'p.pay_time'
,
'o.currency'
];
$data
=
$this
->
from
(
'lie_pay_log as p'
)
->
leftJoin
(
'lie_order as o'
,
'p.order_id'
,
'='
,
'o.order_id'
)
->
leftJoin
(
'lie_user_main as u'
,
'p.user_id'
,
'='
,
'u.user_id'
)
->
where
(
'p.is_paid'
,
1
)
->
whereBetween
(
'p.pay_time'
,
[
$start_time
,
$end_time
])
->
where
(
'o.status'
,
'>'
,
2
)
->
where
(
'o.is_type'
,
0
)
->
where
(
'u.is_test'
,
0
)
->
select
(
$field
)
// ->select('user_id', DB::raw('sum(pay_amount) as pay_amount'))
->
orderBy
(
'p.pay_time'
,
'desc'
)
...
...
app/Model/RemovalModel.php
View file @
4b5f0628
...
...
@@ -13,14 +13,17 @@ class RemovalModel extends Model
protected
$primaryKey
=
'removal_id'
;
public
$timestamps
=
false
;
// 自营账期支付记录
// 自营账期支付记录
(过滤尽调订单、测试账号)
public
function
getSelfAccounts
(
$start_time
,
$end_time
)
{
$field
=
[
'removal_id'
,
'order_id'
,
'order_sn'
,
'user_id'
,
'checkout_paid'
,
'checkout_paid_time'
,
'checkout_paid_amount'
];
$data
=
$this
->
where
(
'checkout_paid'
,
1
)
->
whereBetween
(
'checkout_paid_time'
,
[
$start_time
,
$end_time
])
$field
=
[
'r.removal_id'
,
'r.order_id'
,
'r.order_sn'
,
'r.user_id'
,
'r.checkout_paid'
,
'r.checkout_paid_time'
,
'r.checkout_paid_amount'
,
'o.currency'
];
$data
=
$this
->
from
(
'lie_removal as r'
)
->
leftJoin
(
'lie_order as o'
,
'r.order_id'
,
'='
,
'o.order_id'
)
->
leftJoin
(
'lie_user_main as u'
,
'r.user_id'
,
'='
,
'u.user_id'
)
->
where
(
'r.checkout_paid'
,
1
)
->
whereBetween
(
'r.checkout_paid_time'
,
[
$start_time
,
$end_time
])
->
select
(
$field
)
->
orderBy
(
'
checkout_paid_time'
,
'desc'
)
->
orderBy
(
'
r.checkout_paid_time'
,
'desc'
)
->
get
()
->
toArray
();
...
...
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