You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

67 line
2.9 KiB

  1. package com.simple.controller;
  2. import com.simple.common.ResultData;
  3. import com.simple.domain.po.WxCUser;
  4. import com.simple.domain.po.WxMsgValidationcode;
  5. import com.simple.service.WxMerchantBUserService;
  6. import com.simple.service.WxMerchantService;
  7. import com.simple.service.WxMsgValidationcodeService;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiImplicitParam;
  10. import io.swagger.annotations.ApiImplicitParams;
  11. import org.slf4j.Logger;
  12. import org.slf4j.LoggerFactory;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.web.bind.annotation.GetMapping;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import org.springframework.web.bind.annotation.RestController;
  17. @RestController
  18. @RequestMapping("/api/wxMsgValidationcode")
  19. @Api(description = "短信验证相关接口")
  20. public class WxMsgValidationcodeController extends BaseController {
  21. private final Logger logger = LoggerFactory.getLogger(this.getClass());
  22. @Autowired
  23. private WxMsgValidationcodeService wxMsgValidationcodeService;
  24. @Autowired
  25. private WxMerchantBUserService wxMerchantBUserService;
  26. @Autowired
  27. private WxMerchantService wxMerchantService;
  28. @GetMapping("sendvalidationcode")
  29. @ApiImplicitParams({
  30. @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true),
  31. @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true)})
  32. public ResultData sendvalidationcode(String phone, Integer type) {
  33. WxCUser user = getUser();
  34. WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode();
  35. wxMsgValidationcode.setTenantId(user.getTenantId());
  36. wxMsgValidationcode.setPhone(phone);
  37. wxMsgValidationcode.setType(type);
  38. wxMsgValidationcode.setAppid(user.getAppId());
  39. return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode);
  40. }
  41. @GetMapping("hasvalidationcode")
  42. @ApiImplicitParams({
  43. @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true),
  44. @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true),
  45. @ApiImplicitParam(name = "code", value = "验证码", dataType = "String", paramType = "query", required = true)})
  46. public ResultData hasvalidationcode(String phone, Integer type, String code) {
  47. WxCUser user = getUser();
  48. WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode();
  49. wxMsgValidationcode.setTenantId(user.getTenantId());
  50. wxMsgValidationcode.setPhone(phone);
  51. wxMsgValidationcode.setType(type);
  52. wxMsgValidationcode.setCode(code);
  53. wxMsgValidationcode.setAppid(user.getAppId());
  54. return wxMsgValidationcodeService.hasvalidationcode(wxMsgValidationcode);
  55. }
  56. }