注册
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\common\model\ClientModel::register |
| 所属业务 | 认证安全 |
| 来源模块/系统 | 用户模型 |
功能说明
注册
调用示例
$type = 'phone';
$account = '18423467948';
$phone_code = '86';
$username = 'wyh';
$code = '1234';
$password = '123456';
$re_password = '1';
$customfield = [];
$result = (new \app\common\model\ClientModel())->register($type, $account, $phone_code, $username, $code, $password, $re_password, $customfield);参数
| 参数 | 类型 | 必填 | 默认值 | 校验规则 | 说明 |
|---|---|---|---|---|---|
type | string | 是 | phone | required | 登录类型:phone手机注册,email邮箱注册 |
account | string | 是 | 18423467948 | required | 手机号或邮箱 |
phone_code | string | 否 | 86 | — | 国家区号(登录类型为手机注册时需要传此参数) |
username | string | 否 | wyh | — | 姓名 |
code | string | 是 | 1234 | required | 验证码 |
password | string | 是 | 123456 | required | 密码 |
re_password | string | 是 | 1 | required | 重复密码 |
customfield | object | 否 | {} | — | 自定义字段,格式:{"field1":'test',"field2":'test2'} |
返回值
| 返回项 | 类型 | 说明 |
|---|---|---|
data.jwt | string | jwt:注册后放在请求头Authorization里,拼接成如下格式:Bearer+空格+yJ0eX.test.ste |
正常返回
{
"data": {
"jwt": "string"
}
}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |