def login_handler(): """ @api {post} /v1/user/login 登录 @apiName Login @apiGroup 用户 @apiDescription 登录 @apiParam {string} username 用户 @apiParam {string} password 密码 @apiParamExample {json} Request-Example: { "username":"******", "password":"******" } @apiSuccess {string} token 用户token @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IndpZ2dlbnMiLCJ1c2VyaWQiOj" }, "message": "ok" } """ username, passwd = parse_json_form('login') if passwd is '': return json_detail_render(301) code, data = AuthBusiness.login(username, passwd) return json_detail_render(code, data)
def login_handler(): """ @api {post} /v1/user/login 登录 @apiName Login @apiGroup 用户 @apiDescription 登录 @apiParam {string} username 用户 @apiParam {string} password 密码 @apiParamExample {json} Request-Example: { "username":"******", "password":"******" } @apiSuccess {string} token 用户token @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": { "token": "tokenxxxx.xxxxx" }, "message": "ok" } """ username, passwd = parse_json_form('login') if passwd is '': return json_detail_render(301) code, data = AuthBusiness.login(username, passwd) return json_detail_render(code, data)