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
01a0b3ba
authored
Aug 21, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复使用$request->all()的问题
parent
34ff923f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
86 additions
and
56 deletions
app/Http/Controllers/ExchangeSettingsController.php
app/Http/Controllers/IntegralBillsController.php
app/Http/Controllers/IntegralsController.php
app/Http/Controllers/UserExchangesController.php
app/Http/Controllers/UserIntegralsController.php
routes/web.php
storage/laravels.json
storage/laravels.pid
app/Http/Controllers/ExchangeSettingsController.php
View file @
01a0b3ba
...
...
@@ -39,8 +39,8 @@ class ExchangeSettingsController extends Controller
*/
public
function
index
(
Request
$request
,
ExchangeSettingFilter
$filter
)
{
$page
=
$request
->
has
(
'page'
)
?
$request
->
page
:
1
;
$page_size
=
$request
->
has
(
'page_size'
)
?
$request
->
page_size
:
10
;
$page
=
$request
->
has
(
'page'
)
?
$request
->
page
:
self
::
DEFAULT_PAGE
;
$page_size
=
$request
->
has
(
'page_size'
)
?
$request
->
page_size
:
self
::
DEFAULT_PAGE_SIZE
;
$settings
=
ExchangeSetting
::
filter
(
$filter
)
->
page
(
$page
,
$page_size
)
...
...
@@ -83,7 +83,14 @@ class ExchangeSettingsController extends Controller
public
function
update
(
Request
$request
)
{
$id
=
$request
->
id
;
$data
=
array_merge
(
$request
->
all
(),
[
'update_time'
=>
time
()]);
$data
=
[
'name'
=>
$request
->
name
,
'amount'
=>
$request
->
amount
,
'stock'
=>
$request
->
stock
,
'type'
=>
$request
->
type
,
'status'
=>
$request
->
status
,
'update_time'
=>
time
(),
];
$res
=
DB
::
table
(
'exchange_settings'
)
->
where
(
'id'
,
$id
)
->
update
(
$data
);
if
(
!
$res
)
{
...
...
@@ -95,6 +102,29 @@ class ExchangeSettingsController extends Controller
}
/**
* 修改配置项是否可用状态
* @param Request $request
* @return array
*/
public
function
updateStatus
(
Request
$request
)
{
$id
=
$request
->
id
;
$status
=
$request
->
status
;
$data
=
[
'status'
=>
$status
,
'update_time'
=>
time
(),
];
$res
=
DB
::
table
(
'exchange_settings'
)
->
where
(
'id'
,
$id
)
->
update
(
$data
);
if
(
$res
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
045
,
'修改配置项可使用状态失败'
);
}
}
/**
* 删除红包配置项
* @param Request $request
* @return array
...
...
app/Http/Controllers/IntegralBillsController.php
View file @
01a0b3ba
...
...
@@ -24,8 +24,8 @@ class IntegralBillsController extends Controller
*/
public
function
index
(
Request
$request
,
IntegralBill
$integralBill
,
IntegralBillFilter
$filter
)
{
$page
=
$request
->
has
(
'page'
)
?
$request
->
page
:
1
;
$pageSize
=
$request
->
has
(
'page_size'
)
?
$request
->
page_size
:
10
;
$page
=
$request
->
has
(
'page'
)
?
$request
->
page
:
self
::
DEFAULT_PAGE
;
$pageSize
=
$request
->
has
(
'page_size'
)
?
$request
->
page_size
:
self
::
DEFAULT_PAGE_SIZE
;
$res
=
$integralBill
->
getIntegralBillList
(
$page
,
$pageSize
,
$filter
);
return
$this
->
Export
(
0
,
'ok'
,
$res
);
...
...
app/Http/Controllers/IntegralsController.php
View file @
01a0b3ba
...
...
@@ -38,8 +38,8 @@ class IntegralsController extends Controller
*/
public
function
index
(
Request
$request
,
IntegralFilter
$filter
)
{
$page
=
$request
->
has
(
'page'
)
?
$request
->
page
:
1
;
$page_size
=
$request
->
has
(
'page_size'
)
?
$request
->
page_size
:
10
;
$page
=
$request
->
has
(
'page'
)
?
$request
->
page
:
self
::
DEFAULT_PAGE
;
$page_size
=
$request
->
has
(
'page_size'
)
?
$request
->
page_size
:
self
::
DEFAULT_PAGE_SIZE
;
$integrals
=
Integral
::
with
(
'integralType:id,name'
)
->
filter
(
$filter
)
...
...
@@ -81,7 +81,13 @@ class IntegralsController extends Controller
public
function
update
(
Request
$request
)
{
$id
=
$request
->
id
;
$data
=
array_merge
(
$request
->
all
(),
[
'update_time'
=>
time
()]);
$data
=
[
'name'
=>
$request
->
name
,
'amount'
=>
$request
->
amount
,
'status'
=>
$request
->
status
,
'daily_limit'
=>
$request
->
daily_limit
,
'update_time'
=>
time
(),
];
$res
=
DB
::
table
(
'integrals'
)
->
where
(
'id'
,
$id
)
->
update
(
$data
);
if
(
!
$res
)
{
...
...
@@ -92,6 +98,29 @@ class IntegralsController extends Controller
}
/**
* 更新红包是否可用状态
* @param Request $request
* @return array
*/
public
function
updateStatus
(
Request
$request
)
{
$id
=
$request
->
id
;
$status
=
$request
->
status
;
$data
=
[
'status'
=>
$status
,
'update_time'
=>
time
(),
];
$res
=
DB
::
table
(
'integrals'
)
->
where
(
'id'
,
$id
)
->
update
(
$data
);
if
(
$res
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
005
,
'修改红包可使用状态失败'
);
}
}
/**
* 批量更改状态
* @param Request $request
* @return array
...
...
app/Http/Controllers/UserExchangesController.php
View file @
01a0b3ba
...
...
@@ -37,8 +37,8 @@ class UserExchangesController extends Controller
*/
public
function
index
(
Request
$request
,
UserExchangeFilter
$filter
)
{
$page
=
$request
->
has
(
'page'
)
?
$request
->
page
:
1
;
$pageSize
=
$request
->
has
(
'page_size'
)
?
$request
->
page_size
:
10
;
$page
=
$request
->
has
(
'page'
)
?
$request
->
page
:
self
::
DEFAULT_PAGE
;
$pageSize
=
$request
->
has
(
'page_size'
)
?
$request
->
page_size
:
self
::
DEFAULT_PAGE_SIZE
;
$userExchanges
=
UserExchange
::
with
([
'exchange_setting'
,
'user_integral'
])
->
filter
(
$filter
)
->
page
(
$page
,
$pageSize
)
...
...
@@ -49,24 +49,6 @@ class UserExchangesController extends Controller
return
$this
->
Export
(
0
,
'ok'
,
[
'data'
=>
$userExchanges
,
'count'
=>
$count
]);
}
/**
* 更新用户兑换红包账单
* @param Request $request
* @return array
*/
public
function
update
(
Request
$request
)
{
$id
=
$request
->
id
;
$data
=
array_merge
(
$request
->
all
(),
[
'update_time'
=>
time
()]);
$res
=
DB
::
table
(
'user_exchanges'
)
->
where
(
'id'
,
$id
)
->
update
(
$data
);
if
(
$res
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
031
,
'更新用户兑换红包信息失败'
);
}
}
/**
* 审核用户的兑换
...
...
app/Http/Controllers/UserIntegralsController.php
View file @
01a0b3ba
...
...
@@ -51,26 +51,30 @@ class UserIntegralsController extends Controller
}
/**
* 更新用户红包
详情
* 更新用户红包
可领取状态
* @param Request $request
* @return array
*/
public
function
update
(
Request
$request
)
public
function
update
Status
(
Request
$request
)
{
$id
=
$request
->
id
;
$data
=
array_merge
(
$request
->
all
(),
[
'update_time'
=>
time
()]);
$status
=
$request
->
status
;
$data
=
[
'status'
=>
$status
,
'update_time'
=>
time
(),
];
$res
=
DB
::
table
(
'user_integrals'
)
->
where
(
'id'
,
$id
)
->
update
(
$data
);
if
(
$res
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
051
,
'修改用户红包
详情
失败'
);
return
$this
->
Export
(
051
,
'修改用户红包
可领取状态
失败'
);
}
}
/**
* 批量修改用户
红包是否领取
* 批量修改用户
是否能够领取红包
* @param Request $request
* @return array
*/
...
...
@@ -92,30 +96,13 @@ class UserIntegralsController extends Controller
}
}
/**
*
修改用户红包的已兑换值
*
单个用户的红包兑换统计信息
* @param Request $request
* @param IntegralBill $integralBill
* @return array
*/
public
function
updateExchangedIntegral
(
Request
$request
)
{
// DB::transaction(function () use ($request) {
$userId
=
$request
->
user_id
;
$exchangeAmount
=
$request
->
exchange_amount
;
$oldAmount
=
DB
::
table
(
'user_integrals'
)
->
where
(
'user_id'
,
$userId
)
->
value
(
'exchanged_integral'
);
$res
=
DB
::
table
(
'user_integrals'
)
->
where
(
'user_id'
,
$userId
)
->
update
([
'exchanged_integral'
=>
$oldAmount
+
$exchangeAmount
,
'update_time'
=>
time
(),
]);
if
(
$res
)
{
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
053
,
'批量修改用户是否可领取红包失败'
);
}
// });
}
public
function
statistics
(
Request
$request
,
IntegralBill
$integralBill
)
{
$userId
=
$request
->
user_id
;
...
...
routes/web.php
View file @
01a0b3ba
...
...
@@ -24,6 +24,7 @@ $router->post('/integrals/list', 'IntegralsController@index');
$router
->
post
(
'/integrals/info'
,
'IntegralsController@show'
);
$router
->
post
(
'/integrals/add'
,
'IntegralsController@create'
);
$router
->
post
(
'/integrals/update'
,
'IntegralsController@update'
);
$router
->
post
(
'/integrals/updateStatus'
,
'IntegralsController@updateStatus'
);
$router
->
post
(
'/integrals/delete'
,
'IntegralsController@destroy'
);
$router
->
post
(
'/integrals/batchUpdateStatus'
,
'IntegralsController@batchUpdateStatus'
);
...
...
@@ -43,7 +44,7 @@ $router->post('/integral_bills/delete', 'IntegralBillsController@destroy');
//用户积分信息
$router
->
post
(
'/user_integrals/info'
,
'UserIntegralsController@show'
);
$router
->
post
(
'/user_integrals/list'
,
'UserIntegralsController@index'
);
$router
->
post
(
'/user_integrals/update
'
,
'UserIntegralsController@update
'
);
$router
->
post
(
'/user_integrals/update
Status'
,
'UserIntegralsController@updateStatus
'
);
$router
->
post
(
'/user_integrals/batchUpdateStatus'
,
'UserIntegralsController@batchUpdateStatus'
);
$router
->
post
(
'/user_integrals/updateExchangedIntegral'
,
'UserIntegralsController@updateExchangedIntegral'
);
$router
->
post
(
'/user_integrals/statistics'
,
'UserIntegralsController@statistics'
);
...
...
@@ -55,6 +56,7 @@ $router->post('/exchange_settings/info', 'ExchangeSettingsController@show');
$router
->
post
(
'/exchange_settings/list'
,
'ExchangeSettingsController@index'
);
$router
->
post
(
'/exchange_settings/add'
,
'ExchangeSettingsController@store'
);
$router
->
post
(
'/exchange_settings/update'
,
'ExchangeSettingsController@update'
);
$router
->
post
(
'/exchange_settings/updateStatus'
,
'ExchangeSettingsController@updateStatus'
);
$router
->
post
(
'/exchange_settings/delete'
,
'ExchangeSettingsController@destroy'
);
$router
->
post
(
'/exchange_settings/batchUpdateStatus'
,
'ExchangeSettingsController@batchUpdateStatus'
);
...
...
storage/laravels.json
View file @
01a0b3ba
This diff is collapsed.
Click to expand it.
storage/laravels.pid
View file @
01a0b3ba
2182
\ No newline at end of file
17991
\ 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