k***@163.com
k***@163.com
  • 发布:2021-06-19 12:45
  • 更新:2021-06-28 03:03
  • 阅读:535

uniIDIns.loginBySms(params) 进行注册,自定义字段无法保存

分类:uniCloud

uni-id-user 表中,扩展了自己的一些字段,比如school,然后采用uniIDIns.loginBySms(params)进行注册,但是注册结果中没有school字段。补充:已经确保对uni-id-users.schema.json做了修改

uni-id-users.schema.json文件如下:

{
"bsonType": "object",
"required": ["mobile","name","school","campus","identity"],
"properties": {
"_id": {
"description": "存储文档 ID(用户 ID),系统自动生成"
},
"username": {
"bsonType": "string",
"title": "用户名",
"description": "用户名,不允许重复",
"trim": "both"
},
"password": {
"bsonType": "password",
"title": "密码",
"description": "密码,加密存储",
"trim": "both"
},
"password_secret_version": {
"bsonType": "int",
"title": "passwordSecret",
"description": "密码使用的passwordSecret版本"
},
//--------------------------自定义字段
"school":{
"bsonType": "object",
"title": "学校",
"description": "学校"
},
"campus":{
"bsonType": "object",
"title": "校区",
"description": "校区"
},
"identity":{
"bsonType": "object",
"title": "身份",
"description": "用户身份:教工、家长、校友"
},
"name": { //自定义
"bsonType": "string",
"title": "姓名",
"description": "用户姓名",
"trim": "both"
},

	//------------------------------------  
	"nickname": {  
		"bsonType": "string",  
		"title": "昵称",  
		"description": "用户昵称",  
		"trim": "both"  
	},  
	"gender": {  
		"bsonType": "int",  
		"title": "性别",  
		"description": "用户性别:0 未知 1 男性 2 女性",  
		"defaultValue": 0,  
		"enum": [{  
			"text": "未知",  
			"value": 0  
		}, {  
			"text": "男",  
			"value": 1  
		}, {  
			"text": "女",  
			"value": 2  
		}]  
	},  
	"status": {  
		"bsonType": "int",  
		"description": "用户状态:0 正常 1 禁用 2 审核中 3 审核拒绝",  
		"title": "用户状态",  
		"defaultValue": 0,  
		"enum": [{  
			"text": "正常",  
			"value": 0  
		}, {  
			"text": "禁用",  
			"value": 1  
		}, {  
			"text": "审核中",  
			"value": 2  
		}, {  
			"text": "审核拒绝",  
			"value": 3  
		}]  
	},  
	"mobile": {  
		"bsonType": "string",  
		"title": "手机号码",  
		"description": "手机号码",  
		"pattern": "^\\+?[0-9-]{3,20}$",  
		"trim": "both"  
	},  
	"mobile_confirmed": {  
		"bsonType": "int",  
		"description": "手机号验证状态:0 未验证 1 已验证",  
		"title": "手机号验证状态",  
		"defaultValue": 0,  
		"enum": [{  
			"text": "未验证",  
			"value": 0  
		}, {  
			"text": "已验证",  
			"value": 1  
		}]  
	},  
	"email": {  
		"bsonType": "string",  
		"format": "email",  
		"title": "邮箱",  
		"description": "邮箱地址",  
		"trim": "both"  
	},  
	"email_confirmed": {  
		"bsonType": "int",  
		"description": "邮箱验证状态:0 未验证 1 已验证",  
		"title": "邮箱验证状态",  
		"defaultValue": 0,  
		"enum": [{  
			"text": "未验证",  
			"value": 0  
		}, {  
			"text": "已验证",  
			"value": 1  
		}]  
	},  
	"avatar": {  
		"bsonType": "string",  
		"title": "头像地址",  
		"description": "头像地址",  
		"trim": "both"  
	},  
	"role": {  
		"bsonType": "array",  
		"title": "角色",  
		"description": "用户角色",  
		"enum": {  
			"collection": "uni-id-roles",  
			"field": "role_id as value, role_name as text"  
		},  
		"foreignKey": "uni-id-roles.role_id",  
		"permission": {  
			"write": false  
		}  
	},  
	"wx_unionid": {  
		"bsonType": "string",  
		"description": "微信unionid"  
	},  
	"wx_openid": {  
		"bsonType": "object",  
		"description": "微信各个平台openid",  
		"properties": {  
			"app-plus": {  
				"bsonType": "string",  
				"description": "app平台微信openid"  
			},  
			"mp-weixin": {  
				"bsonType": "string",  
				"description": "微信小程序平台openid"  
			}  
		}  
	},  
	"ali_openid": {  
		"bsonType": "string",  
		"description": "支付宝平台openid"  
	},  
	"comment": {  
		"bsonType": "string",  
		"title": "备注",  
		"description": "备注",  
		"trim": "both"  
	},  
	"realname_auth": {  
		"bsonType": "object",  
		"description": "实名认证信息",  
		"required": ["type", "auth_status"],  
		"properties": {  
			"type": {  
				"bsonType": "int",  
				"minimum": 0,  
				"maximum": 1,  
				"description": "用户类型:0 个人用户 1 企业用户"  
			},  
			"auth_status": {  
				"bsonType": "int",  
				"minimum": 0,  
				"maximum": 3,  
				"description": "认证状态:0 未认证 1 等待认证 2 认证通过 3 认证失败"  
			},  
			"auth_date": {  
				"bsonType": "timestamp",  
				"description": "认证通过时间"  
			},  
			"real_name": {  
				"bsonType": "string",  
				"description": "真实姓名\/企业名称"  
			},  
			"identity": {  
				"bsonType": "string",  
				"description": "身份证号码\/营业执照号码"  
			},  
			"id_card_front": {  
				"bsonType": "string",  
				"description": "身份证正面照 URL"  
			},  
			"id_card_back": {  
				"bsonType": "string",  
				"description": "身份证反面照 URL"  
			},  
			"in_hand": {  
				"bsonType": "string",  
				"description": "手持身份证照片 URL"  
			},  
			"license": {  
				"bsonType": "string",  
				"description": "营业执照 URL"  
			},  
			"contact_person": {  
				"bsonType": "string",  
				"description": "联系人姓名"  
			},  
			"contact_mobile": {  
				"bsonType": "string",  
				"description": "联系人手机号码"  
			},  
			"contact_email": {  
				"bsonType": "string",  
				"description": "联系人邮箱"  
			}  
		}  
	},  
	"register_date": {  
		"bsonType": "timestamp",  
		"description": "注册时间",  
		"forceDefaultValue": {  
			"$env": "now"  
		}  
	},  
	"register_ip": {  
		"bsonType": "string",  
		"description": "注册时 IP 地址",  
		"forceDefaultValue": {  
			"$env": "clientIP"  
		}  
	},  
	"last_login_date": {  
		"bsonType": "timestamp",  
		"description": "最后登录时间"  
	},  
	"last_login_ip": {  
		"bsonType": "string",  
		"description": "最后登录时 IP 地址"  
	},  
	"token": {  
		"bsonType": "array",  
		"description": "用户token"  
	},  
	"inviter_uid": {  
		"bsonType": "array",  
		"description": "用户全部上级邀请者",  
		"trim": "both"  
	},  
	"my_invite_code": {  
		"bsonType": "string",  
		"description": "用户自身邀请码"  
	}  
}  

}

2021-06-19 12:45 负责人:无 分享
已邀请:
hws007

hws007 - 我就是我!

可以用!注册后再更新,或者改源码

DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

不支持自定义字段

该问题目前已经被锁定, 无法添加新回复