diff --git a/zc-business/src/main/java/com/zc/business/controller/DcWeChatController.java b/zc-business/src/main/java/com/zc/business/controller/DcWeChatController.java new file mode 100644 index 00000000..a17a9f4a --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcWeChatController.java @@ -0,0 +1,48 @@ +package com.zc.business.controller; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.zc.business.domain.DcBoardPublish; +import com.zc.business.service.IDcBoardService; +import com.zc.business.utils.QYWXUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @Description 企业微信推送Controller + * + * @author liuwenge + * @date 2024/10/21 11:38 + */ +@Api(tags = "企业微信推送") +@RestController +@RequestMapping("/business/weChat") +public class DcWeChatController { + + @Autowired + private QYWXUtil qywxUtil; + + + @ApiOperation("发送消息") + @PostMapping("/qywxSendMessage") + public AjaxResult qywxSendMessage(@RequestBody Map params){ + + List userIdList = Arrays.asList(params.get("userId").split(",")); + String content = params.get("content"); + return AjaxResult.success(qywxUtil.sendMessageByWxUserId(userIdList,content)); + } + + @ApiOperation("根据手机号获取userId") + @PostMapping("/getQywxUserId") + public AjaxResult getQywxUserId(@RequestBody Map params){ + String mobile = params.get("mobile"); + return AjaxResult.success(qywxUtil.getUserIdByMobile(mobile)); + } + +}