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
c124e07c
authored
Aug 26, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
完成 红包获取列表和红包兑换列表的接口
parent
e5a5c571
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
159 additions
and
2 deletions
app/Http/Controllers/CheckInController.php
app/Http/Controllers/IntegralBillsController.php
app/Http/Controllers/UserExchangesController.php
app/Http/Transformers/IntegralBillTransformer.php
app/Http/Transformers/UserExchangeTransformer.php
app/Services/IntegralBillsService.php
app/Services/UserExchangeService.php
routes/web.php
app/Http/Controllers/CheckInController.php
View file @
c124e07c
...
...
@@ -29,7 +29,8 @@ class CheckInController extends Controller
public
function
add
(
Request
$request
)
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
'user_id'
=>
77
,
// 'user_id' => $request->user->user_id,
];
$result
=
$this
->
service
->
addCheckIn
(
$map
);
if
(
$result
)
{
...
...
app/Http/Controllers/IntegralBillsController.php
0 → 100644
View file @
c124e07c
<?php
namespace
App\Http\Controllers
;
use
App\Services\IntegralBillsService
;
use
Illuminate\Http\Request
;
use
App\Http\Transformers\IntegralBillTransformer
;
class
IntegralBillsController
extends
Controller
{
private
$service
;
public
function
__construct
(
IntegralBillsService
$service
)
{
$this
->
service
=
$service
;
}
public
function
index
(
Request
$request
,
IntegralBillTransformer
$transformer
)
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
];
$result
=
$this
->
service
->
getIntegralBillList
(
$map
);
$result
=
$transformer
->
transform
(
$result
);
return
$this
->
Export
(
0
,
'ok'
,
$result
);
}
}
\ No newline at end of file
app/Http/Controllers/UserExchangesController.php
0 → 100644
View file @
c124e07c
<?php
namespace
App\Http\Controllers
;
use
App\Http\Transformers\UserExchangeTransformer
;
use
App\Services\UserExchangeService
;
use
Illuminate\Http\Request
;
class
UserExchangesController
extends
Controller
{
private
$service
;
public
function
__construct
(
UserExchangeService
$service
)
{
$this
->
service
=
$service
;
}
public
function
index
(
Request
$request
,
UserExchangeTransformer
$transformer
)
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
];
$result
=
$this
->
service
->
getUserExchangeList
(
$map
);
// dd($result);
$result
=
$transformer
->
transform
(
$result
);
return
$this
->
Export
(
0
,
'ok'
,
$result
);
}
}
\ No newline at end of file
app/Http/Transformers/IntegralBillTransformer.php
0 → 100644
View file @
c124e07c
<?php
namespace
App\Http\Transformers
;
class
IntegralBillTransformer
{
public
function
transform
(
$data
=
[])
{
if
(
isset
(
$data
[
'data'
]))
{
foreach
(
$data
[
'data'
]
as
$key
=>
$value
)
{
$data
[
'data'
][
$key
]
=
[
'id'
=>
array_get
(
$value
,
'id'
),
'name'
=>
array_get
(
$value
[
'integral'
],
'name'
),
'add_time'
=>
array_get
(
$value
,
'add_time'
),
'amount'
=>
array_get
(
$value
[
'integral'
],
'amount'
),
];
}
}
return
$data
;
}
}
\ No newline at end of file
app/Http/Transformers/UserExchangeTransformer.php
0 → 100644
View file @
c124e07c
<?php
namespace
App\Http\Transformers
;
class
UserExchangeTransformer
{
public
function
transform
(
$data
=
[])
{
if
(
isset
(
$data
[
'data'
]))
{
foreach
(
$data
[
'data'
]
as
$key
=>
$value
)
{
$data
[
'data'
][
$key
]
=
[
'id'
=>
array_get
(
$value
,
'id'
),
'amount'
=>
array_get
(
$value
,
'amount'
),
'name'
=>
array_get
(
$value
[
'exchange_setting'
],
'name'
),
'add_time'
=>
array_get
(
$value
,
'add_time'
),
];
}
}
return
$data
;
}
}
\ No newline at end of file
app/Services/IntegralBillsService.php
0 → 100644
View file @
c124e07c
<?php
namespace
App\Services
;
class
IntegralBillsService
{
public
function
getIntegralBillList
(
$map
=
[])
{
$url
=
config
(
'website.BaseUrl'
)
.
'/integral_bills/list'
;
$result
=
reportCurl
(
$url
,
$map
,
true
);
$result
=
json_decode
(
$result
,
true
);
return
$result
;
}
}
\ No newline at end of file
app/Services/UserExchangeService.php
0 → 100644
View file @
c124e07c
<?php
namespace
App\Services
;
class
UserExchangeService
{
public
function
getUserExchangeList
(
$map
=
[])
{
$url
=
config
(
'website.BaseUrl'
)
.
'/user_exchanges/list'
;
$result
=
reportCurl
(
$url
,
$map
,
true
);
$result
=
json_decode
(
$result
,
true
);
return
$result
;
}
}
\ No newline at end of file
routes/web.php
View file @
c124e07c
...
...
@@ -27,7 +27,11 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
//签到
$router
->
get
(
'/check_in/list'
,
'CheckInController@index'
);
$router
->
post
(
'/check_in/add'
,
'CheckInController@add'
);
//红包获取流水
$router
->
get
(
'integral_bills/list'
,
'IntegralBillsController@index'
);
//红包兑换流水
$router
->
get
(
'user_exchanges/list'
,
'UserExchangesController@index'
);
});
$router
->
group
([
'middleware'
=>
'web'
],
function
()
use
(
$router
)
{
$router
->
post
(
'/oss/upload'
,
'OssController@upload'
);
...
...
@@ -37,3 +41,7 @@ $router->group(['middleware' => 'web'], function () use ($router) {
//红包活动信息
$router
->
get
(
'/integrals/list'
,
'IntegralsController@index'
);
$router
->
post
(
'/check_in/add'
,
'CheckInController@add'
);
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