Commit 4a514dce by wang

返回格式更改

parent 83b2ede0
......@@ -25,3 +25,5 @@ cmd.exe~
/open/redisLock
/tests
/controller/test.go
/regconfig
/cmd/http/regTest
......@@ -8,12 +8,12 @@ import (
)
//过滤
func SkuFilter(remoteData RemoteSkuData,filedStr []string) (data RemoteSkuData) {
remoteData=filterData(remoteData,filedStr)
if(len(remoteData)==0){
func SkuFilter(remoteData RemoteSkuData,filedStr []string) (ArraySkuData) {
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{}{
......
......@@ -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{}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment