Exemple #1
0
 def __init__(self, type):
     self.host = settings.host
     self.family = settings.family
     self.type = settings.prototal[type]
     self.base_path = settings.server_path
     self.path = None
     self.current_dir = None
     self.user = None
     self.logobj = logger.mylog('server')
Exemple #2
0
 def __init__(self):
     super().__init__()
     self.host = settings.host
     self.family = settings.family
     self.type = settings.prototal['tcp']
     self.base_path = settings.server_path
     self.path = None
     self.current_dir = None
     self.user = None
     self.logobj = logger.mylog('server')
     self.server = self._create()
Exemple #3
0
 def __init__(self, type):
     self.host = settings.host  # 远程主机地址,端口号
     self.family = settings.family  # 类型
     self.type = settings.prototal[type]  # 传输协议
     self.name_flag = 0  # 作为判断发送用户数据,0表示未发送,1表示发送
     self.logobj = logger.mylog('client')
     self.shelveobj = shelve.open('.unfinished')
     self.status = {
         '100': 'login successed',
         '101': 'login failed',
         '102': 'incomplete data packet',
         '200': 'success operation',
         '201': 'data already exists',
         '202': 'not found the directory',
         '301': 'server failed operation',
         '401': 'keyword error',
         '402': 'the file’s md5 was by changed',
         '501': 'not the same file',
         '502': 'esist the file',
         '503': 'your disk is full',
     }
Exemple #4
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:yavan

import os, sys, datetime, logging

base_path = os.path.dirname(os.path.dirname(__file__))
sys.path.append(base_path)
from database import account_data
from lib import logger

# 创建日志对象
atm_log = logger.mylog('atm')


def check(data):
    '''
    查看账单,可用额度
    :param data: 返回用户数据
    :return:
    '''
    # arrears = sum(list(data['bill'].values()))
    print('\033[1;31;40m您的总额度为 %.2f RMB\033[0m' % data['balance'])
    if data['arrears'] > 0:  # 当账户卡内有余额时
        print('\033[1;31;40m已消费 0 RMB,余额 %.2f RMB\033[0m' % data['arrears'])
    else:
        print('\033[1;31;40m已消费 %.2f RMB\033[0m' % abs(data['arrears']))
    print('\033[1;31;40m剩余额度 %.2f RMB\033[0m' %
          (data['balance'] + data['arrears']))
    if data['arrears'] >= 0:
        print('当前暂无欠款')