package com.ruoyi.web.controller;

import cn.hutool.core.lang.Validator;
import cn.hutool.core.net.url.UrlBuilder;
import cn.hutool.core.util.ReUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;

public class Tst {

    public static void main(String[] args) {

        /**
         author:157239486  优惠券  核销  writeOff  团购
         * 输码校验   encrypted_data
         */

            String uri = "https://open.douyin.com/goodlife/v1/fulfilment/certificate/prepare/";

            //二维码扫描出来的短链
            String tempUri = "https://v.douyin.com/i5WxdEgD/";

            String res = HttpUtil.get(tempUri);
            //获取objectId
            String encryptedDataUri = ReUtil.getGroup0(Validator.URL, res);
            String objectId = UrlBuilder.of(encryptedDataUri).getQuery().get("object_id").toString();
            System.out.println(objectId);

//            String result = HttpRequest.get(uri)
//                    .contentType("application/json")
//                    .header("access-token", "clt.2515da8e47993967e30d85fbe8265abaFlf7gCwUaEIsjwtfJtopESDVXLH5_lf")
//                    .form("encrypted_data", objectId).execute().body();

//            System.out.println(result);


    }
}
