chengquan

package
v1.0.196 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiUrl     = "https://api.chengquan.cn"
	ApiTestUrl = "http://test.api.chengquan.vip:11140"
)
View Source
const (
	CodeSuccess = 7000
)
View Source
const (
	LogTable = "chengquan"
)

Variables

This section is empty.

Functions

func CodeInfo

func CodeInfo[codeT int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | string](code codeT) string

CodeInfo 接口响应返回码

func StateInfo

func StateInfo[codeT int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | string](state codeT) string

Types

type Client

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

Client 实例

func NewClient

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

NewClient 创建实例化

func (*Client) ConfigClient added in v1.0.194

func (c *Client) ConfigClient(config *ClientConfig)

func (*Client) ConfigSLogClientFun

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

ConfigSLogClientFun 日志配置

func (*Client) DefaultHttp

func (c *Client) DefaultHttp()

DefaultHttp 默认请求

func (*Client) GetAesIv

func (c *Client) GetAesIv() string

func (*Client) GetAesKey

func (c *Client) GetAesKey() string

func (*Client) GetAppID

func (c *Client) GetAppID() string

func (*Client) GetAppKey

func (c *Client) GetAppKey() string

func (*Client) OrderGet

func (c *Client) OrderGet(ctx context.Context, orderNo string, notMustParams ...gorequest.Params) (*OrderGetResult, error)

OrderGet 订单查询接口 https://www.chengquan.cn/rechargeInterface/queryOrder.html

func (*Client) OrderTelPay

func (c *Client) OrderTelPay(ctx context.Context, orderNo string, rechargeNumber string, notMustParams ...gorequest.Params) (*OrderTelPayResult, error)

OrderTelPay 话费下单接口 https://www.chengquan.cn/rechargeInterface/tel.html

func (*Client) SetAesIv

func (c *Client) SetAesIv(aesIv string)

func (*Client) SetAesKey

func (c *Client) SetAesKey(aesKey string)

func (*Client) SetApiURL added in v1.0.191

func (c *Client) SetApiURL(apiURL string)

func (*Client) SetAppID

func (c *Client) SetAppID(appID string)

func (*Client) SetAppKey

func (c *Client) SetAppKey(appKey string)

func (*Client) SetHttp

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

SetHttp 配置请求

type ClientConfig

type ClientConfig struct {
	ApiURL string
	AppID  string
	AppKey string
	AesKey string
	AesIv  string
}

ClientConfig 实例配置

type OrderGetResponse

type OrderGetResponse struct {
	Code    int    `json:"code"`    // 错误代码
	Message string `json:"message"` // 错误信息
	Data    struct {
		AppID          string  `json:"app_id"`          // 商户账号
		OrderNo        string  `json:"order_no"`        // 商户订单号
		RechargeNumber string  `json:"recharge_number"` // 充值账号
		StartTime      string  `json:"start_time"`      // 订单创建时间
		EndTime        string  `json:"end_time"`        // 订单完成时间,如果订单为充值中该时间和创建时间相同,如果成功或者失败该时间为订单完成时间。
		State          string  `json:"state"`           // 订单状态
		ConsumeAmount  float64 `json:"consume_amount"`  // 扣款金额(单位:元),保留小数点后四位
	} `json:"data"`
}

type OrderGetResult

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

type OrderTelPayResponse

type OrderTelPayResponse struct {
	Code    int    `json:"code"`    // 错误代码
	Message string `json:"message"` // 错误信息
	Data    struct {
		AppID          string  `json:"app_id"`          // 商户账号
		OrderNo        string  `json:"order_no"`        // 商户订单号
		RechargeNumber string  `json:"recharge_number"` // 充值账号
		StartTime      string  `json:"start_time"`      // 订单创建时间
		EndTime        string  `json:"end_time"`        // 订单完成时间,如果订单为充值中该时间和创建时间相同,如果成功或者失败该时间为订单完成时间。
		State          string  `json:"state"`           // 订单状态
		ConsumeAmount  float64 `json:"consume_amount"`  // 扣款金额(单位:元),保留小数点后四位
	} `json:"data"`
}

type OrderTelPayResult

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

Jump to

Keyboard shortcuts

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