All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tmsps.ne4weixin.api.CustomAPI Maven / Gradle / Ivy

There is a newer version: 3.2.2.3
Show newest version
package com.tmsps.ne4weixin.api;

import com.alibaba.fastjson.JSONObject;
import com.tmsps.ne4weixin.bean.message.custom.BaseMessage;
import com.tmsps.ne4weixin.config.WxConfig;
import com.tmsps.ne4weixin.config.constant.CUSTOM;
import com.tmsps.ne4weixin.utils.WXHttpUtil;

import lombok.extern.slf4j.Slf4j;

/**
 * @Title: CustomAPI.java
 * @Package: com.tmsps.ne4weixin.api
 * @Description: 客服消息管理API
 * @author: hanjiefei
 * @date: 2019-10-22
 * @version V1.0
 * @Copyright: 2019 
 */
@Slf4j
public class CustomAPI extends BaseAPI {

	public CustomAPI(WxConfig config) {
		super(config);
	}
	
	/**
	 * 发送客服消息
	 * @param message
	 * @return
	 */
	public String sendMessage(BaseMessage message) {
		String url = String.format(CUSTOM.SEND_MSG, wxConfig.getAccessToken());
		log.debug(JSONObject.toJSONString(message));
		return WXHttpUtil.postJson(url, JSONObject.toJSONString(message));
	}
	
	/**
	 * 发送客服消息
	 * @param json
	 * @return
	 */
	public String sendMessage(String json) {
		String url = String.format(CUSTOM.SEND_MSG, wxConfig.getAccessToken());
		return WXHttpUtil.postJson(url, json);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy