80 lines
2.7 KiB
Python
80 lines
2.7 KiB
Python
from werkzeug.security import generate_password_hash
|
|
|
|
from Utils.ObjUtil import SpecObject
|
|
from Utils.ValidateUtil import ValidateAttr, Validate
|
|
|
|
|
|
class TFSECompanyUser(SpecObject):
|
|
"""天府股交项企业用户"""
|
|
|
|
class VerifyInfo(SpecObject):
|
|
"""认证信息"""
|
|
name = ValidateAttr(field='name', type=str)
|
|
code = ValidateAttr(field='code', type=str)
|
|
legal_person = ValidateAttr(field='legal_person', type=str)
|
|
legal_person_id = ValidateAttr(field='legal_person_id', type=str)
|
|
|
|
fields_map = {
|
|
"name": "企业名称",
|
|
"code": "统一社会信用代码",
|
|
"legal_person": "法人姓名",
|
|
"legal_person_id": "法人身份证号"
|
|
}
|
|
|
|
cid = ValidateAttr(field='cid', type=str)
|
|
pwd = ValidateAttr(field='pwd', func=Validate.password, error_info='密码强度不够')
|
|
name = ValidateAttr(field='name', type=str)
|
|
email = ValidateAttr(field='email', func=Validate.email, error_info='邮箱格式错误')
|
|
telephone = ValidateAttr(field='telephone', func=Validate.telephone, error_info='手机号格式错误')
|
|
register_time = ValidateAttr(field='register_time', func=Validate.time_format)
|
|
avatar_id = ValidateAttr(field='avatar_id', type=str, length=24)
|
|
verify_status = ValidateAttr(field='verify_status', in_list=["是", "否"])
|
|
verify_info = ValidateAttr(field='verify_info', type=VerifyInfo)
|
|
token = ValidateAttr(field='token', type=str)
|
|
|
|
fields_map = {
|
|
"cid": "企业ID",
|
|
"pwd": "密码",
|
|
"name": "企业名称",
|
|
"email": "邮箱",
|
|
"telephone": "手机号",
|
|
"register_time": "注册时间",
|
|
"avatar_id": "头像fid",
|
|
"verify_status": "已认证",
|
|
"verify_info": "认证信息",
|
|
"token": "token"
|
|
}
|
|
|
|
def dict_to_return(self, **kwargs):
|
|
_dict_ = self.dict_keys_toggle(columns=kwargs['columns']) if kwargs.__contains__('columns') else self.dict_keys_toggle()
|
|
|
|
if kwargs.__contains__('verify_status'):
|
|
if kwargs['verify_status'] is True:
|
|
_dict_['认证状态'] = '已认证' if _dict_.pop('已认证') == '是' else '未认证'
|
|
|
|
if _dict_.__contains__('密码'):
|
|
_dict_['密码'] = generate_password_hash(_dict_['密码'])
|
|
|
|
return _dict_
|
|
|
|
def login(self, **kwargs):
|
|
"""登录"""
|
|
|
|
def register(self, **kwargs):
|
|
"""注册"""
|
|
|
|
def get_company_user_info(self):
|
|
"""获取企业用户信息"""
|
|
|
|
def get_avatar(self):
|
|
"""获取用户头像"""
|
|
|
|
def change_avatar(self, **kwargs):
|
|
"""修改用户头像"""
|
|
|
|
def change_password(self, **kwargs):
|
|
"""修改登录密码"""
|
|
|
|
def change_email(self, **kwargs):
|
|
"""修改登录邮箱"""
|