## 登录
登录接口主要用于微信用户首次使用小程序,没有绑定微信的情况下使用。
小程序应该在登录成功后,储存接口中返回的cookie,用于请求其它接口,否则会登录失效。
~~~[api]
post:/server/user/login
*string:username=蒋文健#姓名
*string:password=123456#密码
*string:code= #用户登录凭证
*string:encryptedData= #加密的用户数据
*string:iv= #初始化向量
<<<
success
{
"code": 1,
"msg": "登录成功",
"result": {
"id": 1,
"username": "蒋文健", // 姓名
"tel": "15907511160", // 联系电话
"nickname": "jwj", // 微信昵称
"gender": 1, // 性别
"city": "中国广东韶关", // 城市
"avatar": "https://wx.qlogo.cn/mmopen/vi_32/IEw6UFCFGBeYV8weiczoT8OnDZiaa15FChoyUep0RzDSr6eLl6YzZcQcdYdN0XUG6jvDDD1YJ8CXklobL8P0Iqkw/132", // 头像地址
"status": 1
},
"cookie": "user_uid=1; user_sid=3ef9ea9451162095e35fda0a9f7c0677", // 用户登录凭证(COOKIE)
"debug": true
}
<<<
error
{
"code": 0,
"msg": "密码错误"
}
<<<
error
{
"code": 0,
"msg": "获取session_key失败!Wx Error(40029): invalid code, hints: [ req_id: Jki4Ga0438hb36 ]"
}
<<<
error
{
"code": 0,
"msg": "解密用户信息失败"
}
~~~
### 小程序代码示例

