Documentation ¶
Index ¶
- Constants
- Variables
- func CodeInfo[...](code codeT) string
- func StateInfo[...](state codeT) string
- type Client
- func (c *Client) GetAesIv() string
- func (c *Client) GetAesKey() string
- func (c *Client) GetApiURL() string
- func (c *Client) GetAppID() string
- func (c *Client) GetAppKey() string
- func (c *Client) OrderDirectCharge(ctx context.Context, orderNo string, rechargeNumber string, productID int64, ...) (*OrderDirectChargeResult, error)
- func (c *Client) OrderGet(ctx context.Context, orderNo string, notMustParams ...gorequest.Params) (*OrderGetResult, error)
- func (c *Client) OrderTelPay(ctx context.Context, orderNo string, rechargeNumber string, price int64, ...) (*OrderTelPayResult, error)
- func (c *Client) SetAesIv(v string) *Client
- func (c *Client) SetAesKey(v string) *Client
- func (c *Client) SetApiURL(v string) *Client
- func (c *Client) SetAppID(v string) *Client
- func (c *Client) SetAppKey(v string) *Client
- func (c *Client) SetClientIP(clientIP string) *Client
- func (c *Client) SetLogFun(logFun gorequest.LogFunc)
- func (c *Client) SetTrace(trace bool)
- func (c *Client) TraceEndSpan()
- func (c *Client) TraceGetSpanID() (spanID string)
- func (c *Client) TraceGetTraceID() (traceID string)
- func (c *Client) TraceRecordError(err error, options ...trace.EventOption)
- func (c *Client) TraceSetAttributes(kv ...attribute.KeyValue)
- func (c *Client) TraceSetStatus(code codes.Code, description string)
- func (c *Client) TraceStartSpan(ctx context.Context, spanName string) context.Context
- func (c *Client) UserBalanceGet(ctx context.Context, notMustParams ...gorequest.Params) (*UserBalanceGetResult, error)
- type ClientConfig
- type OrderDirectChargeResponse
- type OrderDirectChargeResult
- type OrderGetResponse
- type OrderGetResult
- type OrderTelPayResponse
- type OrderTelPayResult
- type UserBalanceGetResponse
- type UserBalanceGetResult
Constants ¶
const (
CodeSuccess = 7000
)
const (
LogTable = "chengquan"
)
Variables ¶
var (
Version = "1.0.4"
)
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 实例
func (*Client) OrderDirectCharge ¶
func (c *Client) OrderDirectCharge(ctx context.Context, orderNo string, rechargeNumber string, productID int64, amount int64, notMustParams ...gorequest.Params) (*OrderDirectChargeResult, error)
OrderDirectCharge 直充下单接口 order_no = 商户提交的订单号,最长32位(商户保证其唯一性) recharge_number = 充值账号 product_id = 充值产品编号 amount = 充值数量(加油卡,视频业务默认为1,其它业务按照实际情况传递)。数量范围1-99999 ip = 充值ip(仅腾讯业务需要,根据实际情况进行传递) oil_phone_account = 加油卡充值时用户的手机号 notify_url = 橙券主动通知订单结果地址 https://chengquan.cn/rechargeInterface/directCharge.html
func (*Client) OrderGet ¶
func (c *Client) OrderGet(ctx context.Context, orderNo string, notMustParams ...gorequest.Params) (*OrderGetResult, error)
OrderGet 订单查询接口 order_no = 商户提交的订单号,最长32位(商户保证其唯一性) https://www.chengquan.cn/rechargeInterface/queryOrder.html
func (*Client) OrderTelPay ¶
func (c *Client) OrderTelPay(ctx context.Context, orderNo string, rechargeNumber string, price int64, notMustParams ...gorequest.Params) (*OrderTelPayResult, error)
OrderTelPay 话费下单接口 order_no = 商户提交的订单号,最长32位(商户保证其唯一性) recharge_number = 充值手机号码 price = 充值面值(单位:分) notify_url = 橙券主动通知订单结果地址 https://www.chengquan.cn/rechargeInterface/tel.html
func (*Client) SetClientIP ¶ added in v1.0.3
SetClientIP 配置
func (*Client) TraceEndSpan ¶ added in v1.0.3
func (c *Client) TraceEndSpan()
TraceEndSpan 结束OpenTelemetry链路追踪状态
func (*Client) TraceGetSpanID ¶ added in v1.0.3
TraceGetSpanID 获取OpenTelemetry链路追踪SpanID
func (*Client) TraceGetTraceID ¶ added in v1.0.3
TraceGetTraceID 获取OpenTelemetry链路追踪TraceID
func (*Client) TraceRecordError ¶ added in v1.0.3
func (c *Client) TraceRecordError(err error, options ...trace.EventOption)
TraceRecordError 记录OpenTelemetry链路追踪错误
func (*Client) TraceSetAttributes ¶ added in v1.0.3
TraceSetAttributes 设置OpenTelemetry链路追踪属性
func (*Client) TraceSetStatus ¶ added in v1.0.3
TraceSetStatus 设置OpenTelemetry链路追踪状态
func (*Client) TraceStartSpan ¶ added in v1.0.3
TraceStartSpan 开始OpenTelemetry链路追踪状态
func (*Client) UserBalanceGet ¶
func (c *Client) UserBalanceGet(ctx context.Context, notMustParams ...gorequest.Params) (*UserBalanceGetResult, error)
UserBalanceGet 账号余额查询接口 https://chengquan.cn/basicData/queryBalance.html
type ClientConfig ¶
ClientConfig 实例配置
type OrderDirectChargeResponse ¶
type OrderDirectChargeResponse 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 OrderDirectChargeResult ¶
type OrderDirectChargeResult struct { Result OrderDirectChargeResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }
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 // 请求 }
type UserBalanceGetResponse ¶
type UserBalanceGetResult ¶
type UserBalanceGetResult struct { Result UserBalanceGetResponse // 结果 Body []byte // 内容 Http gorequest.Response // 请求 }