|
|
@@ -0,0 +1,33 @@
|
|
|
+package com.usoftchina.uas.office.qywx.controller;
|
|
|
+
|
|
|
+import com.usoftchina.qywx.sdk.MessageSdk;
|
|
|
+import com.usoftchina.qywx.sdk.dto.SendMessageReq;
|
|
|
+import com.usoftchina.uas.office.dto.Result;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author yingp
|
|
|
+ * @date 2020/2/19
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+public class QywxMessageController {
|
|
|
+ @Autowired
|
|
|
+ private MessageSdk messageSdk;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发送消息
|
|
|
+ *
|
|
|
+ * @param agent
|
|
|
+ * @param message
|
|
|
+ * @param user
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/api/message/send")
|
|
|
+ public Result send(@RequestParam(value = "agent") String agent, String message, String user) {
|
|
|
+ messageSdk.send(agent, new SendMessageReq().text(message).toUser(user));
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+}
|