import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DESUtils;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.IdentityUtils;
import lombok.SneakyThrows;
import org.junit.Test;

import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Scanner;

public class TestAdam {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int dbs = scanner.nextInt();
        String[] keys = {
                "adam:info:member:joinus:0",
                "adam:info:member:joinus:10",
                "adam:info:member:joinus:50",
                "adam:incr:member_no",
                "adam:ad:info",
                "adam:blacklist:member:uid",
                "adam:valid:sms:code:mobile18518013286",
                "adam:valid:sms:code:mobile18548596019",
                "adam:valid:sms:code:mobile17701223310",
                "adam:valid:sms:code:mobile13753596360",
                "adam:valid:sms:code:mobile15901093014",

                "adam:valid:sms:code:mobile15529282737",

                "adam:identity:mobile:13724286255",
                "adam:identity:mobile:15529282737",
                "adam:info:user:882883",
                "adam:info:morder:882883",
                "adam:info:umember:882883",
                "adam:info:real_name:882883",
                "adam:info:third_party:882883",
                "adam:info:enters:882883",
                "adam:info:addresses:882883",
                "adam:info:member:code:GMRGBUQB30",
                "adam:info:certification:1141181199209160192",

                "adam:identity:mobile:15124771442",
                "adam:identity:sso:882883",
                "adam:info:user:809406",
                "adam:info:user:926221815868989446709775",
                "adam:morder:2283655",
                "adam:info:umember:1957341",
                "adam:info:umember:926221815868989446709775",
                "adam:info:umember:926280978917662724119825",
                "adam:info:morder:926221815868989446709775",

                "adam:info:member:simple",
                "adam:info:member:joinus",
                "adam:info:member:category:1",
                "adam:info:member:agreement",
                "adam:info:member:rights:1",
                "adam:info:member:price:1",
                "adam:info:member:rights:v:1",
                "adam:info:tags:music",
                "adam:info:tags:sex",
                "adam:info:morder:2292617",
                "adam:info:certification_junk:1510827199912020821",

                "kylin:member:uid:926221815868989446709775",
                "kylin:member:uid:925802662655180800214832",

                "candy:basic:coupon_code:0Jxko0wLWQdoTTF4",
                "candy:basic:coupon_code:MJIoHC2qVZ0lp9UI",
                "candy:basic:user_coupon:809406",
                "candy:basic:coupon_info:20210906143324612",
                "candy:basic:common_coupon",


                "sweet:manual:pushList",
                "goblin:sku:relation:226416501783461229",
                "goblin:bsc:goods:2264185547679ZZ87427",
                "goblin:bsc:goods_sku:226418554767964895ZZ87427",
                "goblin:user_coupon:926591841436344323959830",
                "goblin:bsc:ustore:809406",
                "goblin:bsc:ustore:922833055536291845022973",
                "goblin:bsc:store:839fa8dde17b5bf248575370f1249eab",
        };
        for (String key : keys) {
            long value = key.hashCode();
            int idx = ((int) (value ^ (value >>> 32)) % dbs);
            System.out.printf("\n[%s] - idx:%s", key, idx);
        }
    }

    @Test
    public void test() {
        System.out.println(IdentityUtils.aliThird("徐佳颖", "429004200001202586"));
    }

    @SneakyThrows
    @Test
    public void testLoginBySilentMobile() {
        String mobile = "15811009011";
        String otp = DESUtils.DES().encrypt(mobile + LocalDateTime.now().toEpochSecond(ZoneOffset.UTC));
        String post = HttpUtil.post("http://testadam.zhengzai.tv/adam/login/silent_mobile?mobile=15811009011&otp=" + otp, null);
        System.out.println(post);
    }

    @Test
    public void testTmp() {
//        String post = HttpUtil.post("http://ttestkylin.zhengzai.tv/kylin/inner/cache/member?uid=925802662655180800214832", CollectionUtil.linkedMultiValueMapStringString());
//        System.out.println("===" + post);

        LocalDateTime now = LocalDateTime.now();
        for (int i = 0; i < 15; i++) {
            System.out.println(now.getSecond() + "----" + now.getSecond()%10);
        }
    }
}
