Commit 879343bf by 杨树贤

添加分页参数

parent 1d3830d8
......@@ -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);
......
......@@ -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,10 +59,13 @@ 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([]);
});
if (is_array($newInvites)) {
$newInvites = array_get($newInvites, 'data');
$newInvites = array_map(function ($value) {
$value['invited_user_mobile'] = substr_replace($value['invited_user_mobile'],
......@@ -68,6 +73,10 @@ class InvitesController extends Controller
return $value;
}, $newInvites);
} else {
$newInvites = [];
}
$result['data']['recent_invites'] = $newInvites;
return $this->Export(0, 'ok', $result);
......
......@@ -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);
......
......@@ -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'),
......
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