Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
ic_welfare_api
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
879343bf
authored
Sep 04, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加分页参数
parent
1d3830d8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
7 deletions
app/Http/Controllers/IntegralBillsController.php
app/Http/Controllers/InvitesController.php
app/Http/Controllers/UserExchangesController.php
app/Http/Transformers/IntegralBillTransformer.php
app/Http/Controllers/IntegralBillsController.php
View file @
879343bf
...
...
@@ -34,6 +34,8 @@ class IntegralBillsController extends Controller
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
'page'
=>
$request
->
get
(
'page'
),
'page_size'
=>
$request
->
get
(
'page_size'
),
];
$result
=
$this
->
service
->
getIntegralBillList
(
$map
);
$result
=
$transformer
->
transform
(
$result
);
...
...
app/Http/Controllers/InvitesController.php
View file @
879343bf
...
...
@@ -25,6 +25,8 @@ class InvitesController extends Controller
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
'page'
=>
$request
->
get
(
'page'
),
'page_size'
=>
$request
->
get
(
'page_size'
),
];
$result
=
$this
->
service
->
getInviteList
(
$map
);
...
...
@@ -57,17 +59,24 @@ class InvitesController extends Controller
{
$userId
=
$request
->
user
->
user_id
;
$result
=
$this
->
service
->
getInviteInfo
([
'user_id'
=>
$userId
]);
//返回user_id方便前端使用
$result
[
'data'
][
'user_id'
]
=
$userId
;
//还要获取最新的10条邀请记录,走缓存
$newInvites
=
Cache
::
remember
(
'recent_invites'
,
10
,
function
()
{
return
$this
->
service
->
getInviteList
([]);
});
$newInvites
=
array_get
(
$newInvites
,
'data'
);
$newInvites
=
array_map
(
function
(
$value
)
{
$value
[
'invited_user_mobile'
]
=
substr_replace
(
$value
[
'invited_user_mobile'
],
'****'
,
4
,
4
);
if
(
is_array
(
$newInvites
))
{
$newInvites
=
array_get
(
$newInvites
,
'data'
);
$newInvites
=
array_map
(
function
(
$value
)
{
$value
[
'invited_user_mobile'
]
=
substr_replace
(
$value
[
'invited_user_mobile'
],
'****'
,
4
,
4
);
return
$value
;
},
$newInvites
);
}
else
{
$newInvites
=
[];
}
return
$value
;
},
$newInvites
);
$result
[
'data'
][
'recent_invites'
]
=
$newInvites
;
return
$this
->
Export
(
0
,
'ok'
,
$result
);
...
...
app/Http/Controllers/UserExchangesController.php
View file @
879343bf
...
...
@@ -39,6 +39,8 @@ class UserExchangesController extends Controller
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
'page'
=>
$request
->
get
(
'page'
),
'page_size'
=>
$request
->
get
(
'page_size'
),
];
$result
=
$this
->
service
->
getUserExchangeList
(
$map
);
$result
=
$transformer
->
transform
(
$result
);
...
...
app/Http/Transformers/IntegralBillTransformer.php
View file @
879343bf
...
...
@@ -8,7 +8,7 @@ class IntegralBillTransformer
{
public
function
transform
(
$data
=
[])
{
if
(
isset
(
$data
[
'data'
]))
{
if
(
isset
(
$data
[
'data'
])
&&
is_array
(
$data
[
'data'
])
)
{
foreach
(
$data
[
'data'
]
as
$key
=>
$value
)
{
$data
[
'data'
][
$key
]
=
[
'id'
=>
array_get
(
$value
,
'id'
),
...
...
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