dayuanren

package
v1.0.215 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

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) 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

func (*Client) ConfigClient

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

ConfigClient 配置

func (*Client) ConfigSLogClientFun

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

ConfigSLogClientFun 日志配置

func (*Client) DefaultHttp

func (c *Client) DefaultHttp()

DefaultHttp 默认请求

func (*Client) Elecity

func (c *Client) Elecity(ctx context.Context, notMustParams ...gorequest.Params) (*ElecityResult, error)

Elecity 电费支持地区查询 https://www.showdoc.com.cn/dyr/9227008514209156

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

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

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(apiKey string)

func (*Client) SetApiURL

func (c *Client) SetApiURL(apiURL string)

func (*Client) SetHttp

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

SetHttp 配置请求

func (*Client) SetUserID

func (c *Client) SetUserID(userID int64)

func (*Client) Typecate

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

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

func (*Client) User

func (c *Client) User(ctx context.Context, notMustParams ...gorequest.Params) (*UserResult, error)

User 查询用户信息 https://www.showdoc.com.cn/dyr/9227004018562421

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 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