Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wang
/
golang-open-platform
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
4a514dce
authored
Feb 24, 2021
by
wang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
返回格式更改
parent
83b2ede0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
.gitignore
model/filter.go
model/sku_model.go
.gitignore
View file @
4a514dce
...
...
@@ -25,3 +25,5 @@ cmd.exe~
/open/redisLock
/tests
/controller/test.go
/regconfig
/cmd/http/regTest
model/filter.go
View file @
4a514dce
...
...
@@ -8,12 +8,12 @@ import (
)
//过滤
func
SkuFilter
(
remoteData
RemoteSkuData
,
filedStr
[]
string
)
(
data
Remote
SkuData
)
{
remoteData
=
filterData
(
remoteData
,
filedStr
)
if
(
len
(
remoteData
)
==
0
){
func
SkuFilter
(
remoteData
RemoteSkuData
,
filedStr
[]
string
)
(
Array
SkuData
)
{
arraySku
:
=
filterData
(
remoteData
,
filedStr
)
if
(
len
(
arraySku
)
==
0
){
return
nil
}
return
remoteData
return
arraySku
}
/**
...
...
@@ -22,9 +22,13 @@ func SkuFilter(remoteData RemoteSkuData,filedStr []string) (data RemoteSkuData)
@param filterField 需要过滤的字段
@return data 返回新的数据
*/
func
filterData
(
remoteData
RemoteSkuData
,
filterField
[]
string
)(
data
RemoteSkuData
){
func
filterData
(
remoteData
RemoteSkuData
,
filterField
[]
string
)(
ArraySkuData
){
//arraySku:=make([]map[string]interface{},0)
arraySkud
:=
ArraySkuData
{}
for
skuId
,
skuInfo
:=
range
remoteData
{
newItem
:=
make
(
map
[
string
]
interface
{})
/*if _,ok:=skuInfo.(bool);ok{
delete(remoteData,skuId)
continue
...
...
@@ -40,6 +44,7 @@ func filterData(remoteData RemoteSkuData,filterField []string)(data RemoteSkuDat
newItem
[
field
]
=
""
//common.PrintStdout().Printf("skuId:%s,字段:%s 不存在",string(skuId),field)
}
arraySkud
=
append
(
arraySkud
,
newItem
)
}
remoteData
[
skuId
]
=
newItem
}
else
{
//有问题的格式
...
...
@@ -48,7 +53,7 @@ func filterData(remoteData RemoteSkuData,filterField []string)(data RemoteSkuDat
continue
}
}
return
remoteData
return
arraySkud
}
func
filterLadder
(
ladder
interface
{})
interface
{}{
...
...
model/sku_model.go
View file @
4a514dce
...
...
@@ -10,7 +10,7 @@ type QuerySkuCreq struct {
//根据class获取sku列表 返回参数
type
QuerySkuCrsp
struct
{
Count
int
`json:"count"`
SkuData
map
[
string
]
interface
{}
`json:"sku_data"`
SkuData
ArraySkuData
`json:"sku_data"`
PageSize
int
`json:"page_size"`
Page
int
`json:"page"`
}
...
...
@@ -29,9 +29,12 @@ type QuerySkuReq struct {
//根据goodsId获取sku列表 返回参数
type
QuerySkuRsp
struct
{
SkuData
map
[
string
]
interface
{}
`json:"sku_data"`
SkuData
ArraySkuData
`json:"sku_data"`
}
//============end=============
//商详接口返回的数据 data字段
type
RemoteSkuData
map
[
string
]
interface
{}
//
type
ArraySkuData
[]
map
[
string
]
interface
{}
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