kashangwl

package
v1.0.215 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSuccess = "ok"
)
View Source
const (
	LogTable = "kashangwl"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiBuyResponse added in v1.0.44

type ApiBuyResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		OrderId      string `json:"order_id"`      // 订单号
		ProductPrice string `json:"product_price"` // 商品价格
		TotalPrice   string `json:"total_price"`   // 总支付价格
		RechargeUrl  string `json:"recharge_url"`  // 卡密充值网址
		State        int    `json:"state"`         // 订单状态(100:等待发货,101:正在充值,200:交易成功,500:交易失败,501:未知状态)
		Cards        []struct {
			CardNo       string `json:"card_no"`
			CardPassword string `json:"card_password"`
		} `json:"cards,omitempty"` // 卡密(仅当订单成功并且商品类型为卡密时返回此数据)
		Tickets []struct {
			No     string `json:"no"`
			Ticket string `json:"ticket"`
		} `json:"tickets,omitempty"` // 卡券(仅当订单成功并且商品类型为卡券时返回此数据)
	} `json:"data"`
}

type ApiBuyResult added in v1.0.37

type ApiBuyResult struct {
	Result ApiBuyResponse     // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

type ApiCustomerResponse added in v1.0.44

type ApiCustomerResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Id      int    `json:"id"`      // 商家编号
		Name    string `json:"name"`    // 商家名称
		Balance string `json:"balance"` // 余额
	} `json:"data"`
}

type ApiCustomerResult added in v1.0.44

type ApiCustomerResult struct {
	Result ApiCustomerResponse // 结果
	Body   []byte              // 内容
	Http   gorequest.Response  // 请求
}

type ApiOrderResponse added in v1.0.44

type ApiOrderResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Id                 string  `json:"id"`                   // 订单号
		ProductId          int     `json:"product_id"`           // 商品编号
		ProductName        string  `json:"product_name"`         // 商品名称
		ProductType        int     `json:"product_type"`         // 商品类型(1:充值,2:卡密,3:卡券,4:人工)
		ProductPrice       string  `json:"product_price"`        // 售价
		Quantity           int     `json:"quantity"`             // 购买数量
		TotalPrice         string  `json:"total_price"`          // 总支付价格
		RefundedAmount     float64 `json:"refunded_amount"`      // 已退款金额
		BuyerCustomerId    int     `json:"buyer_customer_id"`    // 买家编号
		BuyerCustomerName  string  `json:"buyer_customer_name"`  // 买家名称
		SellerCustomerId   int     `json:"seller_customer_id"`   // 卖家编号
		SellerCustomerName string  `json:"seller_customer_name"` // 卖家名称
		State              int     `json:"state"`                // 订单状态(100:等待发货,101:正在充值,200:交易成功,500:交易失败,501:未知状态)
		CreatedAt          string  `json:"created_at"`           // 下单时间
		RechargeAccount    string  `json:"recharge_account"`     // 充值账号
		ProgressInit       int     `json:"progress_init"`        // 充值进度:初始值
		ProgressNow        int     `json:"progress_now"`         // 充值进度:现在值
		ProgressTarget     int     `json:"progress_target"`      // 充值进度:目标值
		RechargeInfo       string  `json:"recharge_info"`        // 返回信息
		RechargeUrl        string  `json:"recharge_url"`         // 卡密充值网址
		Cards              []struct {
			No       string `json:"no"`
			Password string `json:"password"`
		} `json:"cards"` //【卡密类订单】卡密
		RechargeParams string `json:"recharge_params"`          //【充值类订单】
		OuterOrderId   string `json:"outer_order_id,omitempty"` // 外部订单号
	} `json:"data"`
}

type ApiOrderResult added in v1.0.37

