Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
go_sku_server
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
23be8dbd
authored
Nov 18, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
限制库存
parent
e754337f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
service/service_ly.go
service/service_stock_info.go
service/service_ly.go
View file @
23be8dbd
...
@@ -174,6 +174,12 @@ func (ls *LyService) LyGoodsDetail(ctx context.Context, params RequestParams, go
...
@@ -174,6 +174,12 @@ func (ls *LyService) LyGoodsDetail(ctx context.Context, params RequestParams, go
//获取新的在途库存信息
//获取新的在途库存信息
sku
.
OnwayStock
=
ls
.
getOnwayStock
(
sku
.
GoodsId
)
sku
.
OnwayStock
=
ls
.
getOnwayStock
(
sku
.
GoodsId
)
//获取新的限制库存信息
limitStock
:=
ls
.
getLimitStock
(
sku
.
GoodsId
)
if
limitStock
>
0
{
sku
.
Stock
=
int64
(
limitStock
)
}
//格式化为对象返回
//格式化为对象返回
if
sku
.
StockInfo
==
nil
{
if
sku
.
StockInfo
==
nil
{
type
StockInfoResult
struct
{
type
StockInfoResult
struct
{
...
...
service/service_stock_info.go
View file @
23be8dbd
...
@@ -68,3 +68,18 @@ func (ss *LyService) getOnwayStock(goodsId string) int {
...
@@ -68,3 +68,18 @@ func (ss *LyService) getOnwayStock(goodsId string) int {
return
gconv
.
Int
(
onWayStockStr
)
return
gconv
.
Int
(
onWayStockStr
)
}
}
// 获取新的在途库存
func
(
ss
*
LyService
)
getLimitStock
(
goodsId
string
)
int
{
redisConn
:=
gredis
.
Conn
(
"search_r"
)
defer
func
()
{
redisConn
.
Close
()
}()
limitStockStr
,
_
:=
redis
.
String
(
redisConn
.
Do
(
"HGET"
,
"limit_stock"
,
goodsId
))
if
limitStockStr
==
""
{
return
0
}
return
gconv
.
Int
(
limitStockStr
)
}
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