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
6f5921c5
authored
Sep 12, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
ä¿修复用户可以兑换自己的红包码的bug
parent
a1c9a05a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
app/Http/Controllers/CodesController.php
app/Http/Controllers/CodesController.php
View file @
6f5921c5
...
...
@@ -25,15 +25,16 @@ class CodesController extends Controller
*/
public
function
store
(
Request
$request
,
CodeService
$service
)
{
$userId
=
$request
->
user
->
user_id
;
$code
=
$request
->
get
(
'code'
);
if
(
empty
(
$code
))
{
return
$this
->
Export
(
self
::
INVALID_PARAMETER
);
}
elseif
(
!
$this
->
checkCode
(
$code
))
{
}
elseif
(
!
$this
->
checkCode
(
$code
,
$userId
))
{
return
$this
->
Export
(
self
::
INVALID_CODE
);
}
$data
=
[
'user_id'
=>
$
request
->
user
->
user_i
d
,
'user_id'
=>
$
userI
d
,
'code'
=>
$request
->
get
(
'code'
),
];
$result
=
$service
->
addCode
(
$data
);
...
...
@@ -56,8 +57,12 @@ class CodesController extends Controller
}
//检查红包码是否正确
private
function
checkCode
(
$code
)
private
function
checkCode
(
$code
,
$userId
=
0
)
{
//检查是不是自己,自己不能兑换自己的红包码
if
(
$userId
==
substr
(
$code
,
3
))
{
return
false
;
}
//先检查是否是RDD开头
if
(
substr
(
$code
,
0
,
3
)
!==
'RDD'
)
{
return
false
;
...
...
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