diff --git a/jd_blueCoin.py b/jd_blueCoin.py index 8b7f24bd2..fde4ab93b 100644 --- a/jd_blueCoin.py +++ b/jd_blueCoin.py @@ -104,6 +104,10 @@ def getCookie(self): global cookies ckfile = self.getckfile() try: + if "JD_COOKIE" in os.environ: + if len(os.environ["JD_COOKIE"]) > 10: + cookies = os.environ["JD_COOKIE"] + printT("已获取并使用Env环境 Cookie") if os.path.exists(ckfile): with open(ckfile, "r", encoding="utf-8") as f: cks = f.read() @@ -126,10 +130,6 @@ def getCookie(self): cks = "#多账号换行,以下示例:(通过正则获取此文件的ck,理论上可以自定义名字标记ck,也可以随意摆放ck)\n账号1【Curtinlv】cookie1;\n账号2【TopStyle】cookie2;" f.write(cks) f.close() - if "JD_COOKIE" in os.environ: - if len(os.environ["JD_COOKIE"]) > 10: - cookies = os.environ["JD_COOKIE"] - printT("已获取并使用Env环境 Cookie") except Exception as e: printT(f"【getCookie Error】{e}") @@ -205,7 +205,7 @@ def iscookie(self): getCk.getCookie() # 获取v4环境 特殊处理 -if os.path.exists(v4f): +if os.path.exists(v4f) and "JD_COOKIE" not in os.environ: try: with open(v4f, 'r', encoding='utf-8') as f: curenv = locals() @@ -580,4 +580,4 @@ def start(): if '成功兑换' in msg_info: send(script_name, msg_info) except: - pass \ No newline at end of file + pass diff --git a/jd_cashHelp.py b/jd_cashHelp.py index bf59fcbb9..b39f1915a 100644 --- a/jd_cashHelp.py +++ b/jd_cashHelp.py @@ -115,6 +115,10 @@ def getCookie(self): global cookies ckfile = self.getckfile() try: + if "JD_COOKIE" in os.environ: + if len(os.environ["JD_COOKIE"]) > 10: + cookies = os.environ["JD_COOKIE"] + print("已获取并使用Env环境 Cookie") if os.path.exists(ckfile): with open(ckfile, "r", encoding="utf-8") as f: cks = f.read() @@ -137,10 +141,6 @@ def getCookie(self): cks = "#多账号换行,以下示例:(通过正则获取此文件的ck,理论上可以自定义名字标记ck,也可以随意摆放ck)\n账号1【Curtinlv】cookie1;\n账号2【TopStyle】cookie2;" f.write(cks) f.close() - if "JD_COOKIE" in os.environ: - if len(os.environ["JD_COOKIE"]) > 10: - cookies = os.environ["JD_COOKIE"] - print("已获取并使用Env环境 Cookie") except Exception as e: print(f"【getCookie Error】{e}") @@ -216,7 +216,7 @@ def iscookie(self): getCk.getCookie() # 获取v4环境 特殊处理 -if os.path.exists(v4f): +if os.path.exists(v4f) and "JD_COOKIE" not in os.environ: try: with open(v4f, 'r', encoding='utf-8') as f: curenv = locals() diff --git a/jd_jxgc_tuan.py b/jd_jxgc_tuan.py index 6e9433e47..846b70953 100644 --- a/jd_jxgc_tuan.py +++ b/jd_jxgc_tuan.py @@ -112,6 +112,10 @@ def getCookie(self): global cookies ckfile = self.getckfile() try: + if "JD_COOKIE" in os.environ: + if len(os.environ["JD_COOKIE"]) > 10: + cookies = os.environ["JD_COOKIE"] + print("已获取并使用Env环境 Cookie") if os.path.exists(ckfile): with open(ckfile, "r", encoding="utf-8") as f: cks = f.read() @@ -134,10 +138,6 @@ def getCookie(self): cks = "#多账号换行,以下示例:(通过正则获取此文件的ck,理论上可以自定义名字标记ck,也可以随意摆放ck)\n账号1【Curtinlv】cookie1;\n账号2【TopStyle】cookie2;" f.write(cks) f.close() - if "JD_COOKIE" in os.environ: - if len(os.environ["JD_COOKIE"]) > 10: - cookies = os.environ["JD_COOKIE"] - print("已获取并使用Env环境 Cookie") except Exception as e: print(f"【getCookie Error】{e}") @@ -213,7 +213,7 @@ def iscookie(self): getCk.getCookie() # 获取v4环境 特殊处理 -if os.path.exists(v4f): +if os.path.exists(v4f) and "JD_COOKIE" not in os.environ: try: with open(v4f, 'r', encoding='utf-8') as f: curenv = locals() @@ -597,4 +597,4 @@ def start(): except: pass if __name__ == '__main__': - start() \ No newline at end of file + start() diff --git a/jd_qjd.py b/jd_qjd.py index 0b639e551..7d26abc6a 100644 --- a/jd_qjd.py +++ b/jd_qjd.py @@ -173,6 +173,11 @@ def getCookie(self): global cookies ckfile = self.getckfile() try: + if "JD_COOKIE" in os.environ: + if len(os.environ["JD_COOKIE"]) > 10: + cookies = os.environ["JD_COOKIE"] + print("已获取并使用Env环境 Cookie") + if os.path.exists(ckfile): with open(ckfile, "r", encoding="utf-8") as f: cks = f.read() @@ -195,10 +200,7 @@ def getCookie(self): cks = "#多账号换行,以下示例:(通过正则获取此文件的ck,理论上可以自定义名字标记ck,也可以随意摆放ck)\n账号1【Curtinlv】cookie1;\n账号2【TopStyle】cookie2;" f.write(cks) f.close() - if "JD_COOKIE" in os.environ: - if len(os.environ["JD_COOKIE"]) > 10: - cookies = os.environ["JD_COOKIE"] - print("已获取并使用Env环境 Cookie") + except Exception as e: print(f"【getCookie Error】{e}") @@ -273,7 +275,7 @@ def iscookie(self): getCk = getJDCookie() getCk.getCookie() # 获取v4环境 特殊处理 -if os.path.exists(v4f): +if os.path.exists(v4f) and "JD_COOKIE" not in os.environ: try: with open(v4f, 'r', encoding='utf-8') as f: curenv = locals()