From e3ccb13fdd386d41ea2f721924861f6bb64e6708 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Sat, 09 Jan 2021 14:46:09 +0800 Subject: [PATCH] Merge branch 'api' of https://gitee.com/jyyforjava/zq-erp into api --- zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/MsgDemo2.java | 69 ++++++++++++++++++++++++++++++++++ 1 files changed, 69 insertions(+), 0 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/MsgDemo2.java b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/MsgDemo2.java new file mode 100644 index 0000000..b50626a --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/wechart/templateMsg/MsgDemo2.java @@ -0,0 +1,69 @@ +package com.matrix.system.wechart.templateMsg; + +import com.alibaba.fastjson.JSONObject; +import com.matrix.component.tools.HttpClientUtil; +import com.matrix.core.pojo.AjaxResult; +import com.matrix.system.hive.plugin.util.HttpUtils; +import com.matrix.system.shopXcx.api.WeChatGzhApiTools; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@RequestMapping(value = "test2") +public class MsgDemo2 { + + + String xcxAppId="wx5cc58f796224af61"; + + + String xcxSecret="facea088aae414e5c2ee86b459887721"; + + + @RequestMapping("/template") + @ResponseBody + public AjaxResult template() { + UniformMsgPojo uniformMsgPojo=new UniformMsgPojo(); + GzhTemplateMessagePojo messagePojo=new GzhTemplateMessagePojo(); + uniformMsgPojo.setTouser("oJkRK4yelehsY4S7I6Ee1ydWtQMI"); + messagePojo.setTemplate_id("Mqu9xPYj_JFhXNj7nLJS7LESQUy6Z7FoCOmVO66Oxe8"); + //messagePojo.setUrl("www.baidu.com"); + // messagePojo.setMiniprogram(gzhAppId,"/123/234123412"); + messagePojo.setAppid("wx57e6335559bdbda6"); + messagePojo.setFirst("尊敬的谭娅:","#453454"); + messagePojo.setKeyWord("活细胞肩部护理","#453454"); + messagePojo.setKeyWord("2014年7月21日 18:36","#453454"); + messagePojo.setRemark("您的护理课程剩余3次。","#453454"); + + String ACCESS_TOKEN=WeChatGzhApiTools.getAccessToken(xcxAppId,xcxSecret); + String url="https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=ACCESS_TOKEN".replaceAll("ACCESS_TOKEN",ACCESS_TOKEN); + + uniformMsgPojo.setMp_template_msg(messagePojo); + + System.out.println(JSONObject.toJSON(uniformMsgPojo).toString()); + JSONObject result= HttpClientUtil.sendPostWithJson(url,JSONObject.toJSON(uniformMsgPojo).toString()); + System.out.println(result.toString()); + return AjaxResult.buildSuccessInstance("1"); + + + } + + + @RequestMapping("/getUserList") + @ResponseBody + public AjaxResult getUserList() { + + String ACCESS_TOKEN=WeChatGzhApiTools.getAccessToken(xcxAppId,xcxSecret); + + String url="https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID".replaceAll("ACCESS_TOKEN",ACCESS_TOKEN); + + + String result= HttpUtils.sendGet(url,""); + System.out.println(result.toString()); + return AjaxResult.buildSuccessInstance("1"); + + + } + +} -- Gitblit v1.9.1