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
e2a313c2
authored
Aug 26, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加对redis缓存里面的兑换配置type的过滤
parent
c13fb89d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
6 deletions
app/Http/Controllers/ExchangeSettingsController.php
app/Http/Filters/ExchangeSettingFilter.php
app/Models/ExchangeSetting.php
storage/laravels.json
storage/laravels.pid
app/Http/Controllers/ExchangeSettingsController.php
View file @
e2a313c2
...
...
@@ -42,7 +42,9 @@ class ExchangeSettingsController extends Controller
$page
=
$request
->
has
(
'page'
)
?
$request
->
page
:
self
::
DEFAULT_PAGE
;
$pageSize
=
$request
->
has
(
'page_size'
)
?
$request
->
page_size
:
self
::
DEFAULT_PAGE_SIZE
;
if
(
$request
->
has
(
'is_api'
)
&&
$request
->
is_api
)
{
$result
=
$exchangeSetting
->
getExchangeSettingListForApi
();
//判断type
$type
=
$request
->
get
(
'type'
);
$result
=
$exchangeSetting
->
getExchangeSettingListForApi
([
'type'
=>
$type
]);
}
else
{
$result
=
$exchangeSetting
->
getExchangeSettingList
(
$page
,
$pageSize
,
$filter
);
}
...
...
app/Http/Filters/ExchangeSettingFilter.php
View file @
e2a313c2
...
...
@@ -16,7 +16,7 @@ class ExchangeSettingFilter extends QueryFilter
return
$this
->
builder
->
whereStatus
(
$status
);
}
public
function
type
(
$type
)
public
function
type
(
$type
=
0
)
{
return
$this
->
builder
->
whereType
(
$type
);
}
...
...
app/Models/ExchangeSetting.php
View file @
e2a313c2
...
...
@@ -8,6 +8,7 @@ use App\Http\Filters\QueryFilter;
use
Common\Model\RedisModel
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
class
ExchangeSetting
extends
Model
{
...
...
@@ -34,7 +35,7 @@ class ExchangeSetting extends Model
return
[
'data'
=>
$settings
,
'count'
=>
$count
];
}
public
function
getExchangeSettingListForApi
()
public
function
getExchangeSettingListForApi
(
$map
=
[]
)
{
//先从redis里面查询是否有列表,没有的话从MySQL里面取出并且放入redis
$redis
=
new
RedisModel
();
...
...
@@ -50,7 +51,16 @@ class ExchangeSetting extends Model
}
else
{
$count
=
$redis
->
hlen
(
'ic_welfare_integrals'
);
}
$settings
=
arraySequence
(
$settings
,
'id'
,
'SORT_ASC'
);
//如果需要过滤type
if
(
$map
[
'type'
])
{
$settings
=
array_filter
(
$settings
,
function
(
$value
)
use
(
$map
)
{
return
$value
[
'type'
]
==
$map
[
'type'
]
?
true
:
false
;
});
}
if
(
$settings
)
{
$settings
=
arraySequence
(
$settings
,
'id'
,
'SORT_ASC'
);
}
return
[
'data'
=>
array_values
(
$settings
),
'count'
=>
$count
];
}
...
...
storage/laravels.json
View file @
e2a313c2
This diff is collapsed.
Click to expand it.
storage/laravels.pid
View file @
e2a313c2
3352
\ No newline at end of file
4820
\ 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