package com.miaxis.test;

import com.miaxis.JsjpApplication;
import com.miaxis.common.sms.MD5Utils;
import com.miaxis.feign.service.IWxService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.text.SimpleDateFormat;
import java.util.*;

@SpringBootTest(classes = JsjpApplication.class)
@RunWith(SpringRunner.class)
public class NormalTest2 {
    @Autowired
    private IWxService ixService;


    private static String appKey = "10000000000";

    private static String appSecret = "25f9e794323b453885f5181f1b624d0b";

    private static String appSecret2 = "&appSecret=25f9e794323b453885f5181f1b624d0b";


    public static String getSign(Map<String, Object> params,String appSecret2) {
        Map<String, Object> sortMap = new TreeMap<String, Object>();
        sortMap.putAll(params);
        // 以k1=v1&k2=v2...方式拼接参数
        StringBuilder builder = new StringBuilder();
        for (Map.Entry<String, Object> s : sortMap.entrySet()) {
            String k = s.getKey();
            Object v = s.getValue();
            builder.append(k).append("=").append(v).append("&");
        }
        if (!sortMap.isEmpty()) {
            builder.deleteCharAt(builder.length() - 1);
        }
        builder.append(appSecret2);
        return builder.toString();
    }




    public static void main(String[] args) {
//        Long time = System.currentTimeMillis();
//        System.out.println(time);
       long time = 1610610858l-1619334887l;
//       System.out.println(time/1000);
        Date date = new Date(1610610858000l);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

        String str = sdf.format(date);
        System.out.println(str);

    }









}
