From 409d5695b20637c7db994b6efcc0856241c8a851 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Tue, 5 Jan 2021 20:38:30 +0800 Subject: [PATCH 1/8] =?UTF-8?q?Windows=E7=B3=BB=E7=BB=9F=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E7=85=A7=E7=89=87=E6=9F=A5=E7=9C=8B=E5=99=A8=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=EF=BC=9B=E9=9D=9EWIN=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E8=BE=93=E5=87=BA=E6=8E=A7=E5=88=B6=E5=8F=B0(?= =?UTF-8?q?=E5=BE=85=E8=B0=83=E8=AF=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/lib.go | 50 ++++++++++++---- common/var.go | 9 +++ go.mod | 3 + go.sum | 19 +++++++ jd_seckill/user.go | 139 +++++++++++++++++++++++---------------------- 5 files changed, 140 insertions(+), 80 deletions(-) diff --git a/common/lib.go b/common/lib.go index 58aa2fe..c3a4a77 100644 --- a/common/lib.go +++ b/common/lib.go @@ -2,12 +2,19 @@ package common import ( "bytes" + "errors" + "fmt" + "github.com/CodyGuo/win" + "github.com/makiuchi-d/gozxing" + "github.com/makiuchi-d/gozxing/qrcode" + goQrcode "github.com/skip2/go-qrcode" "golang.org/x/text/encoding/simplifiedchinese" "golang.org/x/text/transform" + "image" "io/ioutil" + "log" "math/rand" "os" - "os/exec" "runtime" "strconv" "time" @@ -95,21 +102,40 @@ func Exists(path string) bool { return true } -func OpenImage(file string) { - if runtime.GOOS=="windows" { - cmd:=exec.Command("start",file) - _=cmd.Start() - }else{ - if runtime.GOOS=="linux" { - cmd:=exec.Command("eog",file) - _=cmd.Start() - }else{ - cmd:=exec.Command("open",file) - _=cmd.Start() +func OpenImage(qrPath string) { + if "windows" == runtime.GOOS { // Windows系统 + cmd := "cmd /c rundll32.exe C:\\Windows\\System32\\shimgvw.dll,ImageView_Fullscreen " + qrPath + if err := ExecRun(cmd); err != nil { + log.Println(cmd) + log.Fatal(err) } + } else { // 非Windows系统(Linux等)输出控制台 + //解码二维码 + file, _ := os.Open(qrPath) + img, _, _ := image.Decode(file) + bmp, _ := gozxing.NewBinaryBitmapFromImage(img) + qrReader := qrcode.NewQRCodeReader() + res, _ := qrReader.Decode(bmp, nil) + + //输出控制台 + qr, err := goQrcode.New(res.String(), goQrcode.High) + if err != nil { + log.Println("二维码获取成功,请打开图片用京东APP扫描") + } + fmt.Println(qr.ToSmallString(false)) } } func Hour2Unix(hour string) (time.Time, error) { return time.ParseInLocation(DateTimeFormatStr, time.Now().Format(DateFormatStr) + " " + hour, time.Local) } + +func ExecRun(cmd string) error { + lpCmdLine := win.StringToBytePtr(cmd) + ret := win.WinExec(lpCmdLine, win.SW_HIDE) + if ret <= 31 { + return errors.New(winExecError[ret]) + + } + return nil +} diff --git a/common/var.go b/common/var.go index 69a776f..d6b86b4 100644 --- a/common/var.go +++ b/common/var.go @@ -19,3 +19,12 @@ var CookieJar *httpc.CookieJar var Config *goconfig.ConfigFile var SeckillStatus chan bool + +var ( + winExecError = map[uint32]string{ + 0: "The system is out of memory or resources.", + 2: "The .exe file is invalid.", + 3: "The specified file was not found.", + 11: "The specified path was not found.", + } +) \ No newline at end of file diff --git a/go.mod b/go.mod index 2d16b81..7360825 100644 --- a/go.mod +++ b/go.mod @@ -4,12 +4,15 @@ go 1.15 require ( github.com/Albert-Zhan/httpc v0.0.0-20190712132051-aed72924b5e6 + github.com/CodyGuo/win v0.0.0-20170113125346-08e6b7208274 github.com/PuerkitoBio/goquery v1.6.0 github.com/blinkbean/dingtalk v0.0.0-20201231030509-45a553a84503 github.com/chromedp/cdproto v0.0.0-20201204063249-be40c824ad18 github.com/chromedp/chromedp v0.5.4 github.com/gobwas/httphead v0.1.0 // indirect github.com/json-iterator/go v1.1.10 // indirect + github.com/makiuchi-d/gozxing v0.0.0-20200903113411-25f730ed83da + github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/spf13/cobra v1.1.1 github.com/tidwall/gjson v1.6.7 github.com/unknwon/goconfig v0.0.0-20200908083735-df7de6a44db8 diff --git a/go.sum b/go.sum index be29fa4..859305d 100644 --- a/go.sum +++ b/go.sum @@ -15,6 +15,8 @@ github.com/Albert-Zhan/httpc v0.0.0-20190712132051-aed72924b5e6 h1:/YjYHOxa/xOxb github.com/Albert-Zhan/httpc v0.0.0-20190712132051-aed72924b5e6/go.mod h1:pUw0wQemWzufQn9HP5K3VPnSBYECMOvn1JHN3bjMo9g= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/CodyGuo/win v0.0.0-20170113125346-08e6b7208274 h1:xZ+hO1TTdeXGco1FciZz6VZEk4lCtdEtvURu6rzkIAg= +github.com/CodyGuo/win v0.0.0-20170113125346-08e6b7208274/go.mod h1:WnZcB84JFhpps84rrej/HTM4u9RiT3tvT7zYjJVS6Yk= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/goquery v1.6.0 h1:j7taAbelrdcsOlGeMenZxc2AWXD5fieT1/znArdnx94= github.com/PuerkitoBio/goquery v1.6.0/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc= @@ -29,6 +31,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/blinkbean/dingtalk v0.0.0-20201231030509-45a553a84503 h1:F0ELue0asB0IvriIClt4RKNGPAOYBV2LxreivenNMfE= +github.com/blinkbean/dingtalk v0.0.0-20201231030509-45a553a84503/go.mod h1:9BaLuGSBqY3vT5hstValh48DbsKO7vaHaJnG9pXwbto= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/chromedp/cdproto v0.0.0-20201009231348-1c6a710e77de h1:cuPPanKjAp5XBwrD1RkeN4ILGRSffUhS69LKkFqKtIA= github.com/chromedp/cdproto v0.0.0-20201009231348-1c6a710e77de/go.mod h1:zx0YH7hi8sqkYXAa0LZZxpQLDsU8/a2jzbYbK79dQO8= @@ -84,6 +88,7 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -120,7 +125,10 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.6 h1:MrUvLMLTMxbqFJ9kzlvat/rYZqZnW3u4wkLzWTaFwKs= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -135,6 +143,8 @@ github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czP github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/makiuchi-d/gozxing v0.0.0-20200903113411-25f730ed83da h1:OgNu1PPD9EvZckyKDAc8DA4KymNXuc6vaCLsdOGyjOE= +github.com/makiuchi-d/gozxing v0.0.0-20200903113411-25f730ed83da/go.mod h1:WoI7z45M7ZNA5BJxiJHaB+x7+k8S/3phW5Y13IR4yWY= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -147,7 +157,11 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -173,6 +187,8 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0= +github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -274,7 +290,10 @@ golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= diff --git a/jd_seckill/user.go b/jd_seckill/user.go index 2a86d06..fe0c557 100644 --- a/jd_seckill/user.go +++ b/jd_seckill/user.go @@ -10,127 +10,130 @@ import ( "log" "net/http" "os" + "path/filepath" "strconv" "time" ) type User struct { client *httpc.HttpClient - conf *goconfig.ConfigFile + conf *goconfig.ConfigFile } -func NewUser(client *httpc.HttpClient,conf *goconfig.ConfigFile) *User { - return &User{client: client,conf:conf } +func NewUser(client *httpc.HttpClient, conf *goconfig.ConfigFile) *User { + return &User{client: client, conf: conf} } func (this *User) getUserAgent() string { - return this.conf.MustValue("config","default_user_agent","") + return this.conf.MustValue("config", "default_user_agent", "") } func (this *User) loginPage() { - req:=httpc.NewRequest(this.client) - req.SetHeader("User-Agent",this.getUserAgent()) - req.SetHeader("Connection","keep-alive") - req.SetHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3") - _,_,_=req.SetUrl("https://passport.jd.com/new/login.aspx").SetMethod("get").Send().End() + req := httpc.NewRequest(this.client) + req.SetHeader("User-Agent", this.getUserAgent()) + req.SetHeader("Connection", "keep-alive") + req.SetHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3") + _, _, _ = req.SetUrl("https://passport.jd.com/new/login.aspx").SetMethod("get").Send().End() } -func (this *User) QrLogin() (string,error) { +func (this *User) QrLogin() (string, error) { //鐧诲綍椤甸潰 this.loginPage() //浜岀淮鐮佺櫥褰 - req:=httpc.NewRequest(this.client) - req.SetHeader("User-Agent",this.getUserAgent()) - req.SetHeader("Referer","https://passport.jd.com/new/login.aspx") - resp,err:=req.SetUrl("https://qr.m.jd.com/show?appid=133&size=300&t="+strconv.Itoa(int(time.Now().Unix()*1000))).SetMethod("get").Send().EndFile("./","qr_code.png") - if err!=nil || resp.StatusCode!=http.StatusOK { + req := httpc.NewRequest(this.client) + req.SetHeader("User-Agent", this.getUserAgent()) + req.SetHeader("Referer", "https://passport.jd.com/new/login.aspx") + resp, err := req.SetUrl("https://qr.m.jd.com/show?appid=133&size=300&t="+strconv.Itoa(int(time.Now().Unix()*1000))).SetMethod("get").Send().EndFile("./", "qr_code.png") + if err != nil || resp.StatusCode != http.StatusOK { log.Println("鑾峰彇浜岀淮鐮佸け璐") - return "",errors.New("鑾峰彇浜岀淮鐮佸け璐") + return "", errors.New("鑾峰彇浜岀淮鐮佸け璐") } - cookies:=resp.Cookies() - wlfstkSmdl:="" - for _,cookie:= range cookies { - if cookie.Name=="wlfstk_smdl" { - wlfstkSmdl=cookie.Value + cookies := resp.Cookies() + wlfstkSmdl := "" + for _, cookie := range cookies { + if cookie.Name == "wlfstk_smdl" { + wlfstkSmdl = cookie.Value break } } log.Println("浜岀淮鐮佽幏鍙栨垚鍔燂紝璇锋墦寮浜笢APP鎵弿") - dir,_:=os.Getwd() - common.OpenImage(dir+"/qr_code.png") - return wlfstkSmdl,nil + dir, _ := os.Getwd() + qrPath := filepath.Join(dir, `./qr_code.png`) + common.OpenImage(qrPath) + + return wlfstkSmdl, nil } -func (this *User) QrcodeTicket(wlfstkSmdl string) (string,error) { - req:=httpc.NewRequest(this.client) - req.SetHeader("User-Agent",this.getUserAgent()) - req.SetHeader("Referer","https://passport.jd.com/new/login.aspx") - resp,body,err:=req.SetUrl("https://qr.m.jd.com/check?appid=133&callback=jQuery"+strconv.Itoa(common.Rand(1000000,9999999))+"&token="+wlfstkSmdl+"&_="+strconv.Itoa(int(time.Now().Unix()*1000))).SetMethod("get").Send().End() - if err!=nil || resp.StatusCode!=http.StatusOK { +func (this *User) QrcodeTicket(wlfstkSmdl string) (string, error) { + req := httpc.NewRequest(this.client) + req.SetHeader("User-Agent", this.getUserAgent()) + req.SetHeader("Referer", "https://passport.jd.com/new/login.aspx") + resp, body, err := req.SetUrl("https://qr.m.jd.com/check?appid=133&callback=jQuery" + strconv.Itoa(common.Rand(1000000, 9999999)) + "&token=" + wlfstkSmdl + "&_=" + strconv.Itoa(int(time.Now().Unix()*1000))).SetMethod("get").Send().End() + if err != nil || resp.StatusCode != http.StatusOK { log.Println("鑾峰彇浜岀淮鐮佹壂鎻忕粨鏋滃紓甯") - return "",errors.New("鑾峰彇浜岀淮鐮佹壂鎻忕粨鏋滃紓甯") + return "", errors.New("鑾峰彇浜岀淮鐮佹壂鎻忕粨鏋滃紓甯") } - if gjson.Get(body,"code").Int()!=200 { - log.Printf("Code: %s, Message: %s",gjson.Get(body,"code").String(),gjson.Get(body,"msg").String()) - return "",errors.New(fmt.Sprintf("Code: %s, Message: %s",gjson.Get(body,"code").String(),gjson.Get(body,"msg").String())) + if gjson.Get(body, "code").Int() != 200 { + log.Printf("Code: %s, Message: %s", gjson.Get(body, "code").String(), gjson.Get(body, "msg").String()) + return "", errors.New(fmt.Sprintf("Code: %s, Message: %s", gjson.Get(body, "code").String(), gjson.Get(body, "msg").String())) } log.Println("宸插畬鎴愭墜鏈哄鎴风纭") - return gjson.Get(body,"ticket").String(),nil + return gjson.Get(body, "ticket").String(), nil } -func (this *User) TicketInfo(ticket string) (string,error) { - req:=httpc.NewRequest(this.client) - req.SetHeader("User-Agent",this.getUserAgent()) - req.SetHeader("Referer","https://passport.jd.com/uc/login?ltype=logout") - resp,body,err:=req.SetUrl("https://passport.jd.com/uc/qrCodeTicketValidation?t="+ticket).SetMethod("get").Send().End() - if err!=nil || resp.StatusCode!=http.StatusOK { +func (this *User) TicketInfo(ticket string) (string, error) { + req := httpc.NewRequest(this.client) + req.SetHeader("User-Agent", this.getUserAgent()) + req.SetHeader("Referer", "https://passport.jd.com/uc/login?ltype=logout") + resp, body, err := req.SetUrl("https://passport.jd.com/uc/qrCodeTicketValidation?t=" + ticket).SetMethod("get").Send().End() + if err != nil || resp.StatusCode != http.StatusOK { log.Println("浜岀淮鐮佷俊鎭牎楠屽け璐") - return "",errors.New("浜岀淮鐮佷俊鎭牎楠屽け璐") + return "", errors.New("浜岀淮鐮佷俊鎭牎楠屽け璐") } - if gjson.Get(body,"returnCode").Int()==0 { + if gjson.Get(body, "returnCode").Int() == 0 { log.Println("浜岀淮鐮佷俊鎭牎楠屾垚鍔") - return "",nil - }else{ + return "", nil + } else { log.Println("浜岀淮鐮佷俊鎭牎楠屽け璐") - return "",errors.New("浜岀淮鐮佷俊鎭牎楠屽け璐") + return "", errors.New("浜岀淮鐮佷俊鎭牎楠屽け璐") } } func (this *User) RefreshStatus() error { - client:=httpc.NewHttpClient() + client := httpc.NewHttpClient() client.SetCookieJar(common.CookieJar) client.SetRedirect(func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }) - req:=httpc.NewRequest(client) - req.SetHeader("User-Agent",this.getUserAgent()) - resp,_,err:=req.SetUrl("https://order.jd.com/center/list.action?rid="+strconv.Itoa(int(time.Now().Unix()*1000))).SetMethod("get").Send().End() - if err==nil && resp.StatusCode==http.StatusOK { + req := httpc.NewRequest(client) + req.SetHeader("User-Agent", this.getUserAgent()) + resp, _, err := req.SetUrl("https://order.jd.com/center/list.action?rid=" + strconv.Itoa(int(time.Now().Unix()*1000))).SetMethod("get").Send().End() + if err == nil && resp.StatusCode == http.StatusOK { return nil - }else{ + } else { return errors.New("鐧诲綍澶辨晥") } } -func (this *User) GetUserInfo() (string,error) { - req:=httpc.NewRequest(this.client) - req.SetHeader("User-Agent",this.getUserAgent()) - req.SetHeader("Referer","https://order.jd.com/center/list.action") - errorCount:=5 - nickName:="" - for { - if errorCount>0 { - _,body,_:=req.SetUrl("https://passport.jd.com/user/petName/getUserInfoForMiniJd.action?callback="+strconv.Itoa(common.Rand(1000000,9999999))+"&_="+strconv.Itoa(int(time.Now().Unix()*1000))).SetMethod("get").Send().End() - if gjson.Get(body,"nickName").Exists() { - nickName=gjson.Get(body,"nickName").String() +func (this *User) GetUserInfo() (string, error) { + req := httpc.NewRequest(this.client) + req.SetHeader("User-Agent", this.getUserAgent()) + req.SetHeader("Referer", "https://order.jd.com/center/list.action") + errorCount := 5 + nickName := "" + for { + if errorCount > 0 { + _, body, _ := req.SetUrl("https://passport.jd.com/user/petName/getUserInfoForMiniJd.action?callback=" + strconv.Itoa(common.Rand(1000000, 9999999)) + "&_=" + strconv.Itoa(int(time.Now().Unix()*1000))).SetMethod("get").Send().End() + if gjson.Get(body, "nickName").Exists() { + nickName = gjson.Get(body, "nickName").String() break } - errorCount=errorCount-1 - time.Sleep(300*time.Millisecond) - }else{ + errorCount = errorCount - 1 + time.Sleep(300 * time.Millisecond) + } else { break } } - b,_:=common.GbkToUtf8([]byte(nickName)) + b, _ := common.GbkToUtf8([]byte(nickName)) return string(b), nil -} \ No newline at end of file +} From 9e87050434ed932cb6ca091ef6e0d038cd2697c3 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Wed, 6 Jan 2021 11:59:21 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E9=87=8D=E5=86=99log=E6=A0=87=E5=87=86?= =?UTF-8?q?=E5=BA=93=EF=BC=8C=E5=B0=86=E6=97=A5=E5=BF=97=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=88=B0=E6=8E=A7=E5=88=B6=E5=8F=B0=E5=92=8C?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + cmd/jdTdudfp.go | 2 +- cmd/login.go | 2 +- cmd/logout.go | 2 +- cmd/reserve.go | 2 +- cmd/seckill.go | 2 +- go.mod | 2 ++ jd_seckill/seckill.go | 2 +- jd_seckill/session.go | 2 +- jd_seckill/user.go | 2 +- log/log.go | 66 +++++++++++++++++++++++++++++++++++++++++++ main.go | 18 ++---------- service/dingtalk.go | 2 +- service/email.go | 2 +- service/wechat.go | 2 +- 15 files changed, 83 insertions(+), 26 deletions(-) create mode 100644 log/log.go diff --git a/.gitignore b/.gitignore index 311a4e9..0a763d1 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ /cookie.txt *.bak go.sum +/鍚屾浠g爜.sh diff --git a/cmd/jdTdudfp.go b/cmd/jdTdudfp.go index 1d8c62b..39077f1 100644 --- a/cmd/jdTdudfp.go +++ b/cmd/jdTdudfp.go @@ -10,7 +10,7 @@ import ( "github.com/unknwon/goconfig" "github.com/ztino/jd_seckill/common" "github.com/ztino/jd_seckill/jd_seckill" - "log" + "github.com/ztino/jd_seckill/log" "net/url" "os" "time" diff --git a/cmd/login.go b/cmd/login.go index 66d58cd..8b5458d 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -4,7 +4,7 @@ import ( "github.com/spf13/cobra" "github.com/ztino/jd_seckill/common" "github.com/ztino/jd_seckill/jd_seckill" - "log" + "github.com/ztino/jd_seckill/log" "os" "time" ) diff --git a/cmd/logout.go b/cmd/logout.go index 2e48a4f..29b0f86 100644 --- a/cmd/logout.go +++ b/cmd/logout.go @@ -3,7 +3,7 @@ package cmd import ( "github.com/spf13/cobra" "github.com/ztino/jd_seckill/common" - "log" + "github.com/ztino/jd_seckill/log" "os" ) diff --git a/cmd/reserve.go b/cmd/reserve.go index 1a549d2..81ccef0 100644 --- a/cmd/reserve.go +++ b/cmd/reserve.go @@ -4,7 +4,7 @@ import ( "github.com/spf13/cobra" "github.com/ztino/jd_seckill/common" "github.com/ztino/jd_seckill/jd_seckill" - "log" + "github.com/ztino/jd_seckill/log" ) func init() { diff --git a/cmd/seckill.go b/cmd/seckill.go index 89f1622..07c2a89 100644 --- a/cmd/seckill.go +++ b/cmd/seckill.go @@ -8,7 +8,7 @@ import ( "github.com/tidwall/gjson" "github.com/ztino/jd_seckill/common" "github.com/ztino/jd_seckill/jd_seckill" - "log" + "github.com/ztino/jd_seckill/log" "net/http" "os" "strconv" diff --git a/go.mod b/go.mod index fbf6966..c2bf98c 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/chromedp/cdproto v0.0.0-20201204063249-be40c824ad18 github.com/chromedp/chromedp v0.5.4 github.com/gobwas/httphead v0.1.0 // indirect + github.com/gookit/color v1.3.6 github.com/json-iterator/go v1.1.10 // indirect github.com/makiuchi-d/gozxing v0.0.0-20200903113411-25f730ed83da github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e @@ -19,6 +20,7 @@ require ( golang.org/x/net v0.0.0-20201224014010-6772e930b67b // indirect golang.org/x/sys v0.0.0-20201231184435-2d18734c6014 // indirect golang.org/x/text v0.3.4 + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df ) diff --git a/jd_seckill/seckill.go b/jd_seckill/seckill.go index 74e8524..968e12d 100644 --- a/jd_seckill/seckill.go +++ b/jd_seckill/seckill.go @@ -9,7 +9,7 @@ import ( "github.com/unknwon/goconfig" "github.com/ztino/jd_seckill/common" "github.com/ztino/jd_seckill/service" - "log" + "github.com/ztino/jd_seckill/log" "net/http" "strconv" "strings" diff --git a/jd_seckill/session.go b/jd_seckill/session.go index 10a1fc9..82abd86 100644 --- a/jd_seckill/session.go +++ b/jd_seckill/session.go @@ -5,8 +5,8 @@ import ( "errors" "github.com/Albert-Zhan/httpc" "github.com/ztino/jd_seckill/common" + "github.com/ztino/jd_seckill/log" "io/ioutil" - "log" "net/http" "net/url" "os" diff --git a/jd_seckill/user.go b/jd_seckill/user.go index 3ba429e..2e9f19e 100644 --- a/jd_seckill/user.go +++ b/jd_seckill/user.go @@ -7,7 +7,7 @@ import ( "github.com/tidwall/gjson" "github.com/unknwon/goconfig" "github.com/ztino/jd_seckill/common" - "log" + "github.com/ztino/jd_seckill/log" "net/http" "os" "path/filepath" diff --git a/log/log.go b/log/log.go new file mode 100644 index 0000000..8ef0ef4 --- /dev/null +++ b/log/log.go @@ -0,0 +1,66 @@ +package log + +import ( + "github.com/gookit/color" + "io" + "log" + "os" + "time" +) + +//閲嶅啓log鏍囧噯搴擄紝闇瑕佸灏戜釜鏂规硶灏卞姞澶氬皯涓 + +var file = "./logs/jd_seckill_" + time.Now().Format("20060102") + ".log" + +//灏嗘棩蹇楀悓鏃惰緭鍑哄埌鎺у埗鍙板拰鏂囦欢 +func Println(v ...interface{}) { + logFile, logErr := os.OpenFile(file, os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666) + if logErr != nil { + panic(logErr) + } + defer logFile.Close() + mw := io.MultiWriter(os.Stdout, logFile) + log.SetOutput(mw) + //log.SetPrefix("[jd_seckill]") + log.SetFlags(log.LstdFlags | log.Lshortfile | log.Lmicroseconds) + log.Println(v...) +} + +//灏嗘棩蹇楀悓鏃惰緭鍑哄埌鎺у埗鍙板拰鏂囦欢 +func ColorPrintln(color2 color.Color, v ...interface{}) { + logFile, logErr := os.OpenFile(file, os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666) + if logErr != nil { + panic(logErr) + } + defer logFile.Close() + log.SetOutput(logFile) + //log.SetPrefix("[jd_seckill]") + log.SetFlags(log.LstdFlags | log.Lshortfile | log.Lmicroseconds) + log.Println(v...) + color2.Light().Println(v...) +} + +func Fatal(v ...interface{}) { + log.Fatal(v...) +} + +func Printf(format string, v ...interface{}) { + log.Printf(format, v...) +} + +func Success(v ...interface{}) { + ColorPrintln(color.Green, v...) +} + +func Info(v ...interface{}) { + ColorPrintln(color.LightCyan, v...) +} + +func Warning(v ...interface{}) { + ColorPrintln(color.Yellow, v...) +} + +func Error(v ...interface{}) { + ColorPrintln(color.FgLightRed, v...) + os.Exit(0) +} diff --git a/main.go b/main.go index 3cf7746..522a835 100644 --- a/main.go +++ b/main.go @@ -5,28 +5,16 @@ import ( "github.com/unknwon/goconfig" "github.com/ztino/jd_seckill/cmd" "github.com/ztino/jd_seckill/common" - "io" - "log" + "github.com/ztino/jd_seckill/log" "os" "runtime" - "time" ) func init() { - //鏃ュ織鍒濆鍖,灏嗘棩蹇楀悓鏃惰緭鍑哄埌鎺у埗鍙板拰鏂囦欢 + //鏃ュ織鍒濆鍖 if !common.IsDir("./logs/") { - _=os.Mkdir("./logs/",0777) + _ = os.Mkdir("./logs/", 0777) } - file := "./logs/jd_seckill_" + time.Now().Format("20060102") + ".log" - logFile, logErr := os.OpenFile(file, os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666) - if logErr != nil { - panic(logErr) - } - defer logFile.Close() - mw := io.MultiWriter(os.Stdout, logFile) - log.SetOutput(mw) - log.SetPrefix("[jd_seckill] ") - log.SetFlags(log.LstdFlags | log.Lshortfile | log.LUTC) //瀹㈡埛绔缃垵濮嬪寲 common.Client=httpc.NewHttpClient() diff --git a/service/dingtalk.go b/service/dingtalk.go index 7de4c74..fdead76 100644 --- a/service/dingtalk.go +++ b/service/dingtalk.go @@ -3,7 +3,7 @@ package service import ( "github.com/blinkbean/dingtalk" "github.com/unknwon/goconfig" - "log" + "github.com/ztino/jd_seckill/log" ) type Dingtalk struct { diff --git a/service/email.go b/service/email.go index 2a64907..29b60e5 100644 --- a/service/email.go +++ b/service/email.go @@ -3,7 +3,7 @@ package service import ( "github.com/unknwon/goconfig" "gopkg.in/gomail.v2" - "log" + "github.com/ztino/jd_seckill/log" "strconv" ) diff --git a/service/wechat.go b/service/wechat.go index a60e630..986c82b 100644 --- a/service/wechat.go +++ b/service/wechat.go @@ -6,7 +6,7 @@ import ( "github.com/Albert-Zhan/httpc" "github.com/tidwall/gjson" "github.com/unknwon/goconfig" - "log" + "github.com/ztino/jd_seckill/log" "net/http" ) From 806d7e5bbb0773dd4ce96e8aea1a2524f40c83e4 Mon Sep 17 00:00:00 2001 From: pppscn <35696959@qq.com> Date: Wed, 6 Jan 2021 12:12:49 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=B8=85=E7=90=86?= =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/login.go | 1 + jd_seckill/user.go | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/login.go b/cmd/login.go index 8b5458d..3d1d95e 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -30,6 +30,7 @@ func startLogin(cmd *cobra.Command, args []string) { return } user:=jd_seckill.NewUser(common.Client,common.Config) + user.DelQrCode() log.Println("鐧诲綍鎴愬姛") userInfo,_:=user.GetUserInfo() log.Println("鐢ㄦ埛:"+userInfo) diff --git a/jd_seckill/user.go b/jd_seckill/user.go index 2e9f19e..ad65a88 100644 --- a/jd_seckill/user.go +++ b/jd_seckill/user.go @@ -85,6 +85,7 @@ func (this *User) TicketInfo(ticket string) (string,error) { req.SetHeader("User-Agent",this.getUserAgent()) req.SetHeader("Referer","https://passport.jd.com/uc/login?ltype=logout") resp,body,err:=req.SetUrl("https://passport.jd.com/uc/qrCodeTicketValidation?t="+ticket).SetMethod("get").Send().End() + defer this.DelQrCode() if err!=nil || resp.StatusCode!=http.StatusOK { log.Println("浜岀淮鐮佷俊鎭牎楠屽け璐") return "",errors.New("浜岀淮鐮佷俊鎭牎楠屽け璐") @@ -135,4 +136,13 @@ func (this *User) GetUserInfo() (string,error) { } b,_:=common.GbkToUtf8([]byte(nickName)) return string(b), nil -} \ No newline at end of file +} + +func (this *User) DelQrCode() { + dir, _ := os.Getwd() + qrPath := filepath.Join(dir, `./qr_code.png`) + log.Println(qrPath) + if _, err := os.Stat(qrPath); !os.IsNotExist(err) { + os.Remove(qrPath) + } +} From a99588e6eaee934f8da5d5000a411eaeb5cd34e5 Mon Sep 17 00:00:00 2001 From: ztino <> Date: Wed, 6 Jan 2021 19:09:51 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/var.go | 2 +- go.mod | 1 - jd_seckill/seckill.go | 5 +---- jd_seckill/user.go | 5 ++--- service/email.go | 2 +- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/common/var.go b/common/var.go index 42b57c5..468685c 100644 --- a/common/var.go +++ b/common/var.go @@ -7,7 +7,7 @@ import ( const ( SoftName = "jd_seckill" - Version = "0.2.0" + Version = "0.2.1" DateTimeFormatStr = "2006-01-02 15:04:05" DateFormatStr = "2006-01-02" ) diff --git a/go.mod b/go.mod index c2bf98c..266f514 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.15 require ( github.com/Albert-Zhan/httpc v0.0.0-20190712132051-aed72924b5e6 - github.com/CodyGuo/win v0.0.0-20170113125346-08e6b7208274 github.com/PuerkitoBio/goquery v1.6.0 github.com/blinkbean/dingtalk v0.0.0-20201231030509-45a553a84503 github.com/chromedp/cdproto v0.0.0-20201204063249-be40c824ad18 diff --git a/jd_seckill/seckill.go b/jd_seckill/seckill.go index 968e12d..8b8fb30 100644 --- a/jd_seckill/seckill.go +++ b/jd_seckill/seckill.go @@ -8,8 +8,8 @@ import ( "github.com/tidwall/gjson" "github.com/unknwon/goconfig" "github.com/ztino/jd_seckill/common" - "github.com/ztino/jd_seckill/service" "github.com/ztino/jd_seckill/log" + "github.com/ztino/jd_seckill/service" "net/http" "strconv" "strings" @@ -241,9 +241,6 @@ func (this *Seckill) SubmitSeckillOrder() bool { return false } - //涓存椂鎵撳嵃鏁版嵁 - log.Println("杩斿洖淇℃伅:"+body) - if !gjson.Valid(body) { log.Println("鎶㈣喘澶辫触锛岃繑鍥炰俊鎭:" + body) _ = service.SendMessage(this.conf, "鑼呭彴鎶㈣喘閫氱煡", "鎶㈣喘澶辫触锛岃繑鍥炰俊鎭:"+body) diff --git a/jd_seckill/user.go b/jd_seckill/user.go index ad65a88..bc84d79 100644 --- a/jd_seckill/user.go +++ b/jd_seckill/user.go @@ -141,8 +141,7 @@ func (this *User) GetUserInfo() (string,error) { func (this *User) DelQrCode() { dir, _ := os.Getwd() qrPath := filepath.Join(dir, `./qr_code.png`) - log.Println(qrPath) - if _, err := os.Stat(qrPath); !os.IsNotExist(err) { - os.Remove(qrPath) + if common.Exists(qrPath) { + _=os.Remove(qrPath) } } diff --git a/service/email.go b/service/email.go index 29b60e5..cd6b351 100644 --- a/service/email.go +++ b/service/email.go @@ -2,8 +2,8 @@ package service import ( "github.com/unknwon/goconfig" - "gopkg.in/gomail.v2" "github.com/ztino/jd_seckill/log" + "gopkg.in/gomail.v2" "strconv" ) From fb2be80bdf3cc3030fe5b1ccc1144ae25d2cff4c Mon Sep 17 00:00:00 2001 From: ztino <> Date: Wed, 6 Jan 2021 20:20:32 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8DServer=E9=85=B1=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/wechat.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/service/wechat.go b/service/wechat.go index 986c82b..7b60f9b 100644 --- a/service/wechat.go +++ b/service/wechat.go @@ -7,7 +7,6 @@ import ( "github.com/tidwall/gjson" "github.com/unknwon/goconfig" "github.com/ztino/jd_seckill/log" - "net/http" ) type Wechat struct { @@ -23,11 +22,7 @@ func (this *Wechat) Send(title,msg string) error { req:=httpc.NewRequest(client) url:=fmt.Sprintf("http://sc.ftqq.com/%s.send",this.conf.MustValue("messenger","server_chan_sckey","")) req.SetHeader("User-Agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36") - resp,body,err:=req.SetUrl(url+"?text="+title+"&desp="+msg).SetMethod("get").Send().End() - if err!=nil || resp.StatusCode!=http.StatusOK { - log.Println("寰俊鎺ㄩ佸け璐ワ紝缃戠粶閿欒") - return errors.New("寰俊鎺ㄩ佸け璐ワ紝缃戠粶閿欒") - } + _,body,_:=req.SetUrl(url+"?text="+title+"&desp="+msg).SetMethod("get").Send().End() if gjson.Get(body,"errno").Int()!=0 { log.Println("寰俊鎺ㄩ佸け璐ワ紝杩斿洖閿欒:"+gjson.Get(body,"errmsg").String()) return errors.New("寰俊鎺ㄩ佸け璐ワ紝杩斿洖閿欒:"+gjson.Get(body,"errmsg").String()) From 545d7da8abfc29838528e8eaa128178d511ca008 Mon Sep 17 00:00:00 2001 From: ztino <> Date: Wed, 6 Jan 2021 20:32:11 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 7a58c82..e54355b 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ jd_seckill login > 鈿犱緷璧栬胺姝屾祻瑙堝櫒锛岃瀹夎璋锋瓕娴忚鍣紝windows涓嬭灏嗗畨瑁呯洰褰曞姞鍏ョ郴缁熷彉閲廝ath +> 鈿 浜笢鍙兘鍦ㄤ慨鏀筫id鍜宖p鐨勮幏鍙栨柟寮忎簡锛岀洰鍓嶈鍔熻兘鑾峰彇涓嶅お绋冲畾锛岃鍕夸緷璧栬鍔熻兘锛岀洰鍓嶈鏈涗腑锛屼笉鍋氭洿鏀 + 鎵ц浠ヤ笅鍛戒护鎸夌収鎻愮ず鎿嶄綔: ```shell #鍙傛暟--good_url鍟嗗搧閾炬帴蹇呴』璁剧疆锛岄摼鎺ュ湴鍧鏄竴涓彲浠ュ姞鍏ヨ喘鐗╄溅鐨勫晢鍝 @@ -82,6 +84,9 @@ jd_seckill version #### 1. 鎺ㄨ崘Chrome娴忚鍣 #### 2. 缃戦〉鎵爜鐧诲綍锛屾垨鑰呰处鍙峰瘑鐮佺櫥褰 #### 3. 濉啓config.ini閰嶇疆淇℃伅 + +> 鈿 鎸夌収涓嬫柟鑾峰彇涓嶅埌鐨勶紝鍙互鐐瑰嚮杩涘叆浠樻鐣岄潰(杈撳叆鏀粯瀵嗙爜椤甸潰)锛屽皾璇曚笅鏂规楠よ繘琛岃幏鍙 + (1)`eid`鍜宍fp`鎵句釜鏅氬晢鍝侀殢渚夸笅鍗,鐒跺悗鎶撳寘灏辫兘鐪嬪埌,杩欎袱涓煎彲浠ュ~鍥哄畾鐨 > 闅忎究鎵句竴涓晢鍝佷笅鍗曪紝鐒跺悗杩涘叆缁撶畻椤甸潰锛屾墦寮娴忚鍣ㄧ殑璋冭瘯绐楀彛锛屽垏鎹㈠埌鎺у埗鍙癟ab椤碉紝鍦ㄦ帶鍒跺彴涓緭鍏ュ彉閲廯_JdTdudfp`锛屽嵆鍙粠杈撳嚭鐨凧son涓幏鍙朻eid`鍜宍fp`銆 > 涓嶄細鐨勮瘽鍙傝僫ssue https://github.com/ztino/jd_seckill/issues/2 @@ -99,6 +104,8 @@ jd_seckill version > 鍦ㄧ▼搴忓紑濮嬭繍琛屽悗锛屼細妫娴嬫湰鍦版椂闂翠笌浜笢鏈嶅姟鍣ㄦ椂闂达紝杈撳嚭鐨勫樊鍊间负鏈湴鏃堕棿-浜笢鏈嶅姟鍣ㄦ椂闂达紝鍗-50涓烘湰鍦版椂闂存瘮浜笢鏈嶅姟鍣ㄦ椂闂存參50ms銆 > 鏈唬鐮佺殑鎵ц鐨勬姠璐椂闂翠互鏈湴鐢佃剳/鏈嶅姟鍣ㄦ椂闂翠负鍑 +> 鈿 浜笢姣忔湀闄愯喘涓ょ摱锛屽鏋滄湰鏈堝凡鎶㈠埌涓ょ摱锛屼竴涓湀鍚庡啀鎶㈠惂锛屾湁鐨勬姠鍒1鐡剁殑锛屼娇鐢ㄨ剼鏈寰楅渶瑕佷慨鏀瑰弬鏁 + (4)淇敼鎶㈣喘鐡舵暟 > 鍙湪閰嶇疆鏂囦欢涓壘鍒皊eckill_num杩涜淇敼锛岄粯璁ゅ2鐡 From c80c580526b61dc028014ad67f21507082e08c18 Mon Sep 17 00:00:00 2001 From: ztino <76823311+ztino@users.noreply.github.com> Date: Thu, 7 Jan 2021 01:38:48 +0000 Subject: [PATCH 7/8] =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index e54355b..de8b1cd 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,5 @@ -Jd_Seckill +helloworld ======= - -#### 杩樻湭鏀跺埌瀹夊叏閫氱煡锛屼絾鏄及璁′篃蹇簡锛岀粰澶у寤轰釜Telegram缇ゅ惂锛岃尪浣欓キ鍚庯紝鑱婂ぉ鎵贰锛屾湁鏉′欢鐨勫彲浠ュ姞鍏ワ細https://t.me/joinchat/GsDnhtkdKJ4nbwJh - > 鈿 姝ら」鐩槸[python jd_seckill](https://github.com/huanghyw/jd_seckill) 鐨刧o鐗堟湰瀹炵幇锛屾棬鍦ㄩ檷浣庝娇鐢ㄩ棬鏍忓拰鐩镐簰瀛︿範鑰屽垱寤恒 **go鐗堟湰鐨刯d_seckill锛屼含涓滄姠鑼呭彴绁炲櫒锛屾敮鎸佽法骞冲彴锛屼娇鐢ㄨ呰鍦ㄥ彂甯冮〉涓嬭浇鍙墽琛屾枃浠讹紝娆㈣繋pr銆** From 6100fdc77a553ce6b3107c452e480dd2237dd156 Mon Sep 17 00:00:00 2001 From: ztino <76823311+ztino@users.noreply.github.com> Date: Thu, 7 Jan 2021 01:40:36 +0000 Subject: [PATCH 8/8] =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index de8b1cd..7f6c442 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ helloworld >鐩墠缂栬瘧濂界殑鍙墽琛屾枃浠舵湁Windows,MacOS,Linux,arm,mips骞冲彴銆 -## 瀹夎 +## 瀹夎(寮鍙戣) 鏂瑰紡涓(鎺ㄨ崘):