def POST(self): data = web.input() data.ip = web.ctx.ip log.info('[idsc]ChenckPay:%s', data) act_cls = ACTS[CB_ACT_PAY] code, desc = act_cls.ChenckPay(sdk, data) log.info('[idsc]finish ChenckPay:%s', (code, desc)) if code == CODE_SUCC: return json.dumps({'err_code':0, 'desc':desc}) else: return json.dumps({'err_code':1, 'desc':desc})
def POST(self): data = web.input() data.ip = web.ctx.ip log.info('[idsc]callback:%s', data) act_cls = ACTS[CB_ACT_PAY] try: code, desc = act_cls.GET(sdk, data) except: log.log_except() return json.dumps({'success':0, 'desc':'sys error'}) log.info('[idsc]callbacked:%s', (code, desc)) if code == CODE_SUCC: return json.dumps({'success':1, 'desc':desc}) else: return json.dumps({'success':0, 'desc':desc})
def new(cls, pid, type, items, rid=0): o = cls() o.data.pid = pid o.data.type = type o.data.items = json.dumps(items) #items是列表对象 o.data.rid = rid o.items = items return o
def pack(self, msg): if DEBUG_PACK: log.debug('pack:%s', msg) tag = msg.pop('_tag') if is_ujson: #ujson支持object对象,并且直接输出最短结构 data = json.dumps(msg, ensure_ascii=False) else: data = json.dumps(msg, ensure_ascii=False, default=self._json_default, separators=(',', ':')) #ensure_ascii=False时,json输出unicode, ujson输出utf8str if isinstance(data, unicode): data = data.encode('utf-8') if self.ZIP: data = compress(data, ZLIB_LEVEL) if self.AES: data = self.aes_encrypt(data) l = len(data) return struct.pack('%s%ds' % (self._head_fmt, l), tag, l, data)
def POST(self): data = web.input() act_cls = ACTS[CB_ACT_PAY] rs = act_cls.check_accout(sdk, data) log.debug('[ids]Login:%s', rs) return json.dumps(rs)
def POST(self): data = web.input() act_cls = ACTS[CB_ACT_PAY] rs = act_cls.get_server_list(sdk, data) log.debug('[ids]Server:%s', rs) return json.dumps(rs)
def make_result(code, desc): if code == CODE_SUCC: return 'Success' return json.dumps(dict(ErrorCode=code, ErrorDesc=desc))
def make_result(code, desc): if code == CODE_SUCC: return json.dumps({'status': 'success'}) return ''
def GET(self): """ /api/91pay?CooOrderSerial=xxxx """ data = web.input(_method='GET') rs, code, desc = sdk91.check_pay(data['CooOrderSerial']) return json.dumps((int(rs), code, desc))
def encode_json(data): """ 加密数据 """ data = json.dumps(data, separators=(',', ':')) if not AES: return data return aes_encrypt(data)
def GET(self): p = psutil.Process(os.getpid()) # blocking cpu = p.get_cpu_percent() return json.dumps({'cpu': cpu})
def GET(self): """ /api/91login?sid=xxxx&session=xxxxx """ data = web.input(_method='GET') log.debug('sdk91.login:%s', data) rs, code, desc = sdk91.login(data['sid'], data['session']) return json.dumps((int(rs), code, desc))
def make_result(code, desc): return json.dumps(dict(ErrorCode=code, ErrorDesc=desc))
def make_result(code, desc): if code == CODE_SUCC: return json.dumps({'status':'success'}) return ''