MCPcopy Create free account
hub / github.com/smallfawn/QLScriptPublic / ErkeAPI

Class ErkeAPI

daily/erke.py:55–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 }
54
55class ErkeAPI:
56 def __init__(self, member_id, enterprise_id, unionid, openid, wx_openid, account_name):
57 self.member_id = member_id
58 self.enterprise_id = enterprise_id
59 self.unionid = unionid
60 self.openid = openid
61 self.wx_openid = wx_openid
62 self.account_name = account_name
63 self.appid = "wxa1f1fa3785a47c7d"
64 self.base_url = 'https://hope.demogic.com/gic-wx-app'
65 self.ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF'
66
67 def get_headers(self, sign_val: str) -> Dict[str, str]:
68 return {
69 'User-Agent': self.ua,
70 'Content-Type': 'application/x-www-form-urlencoded',
71 'sign': sign_val, # 注意:原逻辑此处传入的是enterprise_id
72 'channelEntrance': 'wx_app',
73 'Referer': 'https://servicewechat.com/wxa1f1fa3785a47c7d/85/page-frame.html',
74 }
75
76 def get_integral(self):
77 """查询积分明细"""
78 sign_data = calculate_sign(self.appid, self.member_id)
79 data = {
80 'currentPage': 1,
81 'pageSize': 20,
82 'memberId': self.member_id,
83 'cliqueId': '-1',
84 'enterpriseId': self.enterprise_id,
85 'unionid': self.unionid,
86 'openid': self.openid,
87 'wxOpenid': self.wx_openid,
88 'random': sign_data['random'],
89 'appid': self.appid,
90 'transId': sign_data['transId'],
91 'sign': sign_data['sign'],
92 'timestamp': sign_data['timestamp'],
93 'gicWxaVersion': '3.9.56'
94 }
95
96 try:
97 res = requests.post(f"{self.base_url}/integral_record.json",
98 headers=self.get_headers(self.enterprise_id),
99 data=data, timeout=10).json()
100 response_obj = res.get('response', {})
101 accumulate = response_obj.get('accumulatPoints', 0)
102 logger.info(f"[{self.account_name}] 当前累计积分: {accumulate}")
103 return accumulate
104 except Exception as e:
105 logger.error(f"[{self.account_name}] 积分查询异常: {e}")
106 return "未知"
107
108 def sign_in(self):
109 """执行签到"""
110 sign_data = calculate_sign(self.appid, self.member_id)
111 payload = {
112 'source': 'wxapp',

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected