From b3f7509ba48aba7b4507a6544964d2eccd148608 Mon Sep 17 00:00:00 2001 From: cdle <798731886@qq.com> Date: Thu, 19 Aug 2021 13:07:58 +0800 Subject: [PATCH] x --- models/asset.go | 25 ++++++++++++++++++++++++- models/available.go | 2 ++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/models/asset.go b/models/asset.go index dd18b3c..bfdf8ab 100644 --- a/models/asset.go +++ b/models/asset.go @@ -82,12 +82,14 @@ func (ck *JdCookie) Query() string { var gold = make(chan int64) var egg = make(chan int64) var tyt = make(chan string) + var mmc = make(chan int64) go redPacket(cookie, rpc) go initFarm(cookie, fruit) go initPetTown(cookie, pet) go jsGold(cookie, gold) go jxncEgg(cookie, egg) go tytCoupon(cookie, tyt) + go mmCoin(cookie, mmc) today := time.Now().Local().Format("2006-01-02") yestoday := time.Now().Local().Add(-time.Hour * 24).Format("2006-01-02") page := 1 @@ -184,6 +186,12 @@ func (ck *JdCookie) Query() string { msgs = append(msgs, fmt.Sprintf("极速金币:%d(≈%.2f元)💰", gn, float64(gn)/10000)) msgs = append(msgs, fmt.Sprintf("惊喜牧场:%d枚鸡蛋🥚", <-egg)) msgs = append(msgs, fmt.Sprintf("推一推券:%s", <-tyt)) + mmcCoin := <-mmc + if mmcCoin == 0 { + msgs = append(msgs, fmt.Sprintf("京东秒杀:%d秒秒币(≈%.2f元)💰", mmcCoin, float64(mmcCoin)/1000)) + } else { + msgs = append(msgs, fmt.Sprintf("京东秒杀:暂无数据")) + } } else { msgs = append(msgs, []string{ "提醒:该账号已过期,请重新登录", @@ -565,7 +573,7 @@ func jsGold(cookie string, state chan int64) { // RequestID string `json:"requestId"` } a := AutoGenerated{} - req := httplib.Post(`https://api.m.jd.com??functionId=MyAssetsService.execute&appid=market-task-h5`) + req := httplib.Post(`https://api.m.jd.com?functionId=MyAssetsService.execute&appid=market-task-h5`) req.Header("Accept", "application/json, text/plain, */*") req.Header("Accept-Encoding", "gzip, deflate, br") req.Header("Cookie", cookie) @@ -716,3 +724,18 @@ func tytCoupon(cookie string, state chan string) { } state <- rt } + +func mmCoin(cookie string, state chan int64) { + req := httplib.Post(`https://api.m.jd.com/client.action`) + req.Header("Host", "api.m.jd.com") + req.Header("Accept", "application/json, text/plain, */*") + req.Header("Origin", "https://h5.m.jd.com") + + req.Header("User-Agent", ua) + req.Header("cookie", cookie) + req.Header("Content-Type", "application/x-www-form-urlencoded") + req.Body(`uuid=3245ad3d16ab2153c69f9ca91cd2e931b06a3bb8&clientVersion=10.1.0&client=wh5&osVersion=&area=&networkType=wifi&functionId=homePageV2&body=%7B%7D&appid=SecKill2020`) + data, _ := req.Bytes() + mmc, _ := jsonparser.GetInt(data, "result", "assignment", "assignmentPoints") + state <- mmc +} diff --git a/models/available.go b/models/available.go index 1c9c59f..76b6736 100644 --- a/models/available.go +++ b/models/available.go @@ -134,7 +134,9 @@ func initCookie() { } func CookieOK(ck *JdCookie) bool { + cookie := fmt.Sprintf("pt_key=%s;pt_pin=%s;", ck.PtKey, ck.PtPin) + // mmCoin(cookie) if ck == nil { return true }