智简魔方文档

登录

方法概览

项目内容
文档类型PHP 类方法
方法标识app\common\model\ClientModel::login
所属业务认证安全
来源模块/系统用户模型

功能说明

登录

调用示例

$type = 'code';
$account = '18423467948';
$phone_code = '86';
$code = '1234';
$password = '123456';
$remember_password = '1';
$captcha = '1234';
$token = 'fd5adaf7267a5b2996cc113e45b38f05';
$client_operate_password = 'Example@123';
$result = (new \app\common\model\ClientModel())->login($type, $account, $phone_code, $code, $password, $remember_password, $captcha, $token, $client_operate_password);

参数

参数类型必填默认值校验规则说明
typestringcoderequired登录类型:code验证码登录,password密码登录
accountstring18423467948required手机号或邮箱
phone_codestring86国家区号(手机号登录时需要传此参数)
codestring1234验证码(登录类型为验证码登录code时需要传此参数)
passwordstring123456密码(登录类型为密码登录password时需要传此参数)
remember_passwordstring1记住密码(登录类型为密码登录password时需要传此参数,1是,0否)
captchastring1234图形验证码(开启登录图形验证码且为密码登录时或者同一ip地址登录失败3次后需要传此参数)
tokenstringfd5adaf7267a5b2996cc113e45b38f05图形验证码唯一识别码(开启登录图形验证码且为密码登录时或者同一ip地址登录失败3次后需要传此参数)
client_operate_passwordstring操作密码

返回值

返回项类型说明
返回值array
statusint状态码,200成功,400失败
msgstring提示信息
data.jwtstringjwt:登录后放在请求头Authorization里,拼接成如下格式:Bearer+空格+jwt
data.ip_exception_verifyarray状态码400,有该字段,根据返回的验证方式验证,用户异常登录验证方式(operate_password=操作密码)

正常返回

{
  "status": 1,
  "msg": "string",
  "data": {
    "jwt": "string",
    "ip_exception_verify": [
      "192.0.2.1"
    ]
  }
}

异常情况

异常类型说明
Throwable调用失败时由具体实现抛出异常,异常信息以运行时结果为准。