BaseServiceTest.java
1.64 KB
package cn.com.glsx.wechatbuild.service;
import cn.com.glsx.scrm.wechat.dto.workwechat.media.response.GetWorkWechatMediaResponseDTO;
import cn.com.glsx.wechatbuild.Main;
import com.alibaba.fastjson.JSON;
import org.junit.runner.RunWith;
import org.oreframework.util.http.HttpUtil;
import org.oreframework.util.json.JacksonUtils;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.IOException;
/**
* @Title: BaseServiceTest.java
* @Description:
* @author deployer name
* @date 2018年1月6日 下午1:23:03
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2015
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Main.class)
public class BaseServiceTest {
public static void main1(String[] args) throws IOException {
String token = "pkE7tW6GgGR0XI-OpLWOA_tAKNEhSVe3G25Sx6cdMtdDe_1jLzpUu9t0hlWugXP2UNGKLbeBjSnlMgqA3uJ5m51yavC5BOB8v_cX1--wmdkoJv1Wzd3esOgrdu87IPvIJLqtMVUcLY79DXeZxLiPPfoLvSz8zYD8W3VSg58eDhPic4unnWVPWw9K-iwEQeQl3uI6q_XH6KOYOm_elPksBQ";
String url = "https://qyapi.weixin.qq.com/cgi-bin/media/upload?access_token=" + token + "&media_id=" + "WWME_I3njHwAALePR83PZEGFzHbmKoxX1vA";
String body = "{\"merchantId\":44210895,\"useridlist\":[\"Pun.ch\"],\"endtime\":1743523199,\"starttime\":1743436800}";
String response = HttpUtil.post(url, body);
System.out.println(JSON.toJSONString(response));
GetWorkWechatMediaResponseDTO dto = JacksonUtils.jsonCastBean(response, GetWorkWechatMediaResponseDTO.class);
System.out.println(JSON.toJSONString(dto));
}
}