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
685089af
authored
Mar 28, 2022
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
自营品牌切换
parent
139261da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
10 deletions
service/service_zy.go
service/service_zy.go
View file @
685089af
package
service
import
(
"github.com/gin-gonic/gin"
"github.com/iancoleman/orderedmap"
"github.com/syyongx/php2go"
"github.com/tidwall/gjson"
"go_sku_server/model"
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
"strings"
"sync"
"github.com/gin-gonic/gin"
"github.com/iancoleman/orderedmap"
"github.com/syyongx/php2go"
"github.com/tidwall/gjson"
)
type
ZiyingService
struct
{
...
...
@@ -67,7 +68,7 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c
A
.
Set
(
"goods_id"
,
common
.
MyInt64
(
goodsId
))
A
.
Set
(
"goods_type"
,
gjson
.
Get
(
info
,
"goods_type"
)
.
Int
())
//查询总条数
A
.
Set
(
"supplier_id"
,
gjson
.
Get
(
info
,
"supplier_id"
)
.
Int
())
//查询总条数
A
.
Set
(
"brand_id"
,
gjson
.
Get
(
info
,
"brand_id"
)
.
Int
())
//
//
A.Set("brand_id", gjson.Get(info, "brand_id").Int()) //
otherAttrs
:=
gjson
.
Get
(
info
,
"other_attrs"
)
.
String
()
if
otherAttrs
==
""
{
...
...
@@ -101,6 +102,23 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c
classId2Name
=
gjson
.
Get
(
classId2Info
,
"class_name"
)
.
String
()
}
//迁移品牌获取,以前是读的自营品牌库,现在改成了读spu的品牌(其实就是联营品牌)以及获取标准品牌信息
spuId
:=
gjson
.
Get
(
info
,
"spu_id"
)
.
Int
()
var
standardBrand
model
.
StandardBrand
var
brandId
int64
var
brandName
string
if
spuId
!=
0
{
spuStr
,
_
:=
gredis
.
String
(
redisConn
.
Do
(
"HGET"
,
"spu"
,
spuId
))
brandId
=
gjson
.
Get
(
spuStr
,
"brand_id"
)
.
Int
()
brandName
,
_
=
gredis
.
String
(
redisConn
.
Do
(
"HGET"
,
"brand"
,
brandId
))
var
ly
LyService
standardBrand
=
ly
.
GetStandardBrand
(
brandId
)
}
A
.
Set
(
"brand_id"
,
brandId
)
A
.
Set
(
"brand_name"
,
brandName
)
A
.
Set
(
"standard_brand"
,
standardBrand
)
A
.
Set
(
"class_id1"
,
classId1
)
//
A
.
Set
(
"class_id2"
,
classId2
)
//
A
.
Set
(
"class_id1_name"
,
classId1Name
)
//
...
...
@@ -118,6 +136,7 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c
A
.
Set
(
"update_time"
,
gjson
.
Get
(
info
,
"update_time"
)
.
Int
())
//
A
.
Set
(
"sku_name"
,
strings
.
Trim
(
gjson
.
Get
(
info
,
"sku_name"
)
.
String
(),
" "
))
//
A
.
Set
(
"mpl"
,
gjson
.
Get
(
info
,
"mpl"
)
.
Int
())
//
A
.
Set
(
"spu_id"
,
spuId
)
//
//处理库存
A
.
Set
(
"stock"
,
0
)
//默认库存为0
...
...
@@ -150,10 +169,10 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c
}
A
.
Set
(
"cn_delivery_time"
,
cnDeliveryTime
)
// 货期
//查询品牌名称
brand_id
:=
gjson
.
Get
(
info
,
"brand_id"
)
.
Int
()
brand_info
,
_
:=
gredis
.
String
(
redisConn
.
Do
(
"HGET"
,
"Self_Brand"
,
brand_id
))
A
.
Set
(
"brand_name"
,
gjson
.
Get
(
brand_info
,
"brand_name"
)
.
String
())
//
//查询品牌名称
(作废,现在改成读联营的品牌库,之前有关联自营商品到spu_id)
//
brand_id := gjson.Get(info, "brand_id").Int()
//
brand_info, _ := gredis.String(redisConn.Do("HGET", "Self_Brand", brand_id))
// A.Set("brand_name", gjson.Get(brand_info, "brand_name").String())
if
fast
!=
"1"
{
//不是快速查询
// 供应商名称
...
...
@@ -291,7 +310,7 @@ func (qs *ZiyingService) ZyGoodsDetail(ctx *gin.Context, goodsIds []string, ch c
//获取标签信息
var
tagService
TagsService
A
.
Set
(
"goods_tag"
,
tagService
.
GetTags
(
goodsId
,
gjson
.
Get
(
info
,
"self_supplier_type"
)
.
Int
()))
A
.
Set
(
"goods_tag"
,
tagService
.
GetTags
(
goodsId
,
gjson
.
Get
(
info
,
"self_supplier_type"
)
.
Int
()))
//最后写入sync map
(
GoodsRes
)
.
Store
(
goodsId
,
A
)
...
...
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