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
261b27b8
authored
Jul 24, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://119.23.72.7/zhujilai/Order
into zjl_iteration_20190723
parents
f725ddbe
71d10771
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
11 deletions
app/Http/Controllers/CronController.php
app/Http/Controllers/SpecialController.php
app/Http/routes.php
app/Model/PayLogModel.php
config/params.php
app/Http/Controllers/CronController.php
View file @
261b27b8
...
@@ -18,11 +18,10 @@ class CronController extends Controller
...
@@ -18,11 +18,10 @@ class CronController extends Controller
// 统计 2019-8-5 到 2019-10-31 期间的用户总额 定时任务下午6点 (0 18 * * * /usr/bin/curl http://order.ichunt.net/act/useramoumt)
// 统计 2019-8-5 到 2019-10-31 期间的用户总额 定时任务下午6点 (0 18 * * * /usr/bin/curl http://order.ichunt.net/act/useramoumt)
public
function
userAmount
()
public
function
userAmount
()
{
{
// $start_time = strtotime('2019-8-5');
$time
=
Config
(
'params.lx_activity_time'
);
// $end_time = strtotime('2019-10-31 23:59:59');
$start_time
=
strtotime
(
'2018-8-5'
);
$start_time
=
strtotime
(
$time
[
'start_time'
]
);
$end_time
=
strtotime
(
'2018-10-31 23:59:59'
);
$end_time
=
strtotime
(
$time
[
'end_time'
]
);
$PayLogModel
=
new
PayLogModel
();
$PayLogModel
=
new
PayLogModel
();
$ErpPayLogModel
=
new
ErpPayLogModel
();
$ErpPayLogModel
=
new
ErpPayLogModel
();
...
@@ -34,8 +33,8 @@ class CronController extends Controller
...
@@ -34,8 +33,8 @@ class CronController extends Controller
// 查询联营、自营线上支付记录
// 查询联营、自营线上支付记录
$pay_log_list
=
$PayLogModel
->
getPayLog
(
$start_time
,
$end_time
);
$pay_log_list
=
$PayLogModel
->
getPayLog
(
$start_time
,
$end_time
);
$pay_log
=
$this
->
filterFake
(
$pay_log_list
);
// 过滤数据
//
$pay_log = $this->filterFake($pay_log_list); // 过滤数据
$pay_log_amount
=
$this
->
countByCurrency
(
$pay_log
);
// 统计金额
$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
);
...
@@ -63,7 +62,7 @@ class CronController extends Controller
...
@@ -63,7 +62,7 @@ class CronController extends Controller
$user
=
$UserMainModel
->
getUserAccount
(
$k
);
// 获取用户账号
$user
=
$UserMainModel
->
getUserAccount
(
$k
);
// 获取用户账号
if
(
$user
)
{
if
(
$user
)
{
$data
[
'account'
]
=
isset
(
$user
[
'mobile'
])
?
$user
[
'mobile'
]
:
$user
[
'email'
];
$data
[
'account'
]
=
$user
[
'mobile'
]
?
$user
[
'mobile'
]
:
$user
[
'email'
];
}
}
$data
[
'rmb_amount'
]
=
isset
(
$v
[
'rmb'
])
?
$v
[
'rmb'
]
:
0
;
$data
[
'rmb_amount'
]
=
isset
(
$v
[
'rmb'
])
?
$v
[
'rmb'
]
:
0
;
...
@@ -199,4 +198,14 @@ class CronController extends Controller
...
@@ -199,4 +198,14 @@ class CronController extends Controller
return
isset
(
$temp
[
'data'
])
?
$temp
[
'data'
]
:
6.9
;
return
isset
(
$temp
[
'data'
])
?
$temp
[
'data'
]
:
6.9
;
}
}
// 清除用户表数据和缓存数据
public
function
clearData
()
{
$UserAmountModel
=
new
UserAmountModel
();
$RedisModel
=
new
RedisModel
();
$UserAmountModel
->
truncate
();
// 清空数据
$RedisModel
->
set
(
'api_lx_activity_user_rank'
,
null
);
}
}
}
\ No newline at end of file
app/Http/Controllers/SpecialController.php
View file @
261b27b8
...
@@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
...
@@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
use
App\Model\OrderModel
;
use
App\Model\OrderModel
;
use
App\Model\UserMainModel
;
use
App\Model\UserMainModel
;
use
App\Model\OrderActionLogModel
;
use
App\Model\OrderActionLogModel
;
use
App\Model\PayLogModel
;
use
DB
;
use
DB
;
use
Excel
;
use
Excel
;
use
Log
;
use
Log
;
...
@@ -202,4 +203,34 @@ class SpecialController extends Controller
...
@@ -202,4 +203,34 @@ class SpecialController extends Controller
return
$user
->
userId
;
return
$user
->
userId
;
}
}
// 处理支付记录
public
function
handlePayLog
()
{
$PayLogModel
=
new
PayLogModel
();
$pay_log
=
$PayLogModel
->
where
(
'pay_type'
,
4
)
->
where
(
'is_paid'
,
-
1
)
->
orderBy
(
'create_time'
,
'desc'
)
->
get
()
->
toArray
();
$data
=
[];
foreach
(
$pay_log
as
$k
=>
$v
)
{
$log
=
$PayLogModel
->
where
(
'order_id'
,
$v
[
'order_id'
])
->
where
(
'pay_type'
,
1
)
->
first
();
if
(
!
$log
)
continue
;
// dump($log['order_id'].'==='.date('Y-m-d H:i:s', $log['create_time']).'==='.date('Y-m-d H:i:s', $log['pay_time']));
// $PayLogModel->where('pay_log_id', $v['pay_log_id'])->update(['is_paid'=>1, 'pay_time'=>$log['pay_time']]); // 更新账期支付
// $PayLogModel->where('pay_log_id', $log['pay_log_id'])->delete();
// // 记录到日志
// $monolog = Log::getMonolog();
// $monolog->popHandler();
// Log::useDailyFiles(storage_path('logs/update_pay_log.log'));
// Log::info('更新账期支付记录ID:'.$v['pay_log_id'].',删除的支付记录ID:'.$log['pay_log_id']);
$data
[]
=
$log
[
'pay_log_id'
];
}
dd
(
$data
);
}
}
}
\ No newline at end of file
app/Http/routes.php
View file @
261b27b8
...
@@ -143,5 +143,7 @@ Route::group(['middleware' => 'api'], function () {
...
@@ -143,5 +143,7 @@ Route::group(['middleware' => 'api'], function () {
Route
::
get
(
'/api/check/exportdimission'
,
'SpecialController@exportDimission'
);
Route
::
get
(
'/api/check/exportdimission'
,
'SpecialController@exportDimission'
);
Route
::
match
([
'get'
,
'post'
],
'/api/check/importdimission'
,
'SpecialController@importDimission'
);
Route
::
match
([
'get'
,
'post'
],
'/api/check/importdimission'
,
'SpecialController@importDimission'
);
Route
::
get
(
'/act/useramoumt'
,
'CronController@userAmount'
);
// 活动统计用户实付金额
Route
::
get
(
'/act/useramoumt'
,
'CronController@userAmount'
);
// 活动统计用户实付金额
Route
::
get
(
'/act/clear'
,
'CronController@clearData'
);
// 清除活动统计用户表和缓存
Route
::
get
(
'/handle/paylog'
,
'SpecialController@handlePayLog'
);
// 处理支付记录
});
});
app/Model/PayLogModel.php
View file @
261b27b8
...
@@ -16,12 +16,15 @@ class PayLogModel extends Model
...
@@ -16,12 +16,15 @@ class PayLogModel extends Model
// 获取联营、自营线上支付记录
// 获取联营、自营线上支付记录
public
function
getPayLog
(
$start_time
,
$end_time
)
public
function
getPayLog
(
$start_time
,
$end_time
)
{
{
$field
=
[
'pay_log_id'
,
'order_id'
,
'order_sn'
,
'user_id'
,
'pay_type'
,
'is_paid'
,
'pay_amount'
,
'pay_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
->
where
(
'is_paid'
,
1
)
$data
=
$this
->
from
(
'lie_pay_log as p'
)
->
whereBetween
(
'pay_time'
,
[
$start_time
,
$end_time
])
->
leftJoin
(
'lie_order as o'
,
'p.order_id'
,
'='
,
'o.order_id'
)
->
where
(
'p.is_paid'
,
1
)
->
whereBetween
(
'p.pay_time'
,
[
$start_time
,
$end_time
])
->
where
(
'o.is_type'
,
0
)
->
select
(
$field
)
->
select
(
$field
)
// ->select('user_id', DB::raw('sum(pay_amount) as pay_amount'))
// ->select('user_id', DB::raw('sum(pay_amount) as pay_amount'))
->
orderBy
(
'pay_time'
,
'desc'
)
->
orderBy
(
'p
.p
ay_time'
,
'desc'
)
// ->groupBy('user_id')
// ->groupBy('user_id')
->
get
()
->
get
()
->
toArray
();
->
toArray
();
...
...
config/params.php
View file @
261b27b8
...
@@ -86,4 +86,12 @@
...
@@ -86,4 +86,12 @@
7
=>
'待收货'
,
7
=>
'待收货'
,
10
=>
'已完成'
,
10
=>
'已完成'
,
],
],
// 猎芯活动用户金额统计时间
'lx_activity_time'
=>
[
'start_time'
=>
'2018-10-1'
,
'end_time'
=>
'2018-10-31 23:59:59'
,
],
];
];
\ No newline at end of file
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