Commit 869d1cf5 by huangchengyi

1.0

parent 35c626ac
2020-10-13 16:38:11----dddd
\ No newline at end of file
package main
import (
"flag"
"github.com/gin-gonic/gin"
"github.com/micro/go-micro/v2/web"
"go_sku_server/boot"
"go_sku_server/pkg/config"
"go_sku_server/routes"
)
func main() {
var path string
flag.StringVar(&path, "config", "conf", "配置文件")
flag.Parse()
if err := boot.Boot(path); err != nil {
panic(err)
}
gin.SetMode(config.Get("web.mode").String())
r := routes.InitRouter()
port := config.Get("web.port").String()
//web改成micro 就是grpc,并直接注册到etcd里面
service := web.NewService(
web.Name("go.micro.api.http.search"),
web.Handler(r),
web.Address(":"+port),
)
if err := service.Init(); err != nil {
panic(err)
}
if err := service.Run(); err != nil {
panic(err)
}
}
;总配置信息 ;总配置信息
[web] [web]
port = 90004 port = 60005
mode = debug mode = debug
cors_domain = http://bom.liexin.com cors_domain = http://bom.liexin.com
......
...@@ -40,6 +40,7 @@ func Synchronization(ctx *gin.Context) { ...@@ -40,6 +40,7 @@ func Synchronization(ctx *gin.Context) {
common.Output(ctx,1001,"查询型号ID不得为空","") common.Output(ctx,1001,"查询型号ID不得为空","")
return return
} }
//gjson.Parse(string).Array()
GoodsRes := sync.Map{} GoodsRes := sync.Map{}
...@@ -65,7 +66,6 @@ func Synchronization(ctx *gin.Context) { ...@@ -65,7 +66,6 @@ func Synchronization(ctx *gin.Context) {
if len(lyGoodsId) >= goods_slice_count { if len(lyGoodsId) >= goods_slice_count {
common.PrintDebugHtml(ctx,"ly增加协程:") common.PrintDebugHtml(ctx,"ly增加协程:")
common.PrintDebugHtml(ctx,zyGoodsId) common.PrintDebugHtml(ctx,zyGoodsId)
wg.Add(1) wg.Add(1)
go lyService.LyGoodsDetail(lyGoodsId,&wg) go lyService.LyGoodsDetail(lyGoodsId,&wg)
lyGoodsId = lyGoodsId[:0:0] lyGoodsId = lyGoodsId[:0:0]
...@@ -86,7 +86,6 @@ func Synchronization(ctx *gin.Context) { ...@@ -86,7 +86,6 @@ func Synchronization(ctx *gin.Context) {
wg.Add(1) wg.Add(1)
go lyService.LyGoodsDetail(lyGoodsId,&wg) go lyService.LyGoodsDetail(lyGoodsId,&wg)
} }
wg.Wait() wg.Wait()
//异步map最后转成map //异步map最后转成map
...@@ -96,7 +95,6 @@ func Synchronization(ctx *gin.Context) { ...@@ -96,7 +95,6 @@ func Synchronization(ctx *gin.Context) {
temp[s] = v temp[s] = v
return true return true
}) })
common.Output(ctx,0,"查询成功",temp) common.Output(ctx,0,"查询成功",temp)
} }
......
#适用于更新GOSKU代码服务,并且重启代码
#!/bin/bash
Cur_Dir=$(pwd)
echo $Cur_Dir
cd $Cur_Dir
git reset --hard HEAD
git pull origin master
rm -f ${Cur_Dir}"/cmd/http"
export GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go build -o ${Cur_Dir}"/cmd/http/http" ${Cur_Dir}"/cmd/http/http_server.go"
chmod +x ${Cur_Dir}"/cmd/http/http"
chmod +x ${Cur_Dir}"/update.sh"
echo "更新执行成功"
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