Esempio n. 1
0
# -*- coding: utf-8 -*-
from app.model import UuidBase, db
from app.type.typedef_const import TypedefConst

g_payment_type = TypedefConst()

g_payment_type.BANK = 0  # 银行卡
g_payment_type.WECHAT = 1  # 微信
g_payment_type.ALIPAY = 2  # 支付宝
g_payment_type.USDT = 3  # USDT


class Payment(UuidBase):
    user_id = db.Column(db.String(36),
                        db.ForeignKey('user.id'),
                        nullable=False)

    type = db.Column(db.SmallInteger, nullable=False)  # 收款类型 g_payment_type

    name = db.Column(db.String(64))  # 姓名
    bank = db.Column(db.String(128))  # 开户行
    card_number = db.Column(db.String(64))  # 卡号
    wechat = db.Column(db.String(64))  # 微信
    wechat_image = db.Column(db.String(512), default='')  # 微信二维码
    alipay = db.Column(db.String(64))  # 支付宝
    alipay_image = db.Column(db.String(512), default='')  # 支付宝二维码
    address = db.Column(db.String(64))  # usdt 地址
    remark = db.Column(db.String(64), default='')  # 备注

    invalid = db.Column(db.SmallInteger, default=0)  # 收款方式是否有效 0 有效  1 无效
Esempio n. 2
0
# -*- coding: utf-8 -*-
from app.model import AutoIncrementBase, db, generate_timestamp_id
from app.model.user import User, g_user_transaction_level
from app.type.typedef_const import TypedefConst

g_sell_order_status = TypedefConst()

g_sell_order_status.UNPROCESSED = 0  # 未处理
g_sell_order_status.PROCESSED = 1  # 处理成功
g_sell_order_status.FAILED = 2  # 处理失败


class SellOrder(AutoIncrementBase):
    user_id = db.Column(db.String(36),
                        db.ForeignKey('user.id'),
                        nullable=False)  # 用户
    side = db.Column(db.SmallInteger, default=2,
                     nullable=False)  # 单类型 参见 g_order_side
    number = db.Column(db.String(16),
                       default=generate_timestamp_id,
                       unique=True,
                       nullable=False)

    amount = db.Column(db.Numeric(24, 8), nullable=False)  # 数量

    status = db.Column(
        db.SmallInteger,
        default=g_sell_order_status.UNPROCESSED)  # 状态参见 g_sell_order_status

    details = db.Column(db.String(255), default='{}', nullable=True)  # 失败备注
Esempio n. 3
0
File: user.py Progetto: q25979/tdb99
from flask import current_app
from flask_restful import abort
from itsdangerous import BadSignature, SignatureExpired
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from werkzeug.security import check_password_hash, generate_password_hash

from app.model import db, UuidBase

from app.model.currency import Currency
from app.model.setting import Setting
from app.model.pin_code import EmailPinCode, SmsPinCode
from app.model.assets import Assets, AssetsBalanceRecord, g_assets_record_type, g_assets_type

from app.type.typedef_const import TypedefConst

g_user_state_type = TypedefConst()
g_user_state_type.UNCOMPLETED_DATA = 0  # 未完善资料
g_user_state_type.COMPLETED_DATA = 1  # 已经完善资料,未通过测评
g_user_state_type.EVALUATION = 2  # 完善资料并通过了测评

g_user_transaction_level = TypedefConst()
g_user_transaction_level.NORMAL = 0  # 普通级别
g_user_transaction_level.PRIORITY = 1  # 优先级别
g_user_transaction_level.ULTIMATE = 2  # 极优级别


class UserBase(UuidBase):
    __abstract__ = True

    uid = db.Column(db.String(32), unique=True)  # 用户ID
    country_code = db.Column(db.String(16))  # 国际电话区号
Esempio n. 4
0
    payment_amount_usdt = db.Column(db.Numeric(24, 8),
                                    default=0,
                                    nullable=False)  # 对应支付方式,支付数量 USDT

    proof_img = db.Column(db.Text, default='[]')  # 转账凭证

    current_price = db.Column(db.Numeric(24, 8), nullable=False)  # 当前价格
    payment_id = db.Column(db.String(36),
                           db.ForeignKey('payment.id'))  # 卖方收款方式

    sell_user = db.relationship(User, foreign_keys=[sell_user_id])
    buy_user = db.relationship(User, foreign_keys=[buy_user_id])
    sell_order = db.relationship('Order', foreign_keys=[sell_order_id])
    buy_order = db.relationship('Order', foreign_keys=[buy_order_id])
    payment = db.relationship(Payment, foreign_keys=[payment_id])


g_match_order_task_status = TypedefConst()

g_match_order_task_status.UNPROCESSED = 0  # 未处理
g_match_order_task_status.PROCESSED = 1  # 处理成功


class MatchOrderTask(AutoIncrementBase):

    # 状态参见 g_match_order_task_status
    status = db.Column(db.SmallInteger,
                       default=g_match_order_task_status.UNPROCESSED)

    order_cnt = db.Column(db.Integer, nullable=False)  # 需要匹配的单数