type ApiOrderResult struct {
	Result ApiOrderResponse   // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

type ApiOuterOrderResponse added in v1.0.44

type ApiOuterOrderResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Id                 string  `json:"id"`                   // 订单号
		ProductId          int     `json:"product_id"`           // 商品编号
		ProductName        string  `json:"product_name"`         // 商品名称
		ProductType        int     `json:"product_type"`         // 商品类型(1:充值,2:卡密,3:卡券,4:人工)
		ProductPrice       string  `json:"product_price"`        // 售价
		Quantity           int     `json:"quantity"`             // 购买数量
		TotalPrice         string  `json:"total_price"`          // 总支付价格
		RefundedAmount     float64 `json:"refunded_amount"`      // 已退款金额
		BuyerCustomerId    int     `json:"buyer_customer_id"`    // 买家编号
		BuyerCustomerName  string  `json:"buyer_customer_name"`  // 买家名称
		SellerCustomerId   int     `json:"seller_customer_id"`   // 卖家编号
		SellerCustomerName string  `json:"seller_customer_name"` // 卖家名称
		State              int     `json:"state"`                // 订单状态(100:等待发货,101:正在充值,200:交易成功,500:交易失败,501:未知状态)
		CreatedAt          string  `json:"created_at"`           // 下单时间
		RechargeAccount    string  `json:"recharge_account"`     // 充值账号
		ProgressInit       int     `json:"progress_init"`        // 充值进度:初始值
		ProgressNow        int     `json:"progress_now"`         // 充值进度:现在值
		ProgressTarget     int     `json:"progress_target"`      // 充值进度:目标值
		RechargeInfo       string  `json:"recharge_info"`        // 返回信息
		RechargeUrl        string  `json:"recharge_url"`         // 卡密充值网址
		Cards              []struct {
			No       string `json:"no"`
			Password string `json:"password"`
		} `json:"cards"` //【卡密类订单】卡密
		RechargeParams string `json:"recharge_params"`          //【充值类订单】
		OuterOrderId   string `json:"outer_order_id,omitempty"` // 外部订单号
	} `json:"data"`
}

func (ApiOuterOrderResponse) GetStateDesc added in v1.0.85

func (resp ApiOuterOrderResponse) GetStateDesc(state int) string

type ApiOuterOrderResult added in v1.0.44

type ApiOuterOrderResult struct {
	Result ApiOuterOrderResponse // 结果
	Body   []byte                // 内容
	Http   gorequest.Response    // 请求
}

type ApiProductRechargeParamsResponse added in v1.0.44

type ApiProductRechargeParamsResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		RechargeAccountLabel string `json:"recharge_account_label"` // 充值账号类型名称
		RechargeParams       []struct {
			Name    string `json:"name"`
			Type    string `json:"type"`
			Options string `json:"options"`
		} `json:"recharge_params"` // 	充值参数
	} `json:"data"`
}

type ApiProductRechargeParamsResult added in v1.0.44

type ApiProductRechargeParamsResult struct {
	Result ApiProductRechargeParamsResponse // 结果
	Body   []byte                           // 内容
	Http   gorequest.Response               // 请求
}

type ApiProductResponse added in v1.0.44

type ApiProductResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Id                      int64  `json:"id"`                        // 商品编号
		ProductName             string `json:"product_name,omitempty"`    // 商品名称
		Name                    string `json:"name"`                      // 规格名称
		Price                   string `json:"price"`                     // 售价
		ValidPurchasingQuantity string `json:"valid_purchasing_quantity"` // 合法的购买数量
		SuperiorCommissionsRate int    `json:"superior_commissions_rate"` // 上级佣金比例
		Type                    int    `json:"type"`                      // 商品类型(1:充值,2:卡密,3:卡券,4:人工)
		SupplyState             int    `json:"supply_state"`              // 库存状态(1:充足,2:断货)
		StockState              int    `json:"stock_state"`               // 状态(1:上架,2:维护,3:下架)
		BanStartAt              string `json:"ban_start_at,omitempty"`    // 禁售开始时间
		BanEndAt                string `json:"ban_end_at,omitempty"`      // 禁售结束时间
	} `json:"data"`
}

type ApiProductResult added in v1.0.44

