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
54be437d
authored
Dec 05, 2022
by
Joneq
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
新增消息系统-完成脚本开发
parent
91e27849
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
1 deletions
app/Console/Commands/CreateNotice.php
app/Console/Kernel.php
app/Model/SystemUpdateModel.php
app/Console/Commands/CreateNotice.php
0 → 100755
View file @
54be437d
<?php
namespace
App\Console\Commands
;
use
App\Model\SystemBulletinModel
;
use
App\Model\SystemUpdateModel
;
use
Illuminate\Console\Command
;
use
Illuminate\Support\Facades\DB
;
//TODO 上线之后去除注释这个notice ,5。0版本的缺陷 https://blog.csdn.net/weixin_44251615/article/details/93710829
ini_set
(
"error_reporting"
,
"E_ALL & ~E_NOTICE"
);
class
CreateNotice
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'notice:create_notice'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'生成每日六点的公告'
;
/**
* Create a new command instance.
*
* @return void
*/
public
function
__construct
()
{
parent
::
__construct
();
}
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
//查找出今日的所有更新
$date
=
date
(
'Y-m-d'
);
$time
=
strtotime
(
$date
);
$where
[
'begin_time'
]
=
$time
-
(
6
*
3600
);
$where
[
'end_time'
]
=
$time
+
(
18
*
3600
);
$allUpdate
=
(
new
SystemUpdateModel
())
->
select
(
'update_title'
,
'update_content'
)
->
get
()
->
toArray
();
$saveData
[
'title'
]
=
$date
.
'系统不停机维护公告'
;
$saveData
[
'content'
]
=
''
;
$saveData
[
'is_send'
]
=
'未发送'
;
$saveData
[
'create_time'
]
=
time
();
foreach
(
$allUpdate
as
$value
){
$saveData
[
'content'
]
.=
'<h2 style="text-align: center;">'
.
$value
[
'update_title'
]
.
'</h2>'
;
$saveData
[
'content'
]
.=
$value
[
'update_content'
];
}
(
new
SystemBulletinModel
())
->
insertGetId
(
$saveData
);
}
}
app/Console/Kernel.php
View file @
54be437d
...
@@ -21,6 +21,7 @@ class Kernel extends ConsoleKernel
...
@@ -21,6 +21,7 @@ class Kernel extends ConsoleKernel
Commands\qj_sf
::
class
,
Commands\qj_sf
::
class
,
Commands\Initialization
::
class
,
Commands\Initialization
::
class
,
Commands\Add_field
::
class
,
Commands\Add_field
::
class
,
Commands\CreateNotice
::
class
,
];
];
/**
/**
...
...
app/Model/SystemUpdateModel.php
View file @
54be437d
...
@@ -34,7 +34,7 @@ class SystemUpdateModel extends Model
...
@@ -34,7 +34,7 @@ class SystemUpdateModel extends Model
case
'update_content'
:
case
'update_content'
:
$obj
=
$obj
->
where
(
$key
,
'like'
,
'%'
.
$val
.
'%'
);
break
;
$obj
=
$obj
->
where
(
$key
,
'like'
,
'%'
.
$val
.
'%'
);
break
;
case
'begin_time'
:
case
'begin_time'
:
$obj
=
$obj
->
where
(
'create_time'
,
'>
=
'
,
strtotime
(
$val
));
break
;
$obj
=
$obj
->
where
(
'create_time'
,
'>'
,
strtotime
(
$val
));
break
;
case
'end_time'
:
case
'end_time'
:
$obj
=
$obj
->
where
(
'create_time'
,
'<='
,
strtotime
(
$val
));
break
;
$obj
=
$obj
->
where
(
'create_time'
,
'<='
,
strtotime
(
$val
));
break
;
}
}
...
...
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