Commit 7cdf31fe by Aeolus

Merge branch 'aeolus'

parents 60911711 75818ace
...@@ -24,6 +24,7 @@ class Config: ...@@ -24,6 +24,7 @@ class Config:
JWT_SECRET = SECRET_KEY JWT_SECRET = SECRET_KEY
TENCENT_REDIS_URL = os.getenv("TENCENT_REDIS_URL") TENCENT_REDIS_URL = os.getenv("TENCENT_REDIS_URL")
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 MAX_CONTENT_LENGTH = 16 * 1024 * 1024
# SQLALCHEMY_ECHO = True
@staticmethod @staticmethod
def init_app(app): def init_app(app):
......
...@@ -200,6 +200,7 @@ class Machine(Base): ...@@ -200,6 +200,7 @@ class Machine(Base):
updated_at = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
command_time = Column(INTEGER(1), nullable=False, server_default=text("'1'")) command_time = Column(INTEGER(1), nullable=False, server_default=text("'1'"))
discounts_id = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment="折扣活动") discounts_id = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment="折扣活动")
business_id = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment="商户号")
class MachineProduction(Base): class MachineProduction(Base):
...@@ -338,6 +339,7 @@ class Rent(Base): ...@@ -338,6 +339,7 @@ class Rent(Base):
expire_handle = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='是否做过期处理') expire_handle = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='是否做过期处理')
prepay_id = Column(VARCHAR(191), comment='微信支付prepay_id') prepay_id = Column(VARCHAR(191), comment='微信支付prepay_id')
over_time = Column(TIMESTAMP, comment='订单完结时间') over_time = Column(TIMESTAMP, comment='订单完结时间')
business_id = Column(INTEGER(11), nullable=False, server_default=text("'0'"), comment="商户号")
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -347,26 +349,50 @@ class RentDetail(Base): ...@@ -347,26 +349,50 @@ class RentDetail(Base):
id = Column(INTEGER(10), primary_key=True, unique=True) id = Column(INTEGER(10), primary_key=True, unique=True)
rent_no = Column(String(40, 'utf8mb4_unicode_ci'), nullable=False, comment='订单编号') rent_no = Column(String(40, 'utf8mb4_unicode_ci'), nullable=False, comment='订单编号')
user_id = Column(INTEGER(10), nullable=False, index=True, comment='用户id') user_id = Column(INTEGER(10), nullable=False, comment='用户id')
machine_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False, comment='机柜id') machine_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False, comment='机柜id')
hatch_no = Column(TINYINT(3), nullable=False, comment='机柜仓口号') hatch_no = Column(TINYINT(3), nullable=False, comment='机柜仓口号')
production_id = Column(INTEGER(10), nullable=False, comment='商品id') total = Column(INTEGER(10), server_default=text("'0'"), comment='实收金额')
rent_count = Column(TINYINT(3), nullable=False, server_default=text("'0'"))
refund_total = Column(INTEGER(10), server_default=text("'0'"))
refund_count = Column(INTEGER(10), server_default=text("'0'"))
is_take = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='是否取货') is_take = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='是否取货')
name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称') business_id = Column(INTEGER(11), nullable=False, server_default=text("'0'"))
status = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='1正常 2删除')
production_id = Column(INTEGER(10), nullable=False, comment='商品id')
production_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称')
title = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False, comment='商品标题') title = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False, comment='商品标题')
brand_id = Column(INTEGER(10), nullable=False, comment='品牌ID') brand_id = Column(INTEGER(10), nullable=False, comment='品牌ID')
brand_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称') brand_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称')
production_type_id = Column(INTEGER(10), nullable=False, comment='分类ID') production_type_id = Column(INTEGER(10), nullable=False, comment='分类ID')
production_type_name = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False, comment='商品标题') production_type_name = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False, comment='商品标题')
price = Column(INTEGER(10), nullable=False, comment='价格') price = Column(INTEGER(10), nullable=False, comment='价格')
rent_count = Column(INTEGER(10), nullable=False, comment='数量') original_price = Column(INTEGER(10), nullable=False, comment='商品原价')
img = Column(String(200, 'utf8mb4_unicode_ci')) img = Column(String(200, 'utf8mb4_unicode_ci'))
tags = Column(String(255, 'utf8mb4_unicode_ci'), comment='商品标签') tags = Column(String(255, 'utf8mb4_unicode_ci'), comment='商品标签')
content = Column(Text(collation='utf8mb4_unicode_ci'), comment='商品内容') content = Column(Text(collation='utf8mb4_unicode_ci'), comment='商品内容')
summary = Column(Text(collation='utf8mb4_unicode_ci'), comment='商品描述') summary = Column(Text(collation='utf8mb4_unicode_ci'), comment='商品描述')
status = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='1正常 -1删除')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
weight = Column(INTEGER(10), server_default=text("'0'"), comment='重量')
weight_unit = Column(String(10, 'utf8mb4_unicode_ci'), server_default=text("'g'"), comment='重量单位')
expiration_date = Column(INTEGER(10), server_default=text("'0'"), comment='保质期')
expiration_date_unit = Column(String(10, 'utf8mb4_unicode_ci'), server_default=text("'月'"), comment='保质期单位')
is_expiration_date = Column(TINYINT(1), server_default=text("'0'"), comment='是否有保质期')
weight_error = Column(INTEGER(10), server_default=text("'0'"), comment='重量误差')
class RentRefund(Base):
__tablename__ = 'rent_refund'
id = Column(INTEGER(10), primary_key=True)
user_id = Column(INTEGER(10), nullable=False, index=True, comment='用户id')
refund_no = Column(String(191, 'utf8mb4_unicode_ci'), nullable=False)
rent_no = Column(String(191, 'utf8mb4_unicode_ci'), nullable=False)
rent_detail_id = Column(INTEGER(10), nullable=False)
total = Column(INTEGER(10), nullable=False)
comment = Column(Text(collation='utf8mb4_unicode_ci'))
cause = Column(String(191, 'utf8mb4_unicode_ci'))
class SalePlan(Base): class SalePlan(Base):
......
...@@ -14,38 +14,68 @@ class AdminAccount(Base): ...@@ -14,38 +14,68 @@ class AdminAccount(Base):
user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False, unique=True) user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False, unique=True)
user_name = Column(String(255, 'utf8mb4_unicode_ci'), nullable=False) user_name = Column(String(255, 'utf8mb4_unicode_ci'), nullable=False)
phone = Column(String(191, 'utf8mb4_unicode_ci'), nullable=False, unique=True) phone = Column(String(191, 'utf8mb4_unicode_ci'), nullable=False, unique=True)
level = Column(TINYINT(2), nullable=False) level = Column(TINYINT(2), nullable=False, comment='1:超级管理员,2:代理商,3:业务员,4:财务,5:运维管理员,6:补货员,7:客服 ')
parent_id = Column(INTEGER(10), nullable=False) parent_id = Column(INTEGER(10), nullable=False, comment='上级ID')
draw = Column(TINYINT(1), nullable=False, server_default=text("'0'")) draw = Column(TINYINT(1), nullable=False, server_default=text("'0'"), comment='提现权限0不可以1可以')
rate = Column(INTEGER(10), nullable=False) rate = Column(INTEGER(10), nullable=False, comment='分成比例')
status = Column(INTEGER(1), nullable=False) status = Column(INTEGER(1), nullable=False, comment='1:正常 2:删除')
_password_hash_ = Column(String(255, 'utf8mb4_unicode_ci')) _password_hash_ = Column(String(255, 'utf8mb4_unicode_ci'))
comment = Column(String(255, 'utf8mb4_unicode_ci')) comment = Column(String(255, 'utf8mb4_unicode_ci'))
created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
class AdminBrand(Base):
__tablename__ = 'admin_brand'
id = Column(INTEGER(11), primary_key=True)
user_id = Column(INTEGER(11), nullable=False)
user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False)
brand_id = Column(INTEGER(11), nullable=False)
status = Column(INTEGER(1), nullable=False, server_default=text("'1'"), comment='1:正常 2:删除')
created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
class AdminBusines(Base):
__tablename__ = 'admin_business'
__table_args__ = (
Index('unique4admin_business_user_business', 'user_id', 'business_id', unique=True),
)
id = Column(INTEGER(11), primary_key=True)
user_id = Column(INTEGER(11), nullable=False)
user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False)
business_id = Column(INTEGER(11), nullable=False)
status = Column(INTEGER(1), nullable=False, server_default=text("'1'"), comment='1:正常 -1:删除')
created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
class AdminLoginRecord(Base): class AdminLoginRecord(Base):
__tablename__ = 'admin_login_record' __tablename__ = 'admin_login_record'
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
phone = Column(VARCHAR(40), nullable=False) phone = Column(VARCHAR(40), nullable=False)
platform = Column(TINYINT(4), nullable=False, server_default=text("'1'")) platform = Column(TINYINT(4), nullable=False, server_default=text("'1'"), comment='平台 1PC平台')
ip = Column(VARCHAR(40), nullable=False) ip = Column(VARCHAR(40), nullable=False)
last_login = Column(DateTime, nullable=False) last_login = Column(DateTime, nullable=False)
login_type = Column(INTEGER(1), nullable=False) login_type = Column(INTEGER(1), nullable=False, comment='1:验证码登录 2:token 3:发送验证码 4:密码')
created_at = Column(DateTime, nullable=False) created_at = Column(DateTime, nullable=False)
updated_at = Column(DateTime, nullable=False) updated_at = Column(DateTime, nullable=False)
class AdminMachine(Base): class AdminMachine(Base):
__tablename__ = 'admin_machine' __tablename__ = 'admin_machine'
__table_args__ = (
Index('unique4admin_machine_user_id_machine_no', 'user_id', 'machine_no', unique=True),
)
id = Column(INTEGER(11), primary_key=True) id = Column(INTEGER(11), primary_key=True)
user_id = Column(INTEGER(11), nullable=False) user_id = Column(INTEGER(11), nullable=False)
user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False) user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False)
machine_no = Column(INTEGER(11), nullable=False) machine_no = Column(String(40, 'utf8mb4_unicode_ci'), nullable=False)
status = Column(INTEGER(1), nullable=False, server_default=text("'1'")) status = Column(INTEGER(1), nullable=False, server_default=text("'1'"), comment='1:正常 -1:删除')
created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -57,7 +87,7 @@ class AdminPlace(Base): ...@@ -57,7 +87,7 @@ class AdminPlace(Base):
user_id = Column(INTEGER(11), nullable=False) user_id = Column(INTEGER(11), nullable=False)
user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False) user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False)
place_id = Column(INTEGER(11), nullable=False) place_id = Column(INTEGER(11), nullable=False)
status = Column(INTEGER(1), nullable=False, server_default=text("'1'")) status = Column(INTEGER(1), nullable=False, server_default=text("'1'"), comment='1:正常 2:删除')
created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -69,7 +99,19 @@ class AdminProduction(Base): ...@@ -69,7 +99,19 @@ class AdminProduction(Base):
user_id = Column(INTEGER(11), nullable=False) user_id = Column(INTEGER(11), nullable=False)
user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False) user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False)
production_id = Column(INTEGER(11), nullable=False) production_id = Column(INTEGER(11), nullable=False)
status = Column(INTEGER(1), nullable=False, server_default=text("'1'")) status = Column(INTEGER(1), nullable=False, server_default=text("'1'"), comment='1:正常 2:删除')
created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
class AdminProductionType(Base):
__tablename__ = 'admin_production_type'
id = Column(INTEGER(11), primary_key=True)
user_id = Column(INTEGER(11), nullable=False)
user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False)
production_type_id = Column(INTEGER(11), nullable=False)
status = Column(INTEGER(1), nullable=False, server_default=text("'1'"), comment='1:正常 2:删除')
created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(DateTime, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -78,8 +120,19 @@ class Brand(Base): ...@@ -78,8 +120,19 @@ class Brand(Base):
__tablename__ = 'brand' __tablename__ = 'brand'
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
name = Column(VARCHAR(191), nullable=False, index=True) brand_name = Column(VARCHAR(191), nullable=False, index=True, comment='品牌名')
img = Column(VARCHAR(191), nullable=False) img = Column(VARCHAR(191), nullable=False, comment='logo')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
status = Column(TINYINT(1), nullable=False, server_default=text("'1'"), comment='状态: 1正常-1删除')
class Busines(Base):
__tablename__ = 'business'
id = Column(INTEGER(10), primary_key=True)
business_name = Column(VARCHAR(191), nullable=False, comment='品牌名')
status = Column(TINYINT(1), nullable=False, server_default=text("'1'"), comment='状态: 1正常-1删除')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -91,24 +144,30 @@ class Hatch(Base): ...@@ -91,24 +144,30 @@ class Hatch(Base):
) )
id = Column(INTEGER(10), primary_key=True, unique=True) id = Column(INTEGER(10), primary_key=True, unique=True)
machine_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False) machine_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False, comment='机柜id')
hatch_no = Column(TINYINT(3), nullable=False) hatch_no = Column(TINYINT(3), nullable=False, comment='机柜仓口号')
production_id = Column(INTEGER(10), nullable=False) production_id = Column(INTEGER(10), nullable=False, comment='商品id')
name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False) production_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称')
title = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False) title = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False, comment='商品标题')
left_count = Column(TINYINT(3), nullable=False, server_default=text("'1'")) left_count = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='剩余数量')
total_count = Column(TINYINT(3), nullable=False, server_default=text("'1'")) total_count = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='总数量')
brand_id = Column(INTEGER(10), nullable=False) brand_id = Column(INTEGER(10), nullable=False, comment='品牌ID')
brand_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False) brand_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称')
cate_id = Column(INTEGER(10), nullable=False) production_type_id = Column(INTEGER(10), nullable=False, comment='分类ID')
cate_name = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False) production_type_name = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False, comment='商品标题')
price = Column(INTEGER(10), nullable=False) price = Column(INTEGER(10), nullable=False, comment='价格')
original_price = Column(INTEGER(10), nullable=False) original_price = Column(INTEGER(10), nullable=False, comment='商品原价')
weight = Column(INTEGER(10), server_default=text("'0'"), comment='重量')
weight_unit = Column(String(10, 'utf8mb4_unicode_ci'), server_default=text("'g'"), comment='重量单位')
weight_error = Column(INTEGER(10), server_default=text("'0'"), comment='重量误差')
expiration_date = Column(INTEGER(10), server_default=text("'0'"), comment='保质期')
expiration_date_unit = Column(String(10, 'utf8mb4_unicode_ci'), server_default=text("'月'"), comment='保质期单位')
is_expiration_date = Column(TINYINT(1), server_default=text("'0'"), comment='是否有保质期')
img = Column(String(200, 'utf8mb4_unicode_ci')) img = Column(String(200, 'utf8mb4_unicode_ci'))
tags = Column(String(255, 'utf8mb4_unicode_ci')) tags = Column(String(255, 'utf8mb4_unicode_ci'), comment='商品标签')
content = Column(Text(collation='utf8mb4_unicode_ci')) content = Column(Text(collation='utf8mb4_unicode_ci'), comment='商品内容')
summary = Column(Text(collation='utf8mb4_unicode_ci')) summary = Column(Text(collation='utf8mb4_unicode_ci'), comment='商品描述')
status = Column(TINYINT(3), nullable=False, server_default=text("'1'")) status = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='1可售2售空')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -117,23 +176,24 @@ class Machine(Base): ...@@ -117,23 +176,24 @@ class Machine(Base):
__tablename__ = 'machine' __tablename__ = 'machine'
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
machine_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False, unique=True) machine_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False, unique=True, comment='机柜编号')
device_id = Column(String(45, 'utf8mb4_unicode_ci'), unique=True) device_id = Column(String(45, 'utf8mb4_unicode_ci'), unique=True, comment='蓝牙设备号')
qrcode_no = Column(String(20, 'utf8mb4_unicode_ci'), unique=True) qrcode_no = Column(String(20, 'utf8mb4_unicode_ci'), unique=True, comment='机柜编号')
mac = Column(String(30, 'utf8mb4_unicode_ci'), unique=True) mac = Column(String(30, 'utf8mb4_unicode_ci'), unique=True)
power = Column(TINYINT(3), nullable=False, server_default=text("'0'")) power = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='电量')
short_address = Column(VARCHAR(45)) short_address = Column(VARCHAR(45))
address = Column(String(191, 'utf8mb4_unicode_ci')) address = Column(String(191, 'utf8mb4_unicode_ci'), comment='机柜位置')
place_id = Column(INTEGER(10)) place_id = Column(INTEGER(10))
mch_platform = Column(INTEGER(11), nullable=False, server_default=text("'1'")) mch_platform = Column(INTEGER(11), nullable=False, server_default=text("'1'"), comment='1随身玩 2晓见文旅')
position = Column(String(20, 'utf8mb4_unicode_ci')) position = Column(String(20, 'utf8mb4_unicode_ci'), comment='机柜位置坐标')
hatch_number = Column(TINYINT(3), nullable=False, server_default=text("'0'")) hatch_number = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='机柜的仓口数量')
type = Column(TINYINT(3), nullable=False, server_default=text("'1'")) type = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='机柜类型1 单库存 2多库存')
status = Column(TINYINT(1), server_default=text("'0'")) status = Column(TINYINT(1), server_default=text("'0'"), comment='状态: 0未激活 1正常-1删除')
created_at = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
command_time = Column(INTEGER(4), nullable=False, server_default=text("'1'")) command_time = Column(INTEGER(4), nullable=False, server_default=text("'1'"))
discounts_id = Column(INTEGER(10), server_default=text("'0'")) discounts_id = Column(INTEGER(10), server_default=text("'0'"), comment='折扣活动')
business_id = Column(INTEGER(10), nullable=False, server_default=text("'0'"))
class MachineProduction(Base): class MachineProduction(Base):
...@@ -143,7 +203,7 @@ class MachineProduction(Base): ...@@ -143,7 +203,7 @@ class MachineProduction(Base):
machine_id = Column(INTEGER(10), nullable=False) machine_id = Column(INTEGER(10), nullable=False)
production_id = Column(INTEGER(10), nullable=False) production_id = Column(INTEGER(10), nullable=False)
hatch_no = Column(INTEGER(10), nullable=False) hatch_no = Column(INTEGER(10), nullable=False)
status = Column(TINYINT(1), nullable=False) status = Column(TINYINT(1), nullable=False, comment='状态: 1整除-1删除')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -189,33 +249,35 @@ class ManagementTallyman(Base): ...@@ -189,33 +249,35 @@ class ManagementTallyman(Base):
class NfcCard(Base): class NfcCard(Base):
__tablename__ = 'nfc_card' __tablename__ = 'nfc_card'
__table_args__ = {'comment': 'nfc卡片表'}
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
card_no = Column(String(40, 'utf8mb4_unicode_ci')) card_no = Column(String(40, 'utf8mb4_unicode_ci'), comment='卡片编号')
user_id = Column(INTEGER(10)) user_id = Column(INTEGER(10))
nick_name = Column(String(40, 'utf8mb4_unicode_ci')) nick_name = Column(String(40, 'utf8mb4_unicode_ci'), comment='学生名称')
phone = Column(String(40, 'utf8mb4_unicode_ci'), index=True) phone = Column(String(40, 'utf8mb4_unicode_ci'), index=True, comment='手机号')
money = Column(INTEGER(10), nullable=False) money = Column(INTEGER(10), nullable=False)
mch_platform = Column(INTEGER(11), nullable=False, server_default=text("'1'")) mch_platform = Column(INTEGER(11), nullable=False, server_default=text("'1'"), comment='1咻咻')
limit_count = Column(TINYINT(1), nullable=False, server_default=text("'-1'")) limit_count = Column(TINYINT(1), nullable=False, server_default=text("'-1'"))
status = Column(TINYINT(4), nullable=False) status = Column(TINYINT(4), nullable=False, comment='状态0停用1正常')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
class NfcCardPayRecord(Base): class NfcCardPayRecord(Base):
__tablename__ = 'nfc_card_pay_record' __tablename__ = 'nfc_card_pay_record'
__table_args__ = {'comment': 'nfc卡片充值表'}
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
card_no = Column(String(40, 'utf8mb4_unicode_ci'), index=True) card_no = Column(String(40, 'utf8mb4_unicode_ci'), index=True, comment='卡片编号')
rent_no = Column(VARCHAR(40), nullable=False) rent_no = Column(VARCHAR(40), nullable=False, comment='租借单号')
user_id = Column(INTEGER(10), nullable=False) user_id = Column(INTEGER(10), nullable=False, comment='用户id')
is_pay = Column(TINYINT(3), nullable=False, server_default=text("'0'")) is_pay = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='是否支付')
pay_money = Column(INTEGER(10), nullable=False) pay_money = Column(INTEGER(10), nullable=False, comment='充值金额')
mch_platform = Column(INTEGER(11), nullable=False, server_default=text("'1'")) mch_platform = Column(INTEGER(11), nullable=False, server_default=text("'1'"), comment='1随身玩 2晓见文旅')
prepay_id = Column(VARCHAR(191)) prepay_id = Column(VARCHAR(191), comment='微信支付prepay_id')
refund_no = Column(VARCHAR(191)) refund_no = Column(VARCHAR(191), comment='退款单号')
status = Column(TINYINT(4), nullable=False) status = Column(TINYINT(4), nullable=False, comment='1已充值 2已圈存到账 3已退款 -1已删除')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -237,16 +299,16 @@ class Place(Base): ...@@ -237,16 +299,16 @@ class Place(Base):
__tablename__ = 'place' __tablename__ = 'place'
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
parent_id = Column(INTEGER(10)) parent_id = Column(INTEGER(10), comment='上级ID')
place_name = Column(VARCHAR(191), nullable=False, index=True) place_name = Column(VARCHAR(191), nullable=False, index=True, comment='场所名')
img = Column(VARCHAR(191)) img = Column(VARCHAR(191), comment='展示界面的图片')
logo = Column(VARCHAR(191)) logo = Column(VARCHAR(191), comment='微型头像')
address = Column(VARCHAR(255), server_default=text("''")) address = Column(VARCHAR(255), server_default=text("''"))
position = Column(String(20, 'utf8mb4_unicode_ci')) position = Column(String(20, 'utf8mb4_unicode_ci'))
open_time = Column(VARCHAR(191)) open_time = Column(VARCHAR(191), comment='开始时间')
close_time = Column(VARCHAR(191)) close_time = Column(VARCHAR(191), comment='结束时间')
open_week = Column(VARCHAR(255), server_default=text("''")) open_week = Column(VARCHAR(255), server_default=text("''"))
status = Column(INTEGER(1), nullable=False, server_default=text("'1'")) status = Column(INTEGER(1), nullable=False, server_default=text("'1'"), comment='1:正常 2:删除')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -267,23 +329,23 @@ class Production(Base): ...@@ -267,23 +329,23 @@ class Production(Base):
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
production_no = Column(String(45, 'utf8mb4_unicode_ci'), nullable=False) production_no = Column(String(45, 'utf8mb4_unicode_ci'), nullable=False)
production_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, index=True) production_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, index=True, comment='商品名称')
title = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False) title = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False, comment='商品标题')
brand_id = Column(INTEGER(10), nullable=False) brand_id = Column(INTEGER(10), nullable=False, comment='品牌ID')
production_type_id = Column(INTEGER(10), nullable=False) production_type_id = Column(INTEGER(10), nullable=False, comment='分类ID')
price = Column(INTEGER(10), nullable=False) price = Column(INTEGER(10), nullable=False, comment='价格')
original_price = Column(INTEGER(10), nullable=False) original_price = Column(INTEGER(10), nullable=False, comment='商品原价')
weight = Column(INTEGER(10), server_default=text("'0'")) weight = Column(INTEGER(10), server_default=text("'0'"), comment='重量')
weight_unit = Column(String(10, 'utf8mb4_unicode_ci'), server_default=text("'g'")) weight_unit = Column(String(10, 'utf8mb4_unicode_ci'), server_default=text("'g'"), comment='重量单位')
expiration_date = Column(INTEGER(10), server_default=text("'0'")) expiration_date = Column(INTEGER(10), server_default=text("'0'"), comment='保质期')
expiration_date_unit = Column(String(10, 'utf8mb4_unicode_ci'), server_default=text("''")) expiration_date_unit = Column(String(10, 'utf8mb4_unicode_ci'), server_default=text("'月'"), comment='保质期单位')
is_expiration_date = Column(TINYINT(1), server_default=text("'0'")) is_expiration_date = Column(TINYINT(1), server_default=text("'0'"), comment='是否有保质期')
weight_error = Column(INTEGER(10), server_default=text("'0'")) weight_error = Column(INTEGER(10), server_default=text("'0'"), comment='重量误差')
img = Column(String(200, 'utf8mb4_unicode_ci')) img = Column(String(200, 'utf8mb4_unicode_ci'))
tags = Column(String(255, 'utf8mb4_unicode_ci')) tags = Column(String(255, 'utf8mb4_unicode_ci'), comment='商品标签')
content = Column(Text(collation='utf8mb4_unicode_ci')) content = Column(Text(collation='utf8mb4_unicode_ci'), comment='商品内容')
summary = Column(Text(collation='utf8mb4_unicode_ci')) summary = Column(Text(collation='utf8mb4_unicode_ci'), comment='商品描述')
status = Column(TINYINT(1)) status = Column(TINYINT(1), nullable=False, server_default=text("'1'"), comment='状态: 1正常-1删除')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -292,63 +354,90 @@ class ProductionType(Base): ...@@ -292,63 +354,90 @@ class ProductionType(Base):
__tablename__ = 'production_type' __tablename__ = 'production_type'
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
name = Column(VARCHAR(191), nullable=False, index=True) production_type_name = Column(VARCHAR(191), nullable=False, index=True, comment='分类名')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
catecol = Column(String(45, 'utf8mb4_unicode_ci')) status = Column(TINYINT(1), nullable=False, server_default=text("'1'"), comment='状态: 1正常-1删除')
class Rent(Base): class Rent(Base):
__tablename__ = 'rent' __tablename__ = 'rent'
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
rent_no = Column(VARCHAR(40), nullable=False, index=True) rent_no = Column(VARCHAR(40), nullable=False, index=True, comment='租借单号')
machine_no = Column(String(40, 'utf8mb4_unicode_ci'), nullable=False, index=True) machine_no = Column(String(40, 'utf8mb4_unicode_ci'), nullable=False, index=True, comment='机柜id')
user_id = Column(INTEGER(10), nullable=False, index=True) user_id = Column(INTEGER(10), nullable=False, index=True, comment='用户id')
card_no = Column(String(40, 'utf8mb4_unicode_ci'), index=True) card_no = Column(String(40, 'utf8mb4_unicode_ci'), index=True)
place_id = Column(INTEGER(10), nullable=False, index=True) place_id = Column(INTEGER(10), nullable=False, index=True, comment='场所id')
total = Column(INTEGER(10), server_default=text("'0'")) total = Column(INTEGER(10), server_default=text("'0'"), comment='应收金额')
real_total = Column(INTEGER(10), server_default=text("'0'")) real_total = Column(INTEGER(10), server_default=text("'0'"), comment='实收金额')
agent_total = Column(INTEGER(10), server_default=text("'0'")) agent_total = Column(INTEGER(10), server_default=text("'0'"), comment='给代理商看的收入')
back_money = Column(INTEGER(10), nullable=False, server_default=text("'0'")) back_money = Column(INTEGER(10), nullable=False, server_default=text("'0'"), comment='退款金额')
is_pay = Column(TINYINT(3), nullable=False, server_default=text("'0'")) is_pay = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='是否支付')
rent_type = Column(TINYINT(3), nullable=False, server_default=text("'1'")) rent_type = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='租借类型1现场租借2预约3nfc租借')
mch_platform = Column(INTEGER(1), nullable=False, server_default=text("'1'")) mch_platform = Column(INTEGER(1), nullable=False, server_default=text("'1'"), comment='1待定')
add_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) add_time = Column(TIMESTAMP, nullable=False, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"), comment='下单时间')
pay_time = Column(TIMESTAMP) pay_time = Column(TIMESTAMP, comment='支付时间')
is_over = Column(TINYINT(3), nullable=False, server_default=text("'0'")) is_over = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='是否完结')
is_cancel = Column(TINYINT(3), nullable=False, server_default=text("'0'")) is_cancel = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='是否取消交易')
refund_no = Column(VARCHAR(191)) refund_no = Column(VARCHAR(191), comment='退款单号')
expire_handle = Column(TINYINT(3), nullable=False, server_default=text("'0'")) expire_handle = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='是否做过期处理')
prepay_id = Column(VARCHAR(191)) prepay_id = Column(VARCHAR(191), comment='微信支付prepay_id')
over_time = Column(TIMESTAMP) over_time = Column(TIMESTAMP, comment='订单完结时间')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
business_id = Column(INTEGER(11), nullable=False, server_default=text("'0'"))
class RentDetail(Base): class RentDetail(Base):
__tablename__ = 'rent_detail' __tablename__ = 'rent_detail'
id = Column(INTEGER(10), primary_key=True, unique=True) id = Column(INTEGER(10), primary_key=True, unique=True)
rent_no = Column(String(40, 'utf8mb4_unicode_ci'), nullable=False) rent_no = Column(String(40, 'utf8mb4_unicode_ci'), nullable=False, comment='订单编号')
user_id = Column(INTEGER(10), nullable=False) user_id = Column(INTEGER(10), nullable=False, comment='用户id')
machine_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False) machine_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False, comment='机柜id')
hatch_no = Column(TINYINT(3), nullable=False) hatch_no = Column(TINYINT(3), nullable=False, comment='机柜仓口号')
production_id = Column(INTEGER(10), nullable=False) total = Column(INTEGER(10), server_default=text("'0'"), comment='实收金额')
is_take = Column(TINYINT(3), nullable=False, server_default=text("'0'")) rent_count = Column(TINYINT(3), nullable=False, server_default=text("'0'"))
name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False) refund_total = Column(INTEGER(10), server_default=text("'0'"))
title = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False) refund_count = Column(INTEGER(10), server_default=text("'0'"))
brand_id = Column(INTEGER(10), nullable=False) is_take = Column(TINYINT(3), nullable=False, server_default=text("'0'"), comment='是否取货')
brand_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False) business_id = Column(INTEGER(11), nullable=False, server_default=text("'0'"))
cate_id = Column(INTEGER(10), nullable=False) status = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='1正常 2删除')
cate_name = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False) production_id = Column(INTEGER(10), nullable=False, comment='商品id')
price = Column(INTEGER(10), nullable=False) production_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称')
rent_count = Column(TINYINT(3), nullable=False) title = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False, comment='商品标题')
brand_id = Column(INTEGER(10), nullable=False, comment='品牌ID')
brand_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称')
production_type_id = Column(INTEGER(10), nullable=False, comment='分类ID')
production_type_name = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False, comment='商品标题')
price = Column(INTEGER(10), nullable=False, comment='价格')
original_price = Column(INTEGER(10), nullable=False, comment='商品原价')
img = Column(String(200, 'utf8mb4_unicode_ci')) img = Column(String(200, 'utf8mb4_unicode_ci'))
tags = Column(String(255, 'utf8mb4_unicode_ci')) tags = Column(String(255, 'utf8mb4_unicode_ci'), comment='商品标签')
content = Column(Text(collation='utf8mb4_unicode_ci')) content = Column(Text(collation='utf8mb4_unicode_ci'), comment='商品内容')
summary = Column(Text(collation='utf8mb4_unicode_ci')) summary = Column(Text(collation='utf8mb4_unicode_ci'), comment='商品描述')
status = Column(TINYINT(3), nullable=False, server_default=text("'1'")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
weight = Column(INTEGER(10), server_default=text("'0'"), comment='重量')
weight_unit = Column(String(10, 'utf8mb4_unicode_ci'), server_default=text("'g'"), comment='重量单位')
expiration_date = Column(INTEGER(10), server_default=text("'0'"), comment='保质期')
expiration_date_unit = Column(String(10, 'utf8mb4_unicode_ci'), server_default=text("'月'"), comment='保质期单位')
is_expiration_date = Column(TINYINT(1), server_default=text("'0'"), comment='是否有保质期')
weight_error = Column(INTEGER(10), server_default=text("'0'"), comment='重量误差')
class RentRefund(Base):
__tablename__ = 'rent_refund'
id = Column(INTEGER(11), primary_key=True)
user_id = Column(INTEGER(10), nullable=False)
refund_no = Column(VARCHAR(20), nullable=False)
rent_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False)
rent_detail_id = Column(INTEGER(11), nullable=False)
total = Column(INTEGER(11), nullable=False)
cause = Column(VARCHAR(191))
comment = Column(TEXT)
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -357,9 +446,9 @@ class SalePlan(Base): ...@@ -357,9 +446,9 @@ class SalePlan(Base):
__tablename__ = 'sale_plan' __tablename__ = 'sale_plan'
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False) name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='方案名称')
title = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False) title = Column(String(200, 'utf8mb4_unicode_ci'), nullable=False, comment='方案标题')
status = Column(TINYINT(1), nullable=False) status = Column(TINYINT(1), nullable=False, comment='状态: 1整除-1删除')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -370,7 +459,7 @@ class SalePlanMachine(Base): ...@@ -370,7 +459,7 @@ class SalePlanMachine(Base):
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
plan_id = Column(INTEGER(10), nullable=False) plan_id = Column(INTEGER(10), nullable=False)
machine_id = Column(INTEGER(10), nullable=False) machine_id = Column(INTEGER(10), nullable=False)
status = Column(TINYINT(1), nullable=False) status = Column(TINYINT(1), nullable=False, comment='状态: 1正常 -1删除')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -382,7 +471,7 @@ class SalePlanProduction(Base): ...@@ -382,7 +471,7 @@ class SalePlanProduction(Base):
plan_id = Column(INTEGER(10), nullable=False) plan_id = Column(INTEGER(10), nullable=False)
production_id = Column(INTEGER(10), nullable=False) production_id = Column(INTEGER(10), nullable=False)
index = Column(INTEGER(10), nullable=False) index = Column(INTEGER(10), nullable=False)
status = Column(TINYINT(1), nullable=False) status = Column(TINYINT(1), nullable=False, comment='状态: 1整除-1删除')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -391,14 +480,14 @@ class TallyRecord(Base): ...@@ -391,14 +480,14 @@ class TallyRecord(Base):
__tablename__ = 'tally_record' __tablename__ = 'tally_record'
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False) user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False, comment='补货员')
user_name = Column(String(255, 'utf8mb4_unicode_ci'), nullable=False) user_name = Column(String(255, 'utf8mb4_unicode_ci'), nullable=False, comment='补货员')
machine_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False) machine_no = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False, comment='机柜id')
hatch_no = Column(TINYINT(3), nullable=False) hatch_no = Column(TINYINT(3), nullable=False, comment='机柜仓口号')
production_id = Column(INTEGER(10), nullable=False) production_id = Column(INTEGER(10), nullable=False, comment='商品id')
production_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False) production_name = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, comment='商品名称')
tally_count = Column(TINYINT(3), nullable=False, server_default=text("'1'")) tally_count = Column(TINYINT(3), nullable=False, server_default=text("'1'"))
status = Column(TINYINT(3), nullable=False, server_default=text("'1'")) status = Column(TINYINT(3), nullable=False, server_default=text("'1'"), comment='1指令已下发(等待开仓) 2指令上报(补货完成)')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -410,8 +499,8 @@ class TallymanAccount(Base): ...@@ -410,8 +499,8 @@ class TallymanAccount(Base):
user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False, unique=True) user_no = Column(String(25, 'utf8mb4_unicode_ci'), nullable=False, unique=True)
user_name = Column(String(255, 'utf8mb4_unicode_ci'), nullable=False) user_name = Column(String(255, 'utf8mb4_unicode_ci'), nullable=False)
phone = Column(String(191, 'utf8mb4_unicode_ci'), nullable=False, unique=True) phone = Column(String(191, 'utf8mb4_unicode_ci'), nullable=False, unique=True)
level = Column(INTEGER(1), nullable=False) level = Column(INTEGER(1), nullable=False, comment='1:补货员')
status = Column(INTEGER(1), nullable=False) status = Column(INTEGER(1), nullable=False, comment='1:正常 2:删除')
_password_hash_ = Column(String(255, 'utf8mb4_unicode_ci')) _password_hash_ = Column(String(255, 'utf8mb4_unicode_ci'))
comment = Column(String(255, 'utf8mb4_unicode_ci')) comment = Column(String(255, 'utf8mb4_unicode_ci'))
last_login = Column(DateTime) last_login = Column(DateTime)
...@@ -425,10 +514,10 @@ class TallymanLoginRecord(Base): ...@@ -425,10 +514,10 @@ class TallymanLoginRecord(Base):
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
phone = Column(VARCHAR(255), nullable=False) phone = Column(VARCHAR(255), nullable=False)
platform = Column(TINYINT(4), nullable=False, server_default=text("'2'")) platform = Column(TINYINT(4), nullable=False, server_default=text("'2'"), comment='平台 2小导游 8商户PC')
ip = Column(VARCHAR(255), nullable=False) ip = Column(VARCHAR(255), nullable=False)
last_login = Column(DateTime, nullable=False) last_login = Column(DateTime, nullable=False)
login_type = Column(INTEGER(1), nullable=False) login_type = Column(INTEGER(1), nullable=False, comment='1:验证码登录 2:token 3:发送验证码 4:密码')
created_at = Column(DateTime, nullable=False) created_at = Column(DateTime, nullable=False)
updated_at = Column(DateTime, nullable=False) updated_at = Column(DateTime, nullable=False)
...@@ -457,20 +546,21 @@ class TallymanPlace(Base): ...@@ -457,20 +546,21 @@ class TallymanPlace(Base):
class WxUser(Base): class WxUser(Base):
__tablename__ = 'wx_user' __tablename__ = 'wx_user'
__table_args__ = {'comment': '微信用户表'}
id = Column(INTEGER(10), primary_key=True) id = Column(INTEGER(10), primary_key=True)
openid = Column(String(40, 'utf8mb4_unicode_ci'), index=True) openid = Column(String(40, 'utf8mb4_unicode_ci'), index=True, comment='微信支付宝公众平台openID')
unionid = Column(String(40, 'utf8mb4_unicode_ci')) unionid = Column(String(40, 'utf8mb4_unicode_ci'), comment='微信支付宝unionid')
platform = Column(TINYINT(4), nullable=False, server_default=text("'0'")) platform = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='平台')
phone = Column(String(40, 'utf8mb4_unicode_ci'), index=True) phone = Column(String(40, 'utf8mb4_unicode_ci'), index=True, comment='手机号')
language = Column(String(40, 'utf8mb4_unicode_ci')) language = Column(String(40, 'utf8mb4_unicode_ci'), comment='语种')
nick_name = Column(String(40, 'utf8mb4_unicode_ci')) nick_name = Column(String(40, 'utf8mb4_unicode_ci'), comment='昵称')
gender = Column(TINYINT(4), nullable=False, server_default=text("'0'")) gender = Column(TINYINT(4), nullable=False, server_default=text("'0'"), comment='性别 0:未知、1:男、2:女')
avatar_url = Column(String(191, 'utf8mb4_unicode_ci')) avatar_url = Column(String(191, 'utf8mb4_unicode_ci'), comment='头像')
city = Column(String(45, 'utf8mb4_unicode_ci')) city = Column(String(45, 'utf8mb4_unicode_ci'))
province = Column(String(45, 'utf8mb4_unicode_ci')) province = Column(String(45, 'utf8mb4_unicode_ci'))
country = Column(String(45, 'utf8mb4_unicode_ci')) country = Column(String(45, 'utf8mb4_unicode_ci'))
status = Column(TINYINT(4), nullable=False) status = Column(TINYINT(4), nullable=False, comment='状态0停用1正常')
last_login_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) last_login_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"), comment='上次登录时间')
created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP")) created_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP"))
updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")) updated_at = Column(TIMESTAMP, server_default=text("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"))
...@@ -83,7 +83,6 @@ def create_rent(): ...@@ -83,7 +83,6 @@ def create_rent():
Hatch.left_count >= 1).order_by(func.random()).first() Hatch.left_count >= 1).order_by(func.random()).first()
if not open_hatch: if not open_hatch:
print("....")
return jsonify(HATCH_NOT_EXIST_ERROR) return jsonify(HATCH_NOT_EXIST_ERROR)
break break
...@@ -94,6 +93,7 @@ def create_rent(): ...@@ -94,6 +93,7 @@ def create_rent():
rent.user_id = g.user.id rent.user_id = g.user.id
rent.place_id = machine.place_id rent.place_id = machine.place_id
rent.total = total_fee rent.total = total_fee
rent.real_total = total_fee
rent.add_time = datetime.datetime.now() rent.add_time = datetime.datetime.now()
rent.is_pay = 1 rent.is_pay = 1
rent.pay_time = datetime.datetime.now() rent.pay_time = datetime.datetime.now()
...@@ -106,13 +106,14 @@ def create_rent(): ...@@ -106,13 +106,14 @@ def create_rent():
rent_detail.machine_no = rent.machine_no rent_detail.machine_no = rent.machine_no
rent_detail.hatch_no = open_hatch.hatch_no rent_detail.hatch_no = open_hatch.hatch_no
rent_detail.production_id = open_hatch.production_id rent_detail.production_id = open_hatch.production_id
rent_detail.name = open_hatch.production_name rent_detail.production_name = open_hatch.production_name
rent_detail.title = open_hatch.title rent_detail.title = open_hatch.title
rent_detail.brand_id = open_hatch.brand_id rent_detail.brand_id = open_hatch.brand_id
rent_detail.brand_name = open_hatch.brand_name rent_detail.brand_name = open_hatch.brand_name
rent_detail.production_type_id = open_hatch.production_type_id rent_detail.production_type_id = open_hatch.production_type_id
rent_detail.production_type_name = open_hatch.production_type_name rent_detail.production_type_name = open_hatch.production_type_name
rent_detail.price = 0 rent_detail.price = 0
rent_detail.total = 0
rent_detail.rent_count = 1 rent_detail.rent_count = 1
rent_detail.img = open_hatch.img rent_detail.img = open_hatch.img
rent_detail.tags = open_hatch.tags rent_detail.tags = open_hatch.tags
...@@ -212,7 +213,6 @@ def wx_pay_callback(): ...@@ -212,7 +213,6 @@ def wx_pay_callback():
logger.info(xml_data) logger.info(xml_data)
logger.info(callback_data) logger.info(callback_data)
attach = re.sub('\'', '\"', callback_data["attach"]) attach = re.sub('\'', '\"', callback_data["attach"])
print(attach)
rent_data = json.loads(attach) rent_data = json.loads(attach)
platform = rent_data["platform"] platform = rent_data["platform"]
machine_no = rent_data["machine_no"] machine_no = rent_data["machine_no"]
...@@ -262,13 +262,14 @@ def wx_pay_callback(): ...@@ -262,13 +262,14 @@ def wx_pay_callback():
rent_detail.machine_no = rent.machine_no rent_detail.machine_no = rent.machine_no
rent_detail.hatch_no = i.hatch_no rent_detail.hatch_no = i.hatch_no
rent_detail.production_id = i.production_id rent_detail.production_id = i.production_id
rent_detail.name = i.production_name rent_detail.production_name = i.production_name
rent_detail.title = i.title rent_detail.title = i.title
rent_detail.brand_id = i.brand_id rent_detail.brand_id = i.brand_id
rent_detail.brand_name = i.brand_name rent_detail.brand_name = i.brand_name
rent_detail.production_type_id = i.production_type_id rent_detail.production_type_id = i.production_type_id
rent_detail.production_type_name = i.production_type_name rent_detail.production_type_name = i.production_type_name
rent_detail.price = i.price * open_hatchs[str(i.hatch_no)] rent_detail.price = i.price
rent_detail.total = i.price * open_hatchs[str(i.hatch_no)]
rent_detail.rent_count = open_hatchs[str(i.hatch_no)] rent_detail.rent_count = open_hatchs[str(i.hatch_no)]
rent_detail.img = i.img rent_detail.img = i.img
rent_detail.tags = i.tags rent_detail.tags = i.tags
......
...@@ -18,6 +18,7 @@ from myapps.pc_management.api.file_protal import file_route ...@@ -18,6 +18,7 @@ from myapps.pc_management.api.file_protal import file_route
from myapps.pc_management.api.production_portal import production_route from myapps.pc_management.api.production_portal import production_route
from myapps.pc_management.api.hatch_portal import hatch_route from myapps.pc_management.api.hatch_portal import hatch_route
from myapps.pc_management.api.business_portal import business_route from myapps.pc_management.api.business_portal import business_route
from myapps.pc_management.api.rent_portal import rent_route
def register_sukang_blueprint(app: Flask): def register_sukang_blueprint(app: Flask):
...@@ -29,3 +30,4 @@ def register_sukang_blueprint(app: Flask): ...@@ -29,3 +30,4 @@ def register_sukang_blueprint(app: Flask):
app.register_blueprint(production_route, url_prefix=prefix + "/production") app.register_blueprint(production_route, url_prefix=prefix + "/production")
app.register_blueprint(hatch_route, url_prefix=prefix + "/hatch") app.register_blueprint(hatch_route, url_prefix=prefix + "/hatch")
app.register_blueprint(business_route, url_prefix=prefix + "/business") app.register_blueprint(business_route, url_prefix=prefix + "/business")
app.register_blueprint(rent_route, url_prefix=prefix + "/rent")
...@@ -183,6 +183,13 @@ def get_account_detail(): ...@@ -183,6 +183,13 @@ def get_account_detail():
"comment": admin_info.comment "comment": admin_info.comment
} }
business_list = db.session.query(Business).join(AdminBusiness, Business.id == AdminBusiness.business_id,
).filter(Business.status == 1,
AdminBusiness.user_id == admin_info.id,
AdminBusiness.status == 1).all()
user_info["business_list"] = []
for i in business_list:
user_info["business_list"].append({"business_id": i.id, "business_name": i.business_name})
return BaseResponse(data=user_info) return BaseResponse(data=user_info)
...@@ -207,21 +214,25 @@ def edit_user(): ...@@ -207,21 +214,25 @@ def edit_user():
if old_phone == g.user.phone: if old_phone == g.user.phone:
admin_info = g.user admin_info = g.user
if level:
admin_info.level = int(level)
else: else:
admin_info = AdminAccount.query.filter(AdminAccount.phone == old_phone, result = AdminService.get_admin_account_list(phone=old_phone)
AdminAccount.level > g.user.level, if result["total_count"] != 1:
AdminAccount.parent_id == g.user.id return BaseResponse(**ACCOUNT_NOT_EXISTS_ERROR)
).first() admin = json2obj(result["list"][0])
admin_info = AdminAccount.query.filter_by(id=admin.id).first()
if not admin_info: if not admin_info:
return BaseResponse(**ACCOUNT_NOT_EXISTS_ERROR) return BaseResponse(**ACCOUNT_NOT_EXISTS_ERROR)
if level and level > g.user.level:
admin_info.user_name = user_name admin_info.level = level
admin_info.phone = new_phone if status:
admin_info.status = status admin_info.status = status
if comment:
admin_info.comment = comment admin_info.comment = comment
if user_name:
admin_info.user_name = user_name
if new_phone:
admin_info.phone = new_phone
if password: if password:
admin_info.password = password admin_info.password = password
...@@ -230,7 +241,7 @@ def edit_user(): ...@@ -230,7 +241,7 @@ def edit_user():
business_ids = json_data.get("business_ids", []) business_ids = json_data.get("business_ids", [])
if business_ids: if business_ids:
AdminService.add_or_edit_admin_business(account, business_ids) AdminService.add_or_edit_admin_business(admin_info, business_ids)
return BaseResponse() return BaseResponse()
...@@ -241,8 +252,11 @@ def delete_user(): ...@@ -241,8 +252,11 @@ def delete_user():
if not phone: if not phone:
return BaseResponse(**PHONE_NOT_NULL_ERROR) return BaseResponse(**PHONE_NOT_NULL_ERROR)
admin_info = AdminAccount.query.filter(AdminAccount.phone == phone, result = AdminService.get_admin_account_list(phone=phone)
AdminAccount.level > g.user.level).first() if result["total_count"] != 1:
return BaseResponse(**ACCOUNT_NOT_EXISTS_ERROR)
admin = json2obj(result["list"][0])
admin_info = AdminAccount.query.filter_by(id=admin.id).first()
if not admin_info: if not admin_info:
return BaseResponse(**ACCOUNT_NOT_EXISTS_ERROR) return BaseResponse(**ACCOUNT_NOT_EXISTS_ERROR)
......
...@@ -36,10 +36,15 @@ def run_business_list(): ...@@ -36,10 +36,15 @@ def run_business_list():
admin = g.user admin = g.user
select_sql = "select business.business_name,business.status, business.id " select_sql = "select business.business_name,business.status, business.id "
count_sql = "select count(business.id) as total_count" count_sql = "select count(business.id) as total_count"
from_sql = """ from business where business.id in (select business_id from admin_business where from_sql = """ from business """
admin_business.user_id = {} and admin_business.status = 1) """.format(admin.id)
where_sql = " " if g.user.level == 1:
where_sql = " where 0=0 "
else:
where_sql = """ where business.id in (
select business_id from admin_business where
admin_business.user_id = {} and admin_business.status = 1
)""".format(admin.id)
if keyword: if keyword:
where_sql += """ and CONCAT(business.business_name) LIKE '%{keyword}%' """.format(keyword=keyword) where_sql += """ and CONCAT(business.business_name) LIKE '%{keyword}%' """.format(keyword=keyword)
...@@ -57,7 +62,7 @@ def run_business_list(): ...@@ -57,7 +62,7 @@ def run_business_list():
return_data = [] return_data = []
for info in result: for info in result:
return_data.append({"business_name": info.place_name, "business_id": info.id, "status": info.status}) return_data.append({"business_name": info.business_name, "business_id": info.id, "status": info.status})
return BaseResponse({"list": return_data, "page": page, "pageSize": page_size, "total_count": total_count}) return BaseResponse({"list": return_data, "page": page, "pageSize": page_size, "total_count": total_count})
...@@ -118,6 +123,6 @@ def get_business_detail(): ...@@ -118,6 +123,6 @@ def get_business_detail():
business_model = Business.query.filter_by(id=business_id).first() business_model = Business.query.filter_by(id=business_id).first()
if business_model: if business_model:
return BaseResponse(data={"business_name": business_model.business_name, return BaseResponse(data={"business_name": business_model.business_name,
"status": business_model.status, }) "status": business_model.status, "business_id": business_id})
else: else:
return jsonify(NO_BUSINESS_ERROR) return jsonify(NO_BUSINESS_ERROR)
...@@ -33,7 +33,6 @@ def run_upload_img(): ...@@ -33,7 +33,6 @@ def run_upload_img():
if filetype and filetype in ALLOWED_EXTENSIONS: # 后缀格式必须是bmp结尾 if filetype and filetype in ALLOWED_EXTENSIONS: # 后缀格式必须是bmp结尾
uid = uuid.uuid4() # 生成随机名称 uid = uuid.uuid4() # 生成随机名称
save_file_name = str(uid) + "." + filetype # 拼接名称 save_file_name = str(uid) + "." + filetype # 拼接名称
print(os.path.join(img_file_path, filename))
file.save(os.path.join(img_file_path, save_file_name)) # 保存文件 file.save(os.path.join(img_file_path, save_file_name)) # 保存文件
return BaseResponse(data={"filename": save_file_name}) return BaseResponse(data={"filename": save_file_name})
......
...@@ -66,7 +66,6 @@ def run_hatch_list(): ...@@ -66,7 +66,6 @@ def run_hatch_list():
return BaseResponse(data={"list": [], "page": page, "pageSize": page_size, "total_count": 0}) return BaseResponse(data={"list": [], "page": page, "pageSize": page_size, "total_count": 0})
else: else:
total_count = count_result.total_count total_count = count_result.total_count
print(select_sql + from_sql + where_sql + order_sql + limit_sql)
result = db.session.execute(select_sql + from_sql + where_sql + order_sql + limit_sql).fetchall() result = db.session.execute(select_sql + from_sql + where_sql + order_sql + limit_sql).fetchall()
return_data = [] return_data = []
......
...@@ -14,9 +14,11 @@ from flask import Blueprint, g, request, jsonify ...@@ -14,9 +14,11 @@ from flask import Blueprint, g, request, jsonify
from config.commen_config import DISCOUNTS_TYPES from config.commen_config import DISCOUNTS_TYPES
from models.base_model import db from models.base_model import db
from models.models import AdminMachine, Machine, AdminAccount from models.models import AdminMachine, Machine, AdminAccount, AdminBusiness
from utils.error_code import MACHINE_NOT_EXIST_ERROR, ACCOUNT_NOT_EXISTS_ERROR from service.admin_service import AdminService
from utils.error_code import MACHINE_NOT_EXIST_ERROR, ACCOUNT_NOT_EXISTS_ERROR, ADMIN_BUSINESS_NOT_EXIST
from utils.my_response import BaseResponse from utils.my_response import BaseResponse
from utils.mytools import json2obj
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -30,17 +32,19 @@ def run_machine_list(): ...@@ -30,17 +32,19 @@ def run_machine_list():
:return: :return:
""" """
json_data = request.get_json() json_data = request.get_json()
page = json_data.get("page", None) page = json_data.get("page", 1)
page_size = json_data.get("pageSize", None) page_size = json_data.get("pageSize", 10)
keyword = json_data.get("keyword", None) keyword = json_data.get("keyword", None)
admin = g.user admin = g.user
select_sql = """select machine.id, machine.machine_no, machine.device_id, machine.qrcode_no,machine.status, select_sql = """select machine.id, machine.machine_no, machine.device_id, machine.qrcode_no,machine.status,
machine.mac, machine.power, machine.hatch_number, machine.type,machine.place_id, machine.mac, machine.power, machine.hatch_number, machine.type,machine.place_id,
place.place_name, machine.discounts_id place.place_name, machine.discounts_id, machine.business_id,business.business_name
""" """
count_sql = "select count(machine.id) as total_count" count_sql = "select count(machine.id) as total_count"
from_sql = """ from machine left join place on machine.place_id = place.id from_sql = """ from machine
left join place on machine.place_id = place.id
left join business on machine.business_id = business.id
where machine.machine_no in ( select machine_no from admin_machine where where machine.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1) admin_machine.user_id = {user_id} and admin_machine.status = 1)
""".format(user_id=admin.id) """.format(user_id=admin.id)
...@@ -60,7 +64,6 @@ def run_machine_list(): ...@@ -60,7 +64,6 @@ def run_machine_list():
return BaseResponse(data={"list": [], "page": page, "pageSize": page_size, "total_count": 0}) return BaseResponse(data={"list": [], "page": page, "pageSize": page_size, "total_count": 0})
else: else:
total_count = count_result.total_count total_count = count_result.total_count
print(select_sql + from_sql + where_sql + order_sql + limit_sql)
result = db.session.execute(select_sql + from_sql + where_sql + order_sql + limit_sql).fetchall() result = db.session.execute(select_sql + from_sql + where_sql + order_sql + limit_sql).fetchall()
return_data = [] return_data = []
...@@ -71,6 +74,7 @@ def run_machine_list(): ...@@ -71,6 +74,7 @@ def run_machine_list():
"status": info.status, "place_id": info.place_id, "status": info.status, "place_id": info.place_id,
"discounts_id": info.discounts_id, "discounts_id": info.discounts_id,
"discounts_name": DISCOUNTS_TYPES.get(int(info.discounts_id), "无此优惠"), "discounts_name": DISCOUNTS_TYPES.get(int(info.discounts_id), "无此优惠"),
"business_id": info.business_id, "business_name": info.business_name
}) })
return BaseResponse({"list": return_data, "page": page, "pageSize": page_size, "total_count": total_count}) return BaseResponse({"list": return_data, "page": page, "pageSize": page_size, "total_count": total_count})
...@@ -145,7 +149,8 @@ def run_edit_machine(): ...@@ -145,7 +149,8 @@ def run_edit_machine():
machine_model.device_id = device_id machine_model.device_id = device_id
if qrcode_no: if qrcode_no:
machine_model.qrcode_no = qrcode_no machine_model.qrcode_no = qrcode_no
if mac: machine_model.mac = mac if mac:
machine_model.mac = mac
if power: if power:
machine_model.power = power machine_model.power = power
if place_id: if place_id:
...@@ -178,9 +183,11 @@ def get_machine_detail(): ...@@ -178,9 +183,11 @@ def get_machine_detail():
admin = g.user admin = g.user
select_sql = """select machine.id, machine.machine_no, machine.device_id, machine.qrcode_no,machine.status, select_sql = """select machine.id, machine.machine_no, machine.device_id, machine.qrcode_no,machine.status,
machine.mac, machine.power, machine.hatch_number, machine.type,machine.place_id, machine.mac, machine.power, machine.hatch_number, machine.type,machine.place_id,
place.place_name, machine.discounts_id place.place_name, machine.discounts_id,machine.business_id,business.business_name
""" """
from_sql = """ from machine left join place on machine.place_id = place.id from_sql = """ from machine
left join place on machine.place_id = place.id
left join business on machine.business_id = business.id
where machine.machine_no in ( select machine_no from admin_machine where where machine.machine_no in ( select machine_no from admin_machine where
admin_machine.user_id = {user_id} and admin_machine.status = 1) admin_machine.user_id = {user_id} and admin_machine.status = 1)
""".format(user_id=admin.id) """.format(user_id=admin.id)
...@@ -197,7 +204,7 @@ def get_machine_detail(): ...@@ -197,7 +204,7 @@ def get_machine_detail():
"type": info.type, "status": info.status, "place_id": info.place_id, "type": info.type, "status": info.status, "place_id": info.place_id,
"discounts_id": info.discounts_id, "discounts_id": info.discounts_id,
"discounts_name": DISCOUNTS_TYPES.get(int(info.discounts_id), "无此优惠"), "discounts_name": DISCOUNTS_TYPES.get(int(info.discounts_id), "无此优惠"),
"business_id": info.business_id, "business_name": info.business_name
}) })
...@@ -210,26 +217,34 @@ def run_distribute_machine(): ...@@ -210,26 +217,34 @@ def run_distribute_machine():
json_data = request.get_json() json_data = request.get_json()
machine_nos = json_data["machine_nos"] machine_nos = json_data["machine_nos"]
user_id = json_data["user_id"] user_id = json_data["user_id"]
business_id = json_data["business_id"]
user = AdminAccount.query.filter_by(id=user_id, parent_id=g.user.id, status=1).first() result = AdminService.get_admin_account_list(user_id=user_id)
if not user: if result["total_count"] != 1:
return jsonify(ACCOUNT_NOT_EXISTS_ERROR) return jsonify(ACCOUNT_NOT_EXISTS_ERROR)
admin_info = json2obj(result["list"][0])
admin_machines = AdminMachine.query.filter_by(user_id=g.user.id, status=1).all() admin_business = AdminBusiness.query.filter_by(user_id=g.user.id, business_id=business_id, status=1).first()
if not admin_machines: if not admin_business:
return jsonify(MACHINE_NOT_EXIST_ERROR) return jsonify(ADMIN_BUSINESS_NOT_EXIST)
admin_machine_nos = [x.machine_no for x in admin_machines]
right_machine_nos = list(set(machine_nos).intersection(set(admin_machine_nos))) return_machine_no = []
if not right_machine_nos: for i in machine_nos:
return jsonify(MACHINE_NOT_EXIST_ERROR) admin_machines = AdminMachine.query.filter_by(user_id=g.user.id, machine_no=i, status=1).first()
if not admin_machines:
continue
machine = Machine.query.filter_by(machine_no=i).first()
if not machine:
continue
insert_sql = " insert into admin_machine (user_id, user_no, machine_no) values " insert_sql = " insert into admin_machine (user_id, user_no, machine_no) values "
for i in right_machine_nos:
insert_sql += "('{}','{}','{}'),".format(user.id, user.user_no, i) insert_sql += "('{}','{}','{}'),".format(admin_info.id, admin_info.user_no, i)
insert_sql = insert_sql[:-1] insert_sql = insert_sql[:-1]
insert_sql += " ON DUPLICATE KEY UPDATE status = 1" insert_sql += " ON DUPLICATE KEY UPDATE status = 1"
print(insert_sql)
db.session.execute(insert_sql) db.session.execute(insert_sql)
if admin_info.level == 4:
machine.business_id = business_id
db.session.commit() db.session.commit()
return BaseResponse(data={"add_machine_nos": right_machine_nos}) return_machine_no.append(i)
return BaseResponse(data={"add_machine_nos": return_machine_no})
#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
@version:
author:Aeolus
@time: 2022/01/12
@file: place_portal.py
@function:
@modify:
"""
import logging
from flask import Blueprint, g, request, jsonify
from sqlalchemy.exc import SQLAlchemyError
from config.wechat_config import platform_appid_config_list, pay_config_list
from models.base_model import db
from models.models import Rent, RentDetail, WxUser, Machine, RentRefund
from service.rent_service import RentService
from service.wechat_service import WeChatPayService
from utils.error_code import OPERATE_LEVEL_ERROR, ACTION_CODE_ERROR, REFUND_NOT_PRODUCTION_INFO, Param_Invalid_Error, \
REFUND_MONEY_IS_ZERO, REFUND_MONEY_ERROR
from utils.my_response import BaseResponse
logger = logging.getLogger(__name__)
rent_route = Blueprint('rent', __name__)
@rent_route.route("rent_list", methods=["POST"])
def run_rent_list():
"""
:return:
"""
json_data = request.get_json()
page = json_data.get("page", 1)
page_size = json_data.get("pageSize", 10)
keyword = json_data.get("keyword", None)
start_date = json_data.get("startDate", None)
end_date = json_data.get("endDate", None)
business_id = json_data.get("business_id", None)
is_pay = json_data.get("is_pay", None)
if g.user.level not in (1, 2, 4):
return jsonify(OPERATE_LEVEL_ERROR)
select_sql = """
SELECT rent.rent_no, rent.machine_no, rent.user_id,rent.place_id,rent.is_pay,
rent_detail.hatch_no, rent_detail.production_id,rent_detail.production_name,
rent_detail.status,rent_detail.brand_name,
rent_detail.production_type_name,rent_detail.total,rent_detail.rent_count,
rent_detail.refund_total,rent_detail.refund_count, wx_user.phone,place.place_name,
rent_detail.id as rent_detail_id, rent.business_id, rent.created_at,rent.pay_time
"""
count_sql = " select count(rent.id) as total_count "
from_sql = """
FROM
rent
LEFT JOIN
rent_detail ON rent.rent_no = rent_detail.rent_no
LEFT JOIN
place ON rent.place_id = place.id
LEFT JOIN
wx_user ON rent.user_id = wx_user.id
"""
where_sql = " WHERE 0=0 "
if keyword:
where_sql += """
and CONCAT(rent.rent_no,
wx_user.phone) LIKE '%{keyword}%'
""".format(keyword=keyword)
if start_date:
where_sql += " and rent.created_at > '{}'".format(start_date)
if end_date:
where_sql += " and rent.created_at <= '{}'".format(end_date)
if is_pay:
where_sql += " and rent.is_pay = '{}'".format(is_pay)
if business_id:
where_sql += " and rent.business_id = '{}'".format(business_id)
if g.user.level != 1:
where_sql += """ and rent.business_id in (
select business_id from admin_business where user_id = '{}' and status = 1)
""".format(g.user.id)
order_sql = " ORDER BY rent.created_at DESC, rent_detail.created_at desc"
limit_sql = " LIMIT {offset} , {page_size}".format(offset=(page - 1) * page_size, page_size=page_size)
count_result = db.session.execute(count_sql + from_sql + where_sql).fetchone()
if not count_result:
return BaseResponse(data={"list": [], "page": page, "pageSize": page_size, "total_count": 0})
else:
total_count = count_result.total_count
result = db.session.execute(select_sql + from_sql + where_sql + order_sql + limit_sql).fetchall()
return_data = []
if result:
for info in result:
tmp = {
"rent_no": info.rent_no, "machine_no": info.machine_no, "user_id": info.user_id,
"phone": info.phone, "rent_detail_id": info.rent_detail_id, "place_name": info.place_name,
"place_id": info.place_id, "is_pay": info.is_pay, "total": info.total, "rent_count": info.rent_count,
"refund_total": info.refund_total, "refund_count": info.refund_count, "business_id": info.business_id,
"production_name": info.production_name, "production_id": info.production_id,
"status": info.status, "create_time": info.created_at.strftime("%Y-%m-%d %H:%M:%S"),
"pay_time": info.pay_time.strftime("%Y-%m-%d %H:%M:%S"),
}
return_data.append(tmp)
return BaseResponse({"list": return_data, "page": page, "pageSize": page_size, "total_count": total_count})
@rent_route.route("rent_detail", methods=["POST"])
def get_rent_detail():
"""
:return:
"""
json_data = request.get_json()
rent_no = json_data.get("rent_no", None)
rent_detail_id = json_data.get("rent_detail_id", None)
if g.user.level not in (1, 2, 4):
return jsonify(OPERATE_LEVEL_ERROR)
select_sql = """
SELECT rent.id, rent.rent_no, rent.machine_no, rent.user_id,rent.place_id,rent.is_pay,
rent_detail.hatch_no, rent_detail.production_name,rent_detail.title, rent_detail.brand_id,
rent_detail.production_type_id, rent_detail.price,rent_detail.original_price,
rent_detail.weight, rent_detail.weight_unit, rent_detail.expiration_date,
rent_detail.expiration_date_unit, rent_detail.is_expiration_date,rent_detail.business_id,
rent_detail.weight_error, rent_detail.img, rent_detail.tags, rent_detail.content,
rent_detail.summary, rent_detail.status,rent_detail.brand_name,
rent_detail.production_type_name,rent_detail.total,rent_detail.rent_count,
rent_detail.refund_total,rent_detail.refund_count, wx_user.phone,place.place_name,
rent_detail.production_id,rent.business_id, rent.created_at,rent.pay_time,
rent_detail.id as rent_detail_id,
"""
from_sql = """
FROM
rent
LEFT JOIN
rent_detail ON rent.rent_no = rent_detail.rent_no
LEFT JOIN
place ON rent.place_id = place.id
LEFT JOIN
wx_user ON rent.user_id = wx_user.id
"""
where_sql = " where rent.rent_no = '{}'".format(rent_no)
if rent_detail_id:
where_sql += " and rent_detail.id = '{}'".format(rent_detail_id)
if g.user.level != 1:
where_sql += """ and rent.business_id in (
select business_id from admin_business where user_id = '{}' and status = 1)
""".format(g.user.id)
result = db.session.execute(select_sql + from_sql + where_sql).fetchone()
if result:
return_data = {
"rent_detail_id": result.rent_detail_id, "rent_no": result.rent_no, "machine_no": result.machine_no,
"user_id": result.user_id,
"phone": result.phone, "place_name": result.place_name,
"place_id": result.id, "is_pay": result.is_pay, "total": result.total, "rent_count": result.rent_count,
"refund_total": result.refund_total, "refund_count": result.refund_count, "business_id": result.business_id,
"production_name": result.production_name, "production_id": result.production_id,
"title": result.title, "brand_id": result.brand_id, "brand_name": result.brand_name,
"production_type_id": result.production_type_id, "production_type_name": result.production_type_name,
"price": result.price, "original_price": result.original_price, "weight": result.weight,
"weight_unit": result.weight_unit,
"expiration_date": result.expiration_date, "expiration_date_unit": result.expiration_date_unit,
"is_expiration_date": result.is_expiration_date,
"weight_error": result.weight_error,
"img": result.img, "tags": result.tags, "content": result.content,
"summary": result.summary, "status": result.status,
"create_time": result.created_at.strftime("%Y-%m-%d %H:%M:%S"),
"pay_time": result.pay_time.strftime("%Y-%m-%d %H:%M:%S"),
}
return BaseResponse({"data": return_data})
else:
return BaseResponse()
@rent_route.route('/rent_money_refund', methods=['GET', 'POST'])
def rent_money_refund_new():
if g.user.level not in (1, 2, 4):
return jsonify(OPERATE_LEVEL_ERROR)
json_data = request.get_json()
action_pwd = json_data['action_pwd'] if 'action_pwd' in json_data else ''
rent_no = json_data['rent_no']
rent_detail_id = json_data['rent_detail_id']
if action_pwd != "xxzn666":
return BaseResponse(**ACTION_CODE_ERROR)
cause = json_data['cause']
comment = json_data['comment'] if 'comment' in json_data else ''
rent_info = db.session.query(RentDetail, Rent, WxUser, Machine
).join(Rent,
Rent.rent_no == RentDetail.rent_no
).join(WxUser, WxUser.id == Rent.user_id
).filter(RentDetail.id == rent_detail_id,
Rent.rent_no == rent_no).first()
if not rent_info:
return jsonify(REFUND_NOT_PRODUCTION_INFO)
rent = rent_info.Rent
rent_detail = rent_info.RentDetail
wx_user = rent_info.WxUser
refund_count = int(json_data["refund_count"])
refund_money = refund_count * rent_detail.price
if refund_money <= 0:
return jsonify(REFUND_MONEY_IS_ZERO)
if refund_money > rent_detail.total: # 不能超出金额退款
return jsonify(REFUND_MONEY_ERROR)
new_total = rent_detail.total - refund_money
# 重新计算订单对应所有讲解器总收入,退款金额
rent_total = 0
rent_details = RentDetail.query.filter_by(rent_no=rent.rent_no).all()
for tmp in rent_details:
if tmp.id == rent_detail.id:
rent_total += new_total
else:
rent_total += tmp.total
# 退款操作
data = {
"out_refund_no": RentService.create_refund_no(),
"out_trade_no": rent_info.Rent.rent_no,
"total_fee": rent.total,
"refund_fee": refund_money
}
result = WeChatPayService(app_id=platform_appid_config_list[wx_user.platform],
config_name=pay_config_list[rent.mch_platform]).do_refund(data)
if result:
try:
rent_refund = RentRefund()
rent_refund.user_id = g.user.id
rent_refund.refund_no = data["out_refund_no"]
rent_refund.rent_no = rent.rent_no
rent_refund.rent_detail_id = rent_detail.id
rent_refund.total = refund_money
rent_refund.comment = comment
rent_refund.cause = cause
rent.real_total = rent_total
rent.back_money += refund_money
rent_detail.total = new_total
rent_detail.refund_count += refund_count
rent_detail.refund_total += refund_money
db.session.add(rent_refund)
db.session.add(rent)
db.session.add(rent_detail)
db.session.commit()
except SQLAlchemyError as e:
db.session.rollback()
raise e
return BaseResponse()
else:
return BaseResponse(error_code=-1, error_message='refund failed')
...@@ -62,7 +62,7 @@ class AdminService(object): ...@@ -62,7 +62,7 @@ class AdminService(object):
db.session.commit() db.session.commit()
@staticmethod @staticmethod
def get_admin_account_list(phone=None, keyword=None, page=None, page_size=None): def get_admin_account_list(user_id=None, phone=None, keyword=None, page=None, page_size=None):
""" """
:return: :return:
...@@ -87,8 +87,10 @@ class AdminService(object): ...@@ -87,8 +87,10 @@ class AdminService(object):
and admin_account.level > {level} and admin_account.level > {level}
""".format(user_id=g.user.id, level=g.user.level) """.format(user_id=g.user.id, level=g.user.level)
if user_id:
where_sql += " and admin_account.id = '{id}'".format(id=user_id)
if phone: if phone:
where_sql += " and phone = {phone}".format(phone=phone) where_sql += " and phone = '{phone}'".format(phone=phone)
if keyword: if keyword:
where_sql += """ where_sql += """
......
#!usr/bin/env python # -*- coding:utf-8 _*- """ @version: author:Aeolus @file: error_code.py """ ### 通用错误相关 Param_Invalid_Error = { "error_code": "500", "error_message": "params is invalid, 参数无效" } TOKEN_NOT_VALID_ERROR = { "error_code": "1001", "error_message": "无效的token" } TOKEN_NOT_PROVIDED_ERROR = { "error_code": "1002", "error_message": "token未提供" } TOKEN_EXPIRE_ERROR = { "error_code": "1003", "error_message": "token超时" } PHONE_NOT_BINDING_ERROR = { "error_code": "1004", "error_message": "未绑定手机号" } PHONE_NOT_NULL_ERROR = { "error_code": "1005", "error_message": "手机号为空" } PHONE_NOT_VALID_ERROR = { "error_code": "1006", "error_message": "无效的手机号" } USER_ALREADY_REGISTER_ERROR = { "error_code": "1007", "error_message": "用户已注册" } VERIFICATION_CODE_NULL_ERROR = { "error_code": "1008", "error_message": "验证码为空" } VERIFICATION_CODE_INVALID_ERROR = { "error_code": "1009", "error_message": "验证码已失效" } VERIFICATION_CODE_ERROR = { "error_code": "1010", "error_message": "验证码错误" } PASSWORD_ERROR = { "error_code": "1011", "error_message": "账号或密码错误" } # 账号相关 12开头 ACCOUNT_ALREADY_EXISTS_ERROR = { "error_code": '1012', "error_message": "该账号已存在" } ACCOUNT_NOT_EXISTS_ERROR = { "error_code": '1013', "error_message": "账号不存在" } ACCOUNT_ALREADY_DELETE_ERROR = { "error_code": '1014', "error_message": "账号已被删除" } ACCOUNT_AGENT_SPOT_NULL_ERROR = { "error_code": '1015', "error_message": "代理商景点列表为空" } AGNET_MODULES_ERROR = { "error_code": '1016', "error_message": "用户未绑定模块" } OPERATE_TYPE_ERROR = { "error_code": '1017', "error_message": "type错误" } OPERATE_LEVEL_ERROR = { "error_code": '1018', "error_message": "权限错误" } OPERATE_ERROR = { "error_code": '1019', "error_message": "操作有误" } MODULES_NOT_EXISTS_ERROR = { "error_code": '1020', "error_message": "modules not exists,模块不存在" } ACCOUNT_AGENT_SPOT_NOT_EXIST = { "error_code": '1021', "error_message": "agent spot not exists,代理景区不存在" } AGENT_MACHINE_NOT_EXIST = { "error_code": '1022', "error_message": "agent machine not exists,代理机柜不存在" } NO_BUSINESS_ERROR = { "error_code": '1023', "error_message": "no business error,商户不存在" } ## 微信登陆相关 WX_LOGIN_DATA_ERROR = { "error_code": "3001", "error_message": "微信登录数据错误" } WX_LOGIN_CODE_ERROR = { "error_code": "3002", "error_message": "微信登录code值错误" } WX_OPENID_NOT_GET_ERROR = { "error_code": "3003", "error_message": "微信OpenId获取失败,请刷新重试" } WX_SESSION_KEY_ERROR = { "error_code": "3004", "error_message": "session key error" } ### 微信支付相关 WE_MINIAPP_PAY_FAIL = { "error_code": "3101", "error_message": "小程序下单失败" } ### 消息推送相关 WXBizMsgCrypt_OK = { "error_code": "0", "error_message": "WXBizMsgCrypt_OK" } WXBizMsgCrypt_ValidateSignature_Error = { "error_code": "4001", "error_message": "验证签名错误" } WXBizMsgCrypt_ParseXml_Error = { "error_code": "4002", "error_message": "解析xml错误" } WXBizMsgCrypt_ComputeSignature_Error = { "error_code": "4003", "error_message": "计算签名错误" } WXBizMsgCrypt_IllegalAesKey = { "error_code": "4004", "error_message": "Aes key非法错误" } WXBizMsgCrypt_ValidateAppid_Error = { "error_code": "4005", "error_message": "appid错误" } WXBizMsgCrypt_EncryptAES_Error = { "error_code": "4006", "error_message": "aes加密错误" } WXBizMsgCrypt_DecryptAES_Error = { "error_code": "4007", "error_message": "aes解密错误" } WXBizMsgCrypt_IllegalBuffer = { "error_code": "4008", "error_message": "illegal buffer" } WXBizMsgCrypt_EncodeBase64_Error = { "error_code": "4009", "error_message": "base64加密错误" } WXBizMsgCrypt_DecodeBase64_Error = { "error_code": "4010", "error_message": "base64解密错误" } WXBizMsgCrypt_GenReturnXml_Error = { "error_code": "4011", "error_message": "gen return xml error" } MACHINE_NOT_EXIST_ERROR = { "error_code": '5001', "error_message": "机柜不存在" } MACHINE_IS_USE_ERROR = { "error_code": '5002', "error_message": "已有他人正在租借中,请稍后" } MACHINE_IS_NOT_ONLINE_ERROR = { "error_code": '5003', "error_message": "机柜不在线" } MACHINE_ADD_ERROR = { "error_code": '5004', "error_message": "机柜添加失败" } MACHINE_NO_DUPLICATE_ERROR = { "error_code": '5005', "error_message": "machine_no duplicate,机柜编号重复" } MACHINE_EDIT_ERROR = { "error_code": '5006', "error_message": "machine edit error, 机柜修改错误" } HATCH_NOT_EXIST_ERROR = { "error_code": "5007", "error_message": "no hatch, 没有仓道商品信息" } HATCH_NOT_ALL_EXIST_ERROR = { "error_code": "5008", "error_message": "no all hatch, 存在已售出商品" } HATCH_COUNT_ERROR = { "error_code": "5009", "error_message": "hatch count error, 商品数量错误,检查数量" } MACHINE_ACTIVATED_ERROR = { "error_code": '5010', "error_message": "machine activated, 机柜已激活" } MACHINE_NO_CREATE_ERROR = { "error_code": '5011', "error_message": "machine_no create error , 机柜编号生成错误" } MACHINE_MAC_DUPLICATE_ERROR = { "error_code": '5012', "error_message": "machine_mac duplicate,机柜mac重复" } HATCH_COUNT_MAX_ERROR = { "error_code": '5013', "error_message": "hatch count max,仓道数量达到上限" } HATCH_NO_DUPLICATE_ERROR = { "error_code": '5014', "error_message": "hatch_no duplicate,仓道序号重复" } HATCH_NO_DUPLICATE_ERROR = { "error_code": '5014', "error_message": "hatch_no duplicate,仓道序号重复" } ### 订单相关 RENT_ORDER_NOT_BACK_ERROR = { "error_code": '6101', "error_message": "有未归还的订单" } RENT_ORDER_NOT_TAKE_ERROR = { "error_code": '6102', "error_message": "有未取货的订单" } RENT_ORDER_NUMBER_MAX = { "error_code": '6103', "error_message": "订单数量达到上限" } TAKE_CODE_NOT_VALID = { "error_code": '6104', "error_message": "取货码错误请确认手机号及取货码是否匹配" } CODE_CANCEL_ERROR = { "error_code": '6105', "error_message": "取货码已取消" } CODE_USED_ERROR = { "error_code": '6108', "error_message": "取货码已使用" } NO_POWER_ERROR = { "error_code": '6106', "error_message": "没有可租借设备" } NO_RENT_RECORD = { "error_code": '6107', "error_message": "订单不存在" } CODE_USED_ERROR = { "error_code": '6108', "error_message": "取货码已使用" } RENT_ORDER_NUMBER_LIMIT = { "error_code": '6109', "error_message": "机柜只允许租借一台" } REFUND_NOT_RENT_INFO = { "error_code": "6301", "error_message": "没有该订单信息" } REFUND_BACK_TIME_ERROR = { "error_code": "6302", "error_message": "归还时间异常" } REFUND_NOT_PRODUCTION_INFO = { "error_code": "6303", "error_message": "没有该讲解器信息" } REFUND_MONEY_IS_ZERO = { "error_code": "6304", "error_message": "退款金额为零" } REFUND_NO_DUPLICATE = { "error_code": "6305", "error_message": "退款单号重复" } TALLYMAN_ACCOUNT_EXIST = { "error_code": "7001", "error_message": "tallyman account exist, 补货员账号已存在" } TALLYMAN_ACCOUNT_NOT_EXIST = { "error_code": "7002", "error_message": "tallyman account not exist, 补货员账号不存在" } NFC_CARD_NOT_EXIST = { "error_code": "8001", "error_message": "nfc card not exist, 卡号错误" } NFC_CARD_ACTIVATED_ERROR = { "error_code": "8002", "error_message": "nfc card activated, 卡片已激活" } NO_NFC_CARD_ERROR = { "error_code": "8003", "error_message": "no nfc card , 不存在卡片" } RE_NFC_CARD_ERROR = { "error_code": "8004", "error_message": "re nfc card , 卡片已存在" } NFC_PAY_LOAD_SECRET_ERROR = { "error_code": "8005", "error_message": "secret error , 身份验证失败" } # 9 场所相关 NO_PLACE_ERROR = { "error_code": "9001", "error_message": "no place error,不存在场景" } # 10 商品相关 NO_PRODUCTION_ERROR = { "error_code": "10001", "error_message": "no production error,商品不存在" } NO_BRAND_ERROR = { "error_code": "10002", "error_message": "no production error,品牌不存在" } # COMMON_MONGO_ERROR = { "error_code": 5001, "error_message": "mongodb operation error, mongodb操作错误" } #!usr/bin/env python # -*- coding:utf-8 _*- """ @version: author:Aeolus @file: error_code.py """ ### 通用错误相关 Param_Invalid_Error = { "error_code": "500", "error_message": "params is invalid, 参数无效" } TOKEN_NOT_VALID_ERROR = { "error_code": "1001", "error_message": "无效的token" } TOKEN_NOT_PROVIDED_ERROR = { "error_code": "1002", "error_message": "token未提供" } TOKEN_EXPIRE_ERROR = { "error_code": "1003", "error_message": "token超时" } PHONE_NOT_BINDING_ERROR = { "error_code": "1004", "error_message": "未绑定手机号" } PHONE_NOT_NULL_ERROR = { "error_code": "1005", "error_message": "手机号为空" } PHONE_NOT_VALID_ERROR = { "error_code": "1006", "error_message": "无效的手机号" } USER_ALREADY_REGISTER_ERROR = { "error_code": "1007", "error_message": "用户已注册" } VERIFICATION_CODE_NULL_ERROR = { "error_code": "1008", "error_message": "验证码为空" } VERIFICATION_CODE_INVALID_ERROR = { "error_code": "1009", "error_message": "验证码已失效" } VERIFICATION_CODE_ERROR = { "error_code": "1010", "error_message": "验证码错误" } PASSWORD_ERROR = { "error_code": "1011", "error_message": "账号或密码错误" } # 账号相关 12开头 ACCOUNT_ALREADY_EXISTS_ERROR = { "error_code": '1012', "error_message": "该账号已存在" } ACCOUNT_NOT_EXISTS_ERROR = { "error_code": '1013', "error_message": "账号不存在" } ACCOUNT_ALREADY_DELETE_ERROR = { "error_code": '1014', "error_message": "账号已被删除" } ACCOUNT_AGENT_SPOT_NULL_ERROR = { "error_code": '1015', "error_message": "代理商景点列表为空" } AGNET_MODULES_ERROR = { "error_code": '1016', "error_message": "用户未绑定模块" } OPERATE_TYPE_ERROR = { "error_code": '1017', "error_message": "type错误" } OPERATE_LEVEL_ERROR = { "error_code": '1018', "error_message": "权限错误" } OPERATE_ERROR = { "error_code": '1019', "error_message": "操作有误" } MODULES_NOT_EXISTS_ERROR = { "error_code": '1020', "error_message": "modules not exists,模块不存在" } ACCOUNT_AGENT_SPOT_NOT_EXIST = { "error_code": '1021', "error_message": "agent spot not exists,代理景区不存在" } AGENT_MACHINE_NOT_EXIST = { "error_code": '1022', "error_message": "agent machine not exists,代理机柜不存在" } NO_BUSINESS_ERROR = { "error_code": '1023', "error_message": "no business error,商户不存在" } ADMIN_BUSINESS_NOT_EXIST = { "error_code": '1024', "error_message": "admin business not exist,用户商户不存在" } ACTION_CODE_ERROR = { "error_code": '1025', "error_message": "退款操作码错误" } ## 微信登陆相关 WX_LOGIN_DATA_ERROR = { "error_code": "3001", "error_message": "微信登录数据错误" } WX_LOGIN_CODE_ERROR = { "error_code": "3002", "error_message": "微信登录code值错误" } WX_OPENID_NOT_GET_ERROR = { "error_code": "3003", "error_message": "微信OpenId获取失败,请刷新重试" } WX_SESSION_KEY_ERROR = { "error_code": "3004", "error_message": "session key error" } ### 微信支付相关 WE_MINIAPP_PAY_FAIL = { "error_code": "3101", "error_message": "小程序下单失败" } ### 消息推送相关 WXBizMsgCrypt_OK = { "error_code": "0", "error_message": "WXBizMsgCrypt_OK" } WXBizMsgCrypt_ValidateSignature_Error = { "error_code": "4001", "error_message": "验证签名错误" } WXBizMsgCrypt_ParseXml_Error = { "error_code": "4002", "error_message": "解析xml错误" } WXBizMsgCrypt_ComputeSignature_Error = { "error_code": "4003", "error_message": "计算签名错误" } WXBizMsgCrypt_IllegalAesKey = { "error_code": "4004", "error_message": "Aes key非法错误" } WXBizMsgCrypt_ValidateAppid_Error = { "error_code": "4005", "error_message": "appid错误" } WXBizMsgCrypt_EncryptAES_Error = { "error_code": "4006", "error_message": "aes加密错误" } WXBizMsgCrypt_DecryptAES_Error = { "error_code": "4007", "error_message": "aes解密错误" } WXBizMsgCrypt_IllegalBuffer = { "error_code": "4008", "error_message": "illegal buffer" } WXBizMsgCrypt_EncodeBase64_Error = { "error_code": "4009", "error_message": "base64加密错误" } WXBizMsgCrypt_DecodeBase64_Error = { "error_code": "4010", "error_message": "base64解密错误" } WXBizMsgCrypt_GenReturnXml_Error = { "error_code": "4011", "error_message": "gen return xml error" } MACHINE_NOT_EXIST_ERROR = { "error_code": '5001', "error_message": "机柜不存在" } MACHINE_IS_USE_ERROR = { "error_code": '5002', "error_message": "已有他人正在租借中,请稍后" } MACHINE_IS_NOT_ONLINE_ERROR = { "error_code": '5003', "error_message": "机柜不在线" } MACHINE_ADD_ERROR = { "error_code": '5004', "error_message": "机柜添加失败" } MACHINE_NO_DUPLICATE_ERROR = { "error_code": '5005', "error_message": "machine_no duplicate,机柜编号重复" } MACHINE_EDIT_ERROR = { "error_code": '5006', "error_message": "machine edit error, 机柜修改错误" } HATCH_NOT_EXIST_ERROR = { "error_code": "5007", "error_message": "no hatch, 没有仓道商品信息" } HATCH_NOT_ALL_EXIST_ERROR = { "error_code": "5008", "error_message": "no all hatch, 存在已售出商品" } HATCH_COUNT_ERROR = { "error_code": "5009", "error_message": "hatch count error, 商品数量错误,检查数量" } MACHINE_ACTIVATED_ERROR = { "error_code": '5010', "error_message": "machine activated, 机柜已激活" } MACHINE_NO_CREATE_ERROR = { "error_code": '5011', "error_message": "machine_no create error , 机柜编号生成错误" } MACHINE_MAC_DUPLICATE_ERROR = { "error_code": '5012', "error_message": "machine_mac duplicate,机柜mac重复" } HATCH_COUNT_MAX_ERROR = { "error_code": '5013', "error_message": "hatch count max,仓道数量达到上限" } HATCH_NO_DUPLICATE_ERROR = { "error_code": '5014', "error_message": "hatch_no duplicate,仓道序号重复" } HATCH_NO_DUPLICATE_ERROR = { "error_code": '5014', "error_message": "hatch_no duplicate,仓道序号重复" } ### 订单相关 RENT_ORDER_NOT_BACK_ERROR = { "error_code": '6101', "error_message": "有未归还的订单" } RENT_ORDER_NOT_TAKE_ERROR = { "error_code": '6102', "error_message": "有未取货的订单" } RENT_ORDER_NUMBER_MAX = { "error_code": '6103', "error_message": "订单数量达到上限" } TAKE_CODE_NOT_VALID = { "error_code": '6104', "error_message": "取货码错误请确认手机号及取货码是否匹配" } CODE_CANCEL_ERROR = { "error_code": '6105', "error_message": "取货码已取消" } CODE_USED_ERROR = { "error_code": '6108', "error_message": "取货码已使用" } NO_POWER_ERROR = { "error_code": '6106', "error_message": "没有可租借设备" } NO_RENT_RECORD = { "error_code": '6107', "error_message": "订单不存在" } CODE_USED_ERROR = { "error_code": '6108', "error_message": "取货码已使用" } RENT_ORDER_NUMBER_LIMIT = { "error_code": '6109', "error_message": "机柜只允许租借一台" } REFUND_NOT_RENT_INFO = { "error_code": "6301", "error_message": "没有该订单信息" } REFUND_BACK_TIME_ERROR = { "error_code": "6302", "error_message": "归还时间异常" } REFUND_NOT_PRODUCTION_INFO = { "error_code": "6303", "error_message": "没有该讲解器信息" } REFUND_MONEY_IS_ZERO = { "error_code": "6304", "error_message": "退款金额为零" } REFUND_NO_DUPLICATE = { "error_code": "6305", "error_message": "退款单号重复" } REFUND_MONEY_ERROR = { "error_code": "6306", "error_message": "refund money退款金额错误" } TALLYMAN_ACCOUNT_EXIST = { "error_code": "7001", "error_message": "tallyman account exist, 补货员账号已存在" } TALLYMAN_ACCOUNT_NOT_EXIST = { "error_code": "7002", "error_message": "tallyman account not exist, 补货员账号不存在" } NFC_CARD_NOT_EXIST = { "error_code": "8001", "error_message": "nfc card not exist, 卡号错误" } NFC_CARD_ACTIVATED_ERROR = { "error_code": "8002", "error_message": "nfc card activated, 卡片已激活" } NO_NFC_CARD_ERROR = { "error_code": "8003", "error_message": "no nfc card , 不存在卡片" } RE_NFC_CARD_ERROR = { "error_code": "8004", "error_message": "re nfc card , 卡片已存在" } NFC_PAY_LOAD_SECRET_ERROR = { "error_code": "8005", "error_message": "secret error , 身份验证失败" } # 9 场所相关 NO_PLACE_ERROR = { "error_code": "9001", "error_message": "no place error,不存在场景" } # 10 商品相关 NO_PRODUCTION_ERROR = { "error_code": "10001", "error_message": "no production error,商品不存在" } NO_BRAND_ERROR = { "error_code": "10002", "error_message": "no production error,品牌不存在" } # COMMON_MONGO_ERROR = { "error_code": 5001, "error_message": "mongodb operation error, mongodb操作错误" }
\ No newline at end of file \ No newline at end of file
......
#!usr/bin/.env python # -*- coding:utf-8 _*- """ @version: author:Aeolus @time: 2021/03/26 @file: middlewares.py @function: @modify: """ import logging from flask import g, request, url_for, current_app, make_response, jsonify from config.wechat_config import platform_config_list from models.models import WxUser, TallymanAccount, AdminAccount from utils.error_code import TOKEN_NOT_VALID_ERROR from utils.my_response import BaseResponse from utils.jwt_util import verify_jwt logger = logging.getLogger(__name__) def log_enter_interface(): """ 日志打印进入接口 :return: """ logger.info("######################### 进入 {} 接口 ################################ ".format(request.path)) def log_out_interface(environ): """ 日志打印退出接口 :return: """ logger.info("######################### 退出 {} 接口 ################################\n".format(request.path)) return environ def close_db_session(environ): from models.base_model import db db.session.close() return environ """用户认证机制==>每次请求前获取并校验token""" "@myapps.before_request 不使@调用装饰器 在 init文件直接装饰" def jwt_authentication(): """ 1.获取请求头Authorization中的token 2.判断是否以 Bearer开头 3.使用jwt模块进行校验 4.判断校验结果,成功就提取token中的载荷信息,赋值给g对象保存 """ path_list = request.path.split("/") if current_app.name == "automat": NO_AUTH_CHECK_URL = [url_for('wx_auth.my_test'), url_for('wx_auth.mini_login'), url_for('rent.wx_pay_callback'), url_for('hatch.get_production_list'), url_for('tallyman.run_tallyman_login'), url_for('machine.run_get_machine_no'), url_for('machine.run_create_machine_no'), url_for('machine.run_bind_serial_num'), url_for('nfc_card.run_nfc_card_wx_pay_callback'), url_for('nfc_card.run_nfc_card_user_pay_record'), url_for('nfc_card.run_nfc_card_load_succeed'), url_for('nfc_card.run_nfc_card_user_load_record'), ] if request.path not in NO_AUTH_CHECK_URL: token = request.headers.get('Authorization') # "校验token" payload = verify_jwt(token) # "判断token的校验结果" if payload: # "获取载荷中的信息赋值给g对象" if request.path.split("/")[2] == "tallyman": user_no = payload.get('user_no') if not user_no: return BaseResponse(**TOKEN_NOT_VALID_ERROR) try: g.user = TallymanAccount.query.filter_by(user_no=user_no).first() if not g.user: return BaseResponse(**TOKEN_NOT_VALID_ERROR) return except Exception as e: print(e) if request.path.split("/")[2] == "machine": user_no = payload.get('user_no', None) user_id = payload.get('user_id', None) if user_no: try: g.user = TallymanAccount.query.filter_by(user_no=user_no).first() if not g.user: return BaseResponse(**TOKEN_NOT_VALID_ERROR) return except Exception as e: print(e) return BaseResponse(**TOKEN_NOT_VALID_ERROR) if user_id: try: g.user = WxUser.query.filter_by(id=user_id).first() if not g.user: return BaseResponse(**TOKEN_NOT_VALID_ERROR) return except Exception as e: print(e) return BaseResponse(**TOKEN_NOT_VALID_ERROR) return BaseResponse(**TOKEN_NOT_VALID_ERROR) user_id = payload.get('user_id') if not user_id: return BaseResponse(**TOKEN_NOT_VALID_ERROR) try: g.user = WxUser.query.filter_by(id=user_id).first() if not g.user: return BaseResponse(**TOKEN_NOT_VALID_ERROR) return except Exception as e: print(e) return BaseResponse(**TOKEN_NOT_VALID_ERROR) else: return BaseResponse(**TOKEN_NOT_VALID_ERROR) elif current_app.name == "pc_management": NO_AUTH_CHECK_URL = [url_for("admin.user_login") ] if request.path.split("/")[2] == "file" and request.path.split("/")[3] == "img": # 图片接口不验证token return if request.path not in NO_AUTH_CHECK_URL: token = request.headers.get('Authorization') # "校验token" payload = verify_jwt(token) # "判断token的校验结果" if payload: # "获取载荷中的信息赋值给g对象" user_id = payload.get('user_id', None) if user_id: g.user = AdminAccount.query.filter_by(id=user_id).first() if g.user: return return BaseResponse(**TOKEN_NOT_VALID_ERROR) else: NO_AUTH_CHECK_URL = [] return def get_platform(): """ :return: """ g.platform = request.headers.get('platform', "sukang24h") def all_options_pass(): """ :return: """ if request.method == "OPTIONS": headers = {'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'POST', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , platform', } return make_response((jsonify({'error_code': 0}), 200, headers)) #!usr/bin/.env python # -*- coding:utf-8 _*- """ @version: author:Aeolus @time: 2021/03/26 @file: middlewares.py @function: @modify: """ import logging from flask import g, request, url_for, current_app, make_response, jsonify from config.wechat_config import platform_config_list from models.models import WxUser, TallymanAccount, AdminAccount from utils.error_code import TOKEN_NOT_VALID_ERROR from utils.my_response import BaseResponse from utils.jwt_util import verify_jwt logger = logging.getLogger(__name__) def log_enter_interface(): """ 日志打印进入接口 :return: """ logger.info("######################### 进入 {} 接口 ################################ ".format(request.path)) def log_out_interface(environ): """ 日志打印退出接口 :return: """ logger.info("######################### 退出 {} 接口 ################################\n".format(request.path)) return environ def close_db_session(environ): from models.base_model import db db.session.close() return environ """用户认证机制==>每次请求前获取并校验token""" "@myapps.before_request 不使@调用装饰器 在 init文件直接装饰" def jwt_authentication(): """ 1.获取请求头Authorization中的token 2.判断是否以 Bearer开头 3.使用jwt模块进行校验 4.判断校验结果,成功就提取token中的载荷信息,赋值给g对象保存 """ path_list = request.path.split("/") if current_app.name == "automat": NO_AUTH_CHECK_URL = [url_for('wx_auth.my_test'), url_for('wx_auth.mini_login'), url_for('rent.wx_pay_callback'), url_for('hatch.get_production_list'), url_for('tallyman.run_tallyman_login'), url_for('machine.run_get_machine_no'), url_for('machine.run_create_machine_no'), url_for('machine.run_bind_serial_num'), url_for('nfc_card.run_nfc_card_wx_pay_callback'), url_for('nfc_card.run_nfc_card_user_pay_record'), url_for('nfc_card.run_nfc_card_load_succeed'), url_for('nfc_card.run_nfc_card_user_load_record'), ] if request.path not in NO_AUTH_CHECK_URL: token = request.headers.get('Authorization') # "校验token" payload = verify_jwt(token) # "判断token的校验结果" if payload: # "获取载荷中的信息赋值给g对象" if request.path.split("/")[2] == "tallyman": user_no = payload.get('user_no') if not user_no: return BaseResponse(**TOKEN_NOT_VALID_ERROR) try: g.user = TallymanAccount.query.filter_by(user_no=user_no).first() if not g.user: return BaseResponse(**TOKEN_NOT_VALID_ERROR) return except Exception as e: logger.info(e) if request.path.split("/")[2] == "machine": user_no = payload.get('user_no', None) user_id = payload.get('user_id', None) if user_no: try: g.user = TallymanAccount.query.filter_by(user_no=user_no).first() if not g.user: return BaseResponse(**TOKEN_NOT_VALID_ERROR) return except Exception as e: logger.info(e) return BaseResponse(**TOKEN_NOT_VALID_ERROR) if user_id: try: g.user = WxUser.query.filter_by(id=user_id).first() if not g.user: return BaseResponse(**TOKEN_NOT_VALID_ERROR) return except Exception as e: logger.info(e) return BaseResponse(**TOKEN_NOT_VALID_ERROR) return BaseResponse(**TOKEN_NOT_VALID_ERROR) user_id = payload.get('user_id') if not user_id: return BaseResponse(**TOKEN_NOT_VALID_ERROR) try: g.user = WxUser.query.filter_by(id=user_id).first() if not g.user: return BaseResponse(**TOKEN_NOT_VALID_ERROR) return except Exception as e: logger.info(e) return BaseResponse(**TOKEN_NOT_VALID_ERROR) else: return BaseResponse(**TOKEN_NOT_VALID_ERROR) elif current_app.name == "pc_management": NO_AUTH_CHECK_URL = [url_for("admin.user_login") ] if request.path.split("/")[2] == "file" and request.path.split("/")[3] == "img": # 图片接口不验证token return if request.path not in NO_AUTH_CHECK_URL: token = request.headers.get('Authorization') # "校验token" payload = verify_jwt(token) # "判断token的校验结果" if payload: # "获取载荷中的信息赋值给g对象" user_id = payload.get('user_id', None) if user_id: g.user = AdminAccount.query.filter_by(id=user_id).first() if g.user: return return BaseResponse(**TOKEN_NOT_VALID_ERROR) else: NO_AUTH_CHECK_URL = [] return def get_platform(): """ :return: """ g.platform = request.headers.get('platform', "sukang24h") def all_options_pass(): """ :return: """ if request.method == "OPTIONS": headers = {'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'POST', 'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , platform', } return make_response((jsonify({'error_code': 0}), 200, headers))
\ No newline at end of file \ No newline at end of file
......
import base64import jsonfrom Crypto.Cipher import AES class WXBizDataCrypt: def __init__(self, appId, sessionKey): self.appId = appId self.sessionKey = sessionKey def decrypt(self, encryptedData, iv): sessionKey = base64.decodebytes(bytes(self.sessionKey, encoding='utf8')) encryptedData = base64.decodebytes(bytes(encryptedData, encoding='utf8')) iv = base64.decodebytes(bytes(iv, encoding='utf8')) cipher = AES.new(sessionKey, AES.MODE_CBC, iv) des_str = cipher.decrypt(encryptedData) print("==================================") print(des_str) des_str = self._unpad(des_str) print(des_str) des_str = str(des_str,encoding='utf-8') decrypted = json.loads(des_str) if decrypted['watermark']['appid'] != self.appId: raise Exception('Invalid Buffer') return decrypted def _unpad(self, s): return s[:-ord(s[len(s) - 1:])] if __name__ == '__main__': appId = 'wx3185fb4a3633beb0' sessionKey='S7CMDfC6jXJKSaWKanG8oQ==' encryptedData='E7LZhvK7mOcaYsv9xcAfsBN9eSbzFh9FyMtFJ0zsFB0M62zRJ0cosZWksUujUR5WYUmNoIfIJnTIF8gRskxxbFU3fm5X7z4ChZecMSaFM65aEK1suRUD1U0ubB7mOwBBlY4ftdPT5kRwWgXKVkM4VAkYGN8A4fjWE93yGtjzxXs9dypQkCLSNWs6Kw5USEzjhtDZnptVy+lHF5fTXRuzoCstW2Cto4YI3G9hmnS64QuWjRteSqIgh8GN1zEPN0dROJjaWBjqraBCt/BfMsk4HBeL4PA75K8WdqVgKGfQ7/rnmPFOsNXWfajx9jl7XcrfoPaaPL1DmIJ1BlQne2GuLFtzZ3O4/8cdVQ9Lb0N/3kFAzjgzNFNLSYj2VNctmWyLdWi8hH90yslvrODIhMzIsuux2GIAfp0rQd/iVIVvtd7PXBOCe5iZ7aaqD0b0mLF4CmsuBpl8Eh20ZHkYw2SqO0x9uFrS/gy1vwtkmsTpcDw=' iv = 'DQcmcXyQkU+VKqb2mKmasQ==' pc = WXBizDataCrypt(appId, sessionKey) pc.decrypt(encryptedData, iv)# import base64import jsonfrom Crypto.Cipher import AES class WXBizDataCrypt: def __init__(self, appId, sessionKey): self.appId = appId self.sessionKey = sessionKey def decrypt(self, encryptedData, iv): sessionKey = base64.decodebytes(bytes(self.sessionKey, encoding='utf8')) encryptedData = base64.decodebytes(bytes(encryptedData, encoding='utf8')) iv = base64.decodebytes(bytes(iv, encoding='utf8')) cipher = AES.new(sessionKey, AES.MODE_CBC, iv) des_str = cipher.decrypt(encryptedData) des_str = self._unpad(des_str) des_str = str(des_str, encoding='utf-8') decrypted = json.loads(des_str) if decrypted['watermark']['appid'] != self.appId: raise Exception('Invalid Buffer') return decrypted def _unpad(self, s): return s[:-ord(s[len(s) - 1:])] if __name__ == '__main__': appId = 'wx3185fb4a3633beb0' sessionKey = 'S7CMDfC6jXJKSaWKanG8oQ==' encryptedData = 'E7LZhvK7mOcaYsv9xcAfsBN9eSbzFh9FyMtFJ0zsFB0M62zRJ0cosZWksUujUR5WYUmNoIfIJnTIF8gRskxxbFU3fm5X7z4ChZecMSaFM65aEK1suRUD1U0ubB7mOwBBlY4ftdPT5kRwWgXKVkM4VAkYGN8A4fjWE93yGtjzxXs9dypQkCLSNWs6Kw5USEzjhtDZnptVy+lHF5fTXRuzoCstW2Cto4YI3G9hmnS64QuWjRteSqIgh8GN1zEPN0dROJjaWBjqraBCt/BfMsk4HBeL4PA75K8WdqVgKGfQ7/rnmPFOsNXWfajx9jl7XcrfoPaaPL1DmIJ1BlQne2GuLFtzZ3O4/8cdVQ9Lb0N/3kFAzjgzNFNLSYj2VNctmWyLdWi8hH90yslvrODIhMzIsuux2GIAfp0rQd/iVIVvtd7PXBOCe5iZ7aaqD0b0mLF4CmsuBpl8Eh20ZHkYw2SqO0x9uFrS/gy1vwtkmsTpcDw=' iv = 'DQcmcXyQkU+VKqb2mKmasQ==' pc = WXBizDataCrypt(appId, sessionKey) pc.decrypt(encryptedData, iv)#
\ No newline at end of file \ No newline at end of file
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment