Compare commits

...

4 Commits

@ -5,8 +5,15 @@
</component>
<component name="ChangeListManager">
<list default="true" id="b0d18d28-83da-4859-af69-c17746a80875" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/../payment-service/main.go" afterDir="false" />
<change afterPath="$PROJECT_DIR$/jaeger.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/go.mod" afterDir="false" />
<change beforePath="$PROJECT_DIR$/utils.go" beforeDir="false" afterPath="$PROJECT_DIR$/utils.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../payment-service/go.mod" beforeDir="false" afterPath="$PROJECT_DIR$/../payment-service/go.mod" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../payment-service/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/../payment-service/go.sum" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../payment-service/main.go" beforeDir="false" afterPath="$PROJECT_DIR$/../payment-service/main.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../payment-service/proto/trade.pb.go" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/../payment-service/proto/trade.pb.micro.go" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -38,13 +45,29 @@
"WebServerToolWindowFactoryState": "false",
"go.import.settings.migrated": "true",
"go.sdk.automatically.set": "true",
"last_opened_file_path": "E:/msbcode/goshop/payment-service"
"last_opened_file_path": "E:/msbcode/goshop/common"
}
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="E:\msbcode\goshop\common" />
</key>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VgoProject">
<settings-migrated>true</settings-migrated>
</component>

