Commit 81f6d2b5 by huangchengyi

增加mouser联营

parent a20a53f6
protoc --proto_path=protos --micro_out=protopb/mouser --go_out=protopb/mouser mouser.proto
\ No newline at end of file
package controller
import (
"github.com/gin-gonic/gin"
"search_server/framework/gin_"
"search_server/protopb/mouser"
"search_server/service"
)
func init() {
MouserService := service.NewMouserServiceImpl()
gin_.NewBuilder().WithService(MouserService).
WithEndpoint(MouserGetData(MouserService)).
WithRequest(MouserRequest()).
WithResponse(MouserResponse()).Build("/search/mouser/test", "POST")
}
//处理请求
func MouserGetData(c *service.MouserServiceImpl) gin_.Endpoint {
return func(context *gin.Context, request interface{}) (response interface{}, err error) {
rsp := &mouser.MouserResponse{}
err = c.MouserGetData(context, request.(*mouser.MouserRequest), rsp)
return rsp, err
}
}
//接收请求
func MouserRequest() gin_.EncodeRequestFunc {
return func(context *gin.Context) (i interface{}, e error) {
bReq := &mouser.MouserRequest{}
err := context.BindQuery(bReq) //使用的是query 参数
bReq.GoodsName, _ = context.GetPostForm("goods_name")
if err != nil {
return nil, err
}
return bReq, nil
}
}
//响应请求
func MouserResponse() gin_.DecodeResponseFunc {
return func(context *gin.Context, res interface{}) error {
context.JSON(200, res)
return nil
}
}
...@@ -18,8 +18,10 @@ require ( ...@@ -18,8 +18,10 @@ require (
github.com/jinzhu/gorm v1.9.12 github.com/jinzhu/gorm v1.9.12
github.com/joncalhoun/qson v0.0.0-20170526102502-8a9cab3a62b1 // indirect github.com/joncalhoun/qson v0.0.0-20170526102502-8a9cab3a62b1 // indirect
github.com/mholt/certmagic v0.9.3 // indirect github.com/mholt/certmagic v0.9.3 // indirect
github.com/micro/go-micro v1.16.0
github.com/micro/go-micro/v2 v2.9.0 github.com/micro/go-micro/v2 v2.9.0
github.com/micro/micro/v2 v2.9.1 // indirect github.com/micro/micro/v2 v2.9.1 // indirect
github.com/micro/protoc-gen-micro v1.0.0 // indirect
github.com/prometheus/client_golang v1.5.1 // indirect github.com/prometheus/client_golang v1.5.1 // indirect
github.com/prometheus/common v0.9.1 github.com/prometheus/common v0.9.1
github.com/prometheus/procfs v0.0.11 // indirect github.com/prometheus/procfs v0.0.11 // indirect
...@@ -33,6 +35,7 @@ require ( ...@@ -33,6 +35,7 @@ require (
golang.org/x/sys v0.0.0-20200523222454-059865788121 // indirect golang.org/x/sys v0.0.0-20200523222454-059865788121 // indirect
google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece // indirect google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece // indirect
google.golang.org/grpc v1.29.1 // indirect google.golang.org/grpc v1.29.1 // indirect
google.golang.org/protobuf v1.24.0
gopkg.in/ini.v1 v1.51.0 // indirect gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gopkg.in/olivere/elastic.v5 v5.0.85 gopkg.in/olivere/elastic.v5 v5.0.85
......
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0
// protoc v3.12.3
// source: mouser.proto
package mouser
import (
proto "github.com/golang/protobuf/proto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// This is a compile-time assertion that a sufficiently up-to-date version
// of the legacy proto package is being used.
const _ = proto.ProtoPackageIsVersion4
type MouserRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// @inject_tag: uri:"goods_name"
GoodsName string `protobuf:"bytes,1,opt,name=goods_name,json=goodsName,proto3" json:"goods_name,omitempty"`
}
func (x *MouserRequest) Reset() {
*x = MouserRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MouserRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MouserRequest) ProtoMessage() {}
func (x *MouserRequest) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[0]
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 MouserRequest.ProtoReflect.Descriptor instead.
func (*MouserRequest) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{0}
}
func (x *MouserRequest) GetGoodsName() string {
if x != nil {
return x.GoodsName
}
return ""
}
type ResponseData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// @inject_tag: json:"total"
Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
// @inject_tag: json:"flag"
Flag int32 `protobuf:"varint,2,opt,name=flag,proto3" json:"flag,omitempty"`
// @inject_tag: json:"data"
Data []*GoodsModel `protobuf:"bytes,3,rep,name=data,proto3" json:"data,omitempty"`
}
func (x *ResponseData) Reset() {
*x = ResponseData{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ResponseData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ResponseData) ProtoMessage() {}
func (x *ResponseData) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[1]
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 ResponseData.ProtoReflect.Descriptor instead.
func (*ResponseData) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{1}
}
func (x *ResponseData) GetTotal() int64 {
if x != nil {
return x.Total
}
return 0
}
func (x *ResponseData) GetFlag() int32 {
if x != nil {
return x.Flag
}
return 0
}
func (x *ResponseData) GetData() []*GoodsModel {
if x != nil {
return x.Data
}
return nil
}
type MouserResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// @inject_tag: json:"error_code"
ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
// @inject_tag: json:"error_message"
ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
// @inject_tag: json:"data"
Data *ResponseData `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
}
func (x *MouserResponse) Reset() {
*x = MouserResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MouserResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MouserResponse) ProtoMessage() {}
func (x *MouserResponse) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[2]
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 MouserResponse.ProtoReflect.Descriptor instead.
func (*MouserResponse) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{2}
}
func (x *MouserResponse) GetErrorCode() int32 {
if x != nil {
return x.ErrorCode
}
return 0
}
func (x *MouserResponse) GetErrorMessage() string {
if x != nil {
return x.ErrorMessage
}
return ""
}
func (x *MouserResponse) GetData() *ResponseData {
if x != nil {
return x.Data
}
return nil
}
type OtherAttrs struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
GrossWegiht string `protobuf:"bytes,1,opt,name=gross_wegiht,json=grossWegiht,proto3" json:"gross_wegiht,omitempty"`
}
func (x *OtherAttrs) Reset() {
*x = OtherAttrs{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *OtherAttrs) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*OtherAttrs) ProtoMessage() {}
func (x *OtherAttrs) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[3]
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 OtherAttrs.ProtoReflect.Descriptor instead.
func (*OtherAttrs) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{3}
}
func (x *OtherAttrs) GetGrossWegiht() string {
if x != nil {
return x.GrossWegiht
}
return ""
}
type LadderPrice struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Purchases int64 `protobuf:"varint,1,opt,name=purchases,proto3" json:"purchases,omitempty"`
PriceCn float32 `protobuf:"fixed32,2,opt,name=price_cn,json=priceCn,proto3" json:"price_cn,omitempty"`
PriceUs float32 `protobuf:"fixed32,3,opt,name=price_us,json=priceUs,proto3" json:"price_us,omitempty"`
PriceAc float32 `protobuf:"fixed32,4,opt,name=price_ac,json=priceAc,proto3" json:"price_ac,omitempty"`
}
func (x *LadderPrice) Reset() {
*x = LadderPrice{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *LadderPrice) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*LadderPrice) ProtoMessage() {}
func (x *LadderPrice) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[4]
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 LadderPrice.ProtoReflect.Descriptor instead.
func (*LadderPrice) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{4}
}
func (x *LadderPrice) GetPurchases() int64 {
if x != nil {
return x.Purchases
}
return 0
}
func (x *LadderPrice) GetPriceCn() float32 {
if x != nil {
return x.PriceCn
}
return 0
}
func (x *LadderPrice) GetPriceUs() float32 {
if x != nil {
return x.PriceUs
}
return 0
}
func (x *LadderPrice) GetPriceAc() float32 {
if x != nil {
return x.PriceAc
}
return 0
}
type GoodsModel struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// @inject_tag: json:"other_attrs"
OtherAttrs *OtherAttrs `protobuf:"bytes,1,opt,name=other_attrs,json=otherAttrs,proto3" json:"other_attrs,omitempty"`
// @inject_tag: json:"pick_type"
PickType int64 `protobuf:"varint,2,opt,name=pick_type,json=pickType,proto3" json:"pick_type,omitempty"`
// @inject_tag: json:"barcode"
Barcode string `protobuf:"bytes,3,opt,name=barcode,proto3" json:"barcode,omitempty"`
// @inject_tag: json:"goods_id"
GoodsId string `protobuf:"bytes,4,opt,name=goods_id,json=goodsId,proto3" json:"goods_id,omitempty"`
// @inject_tag: json:"goods_type
GoodsType int64 `protobuf:"varint,5,opt,name=goods_type,json=goodsType,proto3" json:"goods_type,omitempty"`
// @inject_tag: json:"supplier_id"
SupplierId int64 `protobuf:"varint,6,opt,name=supplier_id,json=supplierId,proto3" json:"supplier_id,omitempty"`
// @inject_tag: json:"brand_id"
BrandId int64 `protobuf:"varint,7,opt,name=brand_id,json=brandId,proto3" json:"brand_id,omitempty"`
// @inject_tag: json:"class_id1"
ClassId1 int64 `protobuf:"varint,8,opt,name=class_id1,json=classId1,proto3" json:"class_id1,omitempty"`
// @inject_tag: json:"class_id2"
ClassId2 int64 `protobuf:"varint,9,opt,name=class_id2,json=classId2,proto3" json:"class_id2,omitempty"`
// @inject_tag: json:"goods_name"
GoodsName string `protobuf:"bytes,10,opt,name=goods_name,json=goodsName,proto3" json:"goods_name,omitempty"`
// @inject_tag: json:"status"
Status int64 `protobuf:"varint,11,opt,name=status,proto3" json:"status,omitempty"`
// @inject_tag: json:"encoded"
Encoded string `protobuf:"bytes,12,opt,name=encoded,proto3" json:"encoded,omitempty"`
// @inject_tag: json:"encap"
Encap string `protobuf:"bytes,13,opt,name=encap,proto3" json:"encap,omitempty"`
// @inject_tag: json:"packing"
Packing int64 `protobuf:"varint,14,opt,name=packing,proto3" json:"packing,omitempty"`
// @inject_tag: json:"goods_unit"
GoodsUnit int64 `protobuf:"varint,15,opt,name=goods_unit,json=goodsUnit,proto3" json:"goods_unit,omitempty"`
// @inject_tag: json:"goods_images"
GoodsImages bool `protobuf:"varint,16,opt,name=goods_images,json=goodsImages,proto3" json:"goods_images,omitempty"`
// @inject_tag: json:"pdf"
Pdf string `protobuf:"bytes,17,opt,name=pdf,proto3" json:"pdf,omitempty"`
// @inject_tag: json:"goods_brief"
GoodsBrief string `protobuf:"bytes,18,opt,name=goods_brief,json=goodsBrief,proto3" json:"goods_brief,omitempty"`
// @inject_tag: json:"moq"
Moq int64 `protobuf:"varint,19,opt,name=moq,proto3" json:"moq,omitempty"`
// @inject_tag: json:"mpq"
Mpq int64 `protobuf:"varint,20,opt,name=mpq,proto3" json:"mpq,omitempty"`
// @inject_tag: json:"ladder_price"
LadderPrice []*LadderPrice `protobuf:"bytes,21,rep,name=ladder_price,json=ladderPrice,proto3" json:"ladder_price,omitempty"`
// @inject_tag: json:"update_time"
UpdateTime int64 `protobuf:"varint,22,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
// @inject_tag: json:"sku_name"
SkuName string `protobuf:"bytes,23,opt,name=sku_name,json=skuName,proto3" json:"sku_name,omitempty"`
// @inject_tag: json:"mpl"
Mpl int64 `protobuf:"varint,24,opt,name=mpl,proto3" json:"mpl,omitempty"`
// @inject_tag: json:"stock"
Stock int64 `protobuf:"varint,25,opt,name=stock,proto3" json:"stock,omitempty"`
// @inject_tag: json:"attrs"
Attrs string `protobuf:"bytes,26,opt,name=attrs,proto3" json:"attrs,omitempty"`
// @inject_tag: json:"cost"
Cost string `protobuf:"bytes,27,opt,name=cost,proto3" json:"cost,omitempty"`
// @inject_tag: json:"new_cost"
NewCost string `protobuf:"bytes,28,opt,name=new_cost,json=newCost,proto3" json:"new_cost,omitempty"`
// @inject_tag: json:"supplier_stock"
SupplierStock int64 `protobuf:"varint,29,opt,name=supplier_stock,json=supplierStock,proto3" json:"supplier_stock,omitempty"`
// @inject_tag: json:"self_supplier_type"
SelfSupplierType int64 `protobuf:"varint,30,opt,name=self_supplier_type,json=selfSupplierType,proto3" json:"self_supplier_type,omitempty"`
// @inject_tag: json:"cn_delivery_time"
CnDeliveryTime string `protobuf:"bytes,31,opt,name=cn_delivery_time,json=cnDeliveryTime,proto3" json:"cn_delivery_time,omitempty"`
// @inject_tag: json:"brand_name"
BrandName string `protobuf:"bytes,32,opt,name=brand_name,json=brandName,proto3" json:"brand_name,omitempty"`
// @inject_tag: json:"supplier_name"
SupplierName string `protobuf:"bytes,33,opt,name=supplier_name,json=supplierName,proto3" json:"supplier_name,omitempty"`
GoodsUnitName string `protobuf:"bytes,34,opt,name=goods_unit_name,json=goodsUnitName,proto3" json:"goods_unit_name,omitempty"`
PackingName string `protobuf:"bytes,35,opt,name=packing_name,json=packingName,proto3" json:"packing_name,omitempty"`
MpqUnitName string `protobuf:"bytes,36,opt,name=mpq_unit_name,json=mpqUnitName,proto3" json:"mpq_unit_name,omitempty"`
// @inject_tag: json:"ac_type"
AcType int64 `protobuf:"varint,37,opt,name=ac_type,json=acType,proto3" json:"ac_type,omitempty"`
AllowCoupon int64 `protobuf:"varint,38,opt,name=allow_coupon,json=allowCoupon,proto3" json:"allow_coupon,omitempty"`
ClassId1Name string `protobuf:"bytes,39,opt,name=class_id1_name,json=classId1Name,proto3" json:"class_id1_name,omitempty"`
ClassId2Name string `protobuf:"bytes,40,opt,name=class_id2_name,json=classId2Name,proto3" json:"class_id2_name,omitempty"`
// @inject_tag: json:"otheis_buyr_attrs"
IsBuy int64 `protobuf:"varint,41,opt,name=is_buy,json=isBuy,proto3" json:"is_buy,omitempty"`
// @inject_tag: json:"hk_delivery_type"
HkDeliveryType string `protobuf:"bytes,42,opt,name=hk_delivery_type,json=hkDeliveryType,proto3" json:"hk_delivery_type,omitempty"`
}
func (x *GoodsModel) Reset() {
*x = GoodsModel{}
if protoimpl.UnsafeEnabled {
mi := &file_mouser_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GoodsModel) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GoodsModel) ProtoMessage() {}
func (x *GoodsModel) ProtoReflect() protoreflect.Message {
mi := &file_mouser_proto_msgTypes[5]
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 GoodsModel.ProtoReflect.Descriptor instead.
func (*GoodsModel) Descriptor() ([]byte, []int) {
return file_mouser_proto_rawDescGZIP(), []int{5}
}
func (x *GoodsModel) GetOtherAttrs() *OtherAttrs {
if x != nil {
return x.OtherAttrs
}
return nil
}
func (x *GoodsModel) GetPickType() int64 {
if x != nil {
return x.PickType
}
return 0
}
func (x *GoodsModel) GetBarcode() string {
if x != nil {
return x.Barcode
}
return ""
}
func (x *GoodsModel) GetGoodsId() string {
if x != nil {
return x.GoodsId
}
return ""
}
func (x *GoodsModel) GetGoodsType() int64 {
if x != nil {
return x.GoodsType
}
return 0
}
func (x *GoodsModel) GetSupplierId() int64 {
if x != nil {
return x.SupplierId
}
return 0
}
func (x *GoodsModel) GetBrandId() int64 {
if x != nil {
return x.BrandId
}
return 0
}
func (x *GoodsModel) GetClassId1() int64 {
if x != nil {
return x.ClassId1
}
return 0
}
func (x *GoodsModel) GetClassId2() int64 {
if x != nil {
return x.ClassId2
}
return 0
}
func (x *GoodsModel) GetGoodsName() string {
if x != nil {
return x.GoodsName
}
return ""
}
func (x *GoodsModel) GetStatus() int64 {
if x != nil {
return x.Status
}
return 0
}
func (x *GoodsModel) GetEncoded() string {
if x != nil {
return x.Encoded
}
return ""
}
func (x *GoodsModel) GetEncap() string {
if x != nil {
return x.Encap
}
return ""
}
func (x *GoodsModel) GetPacking() int64 {
if x != nil {
return x.Packing
}
return 0
}
func (x *GoodsModel) GetGoodsUnit() int64 {
if x != nil {
return x.GoodsUnit
}
return 0
}
func (x *GoodsModel) GetGoodsImages() bool {
if x != nil {
return x.GoodsImages
}
return false
}
func (x *GoodsModel) GetPdf() string {
if x != nil {
return x.Pdf
}
return ""
}
func (x *GoodsModel) GetGoodsBrief() string {
if x != nil {
return x.GoodsBrief
}
return ""
}
func (x *GoodsModel) GetMoq() int64 {
if x != nil {
return x.Moq
}
return 0
}
func (x *GoodsModel) GetMpq() int64 {
if x != nil {
return x.Mpq
}
return 0
}
func (x *GoodsModel) GetLadderPrice() []*LadderPrice {
if x != nil {
return x.LadderPrice
}
return nil
}
func (x *GoodsModel) GetUpdateTime() int64 {
if x != nil {
return x.UpdateTime
}
return 0
}
func (x *GoodsModel) GetSkuName() string {
if x != nil {
return x.SkuName
}
return ""
}
func (x *GoodsModel) GetMpl() int64 {
if x != nil {
return x.Mpl
}
return 0
}
func (x *GoodsModel) GetStock() int64 {
if x != nil {
return x.Stock
}
return 0
}
func (x *GoodsModel) GetAttrs() string {
if x != nil {
return x.Attrs
}
return ""
}
func (x *GoodsModel) GetCost() string {
if x != nil {
return x.Cost
}
return ""
}
func (x *GoodsModel) GetNewCost() string {
if x != nil {
return x.NewCost
}
return ""
}
func (x *GoodsModel) GetSupplierStock() int64 {
if x != nil {
return x.SupplierStock
}
return 0
}
func (x *GoodsModel) GetSelfSupplierType() int64 {
if x != nil {
return x.SelfSupplierType
}
return 0
}
func (x *GoodsModel) GetCnDeliveryTime() string {
if x != nil {
return x.CnDeliveryTime
}
return ""
}
func (x *GoodsModel) GetBrandName() string {
if x != nil {
return x.BrandName
}
return ""
}
func (x *GoodsModel) GetSupplierName() string {
if x != nil {
return x.SupplierName
}
return ""
}
func (x *GoodsModel) GetGoodsUnitName() string {
if x != nil {
return x.GoodsUnitName
}
return ""
}
func (x *GoodsModel) GetPackingName() string {
if x != nil {
return x.PackingName
}
return ""
}
func (x *GoodsModel) GetMpqUnitName() string {
if x != nil {
return x.MpqUnitName
}
return ""
}
func (x *GoodsModel) GetAcType() int64 {
if x != nil {
return x.AcType
}
return 0
}
func (x *GoodsModel) GetAllowCoupon() int64 {
if x != nil {
return x.AllowCoupon
}
return 0
}
func (x *GoodsModel) GetClassId1Name() string {
if x != nil {
return x.ClassId1Name
}
return ""
}
func (x *GoodsModel) GetClassId2Name() string {
if x != nil {
return x.ClassId2Name
}
return ""
}
func (x *GoodsModel) GetIsBuy() int64 {
if x != nil {
return x.IsBuy
}
return 0
}
func (x *GoodsModel) GetHkDeliveryType() string {
if x != nil {
return x.HkDeliveryType
}
return ""
}
var File_mouser_proto protoreflect.FileDescriptor
var file_mouser_proto_rawDesc = []byte{
0x0a, 0x0c, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06,
0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x22, 0x2e, 0x0a, 0x0d, 0x4d, 0x6f, 0x75, 0x73, 0x65, 0x72,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x6f,
0x64, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x60, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18,
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04,
0x66, 0x6c, 0x61, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67,
0x12, 0x26, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12,
0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x4d, 0x6f, 0x64,
0x65, 0x6c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x7e, 0x0a, 0x0e, 0x4d, 0x6f, 0x75, 0x73,
0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72,
0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09,
0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72,
0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x28,
0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d,
0x6f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x44, 0x61,
0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x2f, 0x0a, 0x0a, 0x4f, 0x74, 0x68, 0x65,
0x72, 0x41, 0x74, 0x74, 0x72, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x67, 0x72, 0x6f, 0x73, 0x73, 0x5f,
0x77, 0x65, 0x67, 0x69, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x67, 0x72,
0x6f, 0x73, 0x73, 0x57, 0x65, 0x67, 0x69, 0x68, 0x74, 0x22, 0x7c, 0x0a, 0x0b, 0x4c, 0x61, 0x64,
0x64, 0x65, 0x72, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x72, 0x63,
0x68, 0x61, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x75, 0x72,
0x63, 0x68, 0x61, 0x73, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x63, 0x65, 0x5f,
0x63, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x07, 0x70, 0x72, 0x69, 0x63, 0x65, 0x43,
0x6e, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x63, 0x65, 0x5f, 0x75, 0x73, 0x18, 0x03, 0x20,
0x01, 0x28, 0x02, 0x52, 0x07, 0x70, 0x72, 0x69, 0x63, 0x65, 0x55, 0x73, 0x12, 0x19, 0x0a, 0x08,
0x70, 0x72, 0x69, 0x63, 0x65, 0x5f, 0x61, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x07,
0x70, 0x72, 0x69, 0x63, 0x65, 0x41, 0x63, 0x22, 0x9e, 0x0a, 0x0a, 0x0a, 0x47, 0x6f, 0x6f, 0x64,
0x73, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x12, 0x33, 0x0a, 0x0b, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f,
0x61, 0x74, 0x74, 0x72, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x6f,
0x75, 0x73, 0x65, 0x72, 0x2e, 0x4f, 0x74, 0x68, 0x65, 0x72, 0x41, 0x74, 0x74, 0x72, 0x73, 0x52,
0x0a, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x41, 0x74, 0x74, 0x72, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x70,
0x69, 0x63, 0x6b, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08,
0x70, 0x69, 0x63, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x72, 0x63,
0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x72, 0x63, 0x6f,
0x64, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x12, 0x1d, 0x0a,
0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
0x03, 0x52, 0x09, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b,
0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28,
0x03, 0x52, 0x0a, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x12, 0x19, 0x0a,
0x08, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52,
0x07, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x61, 0x73,
0x73, 0x5f, 0x69, 0x64, 0x31, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x6c, 0x61,
0x73, 0x73, 0x49, 0x64, 0x31, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69,
0x64, 0x32, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49,
0x64, 0x32, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x4e, 0x61, 0x6d,
0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28,
0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x63,
0x6f, 0x64, 0x65, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x6e, 0x63, 0x6f,
0x64, 0x65, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x63, 0x61, 0x70, 0x18, 0x0d, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x65, 0x6e, 0x63, 0x61, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x63,
0x6b, 0x69, 0x6e, 0x67, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x70, 0x61, 0x63, 0x6b,
0x69, 0x6e, 0x67, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x75, 0x6e, 0x69,
0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x55, 0x6e,
0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x69, 0x6d, 0x61, 0x67,
0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x49,
0x6d, 0x61, 0x67, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x64, 0x66, 0x18, 0x11, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x70, 0x64, 0x66, 0x12, 0x1f, 0x0a, 0x0b, 0x67, 0x6f, 0x6f, 0x64, 0x73,
0x5f, 0x62, 0x72, 0x69, 0x65, 0x66, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x67, 0x6f,
0x6f, 0x64, 0x73, 0x42, 0x72, 0x69, 0x65, 0x66, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x6f, 0x71, 0x18,
0x13, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x6f, 0x71, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x70,
0x71, 0x18, 0x14, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d, 0x70, 0x71, 0x12, 0x36, 0x0a, 0x0c,
0x6c, 0x61, 0x64, 0x64, 0x65, 0x72, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x15, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4c, 0x61, 0x64, 0x64,
0x65, 0x72, 0x50, 0x72, 0x69, 0x63, 0x65, 0x52, 0x0b, 0x6c, 0x61, 0x64, 0x64, 0x65, 0x72, 0x50,
0x72, 0x69, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x16, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74,
0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x6b, 0x75, 0x5f, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x17, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x6b, 0x75, 0x4e, 0x61, 0x6d, 0x65,
0x12, 0x10, 0x0a, 0x03, 0x6d, 0x70, 0x6c, 0x18, 0x18, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6d,
0x70, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x18, 0x19, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x74, 0x74, 0x72,
0x73, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x74, 0x74, 0x72, 0x73, 0x12, 0x12,
0x0a, 0x04, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f,
0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x65, 0x77, 0x5f, 0x63, 0x6f, 0x73, 0x74, 0x18, 0x1c,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x77, 0x43, 0x6f, 0x73, 0x74, 0x12, 0x25, 0x0a,
0x0e, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x18,
0x1d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x53,
0x74, 0x6f, 0x63, 0x6b, 0x12, 0x2c, 0x0a, 0x12, 0x73, 0x65, 0x6c, 0x66, 0x5f, 0x73, 0x75, 0x70,
0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x03,
0x52, 0x10, 0x73, 0x65, 0x6c, 0x66, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x54, 0x79,
0x70, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x63, 0x6e, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72,
0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6e,
0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a,
0x62, 0x72, 0x61, 0x6e, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x20, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x62, 0x72, 0x61, 0x6e, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x73,
0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x21, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65,
0x12, 0x26, 0x0a, 0x0f, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x67, 0x6f, 0x6f, 0x64, 0x73,
0x55, 0x6e, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x63, 0x6b,
0x69, 0x6e, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x23, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
0x70, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x6d,
0x70, 0x71, 0x5f, 0x75, 0x6e, 0x69, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x24, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0b, 0x6d, 0x70, 0x71, 0x55, 0x6e, 0x69, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12,
0x17, 0x0a, 0x07, 0x61, 0x63, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x25, 0x20, 0x01, 0x28, 0x03,
0x52, 0x06, 0x61, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x6c, 0x6c, 0x6f,
0x77, 0x5f, 0x63, 0x6f, 0x75, 0x70, 0x6f, 0x6e, 0x18, 0x26, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b,
0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x70, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0e, 0x63,
0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x31, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x27, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x31, 0x4e, 0x61, 0x6d,
0x65, 0x12, 0x24, 0x0a, 0x0e, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x32, 0x5f, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x28, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x61, 0x73, 0x73,
0x49, 0x64, 0x32, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x69, 0x73, 0x5f, 0x62, 0x75,
0x79, 0x18, 0x29, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x73, 0x42, 0x75, 0x79, 0x12, 0x28,
0x0a, 0x10, 0x68, 0x6b, 0x5f, 0x64, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x74, 0x79,
0x70, 0x65, 0x18, 0x2a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x68, 0x6b, 0x44, 0x65, 0x6c, 0x69,
0x76, 0x65, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x32, 0x4f, 0x0a, 0x0d, 0x4d, 0x6f, 0x75, 0x73,
0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x4d, 0x6f, 0x75,
0x73, 0x65, 0x72, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12, 0x15, 0x2e, 0x6d, 0x6f, 0x75,
0x73, 0x65, 0x72, 0x2e, 0x4d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x16, 0x2e, 0x6d, 0x6f, 0x75, 0x73, 0x65, 0x72, 0x2e, 0x4d, 0x6f, 0x75, 0x73, 0x65,
0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_mouser_proto_rawDescOnce sync.Once
file_mouser_proto_rawDescData = file_mouser_proto_rawDesc
)
func file_mouser_proto_rawDescGZIP() []byte {
file_mouser_proto_rawDescOnce.Do(func() {
file_mouser_proto_rawDescData = protoimpl.X.CompressGZIP(file_mouser_proto_rawDescData)
})
return file_mouser_proto_rawDescData
}
var file_mouser_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_mouser_proto_goTypes = []interface{}{
(*MouserRequest)(nil), // 0: mouser.MouserRequest
(*ResponseData)(nil), // 1: mouser.ResponseData
(*MouserResponse)(nil), // 2: mouser.MouserResponse
(*OtherAttrs)(nil), // 3: mouser.OtherAttrs
(*LadderPrice)(nil), // 4: mouser.LadderPrice
(*GoodsModel)(nil), // 5: mouser.GoodsModel
}
var file_mouser_proto_depIdxs = []int32{
5, // 0: mouser.ResponseData.data:type_name -> mouser.GoodsModel
1, // 1: mouser.MouserResponse.data:type_name -> mouser.ResponseData
3, // 2: mouser.GoodsModel.other_attrs:type_name -> mouser.OtherAttrs
4, // 3: mouser.GoodsModel.ladder_price:type_name -> mouser.LadderPrice
0, // 4: mouser.MouserService.MouserGetData:input_type -> mouser.MouserRequest
2, // 5: mouser.MouserService.MouserGetData:output_type -> mouser.MouserResponse
5, // [5:6] is the sub-list for method output_type
4, // [4:5] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_mouser_proto_init() }
func file_mouser_proto_init() {
if File_mouser_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_mouser_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MouserRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mouser_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ResponseData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mouser_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MouserResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mouser_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*OtherAttrs); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mouser_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LadderPrice); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mouser_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GoodsModel); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_mouser_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_mouser_proto_goTypes,
DependencyIndexes: file_mouser_proto_depIdxs,
MessageInfos: file_mouser_proto_msgTypes,
}.Build()
File_mouser_proto = out.File
file_mouser_proto_rawDesc = nil
file_mouser_proto_goTypes = nil
file_mouser_proto_depIdxs = nil
}
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: mouser.proto
package mouser
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
import (
context "context"
client "github.com/micro/go-micro/client"
server "github.com/micro/go-micro/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ client.Option
var _ server.Option
// Client API for MouserService service
type MouserService interface {
MouserGetData(ctx context.Context, in *MouserRequest, opts ...client.CallOption) (*MouserResponse, error)
}
type mouserService struct {
c client.Client
name string
}
func NewMouserService(name string, c client.Client) MouserService {
if c == nil {
c = client.NewClient()
}
if len(name) == 0 {
name = "mouser"
}
return &mouserService{
c: c,
name: name,
}
}
func (c *mouserService) MouserGetData(ctx context.Context, in *MouserRequest, opts ...client.CallOption) (*MouserResponse, error) {
req := c.c.NewRequest(c.name, "MouserService.MouserGetData", in)
out := new(MouserResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for MouserService service
type MouserServiceHandler interface {
MouserGetData(context.Context, *MouserRequest, *MouserResponse) error
}
func RegisterMouserServiceHandler(s server.Server, hdlr MouserServiceHandler, opts ...server.HandlerOption) error {
type mouserService interface {
MouserGetData(ctx context.Context, in *MouserRequest, out *MouserResponse) error
}
type MouserService struct {
mouserService
}
h := &mouserServiceHandler{hdlr}
return s.Handle(s.NewHandler(&MouserService{h}, opts...))
}
type mouserServiceHandler struct {
MouserServiceHandler
}
func (h *mouserServiceHandler) MouserGetData(ctx context.Context, in *MouserRequest, out *MouserResponse) error {
return h.MouserServiceHandler.MouserGetData(ctx, in, out)
}
syntax = "proto3";
package mouser;
service MouserService {
rpc MouserGetData(MouserRequest) returns (MouserResponse);
}
message MouserRequest {
// @inject_tag: uri:"goods_name"
string goods_name = 1;
}
message ResponseData{
// @inject_tag: json:"total"
int64 total = 1;
// @inject_tag: json:"flag"
int32 flag = 2;
// @inject_tag: json:"data"
repeated GoodsModel data = 3;
}
message MouserResponse{
// @inject_tag: json:"error_code"
int32 error_code = 1;
// @inject_tag: json:"error_message"
string error_message = 2;
// @inject_tag: json:"data"
ResponseData data = 3;
}
message OtherAttrs {
string gross_wegiht = 1;
}
message LadderPrice {
int64 purchases = 1;
float price_cn = 2;
float price_us = 3;
float price_ac = 4;
}
message GoodsModel {
// @inject_tag: json:"other_attrs"
OtherAttrs other_attrs = 1;
// @inject_tag: json:"pick_type"
int64 pick_type = 2;
// @inject_tag: json:"barcode"
string barcode = 3;
// @inject_tag: json:"goods_id"
string goods_id = 4;
// @inject_tag: json:"goods_type
int64 goods_type = 5;
// @inject_tag: json:"supplier_id"
int64 supplier_id = 6;
// @inject_tag: json:"brand_id"
int64 brand_id = 7;
// @inject_tag: json:"class_id1"
int64 class_id1 = 8;
// @inject_tag: json:"class_id2"
int64 class_id2 = 9;
// @inject_tag: json:"goods_name"
string goods_name = 10;
// @inject_tag: json:"status"
int64 status = 11;
// @inject_tag: json:"encoded"
string encoded = 12;
// @inject_tag: json:"encap"
string encap = 13;
// @inject_tag: json:"packing"
int64 packing = 14;
// @inject_tag: json:"goods_unit"
int64 goods_unit = 15;
// @inject_tag: json:"goods_images"
bool goods_images = 16;
// @inject_tag: json:"pdf"
string pdf = 17;
// @inject_tag: json:"goods_brief"
string goods_brief = 18;
// @inject_tag: json:"moq"
int64 moq = 19;
// @inject_tag: json:"mpq"
int64 mpq = 20;
// @inject_tag: json:"ladder_price"
repeated LadderPrice ladder_price = 21;
// @inject_tag: json:"update_time"
int64 update_time = 22;
// @inject_tag: json:"sku_name"
string sku_name = 23;
// @inject_tag: json:"mpl"
int64 mpl = 24;
// @inject_tag: json:"stock"
int64 stock = 25;
// @inject_tag: json:"attrs"
string attrs = 26;
// @inject_tag: json:"cost"
string cost = 27;
// @inject_tag: json:"new_cost"
string new_cost = 28;
// @inject_tag: json:"supplier_stock"
int64 supplier_stock = 29;
// @inject_tag: json:"self_supplier_type"
int64 self_supplier_type = 30;
// @inject_tag: json:"cn_delivery_time"
string cn_delivery_time = 31;
// @inject_tag: json:"brand_name"
string brand_name = 32;
// @inject_tag: json:"supplier_name"
string supplier_name = 33;
string goods_unit_name = 34;
string packing_name = 35;
string mpq_unit_name = 36;
// @inject_tag: json:"ac_type"
int64 ac_type = 37;
int64 allow_coupon = 38;
string class_id1_name = 39;
string class_id2_name = 40;
// @inject_tag: json:"otheis_buyr_attrs"
int64 is_buy = 41;
// @inject_tag: json:"hk_delivery_type"
string hk_delivery_type = 42;
}
\ No newline at end of file
package service
import (
"context"
"github.com/prometheus/common/log"
"github.com/tidwall/gjson"
"gopkg.in/olivere/elastic.v5"
"os"
"regexp"
"search_server/pkg/es"
"search_server/protopb/mouser"
"strings"
)
//单例
type MouserServiceImpl struct{}
func NewMouserServiceImpl() *MouserServiceImpl {
return &MouserServiceImpl{}
}
//mouser外链请求
func (bs *MouserServiceImpl) MouserGetData(ctx context.Context, req *mouser.MouserRequest, rsp *mouser.MouserResponse) error {
goodsNameSlice := OutLink(req.GoodsName)
if len(goodsNameSlice) == 0 {
rsp.ErrorCode = 1
}
//rsp.Data = goodsNameSlice
return nil
}
//mouser请求外链
func OutLink(goodsName string) []string {
print("nini")
os.Exit(1)
replace, _ := regexp.Compile("[^A-Za-z0-9]+")
goodsName = replace.ReplaceAllString(goodsName, "")
goodsName = strings.ToUpper(goodsName)
query := getTermQuery(goodsName)
source := elastic.NewSearchSource().Query(query)
source = source.From(0).Size(10)
searchRequestStr, _ := elastic.NewSearchRequest().Source(source).Body()
result, err := es.CurlES("lie_spu", searchRequestStr)
//只要其中的goods_name
if err != nil {
log.Error(err)
}
goodsNameList := make([]string, 0)
goodsList := gjson.Get(result, "hits.hits.#._source").Array()
for _, goods := range goodsList {
goodsName := gjson.Get(goods.String(), "auto_goods_name").String()
goodsNameList = append(goodsNameList, goodsName)
}
return goodsNameList
}
\ No newline at end of file
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