Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
ic_server_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
8f6bcc4f
authored
Aug 26, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加各种红包类型对应的常量
parent
e2a313c2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
app/Models/CheckIn.php
app/Models/Integral.php
app/Models/CheckIn.php
View file @
8f6bcc4f
...
...
@@ -18,8 +18,6 @@ class CheckIn extends Model
protected
$table
=
'check_in'
;
public
$timestamps
=
false
;
const
INTEGRAL_TYPE_CHECK_IN
=
1
;
public
function
scopePage
(
$query
,
$page
=
1
,
$pageSize
=
10
)
{
return
$query
->
offset
((
$page
-
1
)
*
$pageSize
)
->
limit
(
$pageSize
);
...
...
@@ -49,7 +47,7 @@ class CheckIn extends Model
return
false
;
}
//使用异步任务去添加流水
$data
[
'integral_id'
]
=
self
::
INTEGRAL_TYPE_CHECK_IN
;
$data
[
'integral_id'
]
=
Integral
::
INTEGRAL_TYPE_CHECK_IN
;
$task
=
new
IntegralBillTask
(
$data
);
$result
=
Task
::
deliver
(
$task
);
if
(
!
$result
)
{
...
...
@@ -57,7 +55,7 @@ class CheckIn extends Model
}
//添加流水成功后,要把签到记录放到redis
$date
=
Carbon
::
now
()
->
toDateString
();
$hashKey
=
'ic_welfare_integral_limit_'
.
self
::
INTEGRAL_TYPE_CHECK_IN
;
$hashKey
=
'ic_welfare_integral_limit_'
.
Integral
::
INTEGRAL_TYPE_CHECK_IN
;
$userId
=
$data
[
'user_id'
];
$redis
=
new
RedisModel
();
$redis
->
hincrby
(
$hashKey
,
$userId
,
1
);
...
...
app/Models/Integral.php
View file @
8f6bcc4f
...
...
@@ -18,6 +18,13 @@ class Integral extends Model
protected
$hidden
=
[];
const
INTEGRAL_TYPE_INVITE_FRIEND
=
1
;
const
INTEGRAL_TYPE_UPLOAD_GOODS
=
2
;
const
INTEGRAL_TYPE_INTEGRAL_CODE
=
3
;
const
INTEGRAL_TYPE_SHARE
=
4
;
const
INTEGRAL_TYPE_OFFER
=
5
;
const
INTEGRAL_TYPE_CHECK_IN
=
6
;
public
function
scopePage
(
$query
,
$page
=
1
,
$pageSize
=
10
)
{
return
$query
->
offset
((
$page
-
1
)
*
$pageSize
)
->
limit
(
$pageSize
);
...
...
@@ -57,11 +64,15 @@ class Integral extends Model
if
(
!
$result
)
{
ErrorLog
(
ErrorCode
(
18
,
'5'
),
'写入红包活动列表到Redis失败'
);
$count
=
Integral
::
where
(
'status'
,
1
)
->
count
();
$integrals
=
$this
->
addIntegralListToRedis
();
}
}
else
{
$count
=
$redis
->
hlen
(
'ic_welfare_integrals'
);
}
$integrals
=
arraySequence
(
$integrals
,
'id'
,
'SORT_ASC'
);
if
(
$integrals
)
{
$integrals
=
arraySequence
(
$integrals
,
'id'
,
'SORT_ASC'
);
}
return
[
'data'
=>
array_values
(
$integrals
),
'count'
=>
$count
];
}
...
...
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