Commit d3e924d5 by wang

调整错误码和字段筛选

parent 7c3a6c21
......@@ -33,7 +33,7 @@ func GetSkuListFull(ctx *gin.Context) {
e.CheckError(model.ValidateBind(ctx,req))
rsp,err:=service.NewSkuService().GetSkuListFull(req)
e.CheckError(err)
common.NResponse("",200,rsp).OutPut(ctx)
common.NResponse("",0,rsp).OutPut(ctx)
}
/**
......@@ -44,5 +44,5 @@ func GetSkuListPrice(ctx *gin.Context) {
e.CheckError(model.ValidateBind(ctx,req))
rsp,err:=service.NewSkuService().GetSkuListPrice(req)
e.CheckError(err)
common.NResponse("",200,rsp).OutPut(ctx)
common.NResponse("",0,rsp).OutPut(ctx)
}
......@@ -85,12 +85,12 @@ func businessInterfaceList() {
config:=map[string]interface{}{
jdToken+"_"+GetSkuListByClass: map[string]interface{}{
"dayMaxNum":10000000,
"minMaxNum":50,
"minMaxNum":5,
"totalMaxNum":10000,
},
jdToken+"_"+GetSkuListFull: map[string]interface{}{
"dayMaxNum":10000000,
"minMaxNum":50,
"minMaxNum":5,
"totalMaxNum":10000,
},
jdToken+"_"+GetSkuListPrice: map[string]interface{}{
......
......@@ -33,6 +33,8 @@ func filterData(remoteData RemoteSkuData,filterField []string)(data RemoteSkuDat
if(field=="ladder_price"){
newItem[field]=filterLadder(info[field])
}
}else{
common.PrintStdout().Printf("skuId:%s,字段:%s 不存在",string(skuId),field)
}
}
remoteData[skuId]=newItem
......
......@@ -2,28 +2,31 @@ package open
const (
//开放平台错误码
BUSINESSERR1 = 10007505 //读取商家列表 redis错误
BUSINESSERR2 = 10007404 //商家不存在 token不存在
BUSINESSERR3 = 10007406 //平台没有配置商家列表
//======================开放平台错误码,81开头========================
//商家配置 811
BUSINESSERR1 = 81105 //读取商家列表 redis错误
BUSINESSERR2 = 81104 //商家不存在 token不存在
BUSINESSERR3 = 81106 //平台没有配置商家列表
BUSINESSCONFIG1 = 10007407 //读取商家与接口关系 redis错误(openBusinessInterface)
BUSINESSCONFIG2 = 10007408 //平台没有配置 商家与接口关系 (redis hash openBusinessInterface 空)
BUSINESSCONFIG3 = 10007409 //商家没有此接口的权限
//接口配置812
BUSINESSCONFIG1 = 81205 //读取商家与接口关系 redis错误(openBusinessInterface)
BUSINESSCONFIG2 = 81206 //平台没有配置 商家与接口关系 (redis hash openBusinessInterface 空)
BUSINESSCONFIG3 = 812409 //商家没有此接口的权限
WHILTREDISEERR1 = 10008505//白名单读取redis错误
WHILTREDISEERR2 = 10008404//ip不在白名单里面
WHILTREDISEERR3 = 10008406//没有设置白名单
//白名单配置813
WHILTREDISEERR1 = 813505//白名单读取redis错误
WHILTREDISEERR2 = 813404//ip不在白名单里面
WHILTREDISEERR3 = 813406//没有设置白名单
FLOWERR1 = 10009505//流量控制操作 redis错误
FLOWERR3 = 10009406//触发分钟级流量限制
FLOWERR4 = 10009407//触发天级流量限制
//白名单配置814
FLOWERR1 = 814505//流量控制操作 redis错误
FLOWERR3 = 814406//触发分钟级流量限制
FLOWERR4 = 814407//触发天级流量限制
//获取sku错误码
//sku接口===================================== 80开头 获取sku错误码
PARAM1 = 80001 //参数问题(缺失or数据格式不对)
OTHERERROR = 80500 //其他错误,比如读取redis出错
REMOTESKUINFO = 80501 //调用远程商详接口报错
)
......@@ -23,7 +23,7 @@ func (this *Dao) getOpenWhiteList()(whitestr string,err error){
common.PrintStdout().Printf(strconv.Itoa(WHILTREDISEERR1)+":读取redis 白名单错误"+err.Error())
return "",e.NewApiError("white err",WHILTREDISEERR1)
}
return
return whitestr,nil
}
//获取商家列表 openTokenBusinessList
......
......@@ -33,7 +33,7 @@ func (this *SkuService)GetSkuListByClass(req *model.QuerySkuCreq) (rsp *model.Qu
}
if(req.Page>0){
//验证下page是否有效
if(math.Ceil(float64(pageData.Count/rsp.Limit))<float64(pageData.Page)){
if(math.Ceil(float64(pageData.Count/rsp.Limit))<float64(req.Page)){
return nil,e.NewApiError("page invalid",open.PARAM1)
}
mongoOpenSku,err:=dao.GetMongoOpenSku(req.ClassId,req.Page)
......@@ -53,7 +53,8 @@ func (this *SkuService)GetSkuListByClass(req *model.QuerySkuCreq) (rsp *model.Qu
common.PrintStdout().Printf("获取远程商详接口报错 msg:"+err.Error())
return nil,e.NewApiError("service err",open.REMOTESKUINFO)
}
field:=[]string{"goods_id","spu_id","brand_id","brand_name","goods_name", "stock","moq","mpq","class_id1","class_name","attrs","ladder_price",}
field:=[]string{"goods_id","spu_id","brand_id","brand_name","goods_name", "stock","moq","mpq",
"class_id1","class_id2","class_id1_name","class_id2_name","attrs","ladder_price",}
//field:=[]string{"spu_id","attrs","supplier_name","goods_images","hk_delivery_time"}
rsp.SkuData=model.SkuFilter(*remoteData,field)
......@@ -67,7 +68,12 @@ func (this *SkuService) GetSkuListFull(req * model.QuerySkuReq)(rsp *model.Query
//skuIds
rsp=&model.QuerySkuRsp{}
remoteData,err:=this.getRemoteSku(req.GoodsIds)
field:=[]string{"goods_id","spu_id","brand_id","brand_name","goods_name", "stock","moq","mpq","class_id1","class_name","attrs","ladder_price",}
//"class_id1": 10014,
// "class_id2": 10031,
// "class_id1_name": "处理器及微控制器",
// "class_id2_name": "ADI(亚德诺)",
field:=[]string{"goods_id","spu_id","brand_id","brand_name","goods_name", "stock","moq","mpq",
"class_id1","class_id2","class_id1_name","class_id2_name","attrs","ladder_price",}
rsp.SkuData=model.SkuFilter(*remoteData,field)
return
}
......
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