Untitled
user_2299906
plain_text
2 years ago
8.0 kB
12
Indexable
RequestFb request = new RequestFb(job.pro); string gettoken = request.Get("https://business.facebook.com/ads/manager/account_settings/account_billing/").Result; string xref = RandomString(15); string tokeneaai = Regex.Match(gettoken, "access_token:\"(.*?)\"").Groups[1].Value; string session = RandomString(16); string id_tkqc = job.JobData; GridRow row = new GridRow(); row.UID = job.pro.UID; row.PageID = id_tkqc; this.Dispatcher.Invoke(() => { row.ID = DataRow_CheckInfo_TKQC.Count + 1; DataRow_CheckInfo_TKQC.Add(row); }); string getinfo = request.Get($"https://graph.facebook.com/v14.0/act_{id_tkqc}?access_token={tokeneaai}&__cppo=1&_reqName=path%3A%2Fact_{id_tkqc}%3Ffields%3Dname%2Cowner_business%2Ccreated_time%2Cinsights.date_preset(maximum)%7Bspend%7D%2Ccurrency%2Cadtrust_dsl%2Caccount_status%2Cnext_bill_date%2Cadspaymentcycle%7Bthreshold_amount%7D%2Cis_prepay_account%2Ctimezone_offset_hours_utc%2Ctimezone_name%2Cowner%2Cfunding_source_details%2Cusers%7Brole%7D%2Cbalance%26locale%3Den_US&_sessionID={session}&fields=name%2Cowner_business%2Ccreated_time%2Cinsights.date_preset(maximum)%7Bspend%7D%2Ccurrency%2Cadtrust_dsl%2Caccount_status%2Cnext_bill_date%2Cadspaymentcycle%7Bthreshold_amount%7D%2Cis_prepay_account%2Ctimezone_offset_hours_utc%2Ctimezone_name%2Cowner%2Cfunding_source_details%2Cusers%7Brole%7D%2Cbalance&include_headers=false&locale=en_US&method=get&pretty=0&suppress_http_code=1&xref=" + xref).Result; if(string.IsNullOrEmpty(getinfo)|| getinfo.Contains($"act_{id_tkqc}' does not exist")) { return; } string name_tkqc = Regex.Match(getinfo, "\"name\":\"(.*?)\"").Groups[1].Value; if(getinfo.Contains("\"owner_business\":")) row.GroupID = "Bussiness"; else row.GroupID = "Cá nhân thường"; if (!string.IsNullOrEmpty(name_tkqc)) row.PageName = Regex.Unescape(name_tkqc); DateTime date1 = new DateTime(2000, 1, 1); DateTime date = new DateTime(2000, 1, 1); DateTime.TryParse(Regex.Match(getinfo, "created_time\":\"(.*?)\"").Groups[1].Value, out date1); DateTime.TryParse(Regex.Match(getinfo, "next_bill_date\":\"(.*?)\"").Groups[1].Value, out date); row.date = date; row.date1 = date1; string time = Regex.Match(getinfo, "timezone_offset_hours_utc\":(\\d+)").Groups[1].Value; if (string.IsNullOrEmpty(time)) time = "-" + Regex.Match(getinfo, "timezone_offset_hours_utc\":-(\\d+)").Groups[1].Value; row.VideoFile = time + "|"; row.VideoFile += Regex.Match(getinfo, "timezone_name\":\"(.*?)\"").Groups[1].Value; row.VideoFile = Regex.Unescape(row.VideoFile); string active = Regex.Match(getinfo, "account_status\":(\\d+)").Groups[1].Value; if (active.Equals("2")) row.Status1 = "Vô hiệu hóa"; else if (active.Equals("1")) row.Status1 = "Hoạt động"; else if (active.Equals("3")) row.Status1 = "Cần thanh toán"; else row.Status1 = active; string t = Regex.Match(getinfo, "threshold_amount\":(\\d+)").Groups[1].Value; string currency = Regex.Match(getinfo, "currency\":\"(.*?)\"").Groups[1].Value; if (string.IsNullOrEmpty(t)) t = "0"; else if (!t.Equals("0") && !currency.Equals("VND")) t = (t.ToInt(1) / 100).ToString(); row.StoryID = t + " " + currency; string originalValue = Regex.Match(getinfo, "adtrust_dsl\":(\\d+)").Groups[1].Value; row.End = originalValue + " " + currency; string role = Regex.Match(getinfo, "\"role\":(\\d+),\"id\":\"" + job.pro.UID).Groups[1].Value; if (role.Equals("1002")) row.StoryID1 = "Nhà quảng cáo"; else if (role.Equals("1001")) row.StoryID1 = "Quản trị viên"; else row.StoryID1 = role; string balance = Regex.Match(getinfo, "balance\":\"(\\d+)").Groups[1].Value; if (string.IsNullOrEmpty(balance)) balance = "0"; else if (!balance.Equals("0") && !currency.Equals("VND")) balance = (balance.ToInt(1) / 100).ToString(); row.Balance = balance; //get pttt string getpttt = request.GraphApi("&variables={\"paymentAccountID\":\"" + id_tkqc + "\"}&doc_id=5476249835834724").Result; string ptttall = ""; try { dynamic res2 = JsonConvert.DeserializeObject(getpttt); foreach (var node2 in res2.data.billable_account_by_payment_account.billing_payment_account.billing_payment_methods) { string pttt = ""; try { string name = node2.credential?.card_association_name; string digit = node2.credential?.last_four_digits; if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(digit)) continue; string tempnode = node2.ToString(); pttt += "{" + name + " " + digit; if (tempnode.Replace(" ", "").Contains("\"is_primary\":true")) pttt += "|MD|"; else pttt += "|DP|"; if (tempnode.Contains("ADS_PAYMENTS_RESTRICTED")) pttt += "BHC"; else if (tempnode.Contains("USABLE")|| tempnode.Contains("PENDING_ACTIVATION")) pttt += "OK"; else if (tempnode.Contains("UNVERIFIED_OR_PENDING_AUTH") || tempnode.Contains("UNVERIFIABLE") || tempnode.Contains("PENDING_VERIFICATION")) pttt += "XMT"; else pttt += node2.usability;//{Visa 0578|MD|OK} { |DP|UNVERIFIABLE} {Visa 7645|DP|PENDING_VERIFICATION} {Visa 2616|MD|OK} {Visa 1511|DP|PENDING_ACTIVATION} {Visa 1487|DP|PENDING_ACTIVATION} {Visa 8816|DP|PENDING_ACTIVATION} {Visa 3970|DP|BHC} {Visa 3897|DP|PENDING_ACTIVATION} {Visa 8568|MD|OK} { |DP|XMT} pttt += "} "; ptttall += pttt; } catch { } } row.PTTT = ptttall.TrimEnd(','); } catch { }
Editor is loading...