SystemRestController.java 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * *************************************************
  3. * Copyright (c) 2018 QMTH. All Rights Reserved.
  4. * Created by Deason on 2018-07-18 10:38:43.
  5. * *************************************************
  6. */
  7. package cn.com.qmth.examcloud.app.controller;
  8. import cn.com.qmth.examcloud.app.model.Result;
  9. import cn.com.qmth.examcloud.app.service.NetExamService;
  10. import cn.com.qmth.examcloud.app.service.SmsService;
  11. import cn.com.qmth.examcloud.app.service.UserAuthService;
  12. import io.swagger.annotations.Api;
  13. import io.swagger.annotations.ApiOperation;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.web.bind.annotation.*;
  16. /**
  17. * 系统服务相关接口
  18. *
  19. * @version v1.0
  20. * @author: fengdesheng
  21. * @since: 2018/7/16
  22. */
  23. @RestController
  24. @RequestMapping("/api/v2")
  25. @Api(tags = "系统服务相关接口")
  26. public class SystemRestController {
  27. @Autowired
  28. private NetExamService netExamService;
  29. @Autowired
  30. private UserAuthService userAuthService;
  31. @Autowired
  32. private SmsService smsService;
  33. @ApiOperation(value = "获取服务器当前时间接口")
  34. @RequestMapping(value = "/system/currentTime", method = {RequestMethod.GET, RequestMethod.POST})
  35. public Result getCurrentTime(@RequestHeader String key, @RequestHeader String token) throws Exception {
  36. return netExamService.getCurrentTime(key, token);
  37. }
  38. @ApiOperation(value = "获取短信验证码接口")
  39. @RequestMapping(value = "/send/sms/code", method = {RequestMethod.GET, RequestMethod.POST})
  40. public Result sendSmsCode(@RequestParam String phone) throws Exception {
  41. //return smsService.sendSmsCode(key, token, phone);
  42. return userAuthService.sendSmsCode(phone);
  43. }
  44. @ApiOperation(value = "校验短信验证码接口", hidden = true)
  45. @RequestMapping(value = "/check/sms/code", method = {RequestMethod.GET, RequestMethod.POST})
  46. public Result checkSmsCode(@RequestHeader String key, @RequestHeader String token, @RequestParam String phone, @RequestParam String code) throws Exception {
  47. return smsService.checkSmsCode(key, token, phone, code);
  48. }
  49. }