async def help_friend(self, session): """ :param session: :return: """ path = 'dreamfactory/userinfo/GetUserInfo' body = { 'zone': 'dream_factory', 'pin': '', 'sharePin': '', 'shareType': 2, 'materialTuanPin': '', 'materialTuanId': '', 'source': '', '_stk': '_time,materialTuanId,materialTuanPin,pin,sharePin,shareType,source,zone' } item_list = Code.get_code_list(CODE_JX_FACTORY_WORK) item_list.extend(get_code_list(CODE_JX_FACTORY_WORK)) for item in item_list: account, code = item.get('account'), item.get('code') if account == self.account: continue body['sharePin'] = code res = await self.request(session, path, body) msg = res.get('assistCondition', dict()).get('assistConditionMsg', '未知') println('{}, 助力好友:{}, {}'.format(self.account, account, msg))
async def help_friend(self, session): """ 助力好友 :return: """ item_list = Code.get_code_list(CODE_JD_SUPER_BRAND) item_list.extend(get_code_list(CODE_JD_SUPER_BRAND)) for item in item_list: account, code = item.get('account'), item.get('code') if account == self.account: continue assign_id, item_id = code.split('@') body = { "source": "secondfloor", "activityId": self.activity_id, "encryptProjectId": self.encrypt_project_id, "encryptAssignmentId": assign_id, "assignmentType": 2, "itemId": item_id, "actionType": 0 } res = await self.request(session, 'superBrandDoTask', body) if res.get('code') == 0: println('{}, 成功助力好友:{}'.format(self.account, account)) else: println('{}, 无法助力好友:{}, {}'.format(self.account, account, res.get('msg'))) if res.get('code') == 108: # 上限 break await asyncio.sleep(1)
async def join_tuan(self, session): """ 参团 :param session: :return: """ item_list = Code.get_code_list(CODE_JX_FACTORY_TUAN) item_list.extend(CODE_JX_FACTORY_TUAN) path = 'dreamfactory/tuan/JoinTuan' for item in item_list: account, code = item.get('account'), item.get('code') if account == self.account: continue params = { 'activeId': self.active_id, 'tuanId': code, '_stk': '_time,activeId,tuanId' } data = await self.request(session, path, params) if not data: println('{}, 无法参与好友:{}的团!'.format(self.account, account)) return if data['ret'] in [10208, 0]: println('{}, 已成功参与好友:{}的团!'.format(self.account, account)) else: println('{}, 无法参与好友:{}的团, {}'.format(self.account, account, data['msg'])) if data['ret'] in [10206, 10003]: break await asyncio.sleep(1)
async def run_help(self): """ 助力入口 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: item_list = Code.get_code_list(CODE_5G_BOX) item_list.extend(get_code_list(CODE_5G_BOX)) for item in item_list: account, code = item.get('account'), item.get('code') if account == self.account: continue res = await self.request(session, { "shareId": code, "apiMapping": "/active/addShare" }) if res.get('code') == 200: println('{}, 成功助力好友:{}'.format(self.account, account)) else: println('{}, 无法助力好友:{}, {}'.format(self.account, account, res.get('msg'))) await asyncio.sleep(1)
async def run_help(self): """ 助力入口 :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: item_list = Code.get_code_list(self.code_key) item_list.extend(get_code_list(self.code_key)) for item in item_list: friend_account, friend_code = item.get('account'), item.get( 'code') if friend_account == self.account: continue res = await self.request( session, 'harmony_collectScore', { "appId": self.appid, "taskToken": friend_code, "taskId": 4, "actionType": 1, }) if res.get('bizCode', -1) != 0: println('{}, 助力好友:{}失败, {}'.format(self.account, friend_account, res['bizMsg'])) if res['bizCode'] == 108: # 助力已上限 break else: println('{}, 成功助力好友:{}!'.format(self.account, friend_account)) await asyncio.sleep(1)
async def help_friend(self, session): """ 助力好友 :param session: :return: """ item_list = Code.get_code_list(CODE_JD_FACTORY) item_list.extend(get_code_list(CODE_JD_FACTORY)) for item in item_list: friend_account, friend_code = item.get('account'), item.get('code') if friend_account == self.account: continue params = { "taskToken": friend_code, } data = await self.request(session, 'jdfactory_collectScore', params) println('{}, 助力好友{}, {}'.format(self.account, friend_account, data['bizMsg'])) if data['bizCode'] in [-1001, -7]: # 活动火爆=黑号, 助力次数用完 break await asyncio.sleep(1)
async def run_help(self): """ 助力入口 :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: is_success = await self.login(session) if not is_success: println('{}, 登录失败, 退出程序...'.format(self.account)) return item_list = Code.get_code_list(CODE_MONEY_TREE) item_list.extend(get_code_list(CODE_MONEY_TREE)) for item in item_list: friend_account, friend_code = item.get('account'), item.get('code') if friend_account == self.account: continue params = { "sharePin": friend_account, "shareType": "1", "channelLV": "", "source": 0, "riskDeviceParam": "{}" } data = await self.request(session, 'login', params) if data['code'] == '200': println('{}, 正在帮好友:{}打工!'.format(self.account, friend_account)) else: println('{}, 无法为好友:{}打工!'.format(self.account, friend_account))
async def help_friend(self, session): """ 帮好友打工 :param session: :return: """ path = 'dreamfactory/friend/AssistFriend' body = { 'zone': 'dream_factory', 'sharepin': '', '_stk': '_time,sharepin,zone' } item_list = Code.get_code_list(CODE_JX_FACTORY_WORK) item_list.extend(get_code_list(CODE_JX_FACTORY_WORK)) for item in item_list: account, code = item.get('account'), item.get('code') if account == self.account: continue body['sharepin'] = code res = await self.request(session, path, body) if res.get('ret', -1) != 0: println('{}, 无法助力好友:{}, {}'.format(self.account, account, res.get('msg', '原因未知'))) if res.get('ret', -1) in [11009, 11005]: break else: println('{}, 成功助力好友:{}!'.format(self.account, account)) await asyncio.sleep(1)
async def run_help(self): """ 助力 :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: item_list = Code.get_code_list(code_key=CODE_FLASH_SALE_BOX) item_list.extend(get_code_list(CODE_FLASH_SALE_BOX)) for item in item_list: friend_account, friend_code = item['account'], item['code'] if friend_account == self.account: return body = { "appId": "1EFRXxg", "taskToken": friend_code, "taskId": 6, "actionType": 0 } res = await self.request(session, 'harmony_collectScore', body) if res['code'] != 0: println('{}, 助力好友:{}失败!'.format(self.account, friend_account)) break if res['data']['bizCode'] != 0: println('{}, 助力好友:{}失败, {}!'.format( self.account, friend_account, res['data']['bizMsg'])) if res['data']['bizCode'] in [108]: break else: println('{}, 助力好友:{}成功!'.format(self.account, friend_account)) await asyncio.sleep(1)
async def lottery_help_friend(self, session): """ 天天抽奖助力好友 :param session: :return: """ println('{}, 开始天天抽奖--好友助力--每人每天只有三次助力机会!'.format(self.account)) item_list = Code.get_code_list(CODE_JD_FARM) item_list.extend(get_code_list(CODE_JD_FARM)) for item in item_list: friend_account, friend_code = item.get('account'), item.get('code') if friend_account == self.account: continue res = await self.request( session, 'initForFarm', { "imageUrl": "", "nickName": "", "shareCode": friend_code + '-3', "babelChannel": "3" }) if res['helpResult']['code'] == '0': println('{}, 天天抽奖-成功助力用户:《{}》 !'.format( self.account, friend_account)) elif res['helpResult']['code'] == '11': println('{}, 天天抽奖-无法重复助力用户:《{}》!'.format( self.account, friend_account)) elif res['helpResult']['code'] == '13': println('{}, 天天抽奖-助力用户:《{}》失败, 助力次数已用完!'.format( self.account, friend_account)) break else: println('{}, 天天抽奖助力用户:《{}》失败, 原因未知!'.format( self.account, friend_account)) println('{}, 完成天天抽奖--好友助力!'.format(self.account))
async def help_friend(self, session): """ 助力好友 :return: """ item_list = Code.get_code_list(CODE_DJ_FRUIT) for item in item_list: try: account, code = item.get('account'), item.get('code') if account == self.account: continue params = json.loads(code) except Exception as e: println('{}, 助力失败, 助力码错误, {}'.format(self.account, e.args)) continue if 'assistTargetPin' not in params: println('{}, 助力码错误, 无法助力!'.format(self.account)) continue params.update({ "plateCode": 5, "modelId": "M10007", "taskType": 1201, }) user_pin = params['assistTargetPin'] res = await self.get(session, 'task/finished', params) if res['code'] != '0': println(res) println('{}, 助力好友:{}失败, {}'.format(self.account, user_pin, res)) break else: println('{}, 成功助力好友:{}!'.format(self.account, user_pin)) await asyncio.sleep(1)
async def help_friend(self, session): """ :param session: :return: """ session.headers.add( 'Referer', 'https://h5.m.jd.com/babelDiy/Zeus/GzY6gTjVg1zqnQRnmWfMKC4PsT1/index.html' ) item_list = Code.get_code_list(code_key=CODE_JD_CASH) item_list.extend(get_code_list(CODE_JD_CASH)) for item in item_list: friend_account, friend_code = item.get('account'), item.get('code') if friend_account == self.account: continue invite_code, share_date = friend_code.split('@') data = await self.request(session, 'cash_mob_assist', { "inviteCode": invite_code, "shareDate": share_date, "source": 2 }) if data['code'] != 0 or data['data']['bizCode'] != 0: println('{}, 助力好友:{}失败, {}!'.format(self.account, invite_code, data['data']['bizMsg'])) if data['data']['bizCode'] in [206, 188]: # 助力次数用完/活动太火爆了 break else: println('{}, 助力好友:{}成功!'.format(self.account, invite_code)) await asyncio.sleep(2.5)
async def run_help(self): """ 执行助力 :return: """ async with aiohttp.ClientSession( headers=self.headers, cookies=self.cookies, json_serialize=ujson.dumps) as session: code_list = Code.get_code_list(code_key=CODE_AMUSEMENT_POST) code_list.extend(get_code_list(CODE_AMUSEMENT_POST)) if not code_list: return for code in code_list: friend_account = code.get('account') friend_code = code.get('code') if friend_account == self.account: continue res = await self.request(session, 'MangHeApi/helpFriend', [{ "userNo": "$cooMrdGatewayUid$", "missionNo": friend_code }]) success = res.get('success', False) if success: println('{}, 成功助力好友:{}!'.format(self.account, friend_account)) else: println('{}, 无法助力好友:{}!'.format(self.account, friend_account))
async def run_help(self): """ 助力入口 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: item_list = Code.get_code_list(CODE_SMASH_GOLDEN_EGG) for item in item_list: friend_account, friend_code = item.get('account'), item.get( 'code') if self.account == friend_account: continue body = { "appId": "1EFRQwA", "taskToken": friend_account, "taskId": 6, "actionType": 0 } res = await self.request(session, 'harmony_collectScore', body) if res['bizCode'] != 0: println('{}, 助力好友:{}失败, {}'.format(self.account, friend_account, res.get('bizMsg'))) if res['bizCode'] == 105: break else: println('{}, 成功助力好友:{}!'.format(self.account, friend_account)) await asyncio.sleep(1)
async def run_help(self): """ :return: """ await self.get_encrypt() async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: if not await self.init(session): println('{}, 无法初始化, 退出程序!'.format(self.account)) return item_list = Code.get_code_list(code_key=CODE_JX_PASTURE) item_list.extend(get_code_list(CODE_JX_PASTURE)) for item in item_list: account, code = item.get('account'), item.get('code') if account == self.account: continue res = await self.request(session, '/jxmc/operservice/EnrollFriend', { 'sharekey': code, '_stk': 'channel,sceneid,sharekey' }) if res.get('ret') == 0: println('{}, 成功助力好友:{}'.format(self.account, account)) else: println('{}, 助力好友:{}失败, {}'.format(self.account, account, res.get('message'))) await asyncio.sleep(3)
async def help(self, session): """ :param session: :return: """ item_list = Code.get_code_list(CODE_JD_HEALTH) item_list.extend(get_code_list(CODE_JD_HEALTH)) for item in item_list: account, code = item.get('account'), item.get('code') res = await self.request(session, 'jdhealth_collectScore', {"taskToken": code, "taskId": "6", "actionType": 0}) if res.get('bizCode', ERRCODE_DEFAULT) == 0: println('{}, 成功助力好友{}!'.format(self.account, account)) else: println('{}, 无法助力好友:{}, {}'.format(self.account, account, res.get('bizMsg', '原因未知')))
async def run_help(self): """ 助力好友 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: item_list = Code.get_code_list(code_key=CODE_JD_CARNIVAL_CITY) item_list.extend(get_code_list(CODE_JD_CARNIVAL_CITY)) for item in item_list: account, code = item.get('account'), item.get('code') if account == self.account: continue body = {"shareId": code, "apiMapping": "/khc/task/doSupport"} res = await self.request(session, 'carnivalcity_jd_prod', body) println('{}, 助力好友:{}, 结果:{}'.format(self.account, account, res.get('msg', '未知')))
async def help_friend(self, session): """ 助力好友任务 :param session: :return: """ item_list = Code.get_code_list(code_key=CODE_PLANTING_BEAN) item_list.extend(get_code_list(CODE_PLANTING_BEAN)) for item in item_list: friend_account, friend_code = item.get('account'), item.get('code') if self.account == friend_account: continue body = { "plantUuid": friend_code, "wxHeadImgUrl": "", "shareUuid": "", "followType": "1", } data = await self.post(session, 'plantBeanIndex', body) message = '{}, 助力好友{}, 结果:{}' if data['code'] == '0': if 'helpShareRes' not in data: message = message.format(self.account, friend_account, '未知') println(message) continue if data['data']['helpShareRes']['state'] == '2': message = message.format(self.account, friend_account, '您今日助力的机会已耗尽,已不能再帮助好友助力了!') println(message) break elif data['data']['helpShareRes']['state'] == '3': message = message.format(self.account, friend_account, '该好友今日已满9人助力/20瓶营养液,明天再来为Ta助力吧') else: message = message.format( self.account, friend_account, data['data']['helpShareRes']['promptText']) println(message) else: message = message.format(self.account, message, '原因未知!') println(message) await asyncio.sleep(1)
async def help_friend(self, session): """ 助力好友 :param session: :return: """ item_list = Code.get_code_list(CODE_CUT_PET) item_list.extend(get_code_list(CODE_CUT_PET)) for item in item_list: friend_account, friend_code = item.get('account'), item.get('code') if self.account == friend_account: continue data = await self.request(session, 'slaveHelp', { 'shareCode': friend_code }) if data['resultCode'] != '0': println('{}, 无法助力好友:{}, {}!'.format(self.account, friend_account, data['message'])) else: println('{}, 成功助力好友:{}!'.format(self.account, friend_account))
async def help_friend(self, session): """ 助力好友 :param session: :return: """ help_max_count = 3 # 每人每天只有三次助力机会 cur_count = 0 # 当前已助力次数 item_list = Code.get_code_list(CODE_JD_FARM) item_list.extend(get_code_list(CODE_JD_FARM)) for item in item_list: friend_account, friend_code = item.get('account'), item.get('code') if cur_count >= help_max_count: println('{}, 今日助力次数已用完!'.format(self.account)) if friend_account == self.account: continue res = await self.request( session, 'initForFarm', { "imageUrl": "", "nickName": "", "shareCode": friend_code, "babelChannel": "3" }) if 'helpResult' not in res: println('{}, 助力好友{}状态未知~'.format(self.account, friend_account)) continue if res['helpResult']['code'] == '0': println('{}, 已成功给【{}】助力!'.format(self.account, friend_account)) cur_count += 1 elif res['helpResult']['code'] == '9': println('{}, 之前给【{}】助力过了!'.format(self.account, friend_account)) elif res['helpResult']['code'] == '8': println('{}, 今日助力次数已用完!'.format(self.account)) break elif res['helpResult']['code'] == '10': println('{}, 好友【{}】已满五人助力!'.format(self.account, friend_account)) else: println('{}, 给【{}】助力失败!'.format(self.account, friend_account))
async def help(self, session): """ :return: """ data = await self._get_index_data(session) if not data: println('{}, 获取首页数据失败, 无法助力好友!'.format(self.account)) return None params = { 'activeType': data['activityType'], 'groupCode': '', 'activeId': str(data['activityMsg']['activityId']), 'shareCode': '', "source": "guest" } item_list = Code.get_code_list(CODE_JD_GRAB_BEAN) item_list.extend(get_code_list(CODE_JD_GRAB_BEAN)) for item in item_list: try: account, code = item.get('account'), item.get('code') if account == self.account: continue params['shareCode'], params['groupCode'] = code.split('@') res = await self.request(session, 'signGroupHelp', params) if res.get('code', '-') != '0': println('{}, 无法助力好友:{}, {}!'.format( self.account, account, res.get('errorMessage'))) continue help_message = res.get('data', dict()).get('helpToast') println('{}, 助力好友:{}, {}'.format(self.account, account, help_message)) if '上限' in help_message: break await asyncio.sleep(1) except Exception as e: println('{}, 助力好友失败, {}!'.format(self.account, e.args)) continue
async def run_help(self): """ 助力好友 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: item_list = Code.get_code_list(code_key=CODE_KEY) item_list.extend(get_code_list(code_key=CODE_KEY)) for item in item_list: account, code = item.get('account'), item.get('code') if account == self.account: continue res = await self.request(session, '/luckdraw/helpFriend', [{ "userNo": "$cooMrdGatewayUid$", "missionNo": code }]) if res.get('success'): println('{}, 成功助力好友:{}'.format(self.account, account)) else: println('{}, 无法助力好友:{}'.format(self.account, account))
async def run_help(self): """ 助力入口 :return: """ async with aiohttp.ClientSession(headers=self.headers, cookies=self.cookies) as session: item_list = Code.get_code_list(code_key=CODE_KEY) item_list.extend(get_code_list(CODE_KEY)) for item in item_list: account, code = item.get('account'), item.get('code') if account == self.account: continue res = await self.request(session, 'jinli_h5assist', {"clientInfo": {}, "redPacketId": code, "followShop": 0}) if res.get('biz_code') != 0: println('{}, 助力好友失败:{}!'.format(self.account, account)) break println('{}, 助力好友:{}, {}'.format(self.account, account, res['result']['statusDesc'])) if res['result']['status'] == 3: # 今日助力次数已满 break
async def run_help(self): """ 组队 :return: """ async with aiohttp.ClientSession(cookies=self.cookies, headers=self.headers) as session: dj_cookies = await self.login(session) if not dj_cookies: return println('{}, 登录成功...'.format(self.account)) async with aiohttp.ClientSession(cookies=dj_cookies, headers=self.headers) as session: activity_info = await self.get_activity_info(session) if not activity_info: println('{}, 获取活动ID失败, 退出程序!'.format(self.account)) return item_list = Code.get_code_list(CODE_DJ_BEAN_MANOR) item_list.extend(get_code_list(CODE_DJ_BEAN_MANOR)) for item in item_list: account, code = item.get('account'), item.get('code') # 参数加密了 res = await self.get(session, 'signin/carveUp/joinCarveUp', { "groupId": code, "type": 2 }) println(res) if res.get('code') != '0': println('{}, 无法加入好友:{}的队伍!'.format(self.account, account)) else: println(res) println('{}, 加入好友:{}队伍结果, {}'.format( self.account, account, res['result']['title'])) if '上限' in res['result']['title']: break
async def get_award_of_invite_friend(self, session): """ 获取邀请好友奖励 :param session: :return: """ data = await self.request(session, 'friendListInitForFarm') if data['code'] != '0': println('{}, 获取好友列表失败...'.format(self.account)) return invite_friend_count = data['inviteFriendCount'] # 今日邀请好友个数 invite_friend_max = data['inviteFriendMax'] # 每日邀请上限 println('{}, 今日已邀请好友{}个 / 每日邀请上限{}个'.format(self.account, invite_friend_count, invite_friend_max)) friends = data['friends'] # 好友列表 m_pin = await self.get_encrypted_pin(session) item_list = Code.get_code_list(CODE_JD_FARM) item_list.extend(get_code_list(CODE_JD_FARM)) for item in item_list: friend_account, friend_code = item.get('account'), item.get('code') # 自己不能邀请自己成为好友 if self.account == friend_account: continue res = await self.request( session, 'initForFarm', { 'shareCode': friend_code + '-inviteFriend', "mpin": m_pin, 'version': 13, "babelChannel": 0, 'channel': 1 }) if res['helpResult']['code'] == '0' or res['helpResult'][ 'code'] == '20': println('{}, 接受邀请成功, 已成为{}的好友!'.format( self.account, res['helpResult']['masterUserInfo']['nickName'])) else: println('{}, 接受好友邀请失败, {}'.format(self.account, res['helpResult'])) data = await self.request(session, 'friendListInitForFarm') if data['inviteFriendCount'] > 0: if data['inviteFriendCount'] > data['inviteFriendGotAwardCount']: res = await self.request(session, 'awardInviteFriendForFarm') println('{}, 领取邀请好友奖励结果:{}'.format(self.account, res)) else: println('{}, 今日未邀请过好友!'.format(self.account)) cur_friend_count = len(friends) # 当前好友数量 if cur_friend_count > 0: println('{}, 开始删除{}个好友, 可拿每天的邀请奖励!'.format(self.account, cur_friend_count)) for friend in friends: res = await self.request(session, 'deleteFriendForFarm', {'shareCode': friend['shareCode']}) if res['code'] == '0': println('{}, 成功删除好友:{}'.format(self.account, friend['nickName']))