@ -1,10 +1,12 @@
module git.mashibing.com/msb_47094/utils
module git.mashibing.com/msb_47094/common
go 1.19
require (
github.com/go-redis/redis/v8 v8.11.5
github.com/opentracing/opentracing-go v1.2.0
github.com/spf13/viper v1.13.0
github.com/uber/jaeger-client-go v2.30.0+incompatible
gorm.io/driver/mysql v1.4.3
gorm.io/gorm v1.24.0
)
@ -13,6 +15,7 @@ require (
cloud.google.com/go v0.100.2 // indirect
cloud.google.com/go/compute v1.6.1 // indirect
cloud.google.com/go/firestore v1.6.1 // indirect
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
@ -44,6 +47,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
@ -53,6 +57,7 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v2 v2.305.4 // indirect
@ -72,6 +77,7 @@ require (
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
google.golang.org/grpc v1.46.2 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect

@ -0,0 +1,29 @@
package common
import (
"github.com/opentracing/opentracing-go"
jaeger "github.com/uber/jaeger-client-go"
"github.com/uber/jaeger-client-go/config"
"io"
"time"
)
/*
@Auth:ShenZ
@Description: Jaeger
*/
func NewTracer(serviceName string, addr string) (opentracing.Tracer, io.Closer, error) {
cfg := &config.Configuration{
ServiceName: serviceName,
Sampler: &config.SamplerConfig{
Type: jaeger.SamplerTypeConst,
Param: 1,
},
Reporter: &config.ReporterConfig{
BufferFlushInterval: 1 * time.Second,
LogSpans: true,
LocalAgentHostPort: addr,
},
}
return cfg.NewTracer()
}

@ -3,6 +3,7 @@ package common
import (
"math"
"strconv"
"strings"
)
/*
@ -43,6 +44,7 @@ func SQ(in <-chan int) <-chan int {
return out
}
// 转换成int
func ToInt(intput string) int {
//intput := "101010101110110"
c := GetInput(intput)
@ -63,3 +65,21 @@ func ConverToBinary(n int) string {
}
return res
}
// 格式化页面传入的cartIds 方法提取
func SplitToInt32List(str string, sep string) (int32List []int32) {
tempStr := strings.Split(str, sep)
if len(tempStr) > 0 {
for _, item := range tempStr {
if item == "" {
continue
}
val, err := strconv.ParseInt(item, 10, 32)
if err != nil {
continue
}
int32List = append(int32List, int32(val))
}
}
return int32List
}

@ -8,26 +8,123 @@ require (
github.com/smartwalle/alipay/v3 v3.1.8
)
require github.com/go-pay/gopay v1.5.86
require (
git.mashibing.com/msb_47094/shopping-comm v0.0.0-20221111074328-ab1a5ce6768e
github.com/asim/go-micro/plugins/registry/consul/v4 v4.7.0
go-micro.dev/v4 v4.2.1
google.golang.org/grpc v1.46.2
google.golang.org/protobuf v1.28.1
)
require (
cloud.google.com/go v0.100.2 // indirect
cloud.google.com/go/compute v1.6.1 // indirect
cloud.google.com/go/firestore v1.6.1 // indirect
github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bitly/go-simplejson v0.5.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-git/go-git/v5 v5.4.2 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.11.1 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/goccy/go-json v0.9.11 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/hashicorp/consul/api v1.12.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.2.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/serf v0.9.7 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/miekg/dns v1.1.43 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/hashstructure v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/sagikazarmark/crypt v0.6.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/smartwalle/crypto4go v1.0.2 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.13.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
github.com/urfave/cli/v2 v2.3.0 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v2 v2.305.4 // indirect
go.etcd.io/etcd/client/v3 v3.5.4 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/crypto v0.2.0 // indirect
golang.org/x/net v0.2.0 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
google.golang.org/api v0.81.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/driver/mysql v1.4.3 // indirect
gorm.io/gorm v1.24.0 // indirect
)

File diff suppressed because it is too large Load Diff

@ -1,12 +1,20 @@
package main
import (
"context"
"fmt"
common "git.mashibing.com/msb_47094/shopping-comm"
"github.com/asim/go-micro/plugins/registry/consul/v4"
"github.com/gin-gonic/gin"
"github.com/smartwalle/alipay/v3"
"go-micro.dev/v4"
"go-micro.dev/v4/registry"
"io/ioutil"
"log"
"net/http"
"os/exec"
"payment/proto"
"strings"
"time"
)
// 将公钥提供给支付宝(通过支付宝后台上传)对我们请求的数据进行签名验证,我们的代码中将使用私钥对请求数据签名。
@ -23,6 +31,9 @@ var (
//私钥
PrivateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCnWjoZEzvY8ptTb335WY53XnbuEqn7/9+kQ+TPvIEcEKhoAABK4hppDK4ce0kByNWVvhc2MuhHIhdDvWs9Bq5yz/mqOa/I8CV8E0mFVpQBXllfta1ccwAR1MHNU4M/lrGNjkFLNKam+b1808O5pTdrLKoQ0/nKgcWzbNNKmfBGiH0K366up+sAlEHHjfk7BUnoBu/puUpxcxJEuWCr2Ezl9vMUe/s5DxBe+uwH00DqzY8QsjmFssW5bRPxbJfgBoUijZIeccaW52sPAoLE7ceiXCNmhAo1yxmEM4bQDeRxVSjCmc/dKqRux9Uh33jcrG9dMii4Chhht8Pr8EpxWUL9AgMBAAECggEAYsQ3QZE+Yt1bmjRUrpKSKBTSL9NICveJ75I6OffQYtXZ7fcCNS+X0qOvJhQElE8I7qUPYedNep2+CTaDUbLdxdjEShhdjENefAmN/GmKU/xw1rGMLOGaCuv7rMg6z46KHzbzhgT+zdDaag84lhnRySjE/cV8yG0qVqhFUuPjEFyMrY8lb/68P+E3P4Vm+hvdaOe10ayLmYm7YBh4Z7eSdhSxENBs+7dIG37Z2xC6FQRPm5qLrFdP03tianX71ZU/J7yky4HceqW4lIW8g4CSbWlCKewaucvnZ7q449/P/PSIbPr4KxQS8bGooQF6LGYEkRISWpYIQWBSjXvUU7PDaQKBgQDV3Hgwp93FdLU414ArdXzbklzVC3SEKdIXEBmt9s+Ec13I1xPDjM1HFezow4S/aaqi5soYyR6koVvsaXeHk+cNlphgZj6lz+p0BQvCvTrjkRFwSDdlBNuxgaiwZbjjUHZPwO42d3k2kiUwyRNcGIyDyPzo4b19D06VX2JIKdpp+wKBgQDIU8ZfQUj11Zgqx/dqd5XASGtoSQNwZPROJyLFwTMg6okgdevdoWaFgRUttPDRBhdcrtmVq7voJ35xoriKNFCSvkZc8GAVKiYgIGLXNscDKZx1EP5yc9VVbUnnTW4QXBQRB+VcLGmuh1DOPTkP+sEsTZhPM5TTMCX9HxrDtW6tZwKBgQCAlkBaGQTaTbMNC14QQ2Mgbp+MpYeYU8DzhwW5uNXLcMZqFQ/YG1fuLvu0dKLjqHgl3JiVUJAxMqgfvMZW6ZIadHsIM1Hlxt7UhZgtrjOzUq1mkrVj8wjZcPlpnrANVXrdt0ZDz5A9RKBB9hTC4ivSrU2MBPc3M7XvUFu6wheGcwKBgQCCMCeIOiZPVWuZyfDZ6TOSDb53vJOWlJVMwRRRDljK+ID7bodFtqGo+5Wm6aNjRCEko6FWKpBotFnxQb3KW2tNooiZ18Gpn4W9dS6nDLtTK9S5I70o5mxrIyZXQrPXv+9ujgIZ3+cifGAgWBtgbibiQt9MAYqjoPPfRzqem6d82wKBgQCjcqFOK7Ff0bSz6S2PzFLWyHBlrEKXI+9+9N5nS8aFB8uJduu0PqK4CXs6FqbY+6xuZ9Qdhe9j2NXoqZoJyQlb8/aL1etT+/JP0Md9Wi0v9SVnnz6Ci1RmJEjO02Q/xrpphEbK87h7YpNUI4flHR4ZCr9EmXqdXRTuXImUImc3uw=="
ApliClient, _ = alipay.New(APPID, PrivateKey, false)
FindOrderClient = proto.NewFindOrderService("", nil)
UpdateTraderClient = proto.NewUpdateTradeOrderService("", nil)
)
// 初始化的init
@ -30,18 +41,28 @@ func init() {
ApliClient.LoadAppPublicCert(AliAppPublicKey)
ApliClient.LoadAliPayPublicCert(AliPublicKey)
//证书的方式 ApliClient.LoadAliPayRootCert()
//注册中心
consulReg := consul.NewRegistry(func(options *registry.Options) {
options.Addrs = []string{common.ConsulReistStr}
})
rpcServer := micro.NewService(
micro.Name("shop-payment"),
micro.Registry(consulReg),
)
FindOrderClient = proto.NewFindOrderService("trade-order", rpcServer.Client())
UpdateTraderClient = proto.NewUpdateTradeOrderService("trade-order", rpcServer.Client())
}
// 手机端的支付 弹出选择APP 还是 H5
func TradeWapAliPay(c *gin.Context) {
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TradeAppAliPay ")
var pay = alipay.TradeWapPay{}
pay.TotalAmount = "11.0"
pay.OutTradeNo = time.Now().String()
pay.TotalAmount = c.Query("payAmount")
pay.OutTradeNo = c.Query("orderNo")
//支付之后 支付宝回调的API
//pay.ReturnURL = "http://127.0.0.1:8086/return"
pay.NotifyURL = "http://jixa9i.natappfree.cc/return"
pay.Body = "测试APP订单"
pay.NotifyURL = "http://hegf3z.natappfree.cc/return"
pay.Body = "APP订单"
pay.Subject = "商品标题"
res, err := ApliClient.TradeWapPay(pay)
if err != nil {
@ -56,11 +77,11 @@ func TradeWapAliPay(c *gin.Context) {
func TradePageAlipay(c *gin.Context) {
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TradePageAlipay ")
var p = alipay.TradePagePay{}
p.NotifyURL = "http://jixa9i.natappfree.cc/return" //支付异步
p.NotifyURL = "http://hegf3z.natappfree.cc/return" //支付异步
//p.ReturnURL = "http://127.0.0.1:8086/return" //同步
p.Subject = "修正了中文的 Bug"
p.OutTradeNo = time.Now().String()
p.TotalAmount = "10.00"
p.Subject = "商品支付"
p.OutTradeNo = c.Query("orderNo")
p.TotalAmount = c.Query("payAmount")
p.ProductCode = "FAST_INSTANT_TRADE_PAY"
res, err := ApliClient.TradePagePay(p)
if err != nil {
@ -92,17 +113,22 @@ trade_no=2022111722001428310502276237&
auth_app_id=2021000116681444&
receipt_amount=10.00&
point_amount=0.00&
app_id=2021000116681444&buyer_pay_
app_id=2021000116681444&
buyer_pay_amount=10.00&
sign_type=RSA2&
seller_id=2088621954959062
*/
func AliPayNotify(c *gin.Context) {
fmt.Println(" >>>>>>>>>>>>>>>>> AliPayNotify >>>>>>>>>>>>>>>>>")
//获取请求报文的长度
conLen := c.Request.ContentLength
//新建一个字节切片 长度
body := make([]byte, conLen)
n, _ := c.Request.Body.Read(body)
vals := string(body[0:n])
//conLen := c.Request.ContentLength
////新建一个字节切片 长度
//body := make([]byte, conLen)
//n, _ := c.Request.Body.Read(body)
//改进读取的方法
data, _ := ioutil.ReadAll(c.Request.Body)
vals := string(data[0:len(data)])
fmt.Println(vals)
//验证是否支付成功
if strings.Contains(vals, "TRADE_SUCCESS") {
@ -113,11 +139,36 @@ func AliPayNotify(c *gin.Context) {
//out_trade_no=xxxx
if strings.HasPrefix(v, "out_trade_no") {
index := strings.Index(v, "=")
no = v[index+1 : len(v)-1]
no = v[index+1 : len(v)]
}
}
fmt.Println("订单:", no, "成功支付")
//grpc 处理 no
//远程调用 服务
//查询订单详情
req := &proto.FindOrderReq{}
//req.Id =
req.OrderNo = no
obj, err := FindOrderClient.FindOrder(context.TODO(), req)
if err != nil {
log.Println("findOrder err :", err)
//common.RespFail(c.Writer, resp, "查询失败")
}
fmt.Println("findOrder:", obj)
//c.JSON(http.StatusOK, gin.H{"findOrder": "SUCCESS", "Message": obj})
//修改订单
reqUpdate := &proto.AddTradeOrderReq{}
tradeOrder := &proto.TradeOrder{}
tradeOrder.ID = obj.TradeOrder.ID
reqUpdate.TradeOrder = tradeOrder
//订单状态1待支付2已关闭3已支付4已发货5已收货6已完成7已追评
reqUpdate.TradeOrder.OrderStatus = 3
_, err = UpdateTraderClient.UpdateTradeOrder(context.TODO(), reqUpdate)
if err != nil {
log.Println("/UpdateTradeOrder err ", err)
return
}
c.JSON(http.StatusOK, gin.H{"reslut": "SUCCESS", "Message": "修改订单支付成功!"})
}
}

@ -0,0 +1,68 @@
/**
* @Auth:ShenZ
* @Description:
*/
syntax = "proto3"; //
option go_package="./;proto"; //1 2 package
package proto ; //
message TradeOrder {
string serverTime = 1;
string expireTime = 2;
float totalAmount =3;
float productAmount = 4;
float shippingAmount = 5;
float discountAmount = 6;
float payAmount = 7; //resp
//
int32 iD = 8;
bool isDeleted = 9;
int32 orderStatus = 10;
string orderNo = 11;
int32 userId =12 ;
int32 createUser =13;
int32 updateUser =14;
string cancelReason =15;
string createTime =16;
string submitTime =17;
}
//
message FindOrderReq {
string id = 1;
string orderNo = 2;
}
message FindOrderResp {
TradeOrder tradeOrder = 1;
}
//
service FindOrder {
rpc FindOrder (FindOrderReq) returns (FindOrderResp){}
}
message AddTradeOrderReq {
repeated int32 cartIds = 1;
bool isVirtual = 2;
int32 recipientAddressId =3;
TradeOrder tradeOrder = 4;
}
message ProductOrder {
int32 productId = 1;
int32 productSkuId = 2;
string productName = 3;
string productImageUrl = 4;
string skuDescribe =5 ;
int32 quantity =6;
float productPrice =7;
float realPrice =8;
float realAmount =9;
}
message AddTradeOrderResp{
TradeOrder tradeOrder = 1;
repeated ProductOrder products =2;
}
service UpdateTradeOrder {
//rpc
rpc UpdateTradeOrder (AddTradeOrderReq) returns (AddTradeOrderResp){}
}

@ -69,6 +69,8 @@ func main() {
AddTraderClient := proto.NewAddTradeOrderService("trade-order", rpcServer.Client())
UpdateTraderClient := proto.NewUpdateTradeOrderService("trade-order", rpcServer.Client())
FindCartClient := proto.NewFindCartService("shop-cart", rpcServer.Client())
FindOrderClient := proto.NewFindOrderService("trade-order", rpcServer.Client())
//开始拆分 DTM服务
router.POST("/updateCart", func(c *gin.Context) {
@ -213,107 +215,19 @@ func main() {
common.RespOK(c.Writer, resp, "请求成功")
})
//router.POST("/addCart-compensate", func(c *gin.Context) {
// req := &proto.AddCartReq{}
// if err := c.BindJSON(req); err != nil {
// log.Fatalln(err)
// }
// req.Id = CartId
// resp, err = UpdateCartClient.UpdateCart(context.TODO(), req)
// CartId = resp.ID
// if err != nil {
// log.Println("/addCart-compensate err ", err)
// c.JSON(http.StatusOK, gin.H{"dtm_reslut": "FAILURE", "Message": "删除购物车失败!"})
// return
// }
// c.JSON(http.StatusOK, gin.H{"addCart-compensate": "SUCCESS", "Message": "删除购物车成功!"})
//})
//
//router.GET("/addShoppingCart", func(c *gin.Context) {
// number, _ := strconv.Atoi(c.Request.FormValue("number"))
// productId, _ := strconv.Atoi(c.Request.FormValue("productId"))
// productSkuId, _ := strconv.Atoi(c.Request.FormValue("productSkuId"))
// uuid := c.Request.Header["Uuid"][0]
// cc := common.GetInput(uuid)
// out := common.SQ(cc)
// sum := 0
// for o := range out {
// sum += o
// }
// //Token校验
// //拼接请求信息
// tokenReq := &proto.TokenReq{
// Uuid: uuid,
// }
// //响应
// tokenResp, err := GetUserTokenClient.GetUserToken(context.TODO(), tokenReq)
// //拼接请求信息
// respErr := &proto.AddCartResp{}
// if err != nil || tokenResp.IsLogin == false {
// log.Println("GetUserToken err : ", err)
// common.RespFail(c.Writer, respErr, "未登录!")
// return
// }
// log.Println("GetUserToken success : ", tokenResp)
//
// //拼接请求信息
// req := &proto.AddCartReq{
// Number: int32(number),
// ProductId: int32(productId),
// ProductSkuId: int32(productSkuId),
// UserId: int32(sum),
// }
// resp := &proto.AddCartResp{}
// //商品详情
// reqDetail := &proto.ProductDetailReq{
// Id: int32(productId),
// }
// respDetail, err := ShowProductDetailClient.ShowProductDetail(context.TODO(), reqDetail)
// if err != nil {
// log.Println("ShowProductDetail err : ", err)
// common.RespFail(c.Writer, respErr, "查询商品详情失败!")
// return
// }
// if respDetail != nil {
// req.ProductName = respDetail.ProductDetail[0].Name
// req.ProductMainPicture = respDetail.ProductDetail[0].MainPicture
// }
//
// //log.Println(" /ShowProductDetail resp :", respDetail)
// //SKU详情
// reqDetail.Id = req.ProductSkuId
// respSkuDetail, err := ShowDetailSkuClient.ShowDetailSku(context.TODO(), reqDetail)
// //log.Println(" /ShowDetailSku resp :", respSkuDetail)
// //添加购物车 远程调用服务
// //log.Println(" /AddCart req :", req)
//
// if respSkuDetail.ProductSku[0].Stock < req.Number {
// common.RespFail(c.Writer, &proto.AddCartResp{}, "库存不足,添加失败")
// return
// }
// sku := respSkuDetail.ProductSku[0]
// sku.Stock -= req.Number
// Number = req.Number //
// updateSkuReq := &proto.UpdateSkuReq{
// ProductSku: sku,
// }
// resp.ProductSkuSimple = respSkuDetail.ProductSku[0]
// resp.ProductSimple = respDetail.ProductDetail[0]
//
// //全局事务
// gid := shortuuid.New()
// saga := dtmcli.NewSaga(DtmServer, gid).
// Add(QSBusi+"/updateSku", QSBusi+"/updateSku-compensate", updateSkuReq).
// Add(QSBusi+"/addCart", QSBusi+"/addCart-compensate", req)
// err = saga.Submit()
// if err != nil {
// log.Println("saga submit err :", err)
// common.RespFail(c.Writer, resp, "添加失败")
// }
// log.Println(" /saga submit submit :", gid)
// ////writer data message row total field
// common.RespOK(c.Writer, resp, "请求成功")
//})
router.POST("/findOrder", func(c *gin.Context) {
req := &proto.FindOrderReq{}
req.Id = c.PostForm("id")
req.OrderNo = c.PostForm("orderNo")
obj, err := FindOrderClient.FindOrder(context.TODO(), req)
if err != nil {
log.Println("findOrder err :", err)
common.RespFail(c.Writer, resp, "查询失败")
}
fmt.Println("findOrder:", obj)
c.JSON(http.StatusOK, gin.H{"findOrder": "SUCCESS", "Message": obj})
})
service := web.NewService(
web.Address(":6669"),

@ -20,7 +20,7 @@ type TraderOrder struct {
AfterSaleDeadlineTime time.Time `json:"afterSaleDeadlineTime"`
OrderStatus int32 `gorm:"default:1" json:"orderStatus"`
OrderSource int32 `gorm:"default:6" json:"orderSource"`
CancelReason int32 `gorm:"cancel_reason" json:"cancelReason"`
CancelReason string `gorm:"cancel_reason" json:"cancelReason"`
OrderType int32 `gorm:"default:1" json:"orderType"`
CreateUser int32 `gorm:"default:1" json:"createUser"`
CreateTime time.Time `json:"createTime"`

@ -22,6 +22,7 @@ import (
**/
//接口
type ITradeRepository interface {
FindOrder(req *proto.FindOrderReq) (*model.TraderOrder, error)
AddTradeOrder(req *proto.AddTradeOrderReq) (*model.TraderOrder, error)
UpdateTradeOrder(req *proto.AddTradeOrderReq) (*model.TraderOrder, error)
}
@ -69,6 +70,9 @@ func (u *TradeRepository) AddTradeOrder(req *proto.AddTradeOrderReq) (obj *model
// 修改订单
func (u *TradeRepository) UpdateTradeOrder(req *proto.AddTradeOrderReq) (obj *model.TraderOrder, err error) {
trade := model.TraderOrder{}
trade.ID = req.TradeOrder.ID
trade.OrderStatus = req.TradeOrder.OrderStatus
trade.IsDeleted = req.TradeOrder.IsDeleted
trade.UpdateTime = time.Now() //
tb := u.mysqlDB.Model(&model.TraderOrder{}).
Where("id = ?", trade.ID).
@ -79,6 +83,15 @@ func (u *TradeRepository) UpdateTradeOrder(req *proto.AddTradeOrderReq) (obj *mo
return &trade, tb.Error //err
}
func (u *TradeRepository) FindOrder(req *proto.FindOrderReq) (obj *model.TraderOrder, err error) {
id := req.GetId()
no := req.GetOrderNo()
obj = &model.TraderOrder{}
tb := u.mysqlDB.Where("id=? or order_no=?", id, no).Find(obj)
fmt.Println("FindTradeOrder>>>>>>> ", obj)
return obj, tb.Error
}
// 生产 订单号 Y2022 06 27 11 00 53 948 97 103564
//
// 年 月 日 时 分 秒 毫秒 ID 随机数

@ -7,6 +7,7 @@ import (
)
type ITradeOrderService interface {
FindOrder(req *proto.FindOrderReq) (*model.TraderOrder, error)
AddTradeOrder(req *proto.AddTradeOrderReq) (obj *model.TraderOrder, err error)
UpdateTradeOrder(req *proto.AddTradeOrderReq) (obj *model.TraderOrder, err error)
}
@ -28,5 +29,8 @@ func (u *TradeOrderService) AddTradeOrder(req *proto.AddTradeOrderReq) (obj *mod
return u.tradeRepository.AddTradeOrder(req)
}
func (u *TradeOrderService) UpdateTradeOrder(req *proto.AddTradeOrderReq) (obj *model.TraderOrder, err error) {
return u.tradeRepository.AddTradeOrder(req)
return u.tradeRepository.UpdateTradeOrder(req)
}
func (u *TradeOrderService) FindOrder(req *proto.FindOrderReq) (obj *model.TraderOrder, err error) {
return u.tradeRepository.FindOrder(req)
}

@ -3,6 +3,7 @@ package handler
import (
"context"
"fmt"
common "git.mashibing.com/msb_47094/shopping-comm"
"trade-order/domain/service"
"trade-order/proto"
)
@ -35,3 +36,17 @@ func (u *TradeOrderHandler) UpdateTradeOrder(ctx context.Context, req *proto.Add
}
return err
}
func (u *TradeOrderHandler) FindOrder(ctx context.Context, req *proto.FindOrderReq, resp *proto.FindOrderResp) error {
obj, err := u.TradeOrderService.FindOrder(req)
if err != nil {
println(" FindTradeOrder err :", err)
} else {
order := &proto.TradeOrder{}
err := common.SwapToStruct(obj, order)
if err != nil {
fmt.Println("转换失败 ", err)
}
resp.TradeOrder = order
}
return err
}

@ -60,6 +60,9 @@ func main() {
proto.RegisterAddTradeOrderHandler(repcService.Server(), &handler.TradeOrderHandler{tradeService})
//4.注册handler
proto.RegisterUpdateTradeOrderHandler(repcService.Server(), &handler.TradeOrderHandler{tradeService})
//4.注册handler
proto.RegisterFindOrderHandler(repcService.Server(), &handler.TradeOrderHandler{tradeService})
//5.启动服务
if err := repcService.Run(); err != nil {
log.Println("start cart service err :", err)

@ -1915,6 +1915,109 @@ func (x *OrderTotalResp) GetTotalPrice() float32 {
return 0
}
// 查询订单详情
type FindOrderReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
OrderNo string `protobuf:"bytes,2,opt,name=orderNo,proto3" json:"orderNo,omitempty"`
}
func (x *FindOrderReq) Reset() {
*x = FindOrderReq{}
if protoimpl.UnsafeEnabled {
mi := &file_trade_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindOrderReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindOrderReq) ProtoMessage() {}
func (x *FindOrderReq) ProtoReflect() protoreflect.Message {
mi := &file_trade_proto_msgTypes[24]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FindOrderReq.ProtoReflect.Descriptor instead.
func (*FindOrderReq) Descriptor() ([]byte, []int) {
return file_trade_proto_rawDescGZIP(), []int{24}
}
func (x *FindOrderReq) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *FindOrderReq) GetOrderNo() string {
if x != nil {
return x.OrderNo
}
return ""
}
type FindOrderResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TradeOrder *TradeOrder `protobuf:"bytes,1,opt,name=tradeOrder,proto3" json:"tradeOrder,omitempty"`
}
func (x *FindOrderResp) Reset() {
*x = FindOrderResp{}
if protoimpl.UnsafeEnabled {
mi := &file_trade_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindOrderResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindOrderResp) ProtoMessage() {}
func (x *FindOrderResp) ProtoReflect() protoreflect.Message {
mi := &file_trade_proto_msgTypes[25]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FindOrderResp.ProtoReflect.Descriptor instead.
func (*FindOrderResp) Descriptor() ([]byte, []int) {
return file_trade_proto_rawDescGZIP(), []int{25}
}
func (x *FindOrderResp) GetTradeOrder() *TradeOrder {
if x != nil {
return x.TradeOrder
}
return nil
}
var File_trade_proto protoreflect.FileDescriptor
var file_trade_proto_rawDesc = []byte{
@ -2174,62 +2277,74 @@ var file_trade_proto_rawDesc = []byte{
0x63, 0x61, 0x72, 0x74, 0x49, 0x64, 0x73, 0x22, 0x30, 0x0a, 0x0e, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74,
0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0a, 0x74,
0x6f, 0x74, 0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x32, 0x55, 0x0a, 0x0d, 0x41, 0x64, 0x64,
0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x44, 0x0a, 0x0d, 0x41, 0x64,
0x64, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65,
0x72, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64,
0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00,
0x32, 0x5b, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f,
0x72, 0x64, 0x65, 0x72, 0x12, 0x47, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x72,
0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2e, 0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65,
0x71, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x72, 0x61,
0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x49, 0x0a,
0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x72, 0x74, 0x12, 0x3b, 0x0a, 0x0a, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x72, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a,
0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61,
0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x41, 0x0a, 0x08, 0x46, 0x69, 0x6e, 0x64,
0x43, 0x61, 0x72, 0x74, 0x12, 0x35, 0x0a, 0x08, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x61, 0x72, 0x74,
0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x61, 0x72,
0x74, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6e,
0x64, 0x43, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x31, 0x0a, 0x04, 0x50,
0x61, 0x67, 0x65, 0x12, 0x29, 0x0a, 0x04, 0x50, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x5d,
0x0a, 0x11, 0x53, 0x68, 0x6f, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74,
0x61, 0x69, 0x6c, 0x12, 0x48, 0x0a, 0x11, 0x53, 0x68, 0x6f, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65,
0x71, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x51, 0x0a,
0x6f, 0x74, 0x61, 0x6c, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0x38, 0x0a, 0x0c, 0x46, 0x69, 0x6e,
0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x64,
0x65, 0x72, 0x4e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x4e, 0x6f, 0x22, 0x42, 0x0a, 0x0d, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x52, 0x65, 0x73, 0x70, 0x12, 0x31, 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64,
0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2e, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x0a, 0x74, 0x72, 0x61,
0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x32, 0x55, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x54, 0x72,
0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x44, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x54,
0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52,
0x65, 0x71, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x72,
0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x5b,
0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64,
0x65, 0x72, 0x12, 0x47, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x72, 0x61, 0x64,
0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41,
0x64, 0x64, 0x54, 0x72, 0x61, 0x64, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a,
0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x54, 0x72, 0x61, 0x64, 0x65,
0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x49, 0x0a, 0x0a, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x72, 0x74, 0x12, 0x3b, 0x0a, 0x0a, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x43, 0x61, 0x72, 0x74, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x72, 0x74,
0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x41, 0x0a, 0x08, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x61,
0x72, 0x74, 0x12, 0x35, 0x0a, 0x08, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x61, 0x72, 0x74, 0x12, 0x12,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x43, 0x61, 0x72, 0x74, 0x52,
0x65, 0x71, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x43,
0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x31, 0x0a, 0x04, 0x50, 0x61, 0x67,
0x65, 0x12, 0x29, 0x0a, 0x04, 0x50, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x5d, 0x0a, 0x11,
0x53, 0x68, 0x6f, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69,
0x6c, 0x12, 0x48, 0x0a, 0x11, 0x53, 0x68, 0x6f, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50,
0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a,
0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x44,
0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x51, 0x0a, 0x0e, 0x53,
0x68, 0x6f, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x12, 0x3f, 0x0a,
0x0e, 0x53, 0x68, 0x6f, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x12,
0x3f, 0x0a, 0x0e, 0x53, 0x68, 0x6f, 0x77, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b,
0x75, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
0x74, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00,
0x32, 0x52, 0x0a, 0x0d, 0x53, 0x68, 0x6f, 0x77, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x6b,
0x75, 0x12, 0x41, 0x0a, 0x0d, 0x53, 0x68, 0x6f, 0x77, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53,
0x6b, 0x75, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75,
0x63, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x52, 0x65,
0x73, 0x70, 0x22, 0x00, 0x32, 0x43, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x54,
0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x33, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x54,
0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x6f, 0x6b,
0x65, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x6f,
0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x45, 0x0a, 0x09, 0x55, 0x70, 0x64,
0x61, 0x74, 0x65, 0x53, 0x6b, 0x75, 0x12, 0x38, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x53, 0x6b, 0x75, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61,
0x74, 0x65, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00,
0x32, 0x4f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x6f, 0x74, 0x61,
0x6c, 0x12, 0x3e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x6f, 0x74,
0x61, 0x6c, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x22,
0x00, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53,
0x6b, 0x75, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72,
0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x52,
0x0a, 0x0d, 0x53, 0x68, 0x6f, 0x77, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x6b, 0x75, 0x12,
0x41, 0x0a, 0x0d, 0x53, 0x68, 0x6f, 0x77, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x6b, 0x75,
0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x73, 0x70,
0x22, 0x00, 0x32, 0x43, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x54, 0x6f, 0x6b,
0x65, 0x6e, 0x12, 0x33, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x54, 0x6f, 0x6b,
0x65, 0x6e, 0x12, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x6f, 0x6b, 0x65,
0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x45, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74,
0x65, 0x53, 0x6b, 0x75, 0x12, 0x38, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x6b,
0x75, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
0x53, 0x6b, 0x75, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x6b, 0x75, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32, 0x4f,
0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x12,
0x3e, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x6f, 0x74, 0x61, 0x6c,
0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x54, 0x6f,
0x74, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f,
0x72, 0x64, 0x65, 0x72, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x32,
0x45, 0x0a, 0x09, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x38, 0x0a, 0x09,
0x46, 0x69, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x14,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4f, 0x72, 0x64, 0x65, 0x72,
0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -2244,7 +2359,7 @@ func file_trade_proto_rawDescGZIP() []byte {
return file_trade_proto_rawDescData
}
var file_trade_proto_msgTypes = make([]protoimpl.MessageInfo, 25)
var file_trade_proto_msgTypes = make([]protoimpl.MessageInfo, 27)
var file_trade_proto_goTypes = []interface{}{
(*TradeOrder)(nil), // 0: proto.TradeOrder
(*AddTradeOrderReq)(nil), // 1: proto.AddTradeOrderReq
@ -2270,45 +2385,50 @@ var file_trade_proto_goTypes = []interface{}{
(*UpdateSkuResp)(nil), // 21: proto.UpdateSkuResp
(*OrderTotalReq)(nil), // 22: proto.OrderTotalReq
(*OrderTotalResp)(nil), // 23: proto.OrderTotalResp
nil, // 24: proto.Product.LabelListEntry
(*FindOrderReq)(nil), // 24: proto.FindOrderReq
(*FindOrderResp)(nil), // 25: proto.FindOrderResp
nil, // 26: proto.Product.LabelListEntry
}
var file_trade_proto_depIdxs = []int32{
0, // 0: proto.AddTradeOrderReq.tradeOrder:type_name -> proto.TradeOrder
0, // 1: proto.AddTradeOrderResp.tradeOrder:type_name -> proto.TradeOrder
3, // 2: proto.AddTradeOrderResp.products:type_name -> proto.ProductOrder
4, // 3: proto.FindCartResp.shoppingCart:type_name -> proto.ShoppingCart
24, // 4: proto.Product.labelList:type_name -> proto.Product.LabelListEntry
26, // 4: proto.Product.labelList:type_name -> proto.Product.LabelListEntry
9, // 5: proto.PageResp.product:type_name -> proto.Product
12, // 6: proto.ProductDetailResp.productDetail:type_name -> proto.ProductDetail
15, // 7: proto.ProductSkuResp.productSku:type_name -> proto.ProductSku
15, // 8: proto.UpdateSkuReq.productSku:type_name -> proto.ProductSku
1, // 9: proto.AddTradeOrder.AddTradeOrder:input_type -> proto.AddTradeOrderReq
1, // 10: proto.UpdateTradeOrder.UpdateTradeOrder:input_type -> proto.AddTradeOrderReq
5, // 11: proto.UpdateCart.UpdateCart:input_type -> proto.UpdateCartReq
7, // 12: proto.FindCart.FindCart:input_type -> proto.FindCartReq
10, // 13: proto.Page.Page:input_type -> proto.PageReq
13, // 14: proto.ShowProductDetail.ShowProductDetail:input_type -> proto.ProductDetailReq
16, // 15: proto.ShowProductSku.ShowProductSku:input_type -> proto.ProductSkuReq
13, // 16: proto.ShowDetailSku.ShowDetailSku:input_type -> proto.ProductDetailReq
18, // 17: proto.GetUserToken.GetUserToken:input_type -> proto.TokenReq
20, // 18: proto.UpdateSku.UpdateSku:input_type -> proto.UpdateSkuReq
22, // 19: proto.GetOrderTotal.GetOrderTotal:input_type -> proto.OrderTotalReq
2, // 20: proto.AddTradeOrder.AddTradeOrder:output_type -> proto.AddTradeOrderResp
2, // 21: proto.UpdateTradeOrder.UpdateTradeOrder:output_type -> proto.AddTradeOrderResp
6, // 22: proto.UpdateCart.UpdateCart:output_type -> proto.UpdateCartResp
8, // 23: proto.FindCart.FindCart:output_type -> proto.FindCartResp
11, // 24: proto.Page.Page:output_type -> proto.PageResp
14, // 25: proto.ShowProductDetail.ShowProductDetail:output_type -> proto.ProductDetailResp
17, // 26: proto.ShowProductSku.ShowProductSku:output_type -> proto.ProductSkuResp
17, // 27: proto.ShowDetailSku.ShowDetailSku:output_type -> proto.ProductSkuResp
19, // 28: proto.GetUserToken.GetUserToken:output_type -> proto.TokenResp
21, // 29: proto.UpdateSku.UpdateSku:output_type -> proto.UpdateSkuResp
23, // 30: proto.GetOrderTotal.GetOrderTotal:output_type -> proto.OrderTotalResp
20, // [20:31] is the sub-list for method output_type
9, // [9:20] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
0, // 9: proto.FindOrderResp.tradeOrder:type_name -> proto.TradeOrder
1, // 10: proto.AddTradeOrder.AddTradeOrder:input_type -> proto.AddTradeOrderReq
1, // 11: proto.UpdateTradeOrder.UpdateTradeOrder:input_type -> proto.AddTradeOrderReq
5, // 12: proto.UpdateCart.UpdateCart:input_type -> proto.UpdateCartReq
7, // 13: proto.FindCart.FindCart:input_type -> proto.FindCartReq
10, // 14: proto.Page.Page:input_type -> proto.PageReq
13, // 15: proto.ShowProductDetail.ShowProductDetail:input_type -> proto.ProductDetailReq
16, // 16: proto.ShowProductSku.ShowProductSku:input_type -> proto.ProductSkuReq
13, // 17: proto.ShowDetailSku.ShowDetailSku:input_type -> proto.ProductDetailReq
18, // 18: proto.GetUserToken.GetUserToken:input_type -> proto.TokenReq
20, // 19: proto.UpdateSku.UpdateSku:input_type -> proto.UpdateSkuReq
22, // 20: proto.GetOrderTotal.GetOrderTotal:input_type -> proto.OrderTotalReq
24, // 21: proto.FindOrder.FindOrder:input_type -> proto.FindOrderReq
2, // 22: proto.AddTradeOrder.AddTradeOrder:output_type -> proto.AddTradeOrderResp
2, // 23: proto.UpdateTradeOrder.UpdateTradeOrder:output_type -> proto.AddTradeOrderResp
6, // 24: proto.UpdateCart.UpdateCart:output_type -> proto.UpdateCartResp
8, // 25: proto.FindCart.FindCart:output_type -> proto.FindCartResp
11, // 26: proto.Page.Page:output_type -> proto.PageResp
14, // 27: proto.ShowProductDetail.ShowProductDetail:output_type -> proto.ProductDetailResp
17, // 28: proto.ShowProductSku.ShowProductSku:output_type -> proto.ProductSkuResp
17, // 29: proto.ShowDetailSku.ShowDetailSku:output_type -> proto.ProductSkuResp
19, // 30: proto.GetUserToken.GetUserToken:output_type -> proto.TokenResp
21, // 31: proto.UpdateSku.UpdateSku:output_type -> proto.UpdateSkuResp
23, // 32: proto.GetOrderTotal.GetOrderTotal:output_type -> proto.OrderTotalResp
25, // 33: proto.FindOrder.FindOrder:output_type -> proto.FindOrderResp
22, // [22:34] is the sub-list for method output_type
10, // [10:22] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
}
func init() { file_trade_proto_init() }
@ -2605,6 +2725,30 @@ func file_trade_proto_init() {
return nil
}
}
file_trade_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindOrderReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_trade_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FindOrderResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -2612,9 +2756,9 @@ func file_trade_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_trade_proto_rawDesc,
NumEnums: 0,
NumMessages: 25,
NumMessages: 27,
NumExtensions: 0,
NumServices: 11,
NumServices: 12,
},
GoTypes: file_trade_proto_goTypes,
DependencyIndexes: file_trade_proto_depIdxs,
@ -3443,3 +3587,75 @@ var _GetOrderTotal_serviceDesc = grpc.ServiceDesc{
Streams: []grpc.StreamDesc{},
Metadata: "trade.proto",
}
// FindOrderClient is the client API for FindOrder service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type FindOrderClient interface {
FindOrder(ctx context.Context, in *FindOrderReq, opts ...grpc.CallOption) (*FindOrderResp, error)
}
type findOrderClient struct {
cc grpc.ClientConnInterface
}
func NewFindOrderClient(cc grpc.ClientConnInterface) FindOrderClient {
return &findOrderClient{cc}
}
func (c *findOrderClient) FindOrder(ctx context.Context, in *FindOrderReq, opts ...grpc.CallOption) (*FindOrderResp, error) {
out := new(FindOrderResp)
err := c.cc.Invoke(ctx, "/proto.FindOrder/FindOrder", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// FindOrderServer is the server API for FindOrder service.
type FindOrderServer interface {
FindOrder(context.Context, *FindOrderReq) (*FindOrderResp, error)
}
// UnimplementedFindOrderServer can be embedded to have forward compatible implementations.
type UnimplementedFindOrderServer struct {
}
func (*UnimplementedFindOrderServer) FindOrder(context.Context, *FindOrderReq) (*FindOrderResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method FindOrder not implemented")
}
func RegisterFindOrderServer(s *grpc.Server, srv FindOrderServer) {
s.RegisterService(&_FindOrder_serviceDesc, srv)
}
func _FindOrder_FindOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(FindOrderReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(FindOrderServer).FindOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/proto.FindOrder/FindOrder",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(FindOrderServer).FindOrder(ctx, req.(*FindOrderReq))
}
return interceptor(ctx, in, info, handler)
}
var _FindOrder_serviceDesc = grpc.ServiceDesc{
ServiceName: "proto.FindOrder",
HandlerType: (*FindOrderServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "FindOrder",
Handler: _FindOrder_FindOrder_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "trade.proto",
}

@ -693,3 +693,62 @@ type getOrderTotalHandler struct {
func (h *getOrderTotalHandler) GetOrderTotal(ctx context.Context, in *OrderTotalReq, out *OrderTotalResp) error {
return h.GetOrderTotalHandler.GetOrderTotal(ctx, in, out)
}
// Api Endpoints for FindOrder service
func NewFindOrderEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for FindOrder service
type FindOrderService interface {
FindOrder(ctx context.Context, in *FindOrderReq, opts ...client.CallOption) (*FindOrderResp, error)
}
type findOrderService struct {
c client.Client
name string
}
func NewFindOrderService(name string, c client.Client) FindOrderService {
return &findOrderService{
c: c,
name: name,
}
}
func (c *findOrderService) FindOrder(ctx context.Context, in *FindOrderReq, opts ...client.CallOption) (*FindOrderResp, error) {
req := c.c.NewRequest(c.name, "FindOrder.FindOrder", in)
out := new(FindOrderResp)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for FindOrder service
type FindOrderHandler interface {
FindOrder(context.Context, *FindOrderReq, *FindOrderResp) error
}
func RegisterFindOrderHandler(s server.Server, hdlr FindOrderHandler, opts ...server.HandlerOption) error {
type findOrder interface {
FindOrder(ctx context.Context, in *FindOrderReq, out *FindOrderResp) error
}
type FindOrder struct {
findOrder
}
h := &findOrderHandler{hdlr}
return s.Handle(s.NewHandler(&FindOrder{h}, opts...))
}
type findOrderHandler struct {
FindOrderHandler
}
func (h *findOrderHandler) FindOrder(ctx context.Context, in *FindOrderReq, out *FindOrderResp) error {
return h.FindOrderHandler.FindOrder(ctx, in, out)
}

@ -320,5 +320,16 @@ service GetOrderTotal {
}
//
message FindOrderReq {
string id = 1;
string orderNo = 2;
}
message FindOrderResp {
TradeOrder tradeOrder = 1;
}
//
service FindOrder {
rpc FindOrder (FindOrderReq) returns (FindOrderResp){}
}

Loading…
Cancel
Save