建设亿同狂欢秒杀兑换京东E卡,话费

2020-06-28   463 次阅读


抓包软件HttpCanary
https://wwa.lanzous.com/ibLuMe44n8d

  1. 获取请求头
打开抓包软件,进入活动页面抓取
https://hemi.lianhaikeji.com/front/api/getActDetails/***
记录***的值,即acctId

文件大概20k左右,

拿到以下两个请求头,kv结构
Authorization
merchantId

  1. 请求参数
{
  "actId": "你的acctId",
  "standardId": 8598,
  "commodityNum": 1,
  "account": "你的手机号"
}

standardId商品id

  • 5元话费            8598
  • 20元京东E卡     8599
  • 100元话费         8600
  • 500元京东E卡    8601
  • 1000元京东E卡  8602

**java代码:**
@Component
@EnableScheduling
public class EkaScheduled {


    @SuppressWarnings("deprecation")
    @Scheduled(cron="58 59 9 * * ?")
    public void sendHeadersAndJSON() {
        String postBody = "{\n" +
                "  \"actId\": \"acctId\",\n" +
                "  \"standardId\": 商品id,\n" +
                "  \"commodityNum\": 1,\n" +
                "  \"account\": \"你的手机号\"\n" +
                "}";
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
                .url("https://hemi.lianhaikeji.com/front/api/createOrder")
                .addHeader("Authorization", "")
                .addHeader("merchantId", "366")
                .post(RequestBody.create(
                        MediaType.parse("application/json; charset=utf-8"),
                        postBody))// post json提交
                .build();
        try {
            for (int i = 0; i < 30; i++) {
                Response response = client.newCall(request).execute();
                if (response.isSuccessful()){
                    System.out.println(response.body().string());
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

springboot完整项目

Q.E.D.

知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

如人饮水、冷暖自知