|
@@ -0,0 +1,50 @@
|
|
|
+package com.hz.employmentsite.controller;
|
|
|
+
|
|
|
+import com.hz.employmentsite.filter.exception.BaseResponse;
|
|
|
+import com.hz.employmentsite.filter.exception.RespGenerstor;
|
|
|
+import com.hz.employmentsite.services.service.WechatService;
|
|
|
+import com.hz.employmentsite.util.RemoteHelper;
|
|
|
+import me.chanjar.weixin.mp.api.WxMpService;
|
|
|
+import org.apache.commons.collections.map.AbstractMapDecorator;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/wx")
|
|
|
+public class WxController {
|
|
|
+
|
|
|
+ /*@Autowired
|
|
|
+ private RemoteHelper remoteHelper;
|
|
|
+
|
|
|
+ @GetMapping("/getWxToken")
|
|
|
+ public String getWxToken() {
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ params.put("grant_type","client_credential");
|
|
|
+ params.put("appid","wx765e6ec59e26c288");
|
|
|
+ params.put("secret","a44d8034671866e957484f5ed4e1df48");
|
|
|
+ remoteHelper.getJson(params, "https://api.weixin.qq.com/cgi-bin/token",null);
|
|
|
+
|
|
|
+ return "";
|
|
|
+ }*/
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WechatService wechatService;
|
|
|
+
|
|
|
+ @PostMapping("/sentMsg")
|
|
|
+ public BaseResponse<String> sentMsg(){
|
|
|
+ Map<String,String> data = new HashMap<>();
|
|
|
+ data.put("keyword1","巧克力");
|
|
|
+ data.put("keyword2","39.8元");
|
|
|
+ data.put("keyword3","2014年9月22日");
|
|
|
+
|
|
|
+
|
|
|
+ return RespGenerstor.success(wechatService.sentMsg("admin",data));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|