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
fa196856
Commit
fa196856
authored
Jan 10, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时任务
parent
698751d9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
6 deletions
+78
-6
Autoexec.php
application/index/controller/Autoexec.php
+42
-0
route.php
application/route.php
+5
-0
common.php
application/task/common.php
+1
-0
config.php
application/task/config.php
+6
-0
Exclusive.php
application/task/controller/Exclusive.php
+5
-6
task.php
public/task.php
+19
-0
No files found.
application/index/controller/Autoexec.php
0 → 100644
View file @
fa196856
<?php
/**
* Description of Autoexec
*
* @author : hujun
* @date : 2018-1-9 14:39:26
* @internal : 自动执行
*/
namespace
app\index\controller
;
use
app\model\HouseInfos
;
class
Autoexec
{
public
function
exclusiveExpirationTime
()
{
$house
=
new
HouseInfos
();
$house_data
=
$house
->
field
(
'id,room_num_left'
)
->
where
(
'exclusive_type'
,
1
)
->
where
(
'is_delete'
,
0
)
->
select
();
$insert
=
array
();
foreach
(
$house_data
as
$k
=>
$v
)
{
$insert
[
$k
][
'id'
]
=
$v
->
id
;
}
}
public
function
index
()
{
$house
=
new
HouseInfos
();
$house_data
=
$house
->
field
(
'id,room_num_left,exclusive_end'
)
->
where
(
'exclusive_type'
,
1
)
->
where
(
'is_delete'
,
0
)
->
select
();
if
(
$house_data
)
{
$insert
=
array
();
foreach
(
$house_data
as
$k
=>
$v
)
{
if
(
strtotime
(
$v
[
'exclusive_end'
]
.
'23:59:59'
)
>
time
())
{
continue
;
}
$insert
[
$k
][
'id'
]
=
$v
[
'id'
];
$insert
[
$k
][
'room_num_left'
]
=
0
;
}
$result
=
$house
->
saveAll
(
$insert
);
}
return
;
}
}
application/route.php
View file @
fa196856
...
...
@@ -136,4 +136,8 @@ Route::group('api', [
]);
Route
::
group
(
'task'
,[
'test'
=>
[
'task/exclusive/exclusiveExpirationTime'
,
[
'method'
=>
'get'
]]
//独家过期时间
]);
//Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
application/task/common.php
0 → 100644
View file @
fa196856
<?php
application/task/config.php
0 → 100644
View file @
fa196856
<?php
//配置文件
return
[
];
\ No newline at end of file
application/
index/task/Autoexec
.php
→
application/
task/controller/Exclusive
.php
View file @
fa196856
...
...
@@ -7,12 +7,10 @@
* @date : 2018-1-9 14:39:26
* @internal : 自动执行
*/
namespace
app\
index
\controller
;
namespace
app\
task
\controller
;
use
app\model\HouseInfos
;
class
Autoexec
{
public
function
__construct
()
{
$this
->
exclusiveExpirationTime
();
}
class
Exclusive
{
/**
* 独家时间过期下架商铺
*
...
...
@@ -25,12 +23,13 @@ class Autoexec {
if
(
$house_data
)
{
$insert
=
array
();
foreach
(
$house_data
as
$k
=>
$v
)
{
if
(
strtotime
(
$v
[
'exclusive_end'
]
.
'23:59:59'
)
>
time
())
{
if
(
strtotime
(
$v
[
'exclusive_end'
]
.
'23:59:59'
)
>
time
()
&&
$v
[
'exclusive_end'
]
!=
NULL
)
{
continue
;
}
$insert
[
$k
][
'id'
]
=
$v
[
'id'
];
$insert
[
$k
][
'room_num_left'
]
=
0
;
}
$result
=
$house
->
saveAll
(
$insert
);
}
return
;
...
...
public/task.php
0 → 100644
View file @
fa196856
<?php
/**
* Created by PhpStorm.
* User : zw
* Date : 2017/12/14
* Time : 9:36
* Intro:
*/
// [ 应用入口文件 ]
// 定义应用目录
define
(
'APP_PATH'
,
__DIR__
.
'/../application/'
);
// 加载框架引导文件
require
__DIR__
.
'/../thinkphp/start.php'
;
/*// 读取自动生成定义文件
$build = include './../build.php';
// 运行自动生成
\think\Build::run($build);*/
\ 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