Commit 347acc91 by huangchengyi

更新sku

parent bf33586b
......@@ -2,14 +2,14 @@
[default_redis_read]
host = 192.168.1.235:6379
password = icDb29mLy2s
max_idle = 1000
max_idle = 2000
max_active = 5000
idle_timeout = 20
[default_redis_write]
host = 192.168.1.235:6379
password = icDb29mLy2s
max_idle = 1000
max_idle = 2000
max_active = 5000
idle_timeout = 20
......
package controller
import (
"encoding/json"
"github.com/gin-gonic/gin"
"github.com/gogf/gf/util/gconv"
"github.com/syyongx/php2go"
"go_sku_server/pkg/common"
"go_sku_server/pkg/gredis"
"go_sku_server/pkg/logger"
"go_sku_server/service"
"sync"
......@@ -117,3 +120,23 @@ func Synchronization(ctx *gin.Context) {
func Hbsdata(ctx *gin.Context) {
ctx.String(200, "ok")
}
/*
测试redis
*/
func Testr(ctx *gin.Context) {
redisConn := gredis.Conn("search_r")
defer func() {
redisConn.Close()
}()
time1 := time.Now().UnixNano() / 1e6
goods_ids := ctx.Request.FormValue("goods_ids")
skuArr := gredis.Hmget("default_r", "sku", php2go.Explode(",", goods_ids));
skustr,_ := json.Marshal(skuArr)
time2 := time.Now().UnixNano() / 1e6
ctx.String(200, "查询时间毫秒:"+gconv.String(time2-time1)+ " "+ string(skustr))
}
......@@ -22,6 +22,8 @@ func InitRouter() *gin.Engine {
//心跳
r.GET("hbsdata", controller.Hbsdata)
r.POST("hbsdata",controller.Hbsdata)
//测试redis
r.POST("testr",controller.Testr)
//自营SaveSku
r.POST("SaveSku",controller.Error_Middleware(),controller.SaveSku)
......
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