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:18548596019",
                "adam:info:user:882883",
                "adam:info:morder:882883",
                "adam:info:umember:882883",
                "adam:info:real_name:937580006703923201984419",
                "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:biz: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:2284183012778",
                "goblin:bsc:goods_sku:226418554767964895ZZ87427",
                "goblin:user_coupon:926591841436344323959830",
                "goblin:bsc:ustore:809406",
                "goblin:bsc:ustore:922833055536291845022973",
                "goblin:bsc:store:839fa8dde17b5bf248575370f1249eab",
                "goblin:bsc:self_g_c",

                "goblin:u_d_art_ids:481073045099397123024514",
                "goblin:u_d_art_ids:937580006703923201984419",
                "goblin:u_d_art:2290182141046",
                "goblin:u_d_art_gm:481073045099397123024514" + "229813465121758731" + "1042142566635601925113326",
                "goblin:u_d_art_ct:481073045099397123024514",
                "goblin:real_stock_sku:229811280317503513",
                "goblin:nftNumAccount:926221815868989446709775",
                "goblin:u_d_art_ub:22103172030604",
        };
        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() {
    }
}
