Commit aaee156b by mushishixian

修复无法接收post参数的问题

parent 08779c31
......@@ -32,24 +32,30 @@ const goods_slice_count = 10 //每多少个型号id开启一个协程
*/
func CommonController(ctx *gin.Context) map[string]interface{}{
func CommonController(ctx *gin.Context) map[string]interface{} {
common.PrintDebugHeader(ctx) //开启debug调试
zyService := service.ZiyingService{} //实例化自营查询
lyService := service.LyService{} //实例化自营查询
var goodsIdArr []string
//抽取自营 或者联营 goods_id
GoodsIdStr := ctx.Request.FormValue("goods_id")
if GoodsIdStr == "" {
goodsIdMap := ctx.PostFormMap("goods_id")
for _, goodsId := range goodsIdMap {
goodsIdArr = append(goodsIdArr, goodsId)
}
} else {
goodsIdArr = php2go.Explode(",", GoodsIdStr)
}
if len(goodsIdArr) == 0 {
common.Output(ctx, 1001, "查询型号ID不得为空", "")
return nil
}
goodsIdArr := php2go.Explode(",", GoodsIdStr)
//wg := sync.WaitGroup{} //协程
ch := make(chan sync.Map) //管道
p := 0 //总共协程
zyGoodsId := make([]string, 0)
lyGoodsId := make([]string, 0)
for _, goodsId := range goodsIdArr {
......@@ -114,14 +120,14 @@ func CommonController(ctx *gin.Context) map[string]interface{}{
return temp
}
func Synchronization(ctx *gin.Context) {
func Synchronization(ctx *gin.Context) {
res:=CommonController(ctx)
res := CommonController(ctx)
common.Output(ctx, 0, "success", res)
}
func Synchronization1(ctx *gin.Context) {
func Synchronization1(ctx *gin.Context) {
res:=CommonController(ctx)
res := CommonController(ctx)
common.Output(ctx, 0, "success", res)
}
......@@ -134,8 +140,8 @@ func Hbsdata(ctx *gin.Context) {
/*
测试redis
*/
func Testr(ctx *gin.Context) {
*/
func Testr(ctx *gin.Context) {
time1 := time.Now().UnixNano() / 1e6
......@@ -145,11 +151,10 @@ func Testr(ctx *gin.Context) {
}()
goods_ids := ctx.Request.FormValue("goods_ids")
skuArr := gredis.Hmget("default_r", "sku", php2go.Explode(",", goods_ids));
skustr,_ := json.Marshal(skuArr)
skuArr := gredis.Hmget("default_r", "sku", php2go.Explode(",", goods_ids))
skustr, _ := json.Marshal(skuArr)
time2 := time.Now().UnixNano() / 1e6
ctx.String(200, "查询redis开始时间毫秒:"+gconv.String(time1)+" 结束时间毫秒:"+gconv.String(time2)+" 查询时间毫秒:"+gconv.String(time2-time1)+ " "+ string(skustr))
ctx.String(200, "查询redis开始时间毫秒:"+gconv.String(time1)+" 结束时间毫秒:"+gconv.String(time2)+" 查询时间毫秒:"+gconv.String(time2-time1)+" "+string(skustr))
}
......@@ -164,7 +164,6 @@ func (ls *LyService) LyGoodsDetail(ctx *gin.Context, goodsIds []string, ch chan
//用spuInfo补全信息
sku = ls.CombineSup(sku, spu)
//最后一步,将sku的全部信息放到有序map里面
GoodsRes.Store(goodsId, sku)
//(*goodsRes)[goodsId] = A
......
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