//package cn.freemud.client;
//
//import cn.freemud.entities.dto.GetWxQrcodeDto;
//import cn.freemud.entities.dto.WeChatGetAccessTokenResponseDto;
//import cn.freemud.entities.dto.WechatSendMessageDto;
//import cn.freemud.service.thirdparty.WeChatClient;
//import com.google.gson.Gson;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
//import org.springframework.cloud.openfeign.EnableFeignClients;
//import org.springframework.test.context.junit4.SpringRunner;
//
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * All rights Reserved, Designed By www.freemud.cn
// *
// * @version V1.0
// * @Title: WeChatClientTest
// * @Package cn.freemud.client
// * @Description: 简单描述下这个类是做什么用的
// * @author: zhenghuan.yang
// * @date: 2018/6/25 17:13
// * @Copyright: 2018 www.freemud.cn Inc. All rights reserved.
// * 注意：本内容仅限于上海非码科技内部传阅，禁止外泄以及用于其他的商业目
// */
//@RunWith(SpringRunner.class)
//@SpringBootTest
//@EnableDiscoveryClient
//@EnableFeignClients
//@EnableAutoConfiguration
//public class WeChatClientTest {
//    @Autowired
//    private WeChatClient weChatClient;
//
//    /**
//     * 小程序登录 获取用户openId 和 sercetKey
//     */
//    @Test
//    public void getSession() {
//        String appid = "wx17747e8875943c8a";
//        String secret = "9b8c257bcf5fcba3dc244e44b4b504dc";
//        String jsCode = "011KDpYO1dOXc216tK0P1WnGYO1KDpY8";
//        String grantType = "authorization_code";
//        String responseMessage = weChatClient.getSession(appid, secret, jsCode, grantType);
//    }
//
//    /**
//     * 小程序登录 获取用户openId 和 sercetKey 开放平台授权模式
//     */
//    @Test
//    public void getCode2session() {
//        String appid = "wxec91c5923af56886";
//        String jsCode = "071hPfE61do6YS1gTfE61uvsE61hPfEI";
//        String grantType = "authorization_code";
//        String componentAppid = "wx63ae01ca3e89f3d4";
//        String componentAccessToken = "12_Tvh670QwuAui5-RuveZWBv-3H5wOjFZ_yjH4iXJ-L5wP4EC-zXqOAJm8sMegNSyLDgDp-zLALZ8jn5hN3JswsZizU07NcI7I56UEnuAFv-CMGyWooLxVfDlbmJ0BAEhAFAPOS";
//        String responseMessage = weChatClient.getCode2session(appid, jsCode, grantType, componentAppid, componentAccessToken);
//        System.out.println("responseMessage==" + responseMessage);
//    }
//
//    /**
//     * 获取小程序access_token
//     */
//    @Test
//    public void getAccessToken() {
//        String appid = "wxc0654291837cc4dc";
//        String secret = "0b4393b502b81b5df486bab3e3ed2633";
//        String grantType = "client_credential";
//        WeChatGetAccessTokenResponseDto responseDto = weChatClient.getAccessToken(grantType, appid, secret);
//    }
//
//    /**
//     * 获取小程序码
//     */
//    @Test
//    public void getWxacodeunlimit() {
//        GetWxQrcodeDto getWxQrcodeDto = new GetWxQrcodeDto();
//        getWxQrcodeDto.setScene("1036");
//        getWxQrcodeDto.setPage("");
//        getWxQrcodeDto.setWidth(430);
//        String str = weChatClient.getWxacodeunlimit(getWxQrcodeDto);
//    }
//
//    /**
//     * 发送微信服务通知
//     */
//    @Test
//    public void sendMessageNotice() {
//        String accessToken = "10_wwWER4L2ZkPrScE1_HJH5lxPPgJtPcH3WmKBYh2WA4Z3G6G7sT8O2P3cxcLROZLuT1jgOpJG59SG3vlBxgjRDTWmnIDNoffZ8fe5n6cN7-Pn-EAEhqNfPXYs7LG5zbLaAD-JQestJxkkkOXNBGDcACAOTQ";
//        String touser = "ob0iP4nIyQrS9Ye-vgKOlsc2QGm8";
//        String templateId = "19rc9ZCZJqUeiElisflkAVTvfNS9H3zJeiz2Qcj1ub0";
//        String page = "pages/orderDetails?oid=111350200331670017&take_code=114";
//        String formId = "wx1419500098032476cc4550283187448461";
//        String color = "#FF0000";
//        String emphasisKeyword = "keyword1.DATA";
//        WechatSendMessageDto.content content = new WechatSendMessageDto.content();
//        Map map1 = new HashMap();
//        WechatSendMessageDto.content.keyword keyword1 = new WechatSendMessageDto.content.keyword();
//        WechatSendMessageDto.content.keyword keyword2 = new WechatSendMessageDto.content.keyword();
//        WechatSendMessageDto.content.keyword keyword3 = new WechatSendMessageDto.content.keyword();
//        keyword1.setValue("114");
//        keyword1.setColor("#173177");
//        content.setKeyword1(keyword1);
//        keyword2.setValue("肥猫");
//        keyword2.setColor("#173177");
//        content.setKeyword2(keyword2);
//        keyword3.setValue("非码网络科技有限公司");
//        keyword3.setColor("#173177");
//        content.setKeyword3(keyword3);
//        WechatSendMessageDto wechatSendMessageDto = new WechatSendMessageDto();
//        wechatSendMessageDto.setTemplate_id(templateId);
//        wechatSendMessageDto.setForm_id(formId);
//        wechatSendMessageDto.setTouser(touser);
//        wechatSendMessageDto.setData(content);
//        wechatSendMessageDto.setPage(page);
//        wechatSendMessageDto.setEmphasis_keyword(emphasisKeyword);
//        String str = weChatClient.sendMessageNotice(accessToken, wechatSendMessageDto);
//    }
//}
