From 23b12c485d03c100c87e466d733aa95da8e10e7c Mon Sep 17 00:00:00 2001 From: chenjunxue <1523825571@qq.com> Date: Wed, 3 Mar 2021 12:56:41 +0800 Subject: [PATCH] 5.1.9 1.采集服务增加区别使用 --- conf/config.yaml | 4 ++-- core/callback.py | 9 ++++++--- core/monitor.py | 4 ++-- lib/state.py | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/conf/config.yaml b/conf/config.yaml index 191341a..b13e1d9 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -5,5 +5,5 @@ SERVER: control: http://fbchat.xyz:39002/api/terminal mark: ntkj VERSION: - code: 518 - name: 5.1.8 \ No newline at end of file + code: 519 + name: 5.1.9 \ No newline at end of file diff --git a/core/callback.py b/core/callback.py index bc06a47..76526bc 100644 --- a/core/callback.py +++ b/core/callback.py @@ -64,7 +64,7 @@ class CallBack(): def onLoggingIn(self, email, password, cookie, user_agent=None, proxy=None, approvals_code: list = None, clear: bool = False, is_second: bool = False, adId=None, deviceId=None, familyDeviceId=None, - machineId=None, is_collect=False): + machineId=None, is_collect=False, user_mark=None): if clear: print('清理缓存登录', email) try: @@ -103,6 +103,7 @@ class CallBack(): user_obj.approvals_code = approvals_code # 设置安全码 user_obj.is_second = is_second # 是否是二次登录 user_obj.is_collect = is_collect + user_obj.user_mark = user_mark # 用户标记 return user_obj def onLoggedIn(self, client: FacebookClient): @@ -129,9 +130,11 @@ class CallBack(): try: threading.Thread(target=redis.set, kwargs={'name': client.user_obj.email, 'value': redis_save}).start() threading.Thread(target=redis.set, kwargs={'name': client.user_obj.fbid, 'value': redis_save}).start() - if client.user_obj.is_collect or redis.exists(f'collect:{client.user_obj.fbid}'): + if client.user_obj.is_collect or redis.exists( + f'collect:{client.user_obj.fbid}') and client.user_obj.user_mark is not None: threading.Thread(target=redis.set, - kwargs={'name': f'collect:{client.user_obj.fbid}', 'value': redis_save}).start() + kwargs={'name': f'collect:{client.user_obj.user_mark}:{client.user_obj.fbid}', + 'value': redis_save}).start() print('保存redis成功', redis_save) except BaseException as e: print('保存redis失败', e) diff --git a/core/monitor.py b/core/monitor.py index e5233e7..9645bb9 100644 --- a/core/monitor.py +++ b/core/monitor.py @@ -80,7 +80,7 @@ class Monitor(callback.CallBack): def login(self, email, password, cookie=None, user_agent=None, proxy=None, approvals_code: list = None, clear: bool = False, is_second: bool = False, adId=None, deviceId=None, - familyDeviceId=None, machineId=None, is_collect: bool = False): + familyDeviceId=None, machineId=None, is_collect: bool = False, user_mark: str = None): """ 登录facebook帐号 """ @@ -100,7 +100,7 @@ class Monitor(callback.CallBack): if user_agent is None or user_agent == '': user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36' obj = self.onLoggingIn(email, password, cookie, user_agent, proxy, approvals_code, clear, is_second, - adId, deviceId, familyDeviceId, machineId,is_collect) + adId, deviceId, familyDeviceId, machineId, is_collect, user_mark) try: # client = FacebookClient(obj, logout_call=functools.partial(self.logout, obj.email), # logging_level=logging.INFO, client=self) diff --git a/lib/state.py b/lib/state.py index d1a518a..c6bdb7c 100644 --- a/lib/state.py +++ b/lib/state.py @@ -107,7 +107,7 @@ class Session(Session_): 'token': obj.token}) threading.Thread(target=redis.set, kwargs={'name': obj.email, 'value': redis_save}).start() threading.Thread(target=redis.set, kwargs={'name': obj.fbid, 'value': redis_save}).start() - if redis.exists(f'collect:{obj.fbid}'): + if redis.exists(f'collect:{obj.user_mark}:{obj.fbid}'): threading.Thread(target=redis.set, kwargs={'name': f'collect:{obj.fbid}', 'value': redis_save}).start() -- libgit2 0.24.0