dayuanren

package module
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrnoSuccess = 0 // 成功
)
View Source
const (
	LogTable = "dayuanren"
)

Variables

View Source
var (
	Version = "1.0.18"
)

Functions

This section is empty.

Types

type CancelResponse

type CancelResponse struct {
	Errno  int64    `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string   `json:"errmsg"` // 错误描述
	Data   struct{} `json:"data"`
}

type CancelResult

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

type CheckResponse

type CheckResponse struct {
	Errno  int64  `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string `json:"errmsg"` // 错误描述
}

type CheckResponseContent

type CheckResponseContent struct {
	Errno  int64  `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string `json:"errmsg"` // 错误描述
	Data   []struct {
		Id           int64  `json:"id,omitempty"`           // 编号
		OrderNumber  string `json:"order_number"`           // 系统定单号
		Status       int64  `json:"status"`                 // 充值状态:-1取消,0充值中 ,1充值成功,2充值失败,3部分成功
		OutTradeNum  string `json:"out_trade_num"`          // 商户订单号
		CreateTime   int64  `json:"create_time"`            // 下单时间
		Mobile       string `json:"mobile"`                 // 手机号
		ProductId    int64  `json:"product_id"`             // 产品ID
		ChargeAmount string `json:"charge_amount"`          // 充值成功面额
		ChargeKami   string `json:"charge_kami"`            // 卡密流水
		Isp          string `json:"isp,omitempty"`          // 运营商
		ProductName  string `json:"product_name,omitempty"` // 产品名称
		FinishTime   int64  `json:"finish_time,omitempty"`  // 完成时间
		Remark       string `json:"remark,omitempty"`       // 备注
		State        int64  `json:"state"`                  // 充值状态:-1取消,0充值中 ,1充值成功,2充值失败,3部分成功
		Voucher      string `json:"voucher,omitempty"`      // 凭证
	} `json:"data,omitempty"`
}

type CheckResult

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

func (*CheckResult) ParsingContent

func (cr *CheckResult) ParsingContent() (CheckResponseContent, error)

ParsingContent 解析内容

type Client

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

Client 实例

func NewClient

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

NewClient 创建实例化

func (*Client) Cancel

func (c *Client) Cancel(ctx context.Context, outTradeNums string, notMustParams ...gorequest.Params) (*CancelResult, error)

Cancel 退单申请 out_trade_num = 商户订单号;多个用英文,分割 https://www.kancloud.cn/boyanyun/boyanyun_huafei/3182909

func (*Client) Check

func (c *Client) Check(ctx context.Context, outTradeNums string, notMustParams ...gorequest.Params) (*CheckResult, error)

Check 自发查询订单状态 out_trade_nums = 商户订单号;多个用英文,分割 https://www.showdoc.com.cn/dyr/9227006175502841 https://www.kancloud.cn/boyanyun/boyanyun_huafei/3097254

func (*Client) GetApiKey

func (c *Client) GetApiKey() string

func (*Client) GetApiURL

func (c *Client) GetApiURL() string

func (*Client) GetUserID

func (c *Client) GetUserID() int64

func (*Client) Price

func (c *Client) Price(ctx context.Context, id int64, notMustParams ...gorequest.Params) (*PriceResult, error)

Price 产品ID查询【新增】 id = 产品ID https://www.showdoc.com.cn/dyr/9757701226597233

func (*Client) Product

func (c *Client) Product(ctx context.Context, notMustParams ...gorequest.Params) (*ProductResult, error)

Product 获取产品 type = 产品类型ID cate_id = 分类ID https://www.showdoc.com.cn/dyr/9227005691961526 https://www.kancloud.cn/boyanyun/boyanyun_huafei/3097253

func (*Client) Recharge

func (c *Client) Recharge(ctx context.Context, outTradeNum string, productID int64, mobile string, notifyUrl string, notMustParams ...gorequest.Params) (*RechargeResult, error)

Recharge 充值提交接口 out_trade_num = 商户订单号,由商户自己生成唯一单号。(同一商户,不能存在相同单号订单,相同订单号不能提单) product_id = 产品ID(代理后台查看) mobile = 充值号码(手机号、电费户、qq号等) notify_url = 回调地址,用于接收充值状态回调 amount = 面值,(不传不校验)如果产品的面值与此参数不同,提单驳回 price = 最高成本,(不传不校验)如果产品成本超过这个值,提单驳回 area = 电费省份/直辖市,如:四川、北京、上海,仅电费带此参数 ytype = 电费验证三要素,1-身份证后6位,2-银行卡后六位,3-营业执照后六位,仅南网电费带此参数 id_card_no = 身份证后6位/银行卡后6位/营业执照后6位,仅南网电费带此参数 city = 地级市名,仅部分南网电费带此参数,是否带此参数需咨询渠道方 param1 = 扩展参数,后台查看提交的产品类目是否需要提交此参数 param2 = 扩展参数,后台查看提交的产品类目是否需要提交此参数 param3 = 扩展参数,后台查看提交的产品类目是否需要提交此参数 https://www.showdoc.com.cn/dyr/9227003154511692 https://www.kancloud.cn/boyanyun/boyanyun_huafei/3097250

func (*Client) RechargeNotifyHttp

func (c *Client) RechargeNotifyHttp(ctx context.Context, w http.ResponseWriter, r *http.Request) (validateJson ResponseRechargeNotifyHttp, err error)

RechargeNotifyHttp 充值结果通知-异步通知 https://www.kancloud.cn/boyanyun/boyanyun_huafei/3097255

func (*Client) Remove

func (c *Client) Remove(ctx context.Context, outTradeNums string, notMustParams ...gorequest.Params) (*RemoveResult, error)

Remove 申请撤单【已正式上线】 out_trade_num = 商户订单号;多个用英文,分割 https://www.showdoc.com.cn/dyr/9745453200292104

func (*Client) SetApiKey

func (c *Client) SetApiKey(v string) *Client

func (*Client) SetApiURL

func (c *Client) SetApiURL(v string) *Client

func (*Client) SetClientIP

func (c *Client) SetClientIP(clientIP string) *Client

SetClientIP 配置

func (*Client) SetLogFun

func (c *Client) SetLogFun(logFun gorequest.LogFunc)

SetLogFun 设置日志记录函数

func (*Client) SetTrace

func (c *Client) SetTrace(trace bool)

SetTrace 设置OpenTelemetry链路追踪

func (*Client) SetUserID

func (c *Client) SetUserID(v int64) *Client

func (*Client) TraceEndSpan

func (c *Client) TraceEndSpan()

TraceEndSpan 结束OpenTelemetry链路追踪状态

func (*Client) TraceGetSpanID

func (c *Client) TraceGetSpanID() (spanID string)

TraceGetSpanID 获取OpenTelemetry链路追踪SpanID

func (*Client) TraceGetTraceID

func (c *Client) TraceGetTraceID() (traceID string)

TraceGetTraceID 获取OpenTelemetry链路追踪TraceID

func (*Client) TraceRecordError

func (c *Client) TraceRecordError(err error, options ...trace.EventOption)

TraceRecordError 记录OpenTelemetry链路追踪错误

func (*Client) TraceSetAttributes

func (c *Client) TraceSetAttributes(kv ...attribute.KeyValue)

TraceSetAttributes 设置OpenTelemetry链路追踪属性

func (*Client) TraceSetStatus

func (c *Client) TraceSetStatus(code codes.Code, description string)

TraceSetStatus 设置OpenTelemetry链路追踪状态

func (*Client) TraceStartSpan

func (c *Client) TraceStartSpan(ctx context.Context, spanName string) context.Context

TraceStartSpan 开始OpenTelemetry链路追踪状态

func (*Client) Typecate

func (c *Client) Typecate(ctx context.Context, notMustParams ...gorequest.Params) (*TypecateResult, error)

Typecate 获取产品类型和产品分类 https://www.showdoc.com.cn/dyr/9227005390454727 https://www.kancloud.cn/boyanyun/boyanyun_huafei/3097252

type ClientConfig

type ClientConfig struct {
	ApiURL string // 接口地址
	UserID int64  // 商户ID
	ApiKey string // 秘钥
}

ClientConfig 实例配置

type ElecityResponse

type ElecityResponse struct {
	Errno  int64  `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string `json:"errmsg"` // 错误描述
	Data   []struct {
		Id        int64  `json:"id,omitempty"`
		CityName  string `json:"city_name"`  // 地区名称
		Sort      int64  `json:"sort"`       // 排序
		Initial   string `json:"initial"`    // 首字母
		NeedYtype int64  `json:"need_ytype"` // 是否三要素认证
		NeedCity  int64  `json:"need_city"`  // 是否需要选择城市(当此开关打开以后才有下面的城市列表)
		City      []struct {
			Id       int64  `json:"id,omitempty"`
			CityName string `json:"city_name"` // 城市名称
			Initial  string `json:"initial"`   // 首字母
		} `json:"city"` // 支持的地级市
	} `json:"data,omitempty"`
}

type ElecityResult

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

type PriceResponse

type PriceResponse struct {
	Errno  int64  `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string `json:"errmsg"` // 错误描述
	Data   struct {
		Name     string `json:"name"`      // 产品名称
		Desc     string `json:"desc"`      // 产品说明
		ApiOpen  string `json:"api_open"`  // 自动充值
		Isp      string `json:"isp"`       // 运营商集合(话费、流量有效),1移动,2电信,3联通,4虚拟
		YsTag    string `json:"ys_tag"`    // 标签
		Price    string `json:"price"`     // 价格,下单扣费金额
		YPrice   string `json:"y_price"`   // 原价
		MaxPrice string `json:"max_price"` // 封顶价格
		Type     string `json:"type"`      // 产品类型ID
		CateName string `json:"cate_name"` // 产品分类名称
		TypeName string `json:"type_name"` // 产品类型名称
	} `json:"data,omitempty"`
}

type PriceResult

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

type ProductResponse

type ProductResponse struct {
	Errno  int64  `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string `json:"errmsg"` // 错误描述
	Data   []struct {
		Id       int64  `json:"id"`   // 分类ID
		Cate     string `json:"cate"` // 分类名称
		Sort     int64  `json:"sort"` // 排序
		Type     int64  `json:"type"` // 产品类型ID
		Products []struct {
			Id           int64   `json:"id"`   // 产品ID,下单报文中用此参数
			Name         string  `json:"name"` // 产品名称
			Yname        string  `json:"yname,omitempty"`
			Desc         string  `json:"desc"`     // 产品说明
			ApiOpen      int64   `json:"api_open"` // 自动充值
			Isp          string  `json:"isp"`      // 运营商集合(话费、流量有效),1移动,2电信,3联通,4虚拟
			YsTag        string  `json:"ys_tag"`   // 标签
			Price        string  `json:"price"`    // 价格,下单扣费金额
			ShowStyle    int64   `json:"show_style,omitempty"`
			CateId       int64   `json:"cate_id,omitempty"`
			DelayApi     string  `json:"delay_api,omitempty"`
			YPrice       float64 `json:"y_price"`   // 原价
			MaxPrice     string  `json:"max_price"` // 封顶价格
			Type         int64   `json:"type"`      // 产品类型ID
			AllowPro     string  `json:"allow_pro,omitempty"`
			AllowCity    string  `json:"allow_city,omitempty"`
			ForbidPro    string  `json:"forbid_pro,omitempty"`
			ForbidCity   string  `json:"forbid_city,omitempty"`
			JmapiId      int64   `json:"jmapi_id,omitempty"`
			JmapiParamId int64   `json:"jmapi_param_id,omitempty"`
			IsJiema      int64   `json:"is_jiema,omitempty"`
			CateName     string  `json:"cate_name"` // 产品分类名称
			TypeName     string  `json:"type_name"` // 产品类型名称
			TypecId      int64   `json:"typec_id,omitempty"`
		} `json:"products"` // 产品列表
	} `json:"data,omitempty"`
}

type ProductResult

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

type RechargeResponse

type RechargeResponse struct {
	Errno  int64  `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string `json:"errmsg"` // 错误描述
}

type RechargeResponseContent

type RechargeResponseContent struct {
	Errno  int64  `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string `json:"errmsg"` // 错误描述
	Data   struct {
		CreateTime  int64  `json:"create_time,omitempty"` // 下单时间
		Guishu      string `json:"guishu,omitempty"`      // 归属地
		Id          int64  `json:"id,omitempty"`          // 编号
		Mobile      string `json:"mobile"`                // 充值手机号
		OrderNumber string `json:"order_number"`          // 系统定单号
		OutTradeNum string `json:"out_trade_num"`         // 商户订单号
		ProductId   int64  `json:"product_id"`            // 产品ID
		Title       string `json:"title"`                 // 充值产品说明
		TotalPrice  string `json:"total_price"`           // 消费金额
	} `json:"data,omitempty"`
}

type RechargeResult

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

func (*RechargeResult) ParsingContent

func (cr *RechargeResult) ParsingContent() (RechargeResponseContent, error)

ParsingContent 解析内容

type RemoveResponse

type RemoveResponse struct {
	Errno  int64    `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string   `json:"errmsg"` // 错误描述
	Data   struct{} `json:"data"`
}

type RemoveResult

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

type ResponseRechargeNotifyHttp

type ResponseRechargeNotifyHttp struct {
	Userid       string `json:"userid,omitempty"`        // 商户ID
	OrderNumber  string `json:"order_number,omitempty"`  // true
	OutTradeNum  string `json:"out_trade_num,omitempty"` // 商户订单号
	Otime        string `json:"otime,omitempty"`         // 成功/失败时间,10位时间戳
	State        string `json:"state,omitempty"`         // 充值状态;-1取消, 0充值中, 1充值成功 ,2充值失败,3部分成功(-1,2做失败处理;1做成功处理;3做部分成功处理)
	Mobile       string `json:"mobile,omitempty"`        // 充值手机号
	Remark       string `json:"remark,omitempty"`        // 备注信息
	ChargeAmount string `json:"charge_amount,omitempty"` // 充值成功面额
	Voucher      string `json:"voucher,omitempty"`       // 凭证
	ChargeKami   string `json:"charge_kami,omitempty"`   // 卡密/流水号
	Sign         string `json:"sign,omitempty"`          // 签名字符串,用于验签,以保证回调可靠性。
}

type TypecateResponse

type TypecateResponse struct {
	Errno  int64  `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string `json:"errmsg"` // 错误描述
	Data   []struct {
		Id       int64  `json:"id"`        // 产品类型id
		TypeName string `json:"type_name"` // 产品类型名称
		Cate     []struct {
			Id   int64  `json:"id"`        // 分类ID
			Cate string `json:"type_name"` // 分类名称
			Type int64  `json:"type"`      // 产品类型ID
		} `json:"cate"` // 分类列表
	} `json:"data,omitempty"`
}

type TypecateResult

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

type UserResponse

type UserResponse struct {
	Errno  int64  `json:"errno"`  // 错误码,0代表成功,非0代表失败
	Errmsg string `json:"errmsg"` // 错误描述
	Data   struct {
		Id       int64  `json:"id"`       // userid
		Username string `json:"username"` // 名称
		Balance  string `json:"balance"`  // 余额
	} `json:"data,omitempty"`
}

type UserResult

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

Jump to

Keyboard shortcuts

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