Ejemplo n.º 1
0
 def login(user):
     username = user.get('username', '')
     password = user.get('password', '')
     u = UserModel.get_by_name(username)
     if not u:
         abort(500, **get_result(code=500, msg='账号或密码错误'))
     if password != u['password']:
         abort(500, **get_result(code=500, msg='账号或密码错误'))
     return Response(data=u)
Ejemplo n.º 2
0
 def delete():
     json = get_json()
     _id = json.get('_id', '')
     if _id == '':
         abort(400, **get_result(code=400, msg='参数错误'))
     account = {'_id': _id}
     return Response(account=account)
Ejemplo n.º 3
0
 def reg(user):
     username = user.get('username', '')
     password = user.get('password', '')
     u = UserModel.get_by_name(username)
     if u:
         abort(500, **get_result(code=500, msg='该用户已存在'))
     UserModel.insert(username, password)
     return Response(data={})
Ejemplo n.º 4
0
 def put():
     json = get_json()
     _id = json.get('_id', '')
     if _id == '':
         abort(400, **get_result(code=400, msg='参数错误'))
     account = {
         '_id': _id,
         'exchange': json.get('exchange', ''),
         'desc': json.get('desc', ''),
         'key': json.get('key', ''),
         'secret': json.get('secret', ''),
         'user_id': json.get('userId', '')
     }
     return Response(account=account)
Ejemplo n.º 5
0
 def update(assert_info):
     if not assert_info:
         abort(400, **get_result(code=400, msg='参数错误'))
     AssertInfoModel.update(assert_info)
     return Response(data={})
Ejemplo n.º 6
0
 def get(assert_info):
     if not assert_info:
         abort(400, **get_result(code=400, msg='参数错误'))
     doc = AssertInfoModel.get(assert_info)
     return Response(data=doc)
Ejemplo n.º 7
0
 def update(account):
     if not account:
         abort(400, **get_result(code=400, msg='参数错误'))
     AccountModel.update(account)
     return Response(data={})