Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
ic_welfare
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
c293ed35
authored
Sep 16, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
去除签到相关的页面和逻辑
parent
20e98654
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
151 deletions
app/Http/Controllers/Api/CheckInApiController.php
app/Http/Controllers/CheckInController.php
app/Http/Services/CheckInService.php
app/Http/Transformers/CheckInTransformer.php
routes/web.php
app/Http/Controllers/Api/CheckInApiController.php
deleted
100644 → 0
View file @
20e98654
<?php
namespace
App\Http\Controllers\Api
;
use
App\Http\Requests\ExchangeSettingApiRequest
;
use
App\Http\Services\CheckInService
;
use
App\Http\Services\ExchangeSettingService
;
use
App\Http\Transformers\CheckInTransformer
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
class
CheckInApiController
extends
Controller
{
protected
$service
;
public
function
__construct
(
CheckInService
$service
)
{
$this
->
service
=
$service
;
}
public
function
checkInListApi
(
Request
$request
,
CheckInTransformer
$transformer
)
{
$params
=
$this
->
getListParams
(
$request
);
$params
=
urldecode
(
http_build_query
(
$params
));
$data
=
$this
->
service
->
getCheckInList
(
'/check_in/list?'
.
$params
);
$data
=
$transformer
->
transform
(
$data
);
return
$this
->
apiReturn
(
0
,
'ok'
,
[
'data'
=>
$data
[
'data'
],
'count'
=>
$data
[
'count'
],
]);
}
private
function
getListParams
(
Request
$request
)
{
//因为数据库没有存mobile,所以要根据mobile去获取userId
$userId
=
$this
->
service
->
getUserIdByMobile
(
$request
->
mobile
);
$params
=
array_merge
(
$request
->
toArray
(),
[
'user_id'
=>
$userId
]);
if
(
$request
->
has
(
'mobile'
)
&&
$request
->
mobile
)
{
$params
[
'user_id'
]
=
$params
[
'user_id'
]
?:
0
;
}
unset
(
$params
[
'mobile'
]);
return
$params
;
}
}
app/Http/Controllers/CheckInController.php
deleted
100644 → 0
View file @
20e98654
<?php
namespace
App\Http\Controllers
;
use
App\Http\Services\ExchangeSettingService
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
//用户签到
class
CheckInController
extends
Controller
{
protected
$service
;
public
function
__construct
(
ExchangeSettingService
$service
)
{
$this
->
service
=
$service
;
}
public
function
Entrance
(
Request
$request
,
$id
=
'index'
)
{
if
(
$request
->
path
()
==
'/'
)
{
$path
=
'web/index'
;
}
else
{
$path
=
$request
->
path
();
}
$this
->
data
=
[
'menus'
=>
$request
->
menus
,
'header'
=>
$request
->
user
->
header
,
'username'
=>
$request
->
user
->
email
,
'useremail'
=>
$request
->
user
->
email
,
'uri'
=>
'/'
.
$path
,
'id'
=>
$id
,
];
return
$this
->
$id
(
$request
);
}
public
function
__call
(
$method
,
$parameters
)
{
return
$this
->
errhtml
(
'NotFind'
,
'没有这个页面'
);
}
public
function
checkInList
()
{
$this
->
data
[
'title'
]
=
'签到列表'
;
return
$this
->
view
();
}
}
app/Http/Services/CheckInService.php
deleted
100644 → 0
View file @
20e98654
<?php
namespace
App\Http\Services
;
class
CheckInService
extends
BaseService
{
public
function
getCheckInList
(
$path
)
{
return
$this
->
apiPost
(
$path
);
}
}
\ No newline at end of file
app/Http/Transformers/CheckInTransformer.php
deleted
100644 → 0
View file @
20e98654
<?php
namespace
App\Http\Transformers
;
use
App\Http\Services\BaseService
;
class
CheckInTransformer
{
protected
$service
;
public
function
__construct
(
BaseService
$service
)
{
$this
->
service
=
$service
;
}
public
function
transform
(
$data
)
{
if
(
isset
(
$data
[
'data'
]))
{
$userIds
=
array_column
(
$data
[
'data'
],
'user_id'
);
if
(
$userIds
)
{
$users
=
$this
->
service
->
getUsersFromRedis
(
$userIds
);
$mobiles
=
[];
foreach
(
$users
as
$user
)
{
$mobiles
[
$user
[
'user_id'
]]
=
$user
[
'mobile'
];
}
foreach
(
$data
[
'data'
]
as
&
$item
)
{
$item
[
'mobile'
]
=
array_get
(
$mobiles
,
$item
[
'user_id'
]);
$item
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
,
$item
[
'add_time'
]);
}
}
unset
(
$item
);
}
return
$data
;
}
}
\ No newline at end of file
routes/web.php
View file @
c293ed35
...
...
@@ -19,7 +19,6 @@ Route::group(['middleware' => 'web'], function () {
Route
::
match
([
'get'
,
'post'
],
'/integral_bills/{key}'
,
'IntegralBillsController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/exchange/settings/{key}'
,
'ExchangeSettingsController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/user_exchanges/{key}'
,
'UserExchangesController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/check_in/{key}'
,
'CheckInController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/codes/{key}'
,
'CodesController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/invites/{key}'
,
'InvitesController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/assists/{key}'
,
'AssistsController@Entrance'
);
...
...
@@ -72,10 +71,6 @@ Route::namespace('Api')->group(function () {
Route
::
match
([
'get'
,
'post'
],
'/user_exchanges/api/auditUserExchangeApi'
,
'UserExchangesApiController@auditUserExchangeApi'
);
//用户签到管理
Route
::
match
([
'get'
,
'post'
],
'/check_in/api/checkInListApi'
,
'CheckInApiController@checkInListApi'
);
//红包码兑换管理
Route
::
match
([
'get'
,
'post'
],
'/codes/api/codeListApi'
,
'CodesApiController@codeListApi'
);
...
...
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