# 用户登录 +++ post:/user/public/login *string:username# 用户名(手机或邮箱) password#密码 device_type#设备类型;可选值:mobile,android,iphone,ipad,web,pc,mac,wxapp <<< 成功 { "code":1, "msg":"登录成功!", "data":{ "token":"3588d613a61a1bf6f208173f980741c0", "user": { "id": 用户ID, "user_type": 用户类型;1:admin;2:会员, "sex": 性别;0:保密,1:男,2:女, "birthday": 生日, "last_login_time": 最后登录时间, "score": 用户积分, "coin": 金币, "balance": 余额, "create_time": 注册时间, "user_status": 用户状态;0:禁用,1:正常,2:未验证, "user_login": "用户名", "user_pass": "登录密码", "user_nickname": "用户昵称", "user_email": "用户登录邮箱", "user_url": "用户个人网址", "avatar": "用户头像", "signature": "个性签名", "last_login_ip": "最后登录ip, "user_activation_key": "激活码", "mobile": "用户手机号", "more": 扩展属性 } } } <<< 失败 { "code":0, "msg":"密码不正确!", "data":"" } +++ ## 小程序代码 ``` api.post({ url: 'user/public/login', data: { username: '15121002429', password:'123456', device_type:'wxapp' }, success: data => { if (data.code == 1) { //  成功 } if (data.code == 0) { //  失败 } console.log(data); } }); ```