Commit 06e7565b by wang

增加images字段接口

parent 01371268
......@@ -51,7 +51,7 @@ func GetSkuListPrice(ctx *gin.Context) {
/**
goods_id 获取sku列表价格库存字段
classParent_id 获取sku列表价格库存字段
*/
func GetClassList(ctx *gin.Context) {
parent_id:= ctx.Request.FormValue("parent_id")
......@@ -64,3 +64,13 @@ func GetClassList(ctx *gin.Context) {
common.NResponse("",0,rsp).OutPut(ctx)
}
/**
用goods_id 获取sku列表图片字段
*/
func GetSkuListImages(ctx *gin.Context) {
req:=&model.QuerySkuReq{}
e.CheckError(model.ValidateBind(ctx,req))
rsp,err:=service.NewSkuService().GetSkuListImages(req)
e.CheckError(err)
common.NResponse("",0,rsp).OutPut(ctx)
}
......@@ -22,6 +22,7 @@ var(
GetSkuListFull ="GetSkuListFull"
GetSkuListPrice ="GetSkuListPrice"
GetClassList ="GetClassList"
GetSkuListImages = "GetSkuListImages"
//redis 表key
openWhiteList ="openWhiteList"//白名单
......@@ -81,7 +82,7 @@ func whiteIp() {
"222.92.21.99",
"192.168.2.72",
"::1",
"119.123.79.225",
"119.123.78.14",
}
/*whiteList:=[]string{
......@@ -119,8 +120,9 @@ func newBusinessList() {
func newWhiteBlack() {
jdWhiteList:=jdToken+"_"+openWhiteList
jdBlackList:=jdToken+"_"+openBlackList
//180.163.220.66
config:=map[string]string{
jdWhiteList:"192.168.2.72 222.92.21.99 192.168.2.129 ::1",
jdWhiteList:"192.168.2.72 222.92.21.99 192.168.2.129 ::1 119.123.79.225 119.123.78.14",
jdBlackList:"::1 ",
}
......@@ -154,9 +156,16 @@ func businessInterfaceList() {
"dayMaxNum":1000000,
"minMaxNum":300,
"totalMaxNum":10000,
},
jdToken+"_"+GetSkuListImages: map[string]interface{}{
"dayMaxNum":1000000,
"minMaxNum":300,
"totalMaxNum":10000,
},
},
/*baiduToken+"_"+getSkuListByClass: map[string]interface{}{
"dayMaxNum":100,
"minMaxNum":500,
......
......@@ -4,8 +4,8 @@ const (
//======================开放平台错误码,81开头========================
//商家配置 811
BUSINESSERR1 = 81105 //读取商家列表 redis错误
BUSINESSERR2 = 81104 //商家不存在 token不存在
BUSINESSERR1 = 81105 //读取商家列表
BUSINESSERR2 = 81104 //商家不存在 redis错误token不存在
BUSINESSERR3 = 81106 //平台没有配置商家列表
//接口配置812
......
......@@ -21,7 +21,13 @@ func BuildDatabaseList() (DatabaseList map[string]BaseDatabase) {
Database: Get("pool_class.database").String(),
Prefix: Get("pool_class.table_prefix").String(),
},
"supp": {
UserName: Get("supp.user_name").String(),
Password: Get("supp.password").String(),
Host: Get("supp.host").String(),
Database: Get("supp.database").String(),
Prefix: Get("supp.table_prefix").String(),
},
}
}
......@@ -24,6 +24,7 @@ func Setup() error {
dataSourceName := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8", userName, password, host, database)
DatabaseConMap[conName], err = xorm.NewEngine("mysql", dataSourceName)
//xorm.NewEngineGroup()
if err != nil {
return e.NewFatalError(err.Error()) //这里返回致命异常
}
......
......@@ -29,6 +29,8 @@ func InitRouter() *gin.Engine {
controller.Open_Middleware("GetSkuListPrice"),controller.GetSkuListPrice)
rsku.GET("/GetClassList",controller.Error_Middleware("sku_query"),
controller.Open_Middleware("GetClassList"),controller.GetClassList)
rsku.GET("/GetSkuListImages",controller.Error_Middleware("sku_query"),
controller.Open_Middleware("GetSkuListImages"),controller.GetSkuListImages)
}
/*//用classId获取sku列表
......
......@@ -21,6 +21,9 @@ func (this *ClassService) GetClassList(parentId int)(rsp []model.QueryClassRsp,e
return
}
func NewClassService()*ClassService{
return &ClassService{}
}
\ No newline at end of file
......@@ -53,7 +53,7 @@ func (this *SkuService)GetSkuListByClass(req *model.QuerySkuCreq) (rsp *model.Qu
return rsp,e.NewApiError("service error",open.REMOTESKUINFO)
}
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","supplier_name",}
"class_id1","class_id2","class_id1_name","class_id2_name","attrs","ladder_price","supplier_name","goods_images",}
//field:=[]string{"spu_id","attrs","supplier_name","goods_images","hk_delivery_time"}
rsp.SkuData=model.SkuFilter(*remoteData,field)
......@@ -72,7 +72,7 @@ func (this *SkuService) GetSkuListFull(req * model.QuerySkuReq)(rsp *model.Query
return rsp,e.NewApiError("service error",open.REMOTESKUINFO)
}
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","supplier_name"}
"class_id1","class_id2","class_id1_name","class_id2_name","attrs","ladder_price","supplier_name","goods_images",}
rsp.SkuData=model.SkuFilter(*remoteData,field)
return
}
......@@ -88,6 +88,19 @@ func (this *SkuService) GetSkuListPrice(req * model.QuerySkuReq)(rsp model.Query
return
}
//获取sku列表 价格库存相关字段
func (this *SkuService) GetSkuListImages(req * model.QuerySkuReq)(rsp model.QuerySkuRsp,err error) {
remoteData,err:=this.getRemoteSku(req.GoodsIds)
if(err!=nil){
common.PrintStdout().Printf(err.Error())
return rsp,e.NewApiError("service error",open.REMOTESKUINFO)
}
field:=[]string{"goods_images"}
rsp.SkuData=model.SkuFilter(*remoteData,field)
return
}
//获取远端商详接口
func (this *SkuService) getRemoteSku(ids string) (remoteData *model.RemoteSkuData,err error){
resStr:=""
......
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