coupon

package
v0.6.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package coupon is a generated protocol buffer package.

It is generated from these files:

coupon.proto

It has these top-level messages:

CouponRequest
CouponResponse

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptCouponServiceClient

func AcceptCouponServiceClient(lis net.Listener, x CouponService)

AcceptCouponServiceClient accepts connections on the listener and serves requests for each incoming connection. Accept blocks; the caller typically invokes it in a go statement.

func CheckSign

func CheckSign(sign_str, data, salt string) bool

*

  • 验证签名

func ListenAndServeCouponService

func ListenAndServeCouponService(network, addr string, x CouponService) error

ListenAndServeCouponService listen announces on the local network address laddr and serves the given CouponService implementation.

func NewCouponServiceServer

func NewCouponServiceServer(x CouponService) *rpc.Server

NewCouponServiceServer returns a new CouponService Server.

func RegisterCouponService

func RegisterCouponService(srv *rpc.Server, x CouponService) error

RegisterCouponService publish the given CouponService implementation on the server.

func Sign

func Sign(data string, salt string) string

*

  • 签名

Types

type AvailableReqArg

type AvailableReqArg struct {
	Dbname       string `json:"dbname"`
	UserCouponId string `json:"user_coupon_id"`
	UserId       string `json:"user_id"`
	ProductId    string `json:"product_id"`
}

type AvailableRes

type AvailableRes struct {
	Available bool   `json:"available"`
	Money     string `json:"money"`
	Name      string `json:"name"`
}

func IsAvailable

func IsAvailable(dbname, user_id, product_id, user_coupon_id string, url ...string) (*AvailableRes, error)

*

  • 优惠券是否可用
  • @param data {"user_id":"","product_id":"","coupon_id":""}
  • @param return is_available,name,money,error

type CouponRequest

type CouponRequest struct {
	Data             *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
	Time             *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
	Sign             *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

是否可用请求结构

func (*CouponRequest) GetData

func (m *CouponRequest) GetData() string

func (*CouponRequest) GetSign

func (m *CouponRequest) GetSign() string

func (*CouponRequest) GetTime

func (m *CouponRequest) GetTime() string

func (*CouponRequest) ProtoMessage

func (*CouponRequest) ProtoMessage()

func (*CouponRequest) Reset

func (m *CouponRequest) Reset()

func (*CouponRequest) String

func (m *CouponRequest) String() string

type CouponResponse

type CouponResponse struct {
	Data             *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
	Time             *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
	Sign             *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

是否可用响应结构

func (*CouponResponse) GetData

func (m *CouponResponse) GetData() string

func (*CouponResponse) GetSign

func (m *CouponResponse) GetSign() string

func (*CouponResponse) GetTime

func (m *CouponResponse) GetTime() string

func (*CouponResponse) ProtoMessage

func (*CouponResponse) ProtoMessage()

func (*CouponResponse) Reset

func (m *CouponResponse) Reset()

func (*CouponResponse) String

func (m *CouponResponse) String() string

type CouponService

type CouponService interface {
	IsAvailable(in *CouponRequest, out *CouponResponse) error
	Use(in *CouponRequest, out *CouponResponse) error
}

type CouponServiceClient

type CouponServiceClient struct {
	*rpc.Client
}

func DialCouponService

func DialCouponService(network, addr string) (*CouponServiceClient, *rpc.Client, error)

DialCouponService connects to an CouponService at the specified network address.

func DialCouponServiceTimeout

func DialCouponServiceTimeout(network, addr string,
	timeout time.Duration) (*CouponServiceClient, *rpc.Client, error)

DialCouponServiceTimeout connects to an CouponService at the specified network address.

func NewCouponServiceClient

func NewCouponServiceClient(conn io.ReadWriteCloser) (*CouponServiceClient, *rpc.Client)

NewCouponServiceClient returns a CouponService rpc.Client and stub to handle requests to the set of CouponService at the other end of the connection.

func (*CouponServiceClient) IsAvailable

func (c *CouponServiceClient) IsAvailable(in *CouponRequest, out *CouponResponse) error

func (*CouponServiceClient) Use

type UseReqArg

type UseReqArg struct {
	Dbname       string `json:"dbname"`
	UserCouponId string `json:"user_coupon_id"`
	OrderSn      string `json:"order_sn"`
}

type UseRes

type UseRes struct {
	Success bool
}

func Use

func Use(dbname, user_coupon_id, order_sn string, url ...string) (*UseRes, error)

*

  • 使用优惠券
  • @param data {"user_coupon_id":"","order_sn":""}
  • @param return is_available,name,money,error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL