def hello_world(): url = url_for('index') url_1 = UrlManager.buildUrl("/api ") url_2 = UrlManager.buildStaticUrl('css/bootstrap.css') msg = 'Hello world,url:%s,url_1:%s,url_2:%s' % (url, url_1, url_2) # 日志文件 app.logger.error(msg) app.logger.info(msg) return msg
def hello_world(): url = url_for("index") url_1 = UrlManager.buildUrl("/api") url_2 = UrlManager.buildStaticUrl("/css/bootstrap") msg = "hello word,url:%s;url_1:%s;url_2:%s" % (url, url_1, url_2) app.logger.info(msg) app.logger.error(msg) return "hello word,url:%s;url_1:%s;url_2:%s" % (url, url_1, url_2)
def hello_world(): url = UrlManager.buildUrl("/api") staticUrl = UrlManager.buildStaticUrl("/css/bootstrap.css") msg = '连接地址:%s;静态地址:%s' % (url, staticUrl) # 分别打印三个级别的日志信息 app.logger.info(msg) app.logger.error(msg) app.logger.debug(msg) return msg
def hello(): url = url_for('index') url_1 = UrlManager.buildUrl('/api') url_2 = UrlManager.buildStaticUrl('/css/bootstrap.css') msg = 'hello world, url:%s,url1:%s,url2:%s' % (url, url_1, url_2) app.logger.error(msg) app.logger.info(msg) return msg
def info(): resp_data = {} req = request.args cid = int(req.get("cid", 0)) info = Contract.query.filter_by(cid=cid).first() if info: resp_data["info"] = info file_path = info.file # print(file_path) # excelToHtml(file_path) resp_data["url"] = UrlManager.buildStaticUrl("/uploads/" + file_path) print(resp_data["url"]) return ops_render("info.html", resp_data)
def myOrderInfo(): resp = {'code': 200, 'msg': '操作成功~', 'data': {}} member_info = g.member_info req = request.values order_sn = req['order_sn'] if 'order_sn' in req else '' pay_order_info = PayOrder.query.filter_by(member_id=member_info.Id, order_sn=order_sn).first() if not pay_order_info: resp['code'] = -1 resp['msg'] = "系统繁忙,请稍后再试~~" return jsonify(resp) tmp_deadline = pay_order_info.created_time + datetime.timedelta(minutes=30) info = { "order_sn": pay_order_info.order_sn, "status": pay_order_info.pay_status, "status_desc": pay_order_info.status_desc, "pay_price": str(pay_order_info.pay_price), "yun_price": str(pay_order_info.yun_price), "total_price": str(pay_order_info.total_price), "goods": [], "deadline": tmp_deadline.strftime("%Y-%m-%d %H:%M"), 'qrCode_Url': app.config["APP"][ "domain"] + UrlManager.buildStaticUrl( pay_order_info.qrcode_url) if pay_order_info.qrcode_url else '', } pay_order_items = PayOrderItem.query.filter_by(pay_order_id=pay_order_info.id).all() if pay_order_items: food_ids = selectFilterObj(pay_order_items, "food_id") food_map = getDictFilterField(Shop_Info, Shop_Info.Id, "Id", food_ids) for item in pay_order_items: tmp_food_info = food_map[item.food_id] tmp_data = { "name": tmp_food_info.ShopName, "price": str(item.price), "unit": item.quantity, "pic_url": UrlManager.buildImageUrl(tmp_food_info.ShopImageUrl), } info['goods'].append(tmp_data) if tmp_food_info: merchant = Merchant_Info.query.filter_by(Id=tmp_food_info.ShopMerchantId).first() resp['merchant'] = { 'name': merchant.Name, 'address': merchant.Address, 'imageUrl': merchant.ImageUrl, 'phone': merchant.Phone } resp['data']['info'] = info return jsonify(resp)
def couponInfo(): resp = {'code': 200, 'msg': '操作成功', 'data': {}} req = request.values id = req['id'] if 'id' in req else 0 memberId = req['memberId'] if 'memberId' in req else 0 info = Coupon_Info.query.filter_by(Id=id).first() if info: resp['data'] = { 'name': info.Coupon_Name, 'price': str(info.Coupon_Price), 'min_price': str(info.Price), 'qrCode_Url': app.config["APP"][ "domain"] + UrlManager.buildStaticUrl(info.QrCode_Url) if info.QrCode_Url else '', 'status': str(info.Status), 'isFinish': 0, 'shop_info': { } } p_info = PayOrder.query.filter_by(order_sn=info.Order_sn).first() if p_info: if p_info.express_status == 1: resp['isFinish'] = 1 return jsonify(resp) s_info = Shop_Info.query.filter_by(Id=info.ShopId).first() if s_info: merchant = Merchant_Info.query.filter_by(Id=s_info.ShopMerchantId).first() resp['merchant'] = { 'name': merchant.Name, 'address': merchant.Address, 'imageUrl': merchant.ImageUrl, 'phone': merchant.Phone } resp['data']['shop_info'] = { 'id': s_info.Id, 'name': "%s" % (s_info.ShopName), 'desc': "%s" % (s_info.ShopDesc), 'price': str(s_info.ShopPrice), 'min_price': str(s_info.ShopFloorPrice), 'stock': str(s_info.Stock), 'totalCount': str(s_info.TotalCount), 'pic_url': UrlManager.buildImageUrl(s_info.ShopImageUrl) } return jsonify(resp)