Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
ic_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
f17dd9e9
authored
Sep 30, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
商品配置列表返回redis的可用库存
parent
da9e8419
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
app/Http/Controllers/Api/ExchangeSettingsApiController.php
public/js/web/exchangeSettingList.js
app/Http/Controllers/Api/ExchangeSettingsApiController.php
View file @
f17dd9e9
...
...
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
use
App\Http\Requests\ExchangeSettingApiRequest
;
use
App\Http\Services\ExchangeSettingService
;
use
App\Model\RedisModel
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
...
...
@@ -24,7 +25,7 @@ class ExchangeSettingsApiController extends Controller
return
$this
->
apiReturn
(
0
,
'ok'
,
[
'data'
=>
$data
[
'data'
],
'count'
=>
array_get
(
$data
,
'count'
,
0
),
'count'
=>
array_get
(
$data
,
'count'
,
0
),
]);
}
...
...
@@ -33,7 +34,16 @@ class ExchangeSettingsApiController extends Controller
if
(
!
is_array
(
$data
[
'data'
]))
{
return
$data
;
}
$redis
=
new
RedisModel
();
foreach
(
$data
[
'data'
]
as
&
$item
)
{
//获取当前剩余名额
if
(
$item
[
'status'
]
==
1
)
{
$availableStock
=
$redis
->
llen
(
'ic_exchange_settings_'
.
$item
[
'id'
]);
$item
[
'available_stock'
]
=
$availableStock
;
}
else
{
$item
[
'available_stock'
]
=
'已禁用'
;
}
$item
[
'status'
]
=
$item
[
'status'
]
?
'使用中'
:
'已停用'
;
$item
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
,
$item
[
'add_time'
]);
$item
[
'update_time'
]
=
$item
[
'update_time'
]
?
date
(
'Y-m-d H:i:s'
,
$item
[
'update_time'
])
:
'暂无更新'
;
...
...
public/js/web/exchangeSettingList.js
View file @
f17dd9e9
...
...
@@ -33,7 +33,8 @@ layui.use(['table', 'form', 'laydate', 'layer'], function () {
,
{
field
:
'id'
,
title
:
'序号'
}
,
{
field
:
'name'
,
title
:
'商品名称'
}
,
{
field
:
'type'
,
title
:
'商品类型'
,
templet
:
'#type'
}
,
{
field
:
'stock'
,
title
:
'库存'
}
,
{
field
:
'stock'
,
title
:
'名额'
}
,
{
field
:
'available_stock'
,
title
:
'当前可用名额'
}
,
{
field
:
'amount'
,
title
:
'兑换所需金额'
}
,
{
field
:
'status'
,
title
:
'配置状态'
,
templet
:
'#status'
}
,
{
field
:
'update_time'
,
title
:
'配置更新时间'
,
templet
:
'#update_time'
}
...
...
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