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
5b1b1964
authored
Aug 29, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
返回红包活动列表带上已经添加的次数
parent
87b5ca90
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
app/Http/Controllers/IntegralsController.php
app/Models/Integral.php
app/Http/Controllers/IntegralsController.php
View file @
5b1b1964
...
...
@@ -7,7 +7,6 @@ namespace App\Http\Controllers;
use
App\Http\Filters\IntegralFilter
;
use
App\Models\Integral
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
/**
...
...
@@ -41,9 +40,9 @@ class IntegralsController extends Controller
{
$page
=
$request
->
has
(
'page'
)
?
$request
->
page
:
self
::
DEFAULT_PAGE
;
$pageSize
=
$request
->
has
(
'page_size'
)
?
$request
->
page_size
:
self
::
DEFAULT_PAGE_SIZE
;
$userId
=
$request
->
get
(
'user_id'
);
if
(
$request
->
has
(
'is_api'
)
&&
$request
->
is_api
)
{
$result
=
$integral
->
getIntegralListForApi
();
$result
=
$integral
->
getIntegralListForApi
(
$userId
);
}
else
{
$result
=
$integral
->
getIntegralList
(
$page
,
$pageSize
,
$filter
);
}
...
...
@@ -154,6 +153,7 @@ class IntegralsController extends Controller
$ids
=
$request
->
get
(
'ids'
);
if
(
!
is_array
(
$ids
))
{
Log
::
Info
(
'批量修改参数不是数组'
);
return
$this
->
Export
(
44
,
'批量修改参数不是数组'
);
}
$status
=
$request
->
status
;
...
...
app/Models/Integral.php
View file @
5b1b1964
...
...
@@ -53,7 +53,7 @@ class Integral extends Model
}
//获取红包活动列表,给API使用
public
function
getIntegralListForApi
()
public
function
getIntegralListForApi
(
$userId
)
{
//先从redis里面查询是否有列表,没有的话从MySQL里面取出并且放入redis
$redis
=
new
RedisModel
();
...
...
@@ -66,10 +66,17 @@ class Integral extends Model
$count
=
Integral
::
where
(
'status'
,
1
)
->
count
();
$integrals
=
$this
->
addIntegralListToRedis
();
}
}
else
{
$count
=
$redis
->
hlen
(
'ic_welfare_integrals'
);
}
//处理列表,把不同红包活动今天已使用次数显示出来
foreach
(
$integrals
as
$key
=>
$integral
)
{
$addCount
=
$redis
->
hget
(
'ic_welfare_integral_limit_'
.
$integral
[
'id'
],
$userId
);
$integrals
[
$key
][
'add_count'
]
=
empty
(
$addCount
)
?
0
:
(
int
)
$addCount
;
}
if
(
$integrals
)
{
$integrals
=
arraySequence
(
$integrals
,
'id'
,
'SORT_ASC'
);
}
...
...
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