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 lines
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.apache.log4j.Logger;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.GetMapping;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RestController;
  16. @RestController
  17. @RequestMapping("/api/wxMsgValidationcode")
  18. @Api(description="短信验证相关接口")
  19. public class WxMsgValidationcodeController extends BaseController {
  20. private Logger logger = Logger.getLogger(WxMsgValidationcodeController.class);
  21. @Autowired
  22. private WxMsgValidationcodeService wxMsgValidationcodeService;
  23. @Autowired
  24. private WxMerchantBUserService wxMerchantBUserService;
  25. @Autowired
  26. private WxMerchantService wxMerchantService;
  27. @GetMapping("sendvalidationcode")
  28. @ApiImplicitParams({
  29. @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true),
  30. @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true)})
  31. public ResultData sendvalidationcode(String phone, Integer type) {
  32. WxCUser user = getUser();
  33. WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode();
  34. wxMsgValidationcode.setTenantId(user.getTenantId());
  35. wxMsgValidationcode.setPhone(phone);
  36. wxMsgValidationcode.setType(type);
  37. wxMsgValidationcode.setAppid(user.getAppId());
  38. return wxMsgValidationcodeService.sendvalidationcode(wxMsgValidationcode);
  39. }
  40. @GetMapping("hasvalidationcode")
  41. @ApiImplicitParams({
  42. @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true),
  43. @ApiImplicitParam(name = "type", value = "场景", dataType = "Integer", paramType = "query", required = true),
  44. @ApiImplicitParam(name = "code", value = "验证码", dataType = "String", paramType = "query", required = true)})
  45. public ResultData hasvalidationcode(String phone, Integer type, String code) {
  46. WxCUser user = getUser();
  47. WxMsgValidationcode wxMsgValidationcode = new WxMsgValidationcode();
  48. wxMsgValidationcode.setTenantId(user.getTenantId());
  49. wxMsgValidationcode.setPhone(phone);
  50. wxMsgValidationcode.setType(type);
  51. wxMsgValidationcode.setCode(code);
  52. wxMsgValidationcode.setAppid(user.getAppId());
  53. return wxMsgValidationcodeService.hasvalidationcode(wxMsgValidationcode);
  54. }
  55. }