From 471f693ac87a6ed6a2b00e93472b025266c0271f Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Mon, 13 Nov 2023 09:27:19 +0800 Subject: [PATCH] Merge branch 'wb' of http://blit.7drlb.com:8888/r/moral into qa --- screen-api/src/main/java/com/moral/api/controller/AppUserController.java | 55 ++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 40 insertions(+), 15 deletions(-) diff --git a/screen-api/src/main/java/com/moral/api/controller/AppUserController.java b/screen-api/src/main/java/com/moral/api/controller/AppUserController.java index 444a080..c6157c1 100644 --- a/screen-api/src/main/java/com/moral/api/controller/AppUserController.java +++ b/screen-api/src/main/java/com/moral/api/controller/AppUserController.java @@ -18,9 +18,15 @@ import java.util.HashMap; import java.util.Map; +import javax.validation.Valid; + +import com.alibaba.fastjson.JSON; +import com.moral.api.entity.Allocation; +import com.moral.api.pojo.query.app.AppAllocationPushUserCond; import com.moral.api.service.UserService; -import com.moral.api.utils.HttpClientUtil; + +import com.moral.api.utils.WechatUtils; import com.moral.api.vo.WxMssVo; import com.moral.constant.ResponseCodeEnum; import com.moral.constant.ResultMessage; @@ -65,31 +71,50 @@ return ResultMessage.ok(); } - @GetMapping("pushOneUser") + @PostMapping("pushOneUser") @ApiOperation(value = "���������������������") - public ResultMessage pushOneUser(String openid){ - String body = push("oOCWi6yfVapaK25Jnkk7jKSbMLyw"); - return ResultMessage.ok(body); + public ResultMessage pushOneUser(@Valid @RequestBody Allocation appAllocationPushUserCond){ + userService.pushOneUser(appAllocationPushUserCond); +// String body = push("oOCWi6-_hnzSvrMT8HX5D7Dz7tEA"); + return ResultMessage.ok(); } public String push(String openid) { RestTemplate restTemplate = new RestTemplate(); //������������������������������������������������access_token������������������������������access_token������������������������������ - String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + HttpClientUtil.getAccessToken(); + //��������������� + String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + WechatUtils.getAccessToken(); +// String url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?access_token=" + HttpClientUtil.getAccessToken(); +// String url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=" + HttpClientUtil.getAccessToken(); +// String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + HttpClientUtil.getAccessToken(); + //��������������� +// String url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" + HttpClientUtil.getAccessToken(); + + //��������������������� WxMssVo wxMssVo = new WxMssVo(); wxMssVo.setTouser(openid);//���������openid��������������������������������������������������������������������� - wxMssVo.setTemplate_id("sClgB85aEG1hgaiXpnJBopo5LJX6r91DUsyikOmUgv8");//������������������id - wxMssVo.setPage("pages/index/index"); + wxMssVo.setTemplate_id("YNqUZ1MgMvwY3G-NENVbcmIBR5dUotSdnwcz96CWrho");//������������������id + wxMssVo.setLang("zh_CN"); + wxMssVo.setMiniprogramState("formal"); +// wxMssVo.setPage("pages/index/index"); - Map<String, String> m = new HashMap<>(3); - m.put("time2", "2023-10-23"); - m.put("thing3", "������"); - m.put("thing7", "������������������"); - m.put("character_string8", "������������������"); - m.put("phrase10", "������������������"); - wxMssVo.setData(m); + Map<String, Object> m = new HashMap<>(); + HashMap<String, Object> map1 = new HashMap<>(); + HashMap<String, Object> map2 = new HashMap<>(); + HashMap<String, Object> map3 = new HashMap<>(); + HashMap<String, Object> map4 = new HashMap<>(); + map1.put("value","���������2"); + map2.put("value","ouyanglun"); + map3.put("value","���������1"); + map4.put("value","2023-10-16"); + m.put("thing18", map1); + m.put("character_string1", map2); + m.put("thing2", map3); + m.put("date4", map4); + wxMssVo.setData(JSON.toJSON(m)); + ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, wxMssVo, String.class); return responseEntity.getBody(); -- Gitblit v1.8.0