Documentation
¶
Index ¶
- Constants
- func CallResponseString() string
- func DeserializeCookies(data []byte) ([]*http.Cookie, error)
- func QueryAfdian[T any, R any](c *Client, requestPath string, params *T) (*R, error)
- func RequestApp[R any](c *AppClient, method, path string, form url.Values) (*R, error)
- func SerializeCookies(cookies []*http.Cookie) ([]byte, error)
- type AfdianCall
- type AfdianCallData
- type AfdianCallResponse
- type AfdianResponse
- type AppClient
- func (c *AppClient) DumpCookies()
- func (c *AppClient) Login(username, password string) (*AuthToken, error)
- func (c *AppClient) MyAccount() (*MyAccount, error)
- func (c *AppClient) PlanSkus(planId string) (*PlanSkus, error)
- func (c *AppClient) Plans(userId string) (*Plans, error)
- func (c *AppClient) SetAuthToken(token string)
- type AuthToken
- type Client
- type CreatorPlan
- type CreatorPlanTiming
- type MyAccount
- type MyAccountLogin
- type Order
- type OrderPlan
- type OrderSku
- type PageData
- type PlanSkus
- type Plans
- type Request
- type SerializableCookie
- type Sku
- type SkuPlan
- type SkuRedeem
- type Sponsor
- type Timing
- type TransportWithUA
- type User
Constants ¶
View Source
const AfDianAppUrl = "https://ifdian.net/api"
View Source
const AfDianOpenApiUri = "https://ifdian.net/api/open"
Variables ¶
This section is empty.
Functions ¶
func CallResponseString ¶
func CallResponseString() string
func DeserializeCookies ¶
将序列化后的 JSON 恢复为 []*http.Cookie
func QueryAfdian ¶
QueryAfdian Go1.18 暂不支持成员函数使用泛型
func RequestApp ¶
Types ¶
type AfdianCall ¶
type AfdianCall AfdianResponse[AfdianCallData]
type AfdianCallData ¶
type AfdianCallResponse ¶
AfdianCallResponse 爱发电回调返回 {"ec":200,"em":""}
func CallResponseStruct ¶
func CallResponseStruct() *AfdianCallResponse
type AfdianResponse ¶
type AppClient ¶
type AppClient struct {
// contains filtered or unexported fields
}
func NewAppClient ¶
func NewAppClient() *AppClient
func (*AppClient) DumpCookies ¶
func (c *AppClient) DumpCookies()
func (*AppClient) SetAuthToken ¶
type Client ¶
func (*Client) QueryOrder ¶
QueryOrder 查订单
func (*Client) QueryOrderByNo ¶
QueryOrderByNo 查订单
type CreatorPlan ¶
type CreatorPlan struct { CanAliAgreement int `json:"can_ali_agreement"` PlanId string `json:"plan_id"` Rank int `json:"rank"` UserId string `json:"user_id"` Status int `json:"status"` Name string `json:"name"` Pic string `json:"pic"` Desc string `json:"desc"` Price string `json:"price"` UpdateTime int `json:"update_time"` Timing CreatorPlanTiming `json:"timing"` PayMonth int `json:"pay_month"` ShowPrice string `json:"show_price"` ShowPriceAfterAdjust string `json:"show_price_after_adjust"` HasCoupon int `json:"has_coupon"` FavorablePrice int `json:"favorable_price"` Independent int `json:"independent"` Permanent int `json:"permanent"` CanBuyHide int `json:"can_buy_hide"` NeedAddress int `json:"need_address"` ProductType int `json:"product_type"` SaleLimitCount int `json:"sale_limit_count"` NeedInviteCode bool `json:"need_invite_code"` BundleStock int `json:"bundle_stock"` BundleSkuSelectCount int `json:"bundle_sku_select_count"` HasPlanConfig int `json:"has_plan_config"` HasBadge int `json:"has_badge"` SponsorCount string `json:"sponsor_count"` HasVip int `json:"has_vip"` }
type CreatorPlanTiming ¶
type MyAccount ¶
type MyAccount struct { Login MyAccountLogin `json:"login"` UserPrivateId string `json:"user_private_id"` }
type MyAccountLogin ¶
type Order ¶
type Order struct { OutTradeNo string `json:"out_trade_no"` UserId string `json:"user_id"` PlanId string `json:"plan_id"` Month int `json:"month"` TotalAmount float64 `json:"total_amount"` ShowAmount float64 `json:"show_amount"` Status int `json:"status"` Remark string `json:"remark"` RedeemId string `json:"redeem_id"` ProductType int `json:"product_type"` Discount float64 `json:"discount"` SkuDetail []OrderSku `json:"sku_detail"` PlanTitle string `json:"plan_title"` UserPrivateId string `json:"user_private_id"` AddressPerson string `json:"address_person"` AddressPhone string `json:"address_phone"` AddressAddress string `json:"address_address"` }
func ParseOrderInterface ¶
ParseOrderInterface 爱发电调服务器的请求内容, 解析成Order (AWS无法使用json模糊解析)
type OrderPlan ¶
type OrderPlan struct { BundleSkuSelectCount int `json:"bundle_sku_select_count"` BundleStock int `json:"bundle_stock"` CanBuyHide int `json:"can_buy_hide"` Coupon []interface{} `json:"coupon"` Desc string `json:"desc"` ExpireTime int `json:"expire_time"` FavorablePrice int `json:"favorable_price"` HasCoupon int `json:"has_coupon"` Independent int `json:"independent"` Name string `json:"name"` NeedAddress int `json:"need_address"` NeedInviteCode bool `json:"need_invite_code"` PayMonth int `json:"pay_month"` Permanent int `json:"permanent"` Pic string `json:"pic"` PlanId string `json:"plan_id"` Price float64 `json:"price"` ProductType int `json:"product_type"` Rank int `json:"rank"` RankType int `json:"rankType"` SaleLimitCount int `json:"sale_limit_count"` ShowPrice float64 `json:"show_price"` ShowPriceAfterAdjust string `json:"show_price_after_adjust"` SkuProcessed []interface{} `json:"sku_processed"` Status int `json:"status"` Timing Timing `json:"timing"` UpdateTime int `json:"update_time"` UserId string `json:"user_id"` }
type PlanSkus ¶
type PlanSkus struct { Plan CreatorPlan `json:"plan"` List []Sku `json:"list"` BoughtSkus []interface{} `json:"bought_skus"` }
type Plans ¶
type Plans struct { List []CreatorPlan `json:"list"` SaleHasMore int `json:"sale_has_more"` SaleList []CreatorPlan `json:"sale_list"` LimitShowProductCount int `json:"limit_show_product_count"` }
type SerializableCookie ¶
type SerializableCookie struct { Name string `json:"name"` Value string `json:"value"` Path string `json:"path,omitempty"` Domain string `json:"domain,omitempty"` Expires string `json:"expires,omitempty"` RawExpires string `json:"raw_expires,omitempty"` HttpOnly bool `json:"http_only,omitempty"` Secure bool `json:"secure,omitempty"` }
Cookie 的中间序列化结构
type Sku ¶
type Sku struct { SkuId string `json:"sku_id"` PlanId string `json:"plan_id"` UserId string `json:"user_id"` Status int `json:"status"` Name string `json:"name"` Pic string `json:"pic"` Desc string `json:"desc"` Stock string `json:"stock"` SponsorCount string `json:"sponsor_count"` Price string `json:"price"` ReplyContent string `json:"reply_content"` ReplyRandomContent string `json:"reply_random_content"` ReplyRandomNum int `json:"reply_random_num"` ReplySwitch bool `json:"reply_switch"` ReplyRandomSwitch bool `json:"reply_random_switch"` PurchasedRichText string `json:"purchased_rich_text"` Redeem SkuRedeem `json:"redeem"` Plan SkuPlan `json:"plan"` HasSkuPurchaseLimit int `json:"has_sku_purchase_limit"` CanBuyCount int `json:"can_buy_count"` }
type SkuPlan ¶
type SkuPlan struct { Id int `json:"id"` PlanId string `json:"plan_id"` UserId string `json:"user_id"` Status int `json:"status"` Rank int `json:"rank"` Name string `json:"name"` Pic string `json:"pic"` Desc string `json:"desc"` Price string `json:"price"` PayMonth int `json:"pay_month"` ReplySwitch int `json:"reply_switch"` ReplyContent string `json:"reply_content"` ReplyRandomSwitch int `json:"reply_random_switch"` ReplyRandomContent string `json:"reply_random_content"` Independent int `json:"independent"` Permanent int `json:"permanent"` ProductType int `json:"product_type"` CanBuyHide int `json:"can_buy_hide"` NeedAddress int `json:"need_address"` CreateTime int `json:"create_time"` UpdateTime int `json:"update_time"` BundleSkuSelectCount int `json:"bundle_sku_select_count"` BundleStock int `json:"bundle_stock"` CanAliAgreement int `json:"can_ali_agreement"` }
type TransportWithUA ¶
type TransportWithUA struct { Transport http.RoundTripper UA string }
自定义 Transport 设置统一的 User-Agent
Click to show internal directories.
Click to hide internal directories.