type ApiProductResult struct {
	Result ApiProductResponse // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

type Client added in v1.0.47

type Client struct {
	// contains filtered or unexported fields
}

Client 实例

func NewClient added in v1.0.47

func NewClient(config *ClientConfig) (*Client, error)

NewClient 创建实例化

func (*Client) ApiBuy added in v1.0.47

func (c *Client) ApiBuy(ctx context.Context, productID int64, quantity int64, notMustParams ...gorequest.Params) (*ApiBuyResult, error)

ApiBuy 购买商品 product_id = 商品编号 recharge_account = 充值账号 recharge_template_input_items = 模板充值参数 quantity = 购买数量 notify_url = 异步通知地址 outer_order_id = 外部订单号 safe_cost = 安全进价 client_ip = 购买的用户真实IP http://doc.cqmeihu.cn/sales/buy.html

func (*Client) ApiBuyNotifyGin added in v1.0.52

func (c *Client) ApiBuyNotifyGin(ctx context.Context, ginCtx *gin.Context) (validateJson ResponseApiBuyNotifyGin, err error)

ApiBuyNotifyGin 购买商品 - 回调通知 http://doc.cqmeihu.cn/sales/order-status-notify.html

func (*Client) ApiCustomer added in v1.0.47

func (c *Client) ApiCustomer(ctx context.Context, customerID int64, notMustParams ...gorequest.Params) (*ApiCustomerResult, error)

ApiCustomer 获取商家信息 customer_id = 商家编号 http://doc.cqmeihu.cn/sales/merchant-info.html

func (*Client) ApiOrder added in v1.0.47

func (c *Client) ApiOrder(ctx context.Context, orderID int64, notMustParams ...gorequest.Params) (*ApiOrderResult, error)

ApiOrder 获取单个订单信息。仅能获取自己购买的订单。 order_id = 订单号 http://doc.cqmeihu.cn/sales/order-info.html

func (*Client) ApiOuterOrder added in v1.0.47

func (c *Client) ApiOuterOrder(ctx context.Context, outerOrderID string, notMustParams ...gorequest.Params) (*ApiOuterOrderResult, error)

ApiOuterOrder 使用外部订单号获取单个订单信息 仅能获取自己购买的订单 outer_order_id = 外部订单号 http://doc.cqmeihu.cn/sales/outer-order-info.html

func (*Client) ApiProduct added in v1.0.47

func (c *Client) ApiProduct(ctx context.Context, productID int64, notMustParams ...gorequest.Params) (*ApiProductResult, error)

ApiProduct 获取单个商品信息 product_id = 商品编号 http://doc.cqmeihu.cn/sales/product-info.html

func (*Client) ApiProductRechargeParams added in v1.0.47

func (c *Client) ApiProductRechargeParams(ctx context.Context, productID int64, notMustParams ...gorequest.Params) (*ApiProductRechargeParamsResult, error)

ApiProductRechargeParams 获取商品的充值参数(仅支持充值类商品) product_id = 商品编号 http://doc.cqmeihu.cn/sales/recharge-params.html

func (*Client) ConfigSLogClientFun added in v1.0.162

func (c *Client) ConfigSLogClientFun(apiSLogFun golog.ApiSLogFun)

ConfigSLogClientFun 日志配置

func (*Client) DefaultHttp added in v1.0.177

func (c *Client) DefaultHttp()

DefaultHttp 默认请求

func (*Client) GetCustomerId added in v1.0.47

func (c *Client) GetCustomerId() int64

func (*Client) GetCustomerKey added in v1.0.47

func (c *Client) GetCustomerKey() string

func (*Client) SetConfig added in v1.0.52

func (c *Client) SetConfig(config *SetConfigConfig) *Client

SetConfig 配置

func (*Client) SetHttp added in v1.0.177

func (c *Client) SetHttp(app *gorequest.App)

SetHttp 配置请求

type ClientConfig added in v1.0.52

type ClientConfig struct {
	CustomerId     int64  // 商家编号
	CustomerKey    string // 商家密钥
	CacheLogStatus bool   // 缓存日志状态
}

ClientConfig 实例配置

type ResponseApiBuyNotifyGin added in v1.0.52

type ResponseApiBuyNotifyGin struct {
	OrderId      string `form:"order_id" json:"order_id" xml:"order_id" uri:"order_id" binding:"required"`                          // 订单编号
	OuterOrderId string `form:"outer_order_id" json:"outer_order_id" xml:"outer_order_id" uri:"outer_order_id" binding:"omitempty"` // 商户订单号
	ProductId    int    `form:"product_id" json:"product_id" xml:"product_id" uri:"product_id" binding:"omitempty"`                 // 商品编号
	Quantity     int    `form:"quantity" json:"quantity" xml:"quantity" uri:"quantity" binding:"required"`                          // 购买数量
	State        int    `form:"state" json:"state" xml:"state" uri:"state" binding:"required"`                                      // 订单状态(100:等待发货,101:正在充值,200:交易成功,500:交易失败,501:未知状态)
	StateInfo    string `form:"state_info" json:"state_info" xml:"state_info" uri:"state_info" binding:"omitempty"`                 // 状态信息
	CreatedAt    string `form:"created_at" json:"created_at" xml:"created_at" uri:"created_at" binding:"required"`                  // 购买数量
}

ResponseApiBuyNotifyGin 购买商品 - 回调通知 - 请求参数

type SetConfigConfig added in v1.0.52

type SetConfigConfig struct {
	CustomerId  int64  // 商家编号
	CustomerKey string // 商家密钥
}

Jump to

Keyboard shortcuts

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