private void wxagame_bottlereport() { PostDate pd = new PostDate(); pd.base_req.session_id = session_id; pd.base_req.client_info = new ClientInfo(); pd.report_list = new List <ReportList>(); var rp1 = new ReportList(); var rp2 = new ReportList(); rp1.ts = (long)Math.Round((decimal)startTime / 1000); rp1.type = 10; rp2.ts = (long)Math.Round((decimal)endTime / 1000); rp2.type = 2; rp2.duration = rp2.ts - rp1.ts; rp2.best_score = bestscore; rp2.times = times; rp2.score = score; rp2.break_record = score > bestscore ? 1 : 0; pd.report_list.Add(rp1); pd.report_list.Add(rp2); var jSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; string content = JsonConvert.SerializeObject(pd, jSetting); Debug.WriteLine(content); var result = Post("wxagame_bottlereport", content); Debug.WriteLine(result); }
private void wxagame_bottlereport() { PostDate pd = new PostDate(); pd.base_req.session_id = session_id; pd.base_req.client_info = new ClientInfo(); pd.report_list = new List <ReportList>(); var rp1 = new ReportList(); var rp2 = new ReportList(); rp1.ts = (long)Math.Round((decimal)startTime / 1000); rp1.type = 10; rp2.ts = (long)Math.Round((decimal)endTime / 1000); rp2.type = 2; rp2.duration = rp2.ts - rp1.ts; rp2.best_score = bestscore; rp2.times = times; rp2.score = score; rp2.break_record = score > bestscore ? 1 : 0; pd.report_list.Add(rp1); pd.report_list.Add(rp2); var jSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; string content = JsonConvert.SerializeObject(pd, jSetting); Debug.WriteLine(content); var client = new RestClient(base_site + "wxagame_init"); client.UserAgent = USER_AGENT; var request = new RestRequest(Method.POST); request.AddHeader("content-type", "application/json"); request.AddHeader("referer", referer); request.AddParameter("application/json", content, ParameterType.RequestBody); try { IRestResponse response = client.Execute(request); Debug.WriteLine(response.Content); } catch (Exception) { throw; } }