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
2a575cd4
authored
Sep 16, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
删除签到ç接口,同时对活动列表里面的签到类型添加更多逻辑和字段
parent
52201f9b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
92 deletions
app/Http/Controllers/CheckInController.php
app/Services/CheckInService.php
app/Services/IntegralService.php
app/Http/Controllers/CheckInController.php
deleted
100644 → 0
View file @
52201f9b
<?php
namespace
App\Http\Controllers
;
use
App\Services\CheckInService
;
use
App\Services\UserIntegralService
;
use
Carbon\Carbon
;
use
Illuminate\Http\Request
;
/**
* 用户签到
* Class CheckInController
* @package App\Http\Controllers
*/
class
CheckInController
extends
Controller
{
/**
* @var CheckInService
*/
private
$service
;
/**
* CheckInController constructor.
* @param CheckInService $service
*/
public
function
__construct
(
CheckInService
$service
)
{
$this
->
service
=
$service
;
}
/**
* 用户签到列表
* @param Request $request
* @return array|false|string
*/
public
function
index
(
Request
$request
)
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
];
$result
=
$this
->
service
->
getCheckInList
(
$map
);
return
$this
->
Export
(
0
,
'ok'
,
$result
);
}
/**
* 用户签到
* @param Request $request
* @return array|false|string
*/
public
function
add
(
Request
$request
)
{
$map
=
[
'user_id'
=>
$request
->
user
->
user_id
,
];
$result
=
$this
->
service
->
addCheckIn
(
$map
);
if
(
$result
[
'errcode'
]
===
self
::
SUCCESS
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
self
::
CHECK_IN_FAIL
);
}
}
}
\ No newline at end of file
app/Services/CheckInService.php
deleted
100644 → 0
View file @
52201f9b
<?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
app/Services/IntegralService.php
View file @
2a575cd4
...
...
@@ -47,7 +47,14 @@ class IntegralService
$result
[
'data'
][
$key
][
'button_text'
]
=
'去报价'
;
break
;
case
self
::
INTEGRAL_TYPE_CHECK_IN
:
$result
[
'data'
][
$key
][
'button_text'
]
=
'签到'
;
//去判断是否已经签到了,同时去修改文字还有返回签到状态
$redis
=
new
RedisModel
();
$hashKey
=
'ic_check_in_'
.
date
(
'Ymd'
);
$exists
=
$redis
->
hexists
(
$hashKey
,
$map
[
'user_id'
]);
$buttonText
=
$exists
?
'已签到'
:
'签到'
;
$checkInStatus
=
$exists
?
1
:
0
;
$result
[
'data'
][
$key
][
'button_text'
]
=
$buttonText
;
$result
[
'data'
][
$key
][
'check_in_status'
]
=
$checkInStatus
;
break
;
}
}
...
...
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