Documentation ¶
Index ¶
Constants ¶
const ( //URLSKUState = "http://c0.3.cn/stock" URLSKUState = "https://c0.3.cn/stocks" URLGoodsDets = "http://item.jd.com/%s.html" URLGoodsPrice = "http://p.3.cn/prices/mgets" URLAdd2Cart = "https://cart.jd.com/gate.action" URLChangeCount = "http://cart.jd.com/changeNum.action" URLCartInfo = "https://cart.jd.com/cart.action" URLOrderInfo = "http://trade.jd.com/shopping/order/getOrderInfo.action" URLSubmitOrder = "http://trade.jd.com/shopping/order/submitOrder.action" )
Variables ¶
var ( // URLForQR is the login related URL // URLForQR = [...]string{ "https://passport.jd.com/new/login.aspx", "https://qr.m.jd.com/show", "https://qr.m.jd.com/check", "https://passport.jd.com/uc/qrCodeTicketValidation", "http://home.jd.com/getUserVerifyRight.action", } DefaultHeaders = map[string]string{ "User-Agent": "Chrome/51.0.2704.103", "ContentType": "application/json", "Connection": "keep-alive", "Accept-Encoding": "gzip, deflate", "Accept-Language": "zh-CN,zh;q=0.8", } )
Functions ¶
This section is empty.
Types ¶
type CookieJarType ¶
type CookieJarType int8
const ( JarMemory CookieJarType = iota JarJson JarGob )
type JDConfig ¶
type JDConfig struct { Period time.Duration // refresh period ShipArea string // shipping area AutoRush bool // continue rush when out of stock AutoSubmit bool // whether submit the order }
JDConfig ...
type JarOption ¶
type JarOption struct { // JarType specify the which way used to save the cookies // JarMemory : just in memory without persist // JarGob: persist by module encoding/gob JarType CookieJarType // Filename holds the file to use for storage of the cookies. // If it is empty, JarMemory will be used. Filename string }
JarOption used to configure how cookies data saved
type JingDong ¶
type JingDong struct { JDConfig // contains filtered or unexported fields }
JingDong wrap jing dong operation
func NewJingDong ¶
NewJingDong create an object to wrap JingDong related operation
func (*JingDong) CartDetails ¶
CartDetails get the shopping cart details
func (*JingDong) Login ¶
TODO(adyzng) updatethe login logic Login used to login JD by QR code. if the cookies file exits, will try cookies first.
func (*JingDong) SubmitOrder ¶
SubmitOrder ... submit order to JingDong, return orderID or error
type SKUInfo ¶
type SKUInfo struct { ID string Price string Count int // buying count State string // stock state 33 : on sale, 34 : out of stock StateName string // "现货" / "无货" Name string Link string }
SKUInfo ...
type SimpleJar ¶
type SimpleJar struct {
// contains filtered or unexported fields
}
SimpleJar implement http.CookieJar to handle cookies
func NewSimpleJar ¶
NewSimpleJar return SimpleJar object with sepecified option example:
jar := NewSimpleJar(JarOption{ JarType: JarMemory, Filename: "d:\\cookies.jar", })
func (*SimpleJar) Cookies ¶
Cookies returns the cookies to send in a request for the given URL. It is up to the implementation to honor the standard cookie use restrictions such as in RFC 6265.