def __init__(self,obj): self.obj = obj self.apimsg = lang() self.usepage = pagemodel() self.data = {} self.doll = 1 self.insert_id = None
def finish(self, data=None, code=None, list=False): #跨域使用 self.set_header("Access-Control-Allow-Origin", "*") if code != None : chunk = {'res':code} if code == 0: chunk["message"] = data elif code == 1: if list: chunk['list'] = data else: chunk['data'] = data else: apimsg = lang() chunk["message"] = apimsg.notice(code) self.set_header("Content-Type", "application/json; charset=UTF-8") #返回json中文化 res = json.dumps(chunk,ensure_ascii=False,indent=2) else: res = None super(APIHandler,self).finish(res) #web函数中自带的一些属性 self.flush(include_footers=True) self.request.finish() self._log() self._finished = True self.on_finish()
def __init__(self): self.data = '' #参数 self.name = '' #提示名 self.token = True #判断标示 self.res = '' #判断结果 self.doll = '' #函数出错标示 self.message = [] #错误提示列表 self.apimsg = lang() #中文
# -*- coding: utf-8 -*- from public import * from model.validate import validate from model.chargemodel import * from model.language import lang import time apimsg = lang() # 文字类 # 生成订单 class ChargOrder(apiHandler): @api_token def post(self): code = self.get_argument("code", "") cardno = self.get_argument("cardno", "") cardid = self.get_argument("cardid", "") cardtype = self.get_argument("cardtype", "") price = self.get_argument("price", "") post_data = {} # for key in self.request.arguments: # post_data[key] = self.get_arguments(key) # print post_data if not price or float(price) < 0.5: self.finish("2") return charge = chargemodel(self) # 验证电桩是否存在 device = charge.device_info(code) if device: # 设备存在 则验证卡 uinfo = charge.user_card(cardno, cardtype, cardid)
def __init__(self,obj): self.obj = obj self.apimsg = lang() self.doll = 1
def __init__(self,obj): self.obj = obj self.apimsg = lang() self.data = {} self.usepage = pagemodel()
# -*- coding: utf-8 -*- from public import * from model.cardmodel import * from model.usermodel import * from model.chargemodel import * from model.logmodel import * from model.language import lang import time from model.validate import validate from config import setting from libraries.alipay import * apimsg = lang() #首页 class IndexHandler(webHandler): def get(self): #获取访问openid self.render("home/index.html") def write_error(self, status_code, **kwargs): error = apimsg.notice(status_code) self.render("home/error.html", code=status_code, error=error) #关于 class AboutHandler(webHandler): def get(self): #获取访问openid self.render("home/about.html")
def __init__(self, obj): self.obj = obj self.apimsg = lang() self.uid = False self.usepage = pagemodel() self.doll = 1