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
e5a5c571
authored
Aug 26, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
完成用户签到那块
parent
8eb5e694
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
0 deletions
app/Http/Controllers/CheckInController.php
app/Services/CheckInService.php
routes/web.php
app/Http/Controllers/CheckInController.php
0 → 100644
View file @
e5a5c571
<?php
namespace
App\Http\Controllers
;
use
App\Services\CheckInService
;
use
App\Services\UserIntegralService
;
use
Carbon\Carbon
;
use
Illuminate\Http\Request
;
class
CheckInController
extends
Controller
{
private
$service
;
public
function
__construct
(
CheckInService
$service
)
{
$this
->
service
=
$service
;
}
public
function
index
(
Request
$request
)
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
];
$result
=
$this
->
service
->
getCheckInList
(
$map
);
return
$this
->
Export
(
0
,
'ok'
,
$result
);
}
public
function
add
(
Request
$request
)
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
];
$result
=
$this
->
service
->
addCheckIn
(
$map
);
if
(
$result
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
0
,
'签到失败'
);
}
}
}
\ No newline at end of file
app/Services/CheckInService.php
0 → 100644
View file @
e5a5c571
<?php
namespace
App\Services
;
class
CheckInService
{
public
function
getCheckInList
(
$map
=
[])
{
$url
=
config
(
'website.BaseUrl'
)
.
'/check_in/list'
;
$result
=
reportCurl
(
$url
,
$map
,
true
);
$result
=
json_decode
(
$result
,
true
);
return
$result
;
}
public
function
addCheckIn
(
$map
=
[])
{
$url
=
config
(
'website.BaseUrl'
)
.
'/check_in/add'
;
$result
=
reportCurl
(
$url
,
$map
,
true
);
$result
=
json_decode
(
$result
,
true
);
return
$result
;
}
}
\ No newline at end of file
routes/web.php
View file @
e5a5c571
...
...
@@ -25,6 +25,9 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
$router
->
options
(
'/goods/upload'
,
'ApiController@UploadGoods'
);
//前端插件需要这个请求
$router
->
get
(
'/goods/upload/list'
,
'ApiController@UploadGoodsList'
);
//签到
$router
->
get
(
'/check_in/list'
,
'CheckInController@index'
);
$router
->
post
(
'/check_in/add'
,
'CheckInController@add'
);
});
$router
->
group
([
'middleware'
=>
'web'
],
function
()
use
(
$router
)
{
$router
->
post
(
'/oss/upload'
,
'OssController@upload'
);
...
...
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