kashangwl

package
v1.0.47 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSuccess = "ok"
)

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      int64  `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 // 请求
	Err    error              // 错误
}

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  // 请求
	Err    error               // 错误
}

type ApiOrderResponse added in v1.0.44

type ApiOrderResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		ID                 int64   `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"`             //【充值类订单】
		OuterApiOrderID string `json:"outer_ApiOrder_id,omitempty"` // 外部订单号
	} `json:"data"`
}

type ApiOrderResult added in v1.0.37

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

type ApiOuterOrderResponse added in v1.0.44

type ApiOuterOrderResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		ID                 int64   `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 ApiOuterOrderResult added in v1.0.44

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

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               // 请求
	Err    error                            // 错误
}

type ApiProductResponse added in v1.0.44

type ApiProductResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Id                      int     `json:"id"`                        // 商品编号
		ProductName             string  `json:"product_name"`              // 商品名称
		Name                    string  `json:"name"`                      // 规格名称
		Price                   float64 `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"`              // 禁售开始时间
		BanEndAt                string  `json:"ban_end_at"`                // 禁售结束时间
	} `json:"data"`
}

type ApiProductResult added in v1.0.44

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

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 *ConfigClient) (*Client, error)

func (*Client) ApiBuy added in v1.0.47

func (c *Client) ApiBuy(notMustParams ...gorequest.Params) *ApiBuyResult

ApiBuy 购买商品 http://doc.cqmeihu.cn/sales/buy.html

func (*Client) ApiCustomer added in v1.0.47

func (c *Client) ApiCustomer() *ApiCustomerResult

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

func (*Client) ApiOrder added in v1.0.47

func (c *Client) ApiOrder(orderId string) *ApiOrderResult

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

func (*Client) ApiOuterOrder added in v1.0.47

func (c *Client) ApiOuterOrder(orderId string) *ApiOuterOrderResult

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

func (*Client) ApiProduct added in v1.0.47

func (c *Client) ApiProduct(productId int64) *ApiProductResult

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

func (*Client) ApiProductRechargeParams added in v1.0.47

func (c *Client) ApiProductRechargeParams(productId int64) *ApiProductRechargeParamsResult

ApiProductRechargeParams 接口说明 获取商品的充值参数(仅支持充值类商品) http://doc.cqmeihu.cn/sales/ProductParams.html

func (*Client) GetCustomerId added in v1.0.47

func (c *Client) GetCustomerId() int

func (*Client) GetCustomerKey added in v1.0.47

func (c *Client) GetCustomerKey() string

type ConfigClient added in v1.0.47

type ConfigClient struct {
	CustomerId   int               // 商家编号
	CustomerKey  string            // 商家密钥
	MongoDb      *dorm.MongoClient // 日志数据库
	PgsqlDb      *gorm.DB          // 日志数据库
	DatabaseName string            // 库名
}

Jump to

Keyboard shortcuts

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