Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
go_sku_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ff2853ad
authored
Dec 28, 2020
by
huangchengyi
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into dev
parents
b034541c
347acc91
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
conf/dev/redis.ini
controller/sku_controller.go
routes/router.go
conf/dev/redis.ini
View file @
ff2853ad
...
...
@@ -2,14 +2,14 @@
[default_redis_read]
host
=
192.168.1.235:6379
password
=
icDb29mLy2s
max_idle
=
1
000
max_idle
=
2
000
max_active
=
5000
idle_timeout
=
20
[default_redis_write]
host
=
192.168.1.235:6379
password
=
icDb29mLy2s
max_idle
=
1
000
max_idle
=
2
000
max_active
=
5000
idle_timeout
=
20
...
...
controller/sku_controller.go
View file @
ff2853ad
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
))
}
routes/router.go
View file @
ff2853ad
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment