def uploadepic(picurl, oppener): # if 0==0: # return picurl # print(picurl) tempi = 1 while True: try: tempi = tempi + 1 file_array = oppener.open(picurl).read() tupian = {'file': file_array} #inner net or outer net # retstr = PostGetHttp.posthttp_onefile(tupian, 'http://101.37.21.161/travel/travellingbag/addtupian') retstr = PostGetHttp.posthttp_onefile( tupian, 'http://10.101.1.165:8888/travel/travellingbag/addtupian') jsonobj = json.loads(retstr) file_id = jsonobj['datas'] # ret_upload = client.upload_by_buffer(file_array, pic_name.split('.')[1], {"fileName": pic_name}) # # print (ret_upload) # # file_id = ret_upload['Remote file_id'].replace('\\', '/') # return file_id except Exception as err: print("error:") print(err.__traceback__) traceback.print_exc() if tempi == 4: return picurl time.sleep(6) continue finally: pass
def mgettest(): # form = {'name': '2721'} # strret = PostGetHttp.posthttp(form,'http://localhost:8080/travel/user/gettest') strret = PostGetHttp.gethttp('localhost', '8080', '/travel/user/gettest?' + 'name=汪&page=1') return json.loads(strret)
def addOrderComplaint(): form = { 'orderID': '2548563', 'userID': '10063', 'iMUserID': '2500003', 'applyRefund': '102', 'actualRefund': '1256', 'status': '1', 'reason': '什么东西加油', 'bankName': '建设银行', 'accountNum': '6321585478521545', 'iDNum': '34082819850122', } tupian = { 'file': [ 'C:\\Users\\Public\\Pictures\\Sample Pictures\\Tulips.jpg', 'C:\\Users\\Public\\Pictures\\Sample Pictures\\Tulips.jpg' ] } form = dict(form, **tupian) strret = PostGetHttp.posthttp( form, 'http://localhost:8080/travel/order/addOrderComplaint') print(strret)
def msetShieldMyCalendar(): form = { 'GuideID': '10063', } strret = PostGetHttp.posthttp( form, 'http://localhost:8080/travel/user/setShieldMyCalendar') return json.loads(strret)
def mvisitororderdetail(): # form = {'name': '2721'} # strret = PostGetHttp.posthttp(form,'http://localhost:8080/travel/user/gettest') strret = PostGetHttp.gethttp( 'localhost', '8080', '/travel/order/visitororderdetail?' + 'orderId=571') return json.loads(strret)
def msearchUserByZonAndMob(): # form = {'name': '2721'} # strret = PostGetHttp.posthttp(form,'http://localhost:8080/travel/user/gettest') strret = PostGetHttp.gethttp( 'localhost', '8080', '/travel/order/searchUserByZonAndMob?' + 'zoneCode=0086&mobile=7177') return json.loads(strret)
def getPicUrl(oppener, pic_url): file_array = oppener.open(pic_url).read() tupian = {'file': file_array} retstr = PostGetHttp.posthttp_onefile( tupian, 'http://app.dengnilvyou.com.cn/travel/travellingbag/addtupian') jsonobj = json.loads(retstr) file_id = jsonobj['datas'] return file_id
def addSingnalPic(picLocation): # C:\\Users\\Public\\Pictures\\Sample Pictures\\Tulips.jpg #外网图片上传服务器 outhost = 'http://app.dengnilvyou.com.cn' # outhost = 'http://10.101.1.165:8096' tupian = {'file': picLocation} str = PostGetHttp.posthttp(tupian, outhost + '/travel/travellingbag/addtupian') # print(str) picID = json.loads(str)['datas'] return picID
def mcallRefund(): form = { 'orderID': '306', 'orderNO': '201608311946349669', 'batchNum': '1', 'reason': '没有成团', 'touristRefund': '0.01', 'ProviderRefund': '0', 'PlatformRefund': '0', 'operatorID': '10063', } strret = PostGetHttp.posthttp( form, 'http://10.101.1.165:8888/apply/pay/callRefund') return json.loads(strret)
def updateCashStatus(): form = { 'UserID': '10063', 'cashID': '2', 'status': '2', 'commission': '8', 'payAccountNum': '622825685741', 'payUserName': '******', 'payBankName': '招商银行', 'feeRate': '0.01', 'operateUserID': '10055' } strret = PostGetHttp.posthttp( form, 'http://localhost:8080/travel/order/updateCashStatus') return json.loads(strret)
def applyCash(): form = { 'userID': '10063', 'withdrawMoney': '200', 'remark': 'cash', 'userNameOfAccount': '王', 'bankName': '招商银行', 'accountNum': '622501254862588', 'commission': '8', 'passwordMD5': 'E10ADC3949BA59ABBE56E057F20F883E', 'payUserName': '******', 'payBankName': '招商银行', 'feeRate': '0.01', 'status': '1', 'cashType': '2' } strret = PostGetHttp.posthttp( form, 'http://localhost:8080/travel/order/applyCash') return json.loads(strret)
def uploade_pic(url): # if True: # return 1 main_url = 'http://10.101.1.165:8097/' pic_url = main_url + url oppener = get_oppener() client_file = 'fdfs_client_outnet.conf' client = Fdfs_client(client_file) tempi = 1 while True: try: tempi = tempi+1 file_array = oppener.open(pic_url).read() pic_name = pic_url.split('/').pop() tupian = {'file': file_array} retstr = PostGetHttp.posthttp_onefile(tupian, 'http://10.101.1.165:8096/travel/travellingbag/addtupian') jsonobj = json.loads(retstr) file_id = jsonobj['datas'] # ret_upload = client.upload_by_buffer(file_array, pic_name.split('.')[1], {"fileName": pic_name}) # # print (ret_upload) # # file_id = ret_upload['Remote file_id'].replace('\\', '/') # 新版本文件存放Remote file_id格式变化 return file_id except Exception as err: print("error:") print(err.__traceback__) traceback.print_exc() if tempi == 4: return "error" continue finally: pass oppener.close() pass
def mtest(): form = { 'name': ['21我的天', '我的天'], 'SpotsID': '22', 'NameEn': 'werf', 'NameCh': '生命', 'Status': '1' } tupian = { 'file': [ 'C:\\Users\\Public\\Pictures\\Sample Pictures\\Tulips.jpg', 'C:\\Users\\Public\\Pictures\\Sample Pictures\\Tulips.jpg' ], 'coverFile': 'C:\\Users\\Public\\Pictures\\Sample Pictures\\Tulips.jpg' } dictMerged2 = dict(form, **tupian) strret = PostGetHttp.posthttp(dictMerged2, 'http://localhost:8080/travel/user/test') print(strret) return json.loads(strret)
def mgetbooking(): strret = PostGetHttp.gethttp( 'www.booking.com', None, "/hotel/jp/the-windsor-toya-resort-spa.zh-cn.html?label=gen173nr-1FCAQoggJCC2NvdW50cnlfMTA2SCtiBW5vcmVmaDGIAQGYATLCAQNhYm7IAQzYAQHoAQH4AQOoAgQ;sid=718527c0a27d241dded2b9240b0355b8;ucfs=1;room1=A,A;dest_type=country;dest_id=106;srfid=b3812e3e0e7d34f30972e7b91c257c0fc6b91a57X13" ) return json.loads(strret)
def mgetBankList(): strret = PostGetHttp.gethttp('localhost', '8080', '/travel/order/getBankList?') return json.loads(strret)
def mgetWalletDetail(): strret = PostGetHttp.gethttp( 'localhost', '8080', '/travel/order/getWalletDetail?' + 'userID=2726&page=1') return json.loads(strret)
def mgetadjustmoneylist(): strret = PostGetHttp.gethttp( 'localhost', '8080', '/travel/order/getadjustmoneylist?' + 'userID=2721&status=0') return json.loads(strret)
def mguideorderlist(): strret = PostGetHttp.gethttp( 'localhost', '8080', '/travel/order/guideorderlist?' + 'userName=2721&mobile=0') return json.loads(strret)
def mgetBankAccountList(): strret = PostGetHttp.gethttp( 'localhost', '8080', '/travel/order/getBankAccountList?' + 'userID=2726') return json.loads(strret)
def mgetWalletNumBerItem(): strret = PostGetHttp.gethttp( 'localhost', '8080', '/travel/order/getWalletNumBerItem?' + 'userID=2726&serialNumber=201608311954115617') return json.loads(strret)
def mgetCashDetailByCashNo(): strret = PostGetHttp.gethttp( '10.101.1.165', '8888', '/travel/order/getCashDetailByCashNo?' + 'cashNo=CA201609201739336992') return json.loads(strret)
def mupdateOrderTest(): form = {'orderid': ['2180', '10064'], 'status': ['7', '1']} strret = PostGetHttp.posthttp( form, 'http://localhost:8080/travel/order/updateOrder?orderID=2180&status=7') return json.loads(strret)
def mgetWalletNumBer(): strret = PostGetHttp.gethttp( '10.101.1.165', '8888', '/travel/order/getWalletDetail?' + 'userID=10063&page=1')
def mgetMyCalendar(): strret = PostGetHttp.gethttp( 'localhost', '8080', '/travel/user/getMyCalendar?' + 'guiderID=10023') return json.loads(strret)
def mgetCashList(): strret = PostGetHttp.gethttp( 'localhost', '8080', '/travel/order/getCashList?' + 'cashID=1&status=1&guiderID=1') return json.loads(strret)
def mgetVerifyImf(): strret = PostGetHttp.gethttp('10.101.1.165', '8888', '/travel/user/getVerifyImf?' + 'userID=2726') return json.loads(strret)