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
9a9e4eae
authored
Aug 31, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
属性开关
parent
312d652f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
service/service_ly.go
service/service_ly.go
View file @
9a9e4eae
package
service
import
(
"fmt"
"github.com/gin-gonic/gin"
"github.com/gogf/gf/util/gconv"
"github.com/gomodule/redigo/redis"
...
...
@@ -35,6 +36,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
redisConn
.
Close
()
}()
fast
:=
ctx
.
Request
.
FormValue
(
"power[fast]"
)
showAttr
:=
ctx
.
Request
.
FormValue
(
"show_attr"
)
//批量获取商品详情
skuArr
:=
gredis
.
Hmget
(
"default_r"
,
"sku"
,
goodsIds
)
//为了性能着想,这边也先去批量获取spu的信息
...
...
@@ -82,16 +84,23 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
brandId
:=
gjson
.
Get
(
spu
,
"brand_id"
)
.
Int
()
brandName
,
_
:=
redis
.
String
(
redisConn
.
Do
(
"HGET"
,
"brand"
,
brandId
))
sku
.
BrandName
=
brandName
fmt
.
Println
(
showAttr
)
//获取税务信息
if
fast
!=
"1"
{
//仅提供价格和库存
if
sku
.
GoodsName
!=
""
&&
brandId
!=
0
{
sku
.
ErpTax
=
ls
.
GetErpTax
(
sku
.
GoodsName
,
brandName
)
}
sku
.
SupplierName
=
ls
.
GetPoolSupplierName
(
sku
.
SupplierId
)
if
showAttr
==
"1"
{
//获取属性
sku
.
Attrs
=
ls
.
GetSpuAttr
(
sku
.
SpuId
)
}
if
sku
.
Attrs
==
nil
{
sku
.
Attrs
=
[]
interface
{}{}
}
}
//获取供应链标准品牌
//什么是供应链的标准品牌 供应链那边报关的时候要求他们的标准品牌,所以要吧自己的品牌映射上去
...
...
@@ -161,7 +170,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//}
var
TagService
TagsService
sku
.
GoodsTag
=
TagService
.
GetTags
(
sku
.
GoodsId
,
0
)
sku
.
GoodsTag
=
TagService
.
GetTags
(
sku
.
GoodsId
,
0
)
//用spuInfo补全信息
sku
=
ls
.
CombineSup
(
sku
,
spu
)
...
...
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