def getFriendContribute(*id1): friendidAndpointAll = [] sum = 0 con_log(*id1) jsonresponse = GetFriendContributeList(*id1) if jsonresponse != None: try: ContributeList = jsonresponse.get('data', 0).get('friendPointsList', 0) except Exception: print id1[0], 'unkown error' return for friendPointsList in ContributeList: friendidAndpoint = [] #每个好友id,分数集合 friendId = friendPointsList.get('friendId', 0) contributePoint = friendPointsList.get('contributePoint', 0) nickName = friendPointsList.get('nickName', 0) avatar = friendPointsList.get('avatar', 0) totalPoint = friendPointsList.get('totalPoint', 0) sum = sum + int(contributePoint) friendidAndpoint.append(friendId) friendidAndpoint.append(int(contributePoint)) friendidAndpointAll.append(friendidAndpoint) return friendidAndpointAll, sum else: return
def giveEnergy(*id1): con_log(*id1) url = host + '/fenergy.php?do=SendFEnergy&v=2007&phpp=ANDROID_XIAOMI&phpl=ZH_CN&pvc=1.7.1&pvb=2015-09-25%2017%3A07%3A26&platformtype=1' data = 'Fid=105009' flg, jsonresponse = connection(url, data) if flg == 0: print id1[0], jsonresponse
def GetUserJourneysStatus(*id1): con_log(*id1) url = host + '/Journey.php?do=GetUserJourneysStatus&v=4701&phpp=ANDROID_XIAOMI&phpl=ZH_CN&pvc=1.7.1&pvb=2015-09-25%2017%3A07%3A26&platformtype=1' flg, jsonresponse = connection(url, data='') if flg == 0: print id1[0], jsonresponse return return jsonresponse
def GetFriendContributeList(*id1): con_log(*id1) url = host + '/Journey.php?do=GetFriendContributeList&v=8501&phpp=ANDROID_XIAOMI&phpl=ZH_CN&pvc=1.7.1&pvb=2015-09-25%2017%3A07%3A26&platformtype=1' flg, jsonresponse = connection(url, data='') if flg == 0: #非正常返回值 print id1[0], jsonresponse return return jsonresponse
def GetContributePoints(friendidAndpontList, sum, *id1): con_log(*id1) for FriendContributeId in friendidAndpontList: url = host + '/Journey.php?do=GetContributePoints&v=8502&phpp=ANDROID_XIAOMI&phpl=ZH_CN&pvc=1.7.1&pvb=2015-09-25%2017%3A07%3A26&platformtype=1' data = 'friendUid=' + '%d' %FriendContributeId[0] flg, jsonresponse = connection(url, data) if flg != 1: return GetContributePoints(friendidAndpontList, sum, *id1) print id1[0], '领取', sum
def GetUserInfo(*id1): con_log(*id1) data = 'pvpNewVersion=1' url = host + '/user.php?do=GetUserinfo&OpenCardChip=1&v=1522&phpp=ANDROID_XIAOMI&phpl=ZH_CN&pvc=1.7.1&pvb=2015-09-25%2017%3A07%3A26&platformtype=1' flg, jsonresponse = connection(url, data) if flg == 0: print id1[0], jsonresponse return return jsonresponse
def getHeiDianpoints(*id1): con_log(*id1) url = 'http://s1.xiaomi.mysticalcard.com/devoteMazeActivity.php?do=GetActStatus&v=9208&phpp=ANDROID_XIAOMI&phpl=ZH_CN&pvc=1.7.1&pvb=2015-09-25%2017%3A07%3A26&platformtype=1' flg, jsonresponse = connection(url, data='') if flg == 1: shougu = jsonresponse.get('data').get('actStatus').get('goods')[0].get('totalPoint') shouya = jsonresponse.get('data').get('actStatus').get('goods')[1].get('totalPoint') changedpoints = jsonresponse.get('data').get('actStatus').get('recordPoint', 0) print id1[0], shougu, '+', shouya, '+', changedpoints, '=', shougu+shouya+changedpoints else: print id1[0], jsonresponse
def getEnergy(*id1): con_log(*id1) EnergySurplusList = [] # 定义送体力好友list url = host + '/friend.php?do=GetFriends&v=9804&phpp=ANDROID_XIAOMI&phpl=ZH_CN&pvc=1.7.1&pvb=2015-09-25%2017%3A07%3A26&platformtype=1' # 获取好友列表 flg, jsonresponse = connection(url, data='') if flg != 0: friends = jsonresponse.get('data').get('Friends') # 遍历好友信息 for friend in friends: frienduid = friend.get('Uid') #获得好友id friendname = friend.get('NickName') friendEnergySurplus = friend.get('FEnergySurplus') #获得好友送体力信息 # print frienduid, friendname if friendEnergySurplus == 1: EnergySurplusList.append(frienduid) #送体力好友id集合 else: print id1[0], jsonresponse # 送好友体力 url = host + '/fenergy.php?do=SendFEnergy&v=9804&phpp=ANDROID_XIAOMI&phpl=ZH_CN&pvc=1.7.1&pvb=2015-09-25%2017%3A07%3A26&platformtype=1' EnergySendList = ['104681','104886', '105245', '105265', '105290', '105545', '106192', '106396', '106798', '106752', '107217', '107504', '107663', '108118'] for EnergySend in EnergySendList: data = 'Fid=' + EnergySend flg, jsonresponse = connection(url, data=data) if flg == 0: if jsonresponse == u'今日已经赠送过该好友!': break print id1[0], jsonresponse # 领取体力 url = host + '/fenergy.php?do=GetFEnergy&v=9806&phpp=ANDROID_XIAOMI&phpl=ZH_CN&pvc=1.7.1&pvb=2015-09-25%2017%3A07%3A26&platformtype=1' for EnergySurplus in EnergySurplusList: data = 'Fid=' + EnergySurplus flg, jsonresponse = connection(url, data=data) if flg == 0: if jsonresponse == u'今日领取达到上限!': print jsonresponse break print id1[0], jsonresponse
def changeHeiDianPoints(*id1): con_log(*id1) url = 'http://s1.xiaomi.mysticalcard.com/devoteMazeActivity.php?do=GetReward&v=9236&phpp=ANDROID_XIAOMI&phpl=ZH_CN&pvc=1.7.1&pvb=2015-09-25%2017%3A07%3A26&pl' flg, jsonresponse = connection(url, data='') if flg == 0: print id1[0], jsonresponse