Commit 879343bf by 杨树贤

添加分页参数

parent 1d3830d8
...@@ -34,6 +34,8 @@ class IntegralBillsController extends Controller ...@@ -34,6 +34,8 @@ class IntegralBillsController extends Controller
{ {
$map = [ $map = [
'user_id' => $request->user->user_id, 'user_id' => $request->user->user_id,
'page' => $request->get('page'),
'page_size' => $request->get('page_size'),
]; ];
$result = $this->service->getIntegralBillList($map); $result = $this->service->getIntegralBillList($map);
$result = $transformer->transform($result); $result = $transformer->transform($result);
......
...@@ -25,6 +25,8 @@ class InvitesController extends Controller ...@@ -25,6 +25,8 @@ class InvitesController extends Controller
{ {
$map = [ $map = [
'user_id' => $request->user->user_id, 'user_id' => $request->user->user_id,
'page' => $request->get('page'),
'page_size' => $request->get('page_size'),
]; ];
$result = $this->service->getInviteList($map); $result = $this->service->getInviteList($map);
...@@ -57,17 +59,24 @@ class InvitesController extends Controller ...@@ -57,17 +59,24 @@ class InvitesController extends Controller
{ {
$userId = $request->user->user_id; $userId = $request->user->user_id;
$result = $this->service->getInviteInfo(['user_id' => $userId]); $result = $this->service->getInviteInfo(['user_id' => $userId]);
//返回user_id方便前端使用
$result['data']['user_id'] = $userId;
//还要获取最新的10条邀请记录,走缓存 //还要获取最新的10条邀请记录,走缓存
$newInvites = Cache::remember('recent_invites', 10, function () { $newInvites = Cache::remember('recent_invites', 10, function () {
return $this->service->getInviteList([]); return $this->service->getInviteList([]);
}); });
$newInvites = array_get($newInvites, 'data'); if (is_array($newInvites)) {
$newInvites = array_map(function ($value) { $newInvites = array_get($newInvites, 'data');
$value['invited_user_mobile'] = substr_replace($value['invited_user_mobile'], $newInvites = array_map(function ($value) {
'****', 4, 4); $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; $result['data']['recent_invites'] = $newInvites;
return $this->Export(0, 'ok', $result); return $this->Export(0, 'ok', $result);
......
...@@ -39,6 +39,8 @@ class UserExchangesController extends Controller ...@@ -39,6 +39,8 @@ class UserExchangesController extends Controller
{ {
$map = [ $map = [
'user_id' => $request->user->user_id, 'user_id' => $request->user->user_id,
'page' => $request->get('page'),
'page_size' => $request->get('page_size'),
]; ];
$result = $this->service->getUserExchangeList($map); $result = $this->service->getUserExchangeList($map);
$result = $transformer->transform($result); $result = $transformer->transform($result);
......
...@@ -8,7 +8,7 @@ class IntegralBillTransformer ...@@ -8,7 +8,7 @@ class IntegralBillTransformer
{ {
public function transform($data = []) public function transform($data = [])
{ {
if (isset($data['data'])) { if (isset($data['data'])&&is_array($data['data'])) {
foreach ($data['data'] as $key => $value) { foreach ($data['data'] as $key => $value) {
$data['data'][$key] = [ $data['data'][$key] = [
'id' => array_get($value, 'id'), 'id' => array_get($value, 'id'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment