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
e754337f
authored
Nov 17, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
在途库存的展示和标签的展示
parent
06c00213
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
1 deletions
model/ly_sku.go
service/service_ly.go
service/service_stock_info.go
service/service_tags.go
model/ly_sku.go
View file @
e754337f
...
...
@@ -93,6 +93,7 @@ type LySku struct {
TariffFormat
string
`json:"tariff_format"`
AbilityLevel
int
`json:"ability_level"`
BrandPack
string
`json:"brand_pack"`
OnwayStock
int
`json:"onway_stock"`
}
type
DiscountRatio
struct
{
...
...
service/service_ly.go
View file @
e754337f
...
...
@@ -170,6 +170,10 @@ func (ls *LyService) LyGoodsDetail(ctx context.Context, params RequestParams, go
if
showStockInfo
==
"1"
&&
sku
.
OldGoodsId
!=
0
{
sku
.
StockInfo
=
ls
.
getStockInfo
(
sku
.
SupplierId
,
sku
.
OldGoodsId
)
}
//获取新的在途库存信息
sku
.
OnwayStock
=
ls
.
getOnwayStock
(
sku
.
GoodsId
)
//格式化为对象返回
if
sku
.
StockInfo
==
nil
{
type
StockInfoResult
struct
{
...
...
service/service_stock_info.go
View file @
e754337f
...
...
@@ -2,20 +2,24 @@ package service
import
(
"go_sku_server/model"
"go_sku_server/pkg/gredis"
"go_sku_server/pkg/logger"
"go_sku_server/pkg/mongo"
"go_sku_server/pkg/vars"
"time"
"github.com/gogf/gf/util/gconv"
"github.com/gomodule/redigo/redis"
"github.com/syyongx/php2go"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
)
//在途库存服务
//
在途库存服务
type
StockInfoService
struct
{
}
// 这个是老的在途库存,基本上就是Digikey用的
func
(
ss
*
LyService
)
getStockInfo
(
supplierId
,
oldGoodsId
int64
)
interface
{}
{
if
!
php2go
.
InArray
(
supplierId
,
vars
.
StockInfoSupplierIds
)
{
return
nil
...
...
@@ -49,3 +53,18 @@ func (ss *LyService) getStockInfo(supplierId, oldGoodsId int64) interface{} {
return
nil
}
// 获取新的在途库存
func
(
ss
*
LyService
)
getOnwayStock
(
goodsId
string
)
int
{
redisConn
:=
gredis
.
Conn
(
"search_r"
)
defer
func
()
{
redisConn
.
Close
()
}()
onWayStockStr
,
_
:=
redis
.
String
(
redisConn
.
Do
(
"HGET"
,
"sku_onway_stock"
,
goodsId
))
if
onWayStockStr
==
""
{
return
0
}
return
gconv
.
Int
(
onWayStockStr
)
}
service/service_tags.go
View file @
e754337f
...
...
@@ -115,6 +115,23 @@ func (ts *TagsService) GetLyTags(sku model.LySku) (goodsTags model.GoodsTag) {
tagNames
=
append
(
tagNames
,
tag
.
String
())
}
}
//还要根据在途库存进行标签
// 针对渠道L0018562,L0018319
// 1.SKU存在在途数量,则SKU增加标签:在途预售
// 2.SKU没有在途数量,但是有库存数量,则SKU增加标签:在库即发
// 3.SKU没有在途数量,也没有库存数量,则两个标签都不需要
// 4.同时存在在途数量和库存数量,则标签为:在途预售
if
sku
.
Canal
==
"L0018562"
||
sku
.
Canal
==
"L0018319"
{
if
sku
.
OnwayStock
>
0
{
tagNames
=
append
(
tagNames
,
"在途预售"
)
}
else
if
sku
.
OnwayStock
==
0
&&
sku
.
Stock
>
0
{
tagNames
=
append
(
tagNames
,
"在库即发"
)
}
else
if
sku
.
Stock
>
0
&&
sku
.
OnwayStock
>
0
{
tagNames
=
append
(
tagNames
,
"在途预售"
)
}
}
//去重tagNames
tagNames
=
removeDuplicateString
(
tagNames
)
goodsTags
.
GoodsTagNames
=
tagNames
...
...
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