Esempio n. 5
0
from yunpian_python_sdk.model import constant as YC

from app.model import AutoIncrementBase, db
from app.model.user import User, g_user_transaction_level
from app.model.sell_order import SellOrder, g_sell_order_status
from app.model.buy_order import BuyOrder, g_buy_order_status
from app.model.match_order import MatchOrder, MatchOrderTask, g_match_order_task_status
from app.model.confirm_order import ConfirmOrder, g_confirm_order_status
from app.model.payment import Payment
from app.model.currency import CryptoCurrency
from app.model.setting import Setting
from app.model.currency import Currency
from app.model.assets import Assets, g_assets_record_type
from app.type.typedef_const import TypedefConst

g_order_status = TypedefConst()

g_order_status.PENDING = 1  # 挂单中
g_order_status.MATCH = 2  # 匹配中
g_order_status.PAID = 4  # 已付款
g_order_status.CONFIRMED = 8  # 已确认
g_order_status.CANCELLED = 16  # 已取消
g_order_status.DELETE = 32  # 删除

g_order_side = TypedefConst()

g_order_side.BUY = 1  # 买单
g_order_side.SELL = 2  # 卖单


class Order(AutoIncrementBase):
Esempio n. 6
0
# -*- coding: utf-8 -*-
import decimal
import json

from app.model import UuidBase, AutoIncrementBase, db

from app.model.setting import Setting
from app.type.typedef_const import TypedefConst

g_assets_type = TypedefConst()

g_assets_type.TOTAL = 1  # 总资产钱包 冻结
g_assets_type.COMMUNITY = 2  # 社区钱包 用于交易
g_assets_type.TRANSACTION = 4  # 交易钱包 用于冻结释放

g_assets_record_type = TypedefConst()

g_assets_record_type.EVALUATION = 1  # 测评奖励
g_assets_record_type.RECHARGE = 2  # 充值
g_assets_record_type.BUY = 4  # 买
g_assets_record_type.SELL = 8  # 卖
g_assets_record_type.SPONSOR = 16  # 推荐奖励
g_assets_record_type.BUY_SELL_FREE = 32  # 买卖释放
g_assets_record_type.ACCELERATE_FREE = 64  # 加速释放
g_assets_record_type.EXCHANGE = 128  # 兑换
g_assets_record_type.TRANSACTION = 256  # 转账
g_assets_record_type.DIVIDEND = 512  # 分红


class Assets(UuidBase):
    user_id = db.Column(db.String(36), db.ForeignKey('user.id'), nullable=False)
Esempio n. 7
0
# -*- coding: utf-8 -*-
import datetime
import json
import decimal
from app.model import AutoIncrementBase, db, generate_timestamp_id
from app.model.user import User
from app.type.typedef_const import TypedefConst

g_confirm_order_status = TypedefConst()

g_confirm_order_status.UNPROCESSED = 0  # 未处理
g_confirm_order_status.PROCESSED = 1  # 处理成功


class ConfirmOrder(AutoIncrementBase):
    sell_user_id = db.Column(db.String(36),
                             db.ForeignKey('user.id'),
                             nullable=False)  # 卖方用户
    buy_user_id = db.Column(db.String(36),
                            db.ForeignKey('user.id'),
                            nullable=False)  # 买方用户

    amount = db.Column(db.Numeric(24, 8), nullable=False)  # 数量

    status = db.Column(db.SmallInteger,
                       default=g_confirm_order_status.UNPROCESSED
                       )  # 状态参见 g_confirm_order_status

    sell_user = db.relationship(User, foreign_keys=[sell_user_id])
    buy_user = db.relationship(User, foreign_keys=[buy_user_id])
Esempio n. 8
0
# -*- coding: utf-8 -*-
import datetime
import logging
import time
import json
import decimal
from app.model import AutoIncrementBase, db, generate_timestamp_id
from app.model.user import User, g_user_transaction_level
from app.model.payment import Payment
from app.model.setting import Setting
from app.model.currency import Currency
from app.model.assets import Assets, g_assets_record_type
from app.type.typedef_const import TypedefConst

g_order_old_status = TypedefConst()

g_order_old_status.PENDING = 1  # 挂单中
g_order_old_status.MATCH = 2  # 匹配中
g_order_old_status.PAID = 4  # 已付款
g_order_old_status.CONFIRMED = 8  # 已确认
g_order_old_status.CANCELLED = 16  # 已取消


class OrderOld(AutoIncrementBase):
    user_id = db.Column(db.String(36),
                        db.ForeignKey('user.id'),
                        nullable=False)  # 卖方用户
    match_user_id = db.Column(db.String(36), db.ForeignKey('user.id'))  # 买方用户
    # side = db.Column(db.SmallInteger, nullable=False)  # 1 买单  2 卖单
    number = db.Column(db.String(16),
                       default=generate_timestamp_id,