Commit b034541c by huangchengyi

Merge branch 'dev' of ssh://119.23.72.7:22611/q578953158/go_sku_server into dev

parents bf33586b b18fc6e6
......@@ -10,9 +10,11 @@ cmd.exe~
/bat/logs/
/conf/prod/*.ini
/go.mod
/conf
/logs
/mylogs
/doc/test
/vm.sh
/cmd/http
/doc/spuTest
......@@ -14,4 +14,4 @@ SEARCH_API_MONITOR = 6d0fa85e01a02c39347d011ae973fd21b76c6c7ce582d3ea470c6b65a31
[spu_server]
api_domain = http://localhost:8005
api_domain = http://192.168.2.72:8005
; 比如 sku_save,5000 路径 sku_save 即文件夹是 sku 文件名类似 是save_2020-12-10.log,5000代表队列的容量为5000
[log_config]
1=lysku_save,5000
2=sku_query,5000
3=default_sku,5000
package controller
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/gogf/gf/util/gconv"
......@@ -61,6 +62,7 @@ func SaveSku(ctx *gin.Context) {
common.NResponse(errMsg,code).SetLogHandel(saveLogHandle).OpenParamLog().OutPut(ctx)
}else {//执行成功
res:=saveModel.LySaveResponse{0,"ok",gconv.Int64(skuId)}
fmt.Print("执行成功")
common.NResponse(&res).OutPut(ctx)
}
return
......@@ -94,9 +96,9 @@ func SkuEdit(ctx *gin.Context) {
}
func saveLogHandle(errMsg string) {
logger.Select("sku_save").Error(errMsg)
logger.Select("lysku_save").Error(errMsg)
}
func editLogHandle(errMsg string) {
logger.Select("sku_save").Error(errMsg)
logger.Select("lysku_save").Error(errMsg)
}
......@@ -4,11 +4,7 @@ go 1.14
require (
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd // indirect
github.com/dgraph-io/badger v1.6.2 // indirect
github.com/elliotchance/orderedmap v1.3.0 // indirect
github.com/gin-contrib/cors v1.3.1 // indirect
github.com/gin-gonic/gin v1.6.3
github.com/go-delve/delve v1.5.0 // indirect
github.com/go-ini/ini v1.57.0
github.com/go-sql-driver/mysql v1.5.0
github.com/go-xorm/xorm v0.7.9
......@@ -16,7 +12,6 @@ require (
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/gomodule/redigo v2.0.1-0.20180401191855-9352ab68be13+incompatible
github.com/google/go-dap v0.4.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 // indirect
......@@ -24,52 +19,32 @@ require (
github.com/guonaihong/gout v0.1.3
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0
github.com/ichunt2019/go-rabbitmq v1.0.1
github.com/ichunt2019/log v0.0.0-20201210074003-5f1f31e70d4e
github.com/ichunt2019/log v0.0.0-20201215105603-0792081d6f02
github.com/ichunt2019/logger v1.0.5
github.com/imroc/req v0.3.0
github.com/jasonlvhit/gocron v0.0.1 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/kr/pretty v0.2.0 // indirect
github.com/mattn/go-sqlite3 v2.0.1+incompatible // indirect
github.com/micro/go-micro v1.16.0 // indirect
github.com/micro/go-micro/v2 v2.9.0
github.com/orcaman/concurrent-map v0.0.0-20190826125027-8c72a8bb44f6
github.com/peterh/liner v1.2.1 // indirect
github.com/prometheus/client_golang v1.5.1 // indirect
github.com/prometheus/common v0.10.0 // indirect
github.com/prometheus/procfs v0.0.11 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/semihalev/gin-stats v0.0.0-20180505163755-30fdcbbd3533
github.com/sirupsen/logrus v1.7.0
github.com/smartystreets/assertions v1.0.1 // indirect
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/spf13/cobra v1.1.1 // indirect
github.com/stretchr/testify v1.5.1 // indirect
github.com/syyongx/php2go v0.9.4
github.com/tidwall/gjson v1.6.1
github.com/tidwall/sjson v1.1.1
github.com/uniplaces/carbon v0.1.6 // indirect
go.etcd.io/bbolt v1.3.4 // indirect
go.mongodb.org/mongo-driver v1.3.5 // indirect
go.starlark.net v0.0.0-20201204201740-42d4f566359b // indirect
go.uber.org/zap v1.14.1 // indirect
golang.org/x/arch v0.0.0-20201207015849-377592649dd6 // indirect
golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361 // indirect
golang.org/x/text v0.3.3 // indirect
google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece // indirect
google.golang.org/grpc v1.29.1 // indirect
google.golang.org/protobuf v1.24.0 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gopkg.in/olivere/elastic.v5 v5.0.85
gopkg.in/yaml.v2 v2.4.0 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
xorm.io/core v0.7.2-0.20190928055935-90aeac8d08eb // indirect
)
replace google.golang.org/grpc => google.golang.org/grpc v1.26.0
......@@ -27,7 +27,7 @@ type LySaveRequest struct {
GoodsSn string `json:"goods_sn" form:"goods_sn" ` //供应商自己的唯一标识码
Encap string `json:"encap" form:"encap" ` //封装 所属spu
Pdf string `json:"pdf" form:"pdf" ` //PDF地址 所属spu
SpuBrief int `json:"spu_brief" form:"spu_brief" `//简短描述 所属spu
SpuBrief string `json:"spu_brief" form:"spu_brief" `//简短描述 所属spu
Attrs map[string]OneAttrs `json:"attrs" form:"attrs" ` //商品参数 所属spu
}
......
......@@ -5,13 +5,13 @@ import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/gogf/gf/util/gconv"
"github.com/guonaihong/gout"
"github.com/syyongx/php2go"
"go_sku_server/model"
"go_sku_server/model/saveModel"
"go_sku_server/pkg/common"
"go_sku_server/pkg/config"
"go_sku_server/pkg/e"
"github.com/guonaihong/gout"
"go_sku_server/pkg/logger"
"go_sku_server/pkg/mysql"
"reflect"
"sort"
......@@ -80,12 +80,14 @@ func (S *LySaveService)SaveSku(lySaveRequest saveModel.LySaveRequest,ctx *gin.Co
if(err!=nil){
return e.NewApiError("skuSave 修改sku失败"+err.Error()),""
}
return nil,lySkuEntity.GoodsId
}else{//插入sku
err,skuId:=S.insert(lySkuEntity,lySaveRequest)
if(err!=nil){
return e.NewApiError("skuSave insert sku失败"+err.Error()),""
}
logger.Select("lysku_save").Info("新增完成:brand_name:"+lySaveRequest.BrandName+";sku_id:"+skuId+";good_name:"+lySaveRequest.GoodsName)
return nil, skuId
}
......@@ -182,7 +184,8 @@ func (S *LySaveService) spuHandle(lySpuRequest saveModel.LySpuRequest,lySkuEntit
lySpuResponse:=saveModel.LySpuResponse{}
err:=gout.POST(config.Get("spu_server.api_domain").String()+"/saveSpu").Debug(false).SetJSON(&lySpuRequest).BindJSON(&lySpuResponse).Do()
//err:=gout.POST(config.Get("spu_server.api_domain").String()+"/saveSpu1").Debug(false).SetJSON(&lySpuRequest).BindJSON(&lySpuResponse).Do()
err:=gout.POST("http://192.168.1.237:8005/saveSpu").Debug(false).SetJSON(&lySpuRequest).BindJSON(&lySpuResponse).Do()
if(err!=nil){
return e.NewApiError("调用spu server saveSpu接口报错"+err.Error())
......@@ -227,10 +230,12 @@ func (S *LySaveService) update(lySkuEntity saveModel.LySkuEntity,lySaveRequest s
}
if(affected<=0){//没有什么可以修改的,直接完成就好了
fmt.Println("没什么可以修改的")
logger.Select("lysku_save").Info("不需要修改:brand_name:"+lySaveRequest.BrandName+";sku_id:"+lySkuEntity.GoodsId+";good_name:"+lySaveRequest.GoodsName)
return nil
}else{
err=S.skuCacheSave(false,lySkuEntity.GoodsId,lySkuEntity,lySaveRequest)
if (err != nil) {
logger.Select("lysku_save").Info("修改完成:brand_name:"+lySaveRequest.BrandName+";sku_id:"+lySkuEntity.GoodsId+";good_name:"+lySaveRequest.GoodsName)
return e.NewApiError("缓存处理失败"+err.Error())
}
}
......
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