@Test public void testRegister() throws Exception { JSONObject jsonObject = new JSONObject(); jsonObject.put("phone", "1234567"); jsonObject.put("password", "1234567"); post("/api/v1/auth/register?phone=1234567&password=1234567", jsonObject.toJSONString()); }
@ResponseBody @RequestMapping(value = "/api/v1/pub/auth/register", method = RequestMethod.POST) public JSONObject register( @RequestParam("phone") String phone, @RequestParam("password") String password, @RequestParam("SMSCode") String smscode) { boolean isOk = captchaService.validatorImageCode(phone, smscode); if (isOk) { fail(-1, "验证码无效"); } else { isOk = usersService.register(phone, password); if (!isOk) { return fail(-1, "注册失败"); } } return success(); }
AuthorController extends BaseController { @ResponseBody @RequestMapping(value = "/api/v1/pub/auth/register", method = RequestMethod.POST) public JSONObject register( @RequestParam("phone") String phone, @RequestParam("password") String password, @RequestParam("SMSCode") String smscode) { boolean isOk = captchaService.validatorImageCode(phone, smscode); if (isOk) { fail(-1, "验证码无效"); } else { isOk = usersService.register(phone, password); if (!isOk) { return fail(-1, "注册失败"); } } return success(); } }
AuthorController extends BaseController { @ResponseBody @RequestMapping(value = "/api/v1/pub/auth/register", method = RequestMethod.POST) public JSONObject register( @RequestParam("phone") String phone, @RequestParam("password") String password, @RequestParam("SMSCode") String smscode) { boolean isOk = captchaService.validatorImageCode(phone, smscode); if (isOk) { fail(-1, "验证码无效"); } else { isOk = usersService.register(phone, password); if (!isOk) { return fail(-1, "注册失败"); } } return success(); }  }
AuthorController extends BaseController { @ResponseBody @RequestMapping(value = "/api/v1/pub/auth/register", method = RequestMethod.POST) public JSONObject register( @RequestParam("phone") String phone, @RequestParam("password") String password, @RequestParam("SMSCode") String smscode) { boolean isOk = captchaService.validatorImageCode(phone, smscode); if (isOk) { fail(-1, "验证码无效"); } else { isOk = usersService.register(phone, password); if (!isOk) { return fail(-1, "注册失败"); } } return success(); }  @RequestMapping(value = "/api/v1/pub/error/403", method = {RequestMethod.GET, RequestMethod.POST}) JSONObject error403(); @ApiOperation(value = "partyLogin", notes = "第三方登录", httpMethod = "POST") @ApiImplicitParams( { @ApiImplicitParam(name = "openid", value = "openid", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "platform", value = "平台类型,1=QQ,2=微信", paramType = "query", dataType = "int"), @ApiImplicitParam(name = "nickName", value = "昵称", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "headImg", value = "平台类型,1=QQ,2=微信", paramType = "query", dataType = "string") } ) @RequestMapping(value = "/api/v1/pub/party/login", method = {RequestMethod.POST, RequestMethod.GET}) JSONObject partyLogin(
            @RequestParam(value = "openid", required = true) String openid,
            @RequestParam(value = "access_token", required = true) String accessToken,
            @RequestParam(value = "platform", required = true) int platform,
            @RequestParam(value = "nickName", required = true) String nickName,
            @RequestParam(value = "headImg", required = true) String headImg
    ); @ResponseBody @RequestMapping(value = "/api/v1/pub/auth/login", method = RequestMethod.POST) JSONObject login(@RequestBody(required = true) CaptchaUsernamePasswordToken token); @ResponseBody @RequestMapping(value = "/api/v1/pub/auth/logout", method = {RequestMethod.POST, RequestMethod.GET}) void logout(); @ResponseBody @RequestMapping(value = "/api/v1/pub/auth/register", method = RequestMethod.POST) JSONObject register(
            @RequestParam("phone") String phone,
            @RequestParam("password") String password,
            @RequestParam("SMSCode") String smscode); }
AuthorController extends BaseController { @ResponseBody @RequestMapping(value = "/api/v1/pub/auth/register", method = RequestMethod.POST) public JSONObject register( @RequestParam("phone") String phone, @RequestParam("password") String password, @RequestParam("SMSCode") String smscode) { boolean isOk = captchaService.validatorImageCode(phone, smscode); if (isOk) { fail(-1, "验证码无效"); } else { isOk = usersService.register(phone, password); if (!isOk) { return fail(-1, "注册失败"); } } return success(); }  @RequestMapping(value = "/api/v1/pub/error/403", method = {RequestMethod.GET, RequestMethod.POST}) JSONObject error403(); @ApiOperation(value = "partyLogin", notes = "第三方登录", httpMethod = "POST") @ApiImplicitParams( { @ApiImplicitParam(name = "openid", value = "openid", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "platform", value = "平台类型,1=QQ,2=微信", paramType = "query", dataType = "int"), @ApiImplicitParam(name = "nickName", value = "昵称", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "headImg", value = "平台类型,1=QQ,2=微信", paramType = "query", dataType = "string") } ) @RequestMapping(value = "/api/v1/pub/party/login", method = {RequestMethod.POST, RequestMethod.GET}) JSONObject partyLogin(
            @RequestParam(value = "openid", required = true) String openid,
            @RequestParam(value = "access_token", required = true) String accessToken,
            @RequestParam(value = "platform", required = true) int platform,
            @RequestParam(value = "nickName", required = true) String nickName,
            @RequestParam(value = "headImg", required = true) String headImg
    ); @ResponseBody @RequestMapping(value = "/api/v1/pub/auth/login", method = RequestMethod.POST) JSONObject login(@RequestBody(required = true) CaptchaUsernamePasswordToken token); @ResponseBody @RequestMapping(value = "/api/v1/pub/auth/logout", method = {RequestMethod.POST, RequestMethod.GET}) void logout(); @ResponseBody @RequestMapping(value = "/api/v1/pub/auth/register", method = RequestMethod.POST) JSONObject register(
            @RequestParam("phone") String phone,
            @RequestParam("password") String password,
            @RequestParam("SMSCode") String smscode);  }