package com.example.getweather.util; import com.alibaba.fastjson.JSONObject; import lombok.Data; @Data public class WeixinMessage { private String toUser; private String msgType; private String content; private String markdown; private int agentid; public String getToUser() { return toUser; } public void setToUser(String toUser) { this.toUser = toUser; } public String getMsgType() { return msgType; } public void setMsgType(String msgType) { this.msgType = msgType; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public int getAgentid() { return agentid; } public void setAgentid(int agentid) { this.agentid = agentid; } public String toJson() { JSONObject jsonObject = new JSONObject(); jsonObject.put("touser", toUser); jsonObject.put("msgtype", msgType); jsonObject.put("agentid", agentid); JSONObject textObject = new JSONObject(); textObject.put("content", content); jsonObject.put("text", textObject); return jsonObject.toJSONString(); } }