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
f0f76118
authored
Dec 11, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复类型
parent
c6f3f3f1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
model/ly_sku.go
service/service_ly.go
service/service_ly_common.go
model/ly_sku.go
View file @
f0f76118
...
...
@@ -7,7 +7,7 @@ import (
//联营sku结构体
type
LySku
struct
{
LadderPrice
[]
LadderPrice
`json:"-"`
SpuId
int64
`json:"spu_id"`
SpuId
string
`json:"spu_id"`
OldGoodsId
int64
`json:"old_goods_id"`
UpdateTime
int64
`json:"update_time"`
CpTime
int64
`json:"cp_time"`
...
...
@@ -71,7 +71,7 @@ func InitSkuData(sku string) (data LySku) {
goodsSn
:=
gjson
.
Get
(
sku
,
"goods_sn"
)
.
String
()
data
.
GoodsSn
=
goodsSn
spuId
:=
gjson
.
Get
(
sku
,
"spu_id"
)
.
Int
()
spuId
:=
gjson
.
Get
(
sku
,
"spu_id"
)
.
String
()
data
.
SpuId
=
spuId
oldGoodsId
:=
gjson
.
Get
(
sku
,
"old_goods_id"
)
.
Int
()
...
...
service/service_ly.go
View file @
f0f76118
...
...
@@ -9,7 +9,6 @@ import (
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
"sort"
"strconv"
"sync"
)
...
...
@@ -62,8 +61,7 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//A := orderedmap.New()
sku
:=
model
.
InitSkuData
(
skuStr
)
sku
.
GoodsId
=
goodsId
spuIdStr
:=
strconv
.
Itoa
(
int
(
sku
.
SpuId
))
spu
:=
spuList
[
spuIdStr
]
spu
:=
spuList
[
sku
.
SpuId
]
//读取包装字段的缓存
if
sku
.
SupplierId
==
7
{
//sku_raw_map哪里写入(成意写的)
...
...
service/service_ly_common.go
View file @
f0f76118
...
...
@@ -17,6 +17,7 @@ import (
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
_
"gopkg.in/mgo.v2/bson"
"strconv"
"strings"
)
...
...
@@ -95,14 +96,15 @@ type SpuAttr struct {
}
//获取Spu的属性
func
(
ls
*
LyService
)
GetSpuAttr
(
spuId
int64
)
(
attrsResult
interface
{})
{
func
(
ls
*
LyService
)
GetSpuAttr
(
spuId
string
)
(
attrsResult
interface
{})
{
var
spuAttr
SpuAttr
var
attrsList
[]
interface
{}
mongodb
:=
mongo
.
Conn
(
"default"
)
defer
func
()
{
mongodb
.
Close
()
}()
err
:=
mongodb
.
DB
(
"ichunt"
)
.
C
(
"spu_attrs"
)
.
Find
(
bson
.
M
{
"spu_id"
:
spuId
})
.
One
(
&
spuAttr
)
spuIdInt
,
_
:=
strconv
.
Atoi
(
spuId
)
err
:=
mongodb
.
DB
(
"ichunt"
)
.
C
(
"spu_attrs"
)
.
Find
(
bson
.
M
{
"spu_id"
:
spuIdInt
})
.
One
(
&
spuAttr
)
//err := mongo.Conn("default").DB("ichunt").C("spu_attrs").Find(bson.M{"spu_id": spuId}).One(&spuAttr)
if
err
!=
nil
&&
err
!=
mgo
.
ErrNotFound
{
fmt
.
Println
(
"mongodb连接错误:"
)
...
...
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