WechatInfoController.java 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package com.boman.wechat.controller;
  2. import com.boman.domain.dto.AjaxResult;
  3. import com.boman.domain.dto.WxMsgDto;
  4. import com.boman.domain.form.LoginBody;
  5. import com.boman.wechat.service.WechatService;
  6. import com.boman.wechat.service.WxPushService;
  7. import io.swagger.annotations.ApiOperation;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.*;
  10. import java.util.Map;
  11. /**
  12. * 微信登录验证
  13. *
  14. * @author zhong.h
  15. */
  16. @RequestMapping("/wechat/p/c")
  17. @RestController
  18. public class WechatInfoController {
  19. @Autowired
  20. private WxPushService wxPushService;
  21. @Autowired
  22. private WechatService wechatService;
  23. @ApiOperation(value = "小程序相关信息获取")
  24. @RequestMapping(value = "/wechatInfo", method = RequestMethod.POST)
  25. public AjaxResult getWechatInfo(@RequestBody LoginBody loginBody) {
  26. return wechatService.getWechatInfo(loginBody);
  27. }
  28. @ApiOperation(value = "小程序模板id获取")
  29. @GetMapping("/tmpIds")
  30. public AjaxResult getTmpIds() {
  31. return wechatService.getTmpIds();
  32. }
  33. /**
  34. * 发送消息
  35. *
  36. * @param dto
  37. * @return
  38. */
  39. @PostMapping("/pushMsg")
  40. public Map<String, Object> pushMsg(@RequestBody WxMsgDto dto) {
  41. return wxPushService.pushToUser(dto);
  42. }
  43. }