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
3c993191
authored
May 10, 2018
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
自营订单定时取消
parent
41a94eab
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
app/Http/Controllers/OrderController.php
app/Http/routes.php
app/Http/Controllers/OrderController.php
View file @
3c993191
...
@@ -1335,4 +1335,35 @@ Class OrderController extends Controller
...
@@ -1335,4 +1335,35 @@ Class OrderController extends Controller
}
}
}
}
// 自营订单到达48小时后自动取消订单
public
function
selfOrderCancel
()
{
$order
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
whereNotIn
(
'user_id'
,
$this
->
testMobile
())
->
where
(
'status'
,
'='
,
2
)
->
where
(
'order_goods_type'
,
'='
,
2
)
->
where
(
'is_type'
,
'='
,
0
)
->
select
(
'order_id'
,
'create_time'
)
->
orderBy
(
'create_time'
,
'DESC'
)
->
get
();
if
(
!
empty
(
$order
))
{
foreach
(
$order
as
$v
)
{
$limit_time
=
$v
->
create_time
+
2
*
86400
;
if
(
$limit_time
<=
time
())
{
$update
=
DB
::
connection
(
'order'
)
->
table
(
'lie_order'
)
->
where
(
'order_id'
,
'='
,
$v
->
order_id
)
->
update
([
'status'
=>
-
1
,
'cancel_time'
=>
time
()]);
if
(
$update
)
{
continue
;
}
}
}
}
}
}
}
\ No newline at end of file
app/Http/routes.php
View file @
3c993191
...
@@ -65,5 +65,6 @@ Route::group(['middleware' => 'web'], function () {
...
@@ -65,5 +65,6 @@ Route::group(['middleware' => 'web'], function () {
Route
::
group
([
'middleware'
=>
'api'
],
function
()
{
Route
::
group
([
'middleware'
=>
'api'
],
function
()
{
Route
::
get
(
'/api/check/sendsms'
,
'OrderController@checkOrderSendSms'
);
Route
::
get
(
'/api/check/sendsms'
,
'OrderController@checkOrderSendSms'
);
Route
::
get
(
'/api/check/cancelorder'
,
'OrderController@checkOrderCancel'
);
Route
::
get
(
'/api/check/cancelorder'
,
'OrderController@checkOrderCancel'
);
Route
::
get
(
'/api/check/cancelselforder'
,
'OrderController@selfOrderCancel'
);
});
});
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