ddmc

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PaymentAlipay    = "alipay"
	PaymentAlipayStr = "支付宝"
	PaymentWechat    = "wechat"
	PaymentWechatStr = "微信"
)

Variables

View Source
var (
	ErrorNoValidProduct     = errors.New("无有效商品")
	ErrorNoReserveTime      = errors.New("无可预约时间段")
	ErrorOutStock           = errors.New("部分商品已缺货")
	ErrorProductChange      = errors.New("商品信息发生变化")
	ErrorReserveTimeExpired = errors.New("送达时间已失效")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	Id         string  `json:"id"`
	Name       string  `json:"name"`
	StationId  string  `json:"station_id"`
	CityNumber string  `json:"city_number"`
	Longitude  float64 `json:"longitude"`
	Latitude   float64 `json:"latitude"`
	UserName   string  `json:"user_name"`
	Mobile     string  `json:"mobile"`
	Address    string  `json:"address"`
	AddrDetail string  `json:"addr_detail"`
}

type AddressData

type AddressData struct {
	ValidAddress    []AddressItem `json:"valid_address"`
	InvalidAddress  []AddressItem `json:"invalid_address"`
	MaxAddressCount int           `json:"max_address_count"`
	CanAddAddress   bool          `json:"can_add_address"`
}

type AddressItem

type AddressItem struct {
	Id          string             `json:"id"`
	Gender      int                `json:"gender"`
	Mobile      string             `json:"mobile"`
	Location    AddressLocation    `json:"location"`
	Label       string             `json:"label"`
	UserName    string             `json:"user_name"`
	AddrDetail  string             `json:"addr_detail"`
	StationId   string             `json:"station_id"`
	StationName string             `json:"station_name"`
	IsDefault   bool               `json:"is_default"`
	CityNumber  string             `json:"city_number"`
	InfoStatus  int                `json:"info_status"`
	StationInfo AddressStationInfo `json:"station_info"`
	VillageId   string             `json:"village_id"`
}

type AddressLocation

type AddressLocation struct {
	TypeCode string    `json:"typecode"`
	Address  string    `json:"address"`
	Name     string    `json:"name"`
	Location []float64 `json:"location"`
	Id       string    `json:"id"`
}

type AddressResult

type AddressResult struct {
	Success bool        `json:"success"`
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    AddressData `json:"data"`
}

type AddressStationInfo

type AddressStationInfo struct {
	Id           string `json:"id"`
	Address      string `json:"address"`
	Name         string `json:"name"`
	Phone        string `json:"phone"`
	BusinessTime string `json:"business_time"`
	CityName     string `json:"city_name"`
	CityNumber   string `json:"city_number"`
}

type Config

type Config struct {
	Cookie     string `json:"cookie"`
	PayType    string `json:"pay_type"`
	Channel    int    `json:"channel"`
	Interval   int64  `json:"interval"`
	RetryCount int    `json:"retry_count"`
}

type ReserveTime

type ReserveTime struct {
	StartTimestamp int    `json:"start_timestamp"`
	EndTimestamp   int    `json:"end_timestamp"`
	SelectMsg      string `json:"select_msg"`
}

type Session

type Session struct {
	UserID  string
	PayType int64
	Address *AddressItem
	// contains filtered or unexported fields
}

func NewSession

func NewSession(cfg *Config, noticeIns notice.Interface) (*Session, error)

func (*Session) CartAllCheck

func (s *Session) CartAllCheck(ctx context.Context) error

func (*Session) CheckOrder

func (s *Session) CheckOrder(ctx context.Context, cartData map[string]interface{}, reserveTime *ReserveTime) (map[string]interface{}, error)

func (*Session) Choose

func (s *Session) Choose() error

func (*Session) CreateOrder

func (s *Session) CreateOrder(
	ctx context.Context,
	cartData map[string]interface{},
	checkOrderData map[string]interface{},
	reserveTime *ReserveTime,
) error

func (*Session) GetAddress

func (s *Session) GetAddress() (map[string]AddressItem, error)

func (*Session) GetCart

func (s *Session) GetCart(ctx context.Context) (map[string]interface{}, error)

func (*Session) GetMultiReserveTime

func (s *Session) GetMultiReserveTime(ctx context.Context, products []map[string]interface{}) ([]ReserveTime, error)

func (*Session) GetUser

func (s *Session) GetUser() error

func (*Session) Run

func (s *Session) Run(ctx context.Context) error

type UserBalance

type UserBalance struct {
	SetFingerPayPassword int    `json:"set_finger_pay_password"`
	Balance              string `json:"balance"`
	SetPayPassword       int    `json:"set_pay_password"`
}

type UserData

type UserData struct {
	DoingRefundNum      int         `json:"doing_refund_num"`
	NoCommentOrderPoint int         `json:"no_comment_order_point"`
	NameNotice          string      `json:"name_notice"`
	NoPayOrderNum       int         `json:"no_pay_order_num"`
	DoingOrderNum       int         `json:"doing_order_num"`
	UserVip             UserVIP     `json:"user_vip"`
	UserSign            UserSign    `json:"user_sign"`
	NotOnionTip         int         `json:"not_onion_tip"`
	NoDrawCouponMoney   string      `json:"no_draw_coupon_money"`
	PointNum            int         `json:"point_num"`
	Balance             UserBalance `json:"balance"`
	UserInfo            UserInfo    `json:"user_info"`
	CouponNum           int         `json:"coupon_num"`
	NoCommentOrderNum   int         `json:"no_comment_order_num"`
}

type UserInfo

type UserInfo struct {
	Birthday       string `json:"birthday"`
	ShowInviteCode bool   `json:"show_invite_code"`
	NameInCheck    string `json:"name_in_check"`
	InviteCodeUrl  string `json:"invite_code_url"`
	Sex            int    `json:"sex"`
	Mobile         string `json:"mobile"`
	Avatar         string `json:"avatar"`
	ImUid          int    `json:"im_uid"`
	BindStatus     int    `json:"bind_status"`
	NameStatus     int    `json:"name_status"`
	NewRegister    bool   `json:"new_register"`
	ImSecret       string `json:"im_secret"`
	Name           string `json:"name"`
	Id             string `json:"id"`
	Introduction   string `json:"introduction"`
}

type UserResult

type UserResult struct {
	Success bool     `json:"success"`
	Code    int      `json:"code"`
	Message string   `json:"message"`
	Data    UserData `json:"data"`
}

type UserSign

type UserSign struct {
	IsTodaySign bool   `json:"is_today_sign"`
	SignSeries  int    `json:"sign_series"`
	SignText    string `json:"sign_text"`
}

type UserVIP

type UserVIP struct {
	IsRenew                  int    `json:"is_renew"`
	VipSaveMoneyDescription  string `json:"vip_save_money_description"`
	VipDescription           string `json:"vip_description"`
	VipStatus                int    `json:"vip_status"`
	VipNotice                string `json:"vip_notice"`
	VipExpireTimeDescription string `json:"vip_expire_time_description"`
	VipUrl                   string `json:"vip_url"`
}

Jump to

Keyboard shortcuts

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