Documentation ¶
Index ¶
- type App
- func (app *App) Buy(notMustParams ...Params) *BuyResult
- func (app *App) NewParamsWith(params ...Params) Params
- func (app App) Order(orderId string) *OrderResult
- func (app App) Product(productId int64) *ProductResult
- func (app App) ProductRechargeParams(notMustParams ...Params) *ProductRechargeParamsResult
- type BuyResponse
- type BuyResult
- type OrderResponse
- type OrderResult
- type Params
- type ProductRechargeParamsResponse
- type ProductRechargeParamsResult
- type ProductResponse
- type ProductResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { CustomerId int // 商家编号 CustomerKey string // 商家密钥 ZapLog *zap.Logger // 日志服务 Db *gorm.DB // 关系数据库服务 RDb *redis.Client // 缓存数据库服务 MDb *mongo.Client // 非关系数据库服务 }
App 卡商网服务
func (*App) NewParamsWith ¶
func (App) Order ¶
func (app App) Order(orderId string) *OrderResult
Order 获取单个订单信息。 仅能获取自己购买的订单。 http://doc.cqmeihu.cn/sales/OrderInfo.html
func (App) Product ¶
func (app App) Product(productId int64) *ProductResult
Product 获取单个商品信息 http://doc.cqmeihu.cn/sales/product-info.html
func (App) ProductRechargeParams ¶
func (app App) ProductRechargeParams(notMustParams ...Params) *ProductRechargeParamsResult
ProductRechargeParams 接口说明 获取商品的充值参数(仅支持充值类商品) http://doc.cqmeihu.cn/sales/ProductParams.html
type BuyResponse ¶
type BuyResponse 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 BuyResult ¶
type BuyResult struct { Result BuyResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewBuyResult ¶
func NewBuyResult(result BuyResponse, body []byte, err error) *BuyResult
type OrderResponse ¶
type OrderResponse 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 OrderResult ¶
type OrderResult struct { Result OrderResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewOrderResult ¶
func NewOrderResult(result OrderResponse, body []byte, err error) *OrderResult
type ProductRechargeParamsResponse ¶
type ProductRechargeParamsResponse 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 ProductRechargeParamsResult ¶
type ProductRechargeParamsResult struct { Result ProductRechargeParamsResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewProductRechargeParamsResult ¶
func NewProductRechargeParamsResult(result ProductRechargeParamsResponse, body []byte, err error) *ProductRechargeParamsResult
type ProductResponse ¶
type ProductResponse 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 float64 `json:"price"` ValidPurchasingQuantity string `json:"valid_purchasing_quantity"` SuperiorCommissionsRate int `json:"superior_commissions_rate"` Type int `json:"type"` SupplyState int `json:"supply_state"` StockState int `json:"stock_state"` BanStartAt string `json:"ban_start_at,omitempty"` BanEndAt string `json:"ban_end_at,omitempty"` } `json:"data"` }
type ProductResult ¶
type ProductResult struct { Result ProductResponse // 结果 Body []byte // 内容 Err error // 错误 }
func NewProductResult ¶
func NewProductResult(result ProductResponse, body []byte, err error) *ProductResult
Click to show internal directories.
Click to hide internal directories.