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
2e21ca92
authored
Aug 26, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复定时重置商品可兑换限额的bug
parent
a5739cf1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
app/Console/Commands/ResetExchangeSetting.php
storage/laravels.json
storage/laravels.pid
app/Console/Commands/ResetExchangeSetting.php
View file @
2e21ca92
...
@@ -19,7 +19,7 @@ class ResetExchangeSetting extends Command
...
@@ -19,7 +19,7 @@ class ResetExchangeSetting extends Command
public
function
handle
()
public
function
handle
()
{
{
// 在命令行打印一行信息
// 在命令行打印一行信息
$this
->
info
(
"开始查找
..."
);
Log
::
info
(
"开始重置
..."
);
//重置商品可兑换限额
//重置商品可兑换限额
//先从redis缓存里面去取需要的数据
//先从redis缓存里面去取需要的数据
...
@@ -27,15 +27,22 @@ class ResetExchangeSetting extends Command
...
@@ -27,15 +27,22 @@ class ResetExchangeSetting extends Command
$settings
=
$redis
->
hgetall
(
'ic_exchange_settings'
);
$settings
=
$redis
->
hgetall
(
'ic_exchange_settings'
);
//获取到所有配置项之后,就要根据配置项里面的stock字段更新对应的列表
//获取到所有配置项之后,就要根据配置项里面的stock字段更新对应的列表
//列表形式为ic_exchange_setting_{$id},然后这个键是list类型,里面简单存1就好
//列表形式为ic_exchange_setting_{$id},然后这个键是list类型,里面简单存1就好
try
{
foreach
(
$settings
as
$key
=>
$setting
)
{
foreach
(
$settings
as
$key
=>
$setting
)
{
$setting
=
json_decode
(
$setting
,
true
);
$setting
=
json_decode
(
$setting
,
true
);
$id
=
$setting
[
'id'
];
$id
=
$setting
[
'id'
];
//先去删除原有的
//先去删除原有的
$redis
->
del
(
'ic_exchange_settings_'
.
$id
);
$redis
->
del
(
'ic_exchange_settings_'
.
$id
);
$data
=
array_fill
(
0
,
$setting
[
'stock'
],
1
);
$data
=
array_fill
(
0
,
$setting
[
'stock'
],
1
);
$redis
->
lpush
(
'ic_exchange_settings_'
.
$id
,
$data
);
$redis
->
lpush
(
'ic_exchange_settings_'
.
$id
,
$data
);
}
}
}
catch
(
\Exception
$e
)
{
Log
::
info
(
"重置失败,原因是"
.
$e
);
return
;
}
$this
->
info
(
"执行成功!
"
);
Log
::
info
(
"重置完成
"
);
}
}
}
}
\ No newline at end of file
storage/laravels.json
View file @
2e21ca92
This diff is collapsed.
Click to expand it.
storage/laravels.pid
View file @
2e21ca92
478
517
\ No newline at end of file
\ 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