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
75315a6a
authored
Aug 26, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改增加保单只返回成功或者失败,不返回超过限制的提示
parent
d420842b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
23 deletions
app/Http/Controllers/IntegralBillsController.php
app/Models/IntegralBill.php
storage/laravels.json
storage/laravels.pid
app/Http/Controllers/IntegralBillsController.php
View file @
75315a6a
...
...
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
use
App\Http\Filters\IntegralBillFilter
;
use
App\Http\Filters\IntegralFilter
;
use
App\Models\Integral
;
use
App\Models\IntegralBill
;
use
Illuminate\Http\Request
;
...
...
@@ -36,23 +37,31 @@ class IntegralBillsController extends Controller
* 创建红包获取记录
* @param Request $request
* @param IntegralBill $integralBill
* @param Integral $integral
* @return array
*/
public
function
store
(
Request
$request
,
IntegralBill
$integralBill
)
public
function
store
(
Request
$request
,
IntegralBill
$integralBill
,
Integral
$integral
)
{
$data
=
[
'user_id'
=>
$request
->
user_id
,
'integral_id'
=>
$request
->
integral_id
,
'status'
=>
1
,
'user_id'
=>
$request
->
get
(
'user_id'
),
'integral_id'
=>
$request
->
get
(
'integral_id'
),
'add_time'
=>
time
(),
];
$res
=
$integralBill
->
createIntegralBill
(
$data
);
if
(
$res
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
ErrorCode
(
6
,
5
),
'新增红包获取记录失败'
);
//先去检测这个操作是否已经达到每个用户每日的限额
$canAdd
=
$integral
->
checkIntegralLimit
(
$data
[
'user_id'
],
$data
[
'integral_id'
]);
if
(
$canAdd
)
{
$res
=
$integralBill
->
createIntegralBill
(
$data
);
if
(
$res
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
ErrorCode
(
6
,
5
),
'新增红包获取记录失败'
);
}
}
// else {
// return $this->Export(ErrorCode(1, 1), '该操作超过限定次数');
// }
return
$this
->
Export
(
0
,
'ok'
);
}
/**
...
...
app/Models/IntegralBill.php
View file @
75315a6a
...
...
@@ -11,6 +11,7 @@ use Hhxsv5\LaravelS\Swoole\Task\Task;
use
http\Env\Request
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
class
IntegralBill
extends
Model
{
...
...
@@ -44,20 +45,23 @@ class IntegralBill extends Model
return
[
'data'
=>
$bills
,
'count'
=>
$count
];
}
//这是一个比较重要的方法,这个方法关系着需不需要插入红包获取流水
public
function
createIntegralBill
(
$data
=
[])
{
$res
=
DB
::
table
(
'integral_bills'
)
->
insert
(
$data
);
return
$res
;
// public function addIntegralBill($userId,$integralId)
// {
// $task = new IntegralBillTask($data);
// $result = Task::deliver($task);
// if (!$result) {
// return false;
// }
// }
$integralId
=
$data
[
'integral_id'
];
switch
(
$integralId
)
{
case
Integral
::
INTEGRAL_TYPE_UPLOAD_GOODS
:
case
Integral
::
INTEGRAL_TYPE_INTEGRAL_CODE
:
case
Integral
::
INTEGRAL_TYPE_SHARE
:
case
Integral
::
INTEGRAL_TYPE_OFFER
:
case
Integral
::
INTEGRAL_TYPE_CHECK_IN
:
case
Integral
::
INTEGRAL_TYPE_INVITE_FRIEND
:
$task
=
new
IntegralBillTask
(
$data
);
$result
=
Task
::
deliver
(
$task
);
return
$result
?
true
:
false
;
break
;
}
}
//更新用户红包兑换列表
...
...
storage/laravels.json
View file @
75315a6a
This diff is collapsed.
Click to expand it.
storage/laravels.pid
View file @
75315a6a
4820
\ No newline at end of file
3271
\ No newline at end of file
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