Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
ic_server_welfare
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
f7f2c0c3
authored
Oct 17, 2019
by
叶明星
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
兼容提现名额为0的情况,优化自动刷新名额
parent
8b51d701
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
app/Jobs/Timer/ResetExchangeSettingsCronJob.php
app/Jobs/Timer/ResetExchangeSettingsCronJob.php
View file @
f7f2c0c3
...
...
@@ -32,10 +32,21 @@ class ResetExchangeSettingsCronJob extends CronJob
$time
=
Carbon
::
create
(
null
,
null
,
null
,
10
);
$time
=
$time
->
timestamp
;
$now
=
Carbon
::
now
()
->
timestamp
;
if
(
$time
===
$now
)
{
//判断是否进行名额刷新
if
(
$now
>=
$time
){
//当前时间大于10点
//判断今天是否有刷新名额记录
$Redis
=
new
RedisModel
();
$day
=
date
(
'Ymd'
);
$findCache
=
$Redis
->
get
(
$day
);
if
(
$findCache
)
//已经刷新
return
true
;
Log
::
info
(
"进行定时检测重置任务..."
);
$this
->
reset
();
}
return
true
;
}
private
function
reset
()
...
...
@@ -56,14 +67,17 @@ class ResetExchangeSettingsCronJob extends CronJob
//先去删除原有的
$redis
->
del
(
'ic_exchange_settings_'
.
$id
);
$data
=
array_fill
(
0
,
$setting
[
'stock'
],
1
);
if
(
empty
(
$data
))
//兼容名额为0的情况
continue
;
$redis
->
lpush
(
'ic_exchange_settings_'
.
$id
,
$data
);
}
}
catch
(
\Exception
$e
)
{
Log
::
info
(
"重置失败,原因是"
.
$e
);
return
;
}
$day
=
date
(
'Ymd'
);
$redis
->
set
(
$day
,
1
);
$redis
->
expire
(
$day
,
60
*
60
*
24
);
//24小时后过期掉
Log
::
info
(
"重置完成"
);
}
...
...
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