def getBookData(): ratelist = [] numberlist = [] result1 = [] result2 = [] result3 = [] result4 = [] result5 = [] result6 = [] result7 = [] result8 = [] """打包推荐失败率""" result = db.session.query(PackageBookData.packagePercent).limit(40).all() for i in range(0, len(result)): result3.append(result[i][0]) """返回最近30天的时间数据""" result = db.session.query(PackageBookData.date_time).limit(40).all() for i in range(0, len(result)): result1.append(result[i][0]) """rate相关数据和时间数据放入ratedata,用于比率试图的数据来源""" ratelist.append(result3) ratelist.append(result1) """打包接口调用次数""" result = db.session.query(PackageBookData.packageNum).limit(40).all() for i in range(0, len(result)): result2.append(result[i][0]) """进入预定页次数""" result = db.session.query(PackageBookData.enterBookNum).limit(40).all() for i in range(0, len(result)): result4.append(result[i][0]) """机酒下单数""" result = db.session.query(PackageBookData.orderNum).limit(40).all() for i in range(0, len(result)): result5.append(result[i][0]) """机酒签约数""" result = db.session.query(PackageBookData.resign).limit(40).all() for i in range(0, len(result)): result6.append(result[i][0]) """酒景下单数""" result = db.session.query(PackageBookData.orderNumforHS).limit(40).all() for i in range(0, len(result)): result7.append(result[i][0]) """酒景签约数""" result = db.session.query(PackageBookData.resignforHS).limit(40).all() for i in range(0, len(result)): result8.append(result[i][0]) numberlist.append(result2) numberlist.append(result4) numberlist.append(result5) numberlist.append(result6) numberlist.append(result7) numberlist.append(result8) resp = cors_response({ "success": True, "ratedata": ratelist, "numberdata": numberlist }) return resp
def sync1(): data = request.get_json('data') # print(data) executor.submit(syncScrumInfo, data) response = {"success": "true", "msg": "同步进行中,请稍后查看~~"} # print("aa") # print(response) return cors_response(response)
def getShotEail(data): logging.info("异步调用~~") url = data['url'] subject = data['subject'] to =data['to'] # 收件人 cc=data['cc'] # 抄送人 type=data['type'] #截图类型 row=data['row'] #selector 选择器 panel=data['panel'] #selector 选择器 content=data['content'] ''' :param selector str: 选择器,需要截图的row 和 panel 的class :param to str: 收件人地址 :param to subject: 邮件主题 ''' # type="support" # hostname = socket.gethostname() # if (hostname == 'vm-prd-tnauto-occamrazor-185-170.tuniu.org'): # url = 'http://pandora.tuniu.org/support' # else: # if (hostname == 'vm-sit-tnauto-occamrazor-32-130.tuniu.org'): # url = 'http://10.28.32.130/support' # else: # url = "http://*****:*****@tuniu.com" # subject="本周度假技术支持分析" try: if getShot(selector,to,cc,subject,content): logging.info("aa") response={"success": "true", "msg": "发送邮件成功~~"} else: logging.info("bb") response = {"success": "false", "msg": "发送邮件失败~~"} except Exception as e: raise e response = {"success": "false", "msg": "发送邮件失败~~"} response = json.dumps(response,ensure_ascii=False) return cors_response(response)
def getForeignTicketData(): ratelist = [] numberlist = [] result1 = [] result2 = [] result3 = [] result4 = [] result5 = [] result6 = [] result7 = [] result8 = [] result9 = [] result10 = [] result11 = [] """门票推荐失败率""" result = db.session.query(ForeignTicketData.defaultPercent).limit(40).all() for i in range(0, len(result)): result3.append(result[i][0]) """验价失败率""" result = db.session.query(ForeignTicketData.checkPercent).limit(40).all() for i in range(0, len(result)): result6.append(result[i][0]) """返回最近30天的时间数据""" result = db.session.query(ForeignTicketData.date_time).limit(40).all() for i in range(0, len(result)): result11.append(result[i][0]) """rate相关数据和时间数据放入ratedata,用于比率试图的数据来源""" ratelist.append(result3) ratelist.append(result6) ratelist.append(result11) """门票默认推荐次数""" result = db.session.query( ForeignTicketData.defaultRecommed).limit(40).all() for i in range(0, len(result)): result1.append(result[i][0]) """门票默认推荐失败次数""" result = db.session.query(ForeignTicketData.defaultFailed).limit(40).all() for i in range(0, len(result)): result2.append(result[i][0]) """门票总验价次数""" result = db.session.query(ForeignTicketData.checkPrice).limit(40).all() for i in range(0, len(result)): result4.append(result[i][0]) """酒店验价失败总次数""" result = db.session.query(ForeignTicketData.checkFailed).limit(40).all() for i in range(0, len(result)): result5.append(result[i][0]) """门票购物车验价次数""" result = db.session.query(ForeignTicketData.shoppingCart).limit(40).all() for i in range(0, len(result)): result7.append(result[i][0]) """门票购物车验价失败次数""" result = db.session.query(ForeignTicketData.shoppingFailed).limit(40).all() for i in range(0, len(result)): result8.append(result[i][0]) """门票预定页验价次数""" result = db.session.query(ForeignTicketData.orderPage).limit(40).all() for i in range(0, len(result)): result9.append(result[i][0]) """门票预定页验价失败次数""" result = db.session.query(ForeignTicketData.orderFailed).limit(40).all() for i in range(0, len(result)): result10.append(result[i][0]) numberlist.append(result1) numberlist.append(result2) numberlist.append(result4) numberlist.append(result5) numberlist.append(result7) numberlist.append(result8) numberlist.append(result9) numberlist.append(result10) resp = cors_response({ "success": True, "ratedata": ratelist, "numberdata": numberlist }) return resp
def getForeignHotelData(): ratelist = [] numberlist = [] result1 = [] result2 = [] result3 = [] result4 = [] result5 = [] result6 = [] result7 = [] result8 = [] result9 = [] result10 = [] result11 = [] result12 = [] result13 = [] result14 = [] """酒店推荐失败率""" result = db.session.query(ForeignHotelData.defaultPercent).limit(40).all() for i in range(0, len(result)): result3.append(result[i][0]) # """系统推荐失败率""" # result = db.session.query(ForeignHotelData.systemPercent).limit(40).all() # for i in range(0, len(result)): # result6.append(result[i][0]) """验价失败率""" result = db.session.query(ForeignHotelData.checkPercent).limit(40).all() for i in range(0, len(result)): result9.append(result[i][0]) """返回最近30天的时间数据""" result = db.session.query(ForeignHotelData.date_time).limit(40).all() for i in range(0, len(result)): result10.append(result[i][0]) """rate相关数据和时间数据放入ratedata,用于比率试图的数据来源""" ratelist.append(result3) # ratelist.append(result6) ratelist.append(result9) ratelist.append(result10) """酒店默认推荐次数""" result = db.session.query(ForeignHotelData.defaultRecommed).limit(40).all() for i in range(0, len(result)): result1.append(result[i][0]) """酒店默认推荐失败次数""" result = db.session.query(ForeignHotelData.defaultFailed).limit(40).all() for i in range(0, len(result)): result2.append(result[i][0]) # """酒店系统打包产品推荐次数""" # result = db.session.query(ForeignHotelData.systemProduct).limit(40).all() # for i in range(0, len(result)): # result4.append(result[i][0]) # # """酒店系统打包产品推荐失败次数""" # result = db.session.query(ForeignHotelData.systemFailed).limit(40).all() # for i in range(0, len(result)): # result5.append(result[i][0]) """酒店总验价次数""" result = db.session.query(ForeignHotelData.checkPrice).limit(40).all() for i in range(0, len(result)): result7.append(result[i][0]) """酒店验价失败总次数""" result = db.session.query(ForeignHotelData.checkFailed).limit(40).all() for i in range(0, len(result)): result8.append(result[i][0]) """酒店购物车验价次数""" result = db.session.query(ForeignHotelData.shoppingCart).limit(40).all() for i in range(0, len(result)): result11.append(result[i][0]) """酒店购物车验价失败次数""" result = db.session.query(ForeignHotelData.shoppingFailed).limit(40).all() for i in range(0, len(result)): result12.append(result[i][0]) """酒店预定页验价次数""" result = db.session.query(ForeignHotelData.orderPage).limit(40).all() for i in range(0, len(result)): result13.append(result[i][0]) """酒店预定页验价失败次数""" result = db.session.query(ForeignHotelData.orderFailed).limit(40).all() for i in range(0, len(result)): result14.append(result[i][0]) numberlist.append(result1) numberlist.append(result2) # numberlist.append(result4) # numberlist.append(result5) numberlist.append(result7) numberlist.append(result8) numberlist.append(result11) numberlist.append(result12) numberlist.append(result13) numberlist.append(result14) resp = cors_response({ "success": True, "ratedata": ratelist, "numberdata": numberlist }) return resp
def shot(): data = request.get_json('data') executor.submit(getShotEail,data) response = {"success": "true", "msg": "请稍后查看邮箱是否收到邮件~~"} return cors_response(response)