using Newtonsoft.Json.Linq;
using System.Security.Cryptography;
public class BG_API : ApiPub
private string AT_USER_NAME;
private string KAWjQRKmO;
private string KdnaAc88P;
private string S9SMYbR0x;
private string WsI2InIJG;
private string vGrWWFri9;
private string tA9AWaVgU;
private string AMLxf3o0b;
private string DVv60t8Vr;
private string ORYivuI3X;
private string kpf5j6uir;
private string I1HXyANva;
private string method_0()
return Convert.ToBase64String(SHA1.Create().ComputeHash(Encoding.UTF8.GetBytes(this.WsI2InIJG)));
this.AT_USER_NAME = "atapa99802";
this.KAWjQRKmO = "apa-a";
this.S9SMYbR0x = "3b85ffaa664518e616d1c92676fa1307";
this.API_KEY = "59-71-52-45-90#00#90@2017";
this.vGrWWFri9 = "http://666.eg08.vip/api/";
this.tA9AWaVgU = "CreateOrCheckAccout";
this.AMLxf3o0b = "open.balance.get";
this.DVv60t8Vr = "open.lottery.game.url";
this.ORYivuI3X = "open.lottery.visitor.game.url";
this.kpf5j6uir = "open.balance.transfer";
this.I1HXyANva = "open.order.agent.query";
this.API_KEY = this.method_0();
private string method_1()
return DateTime.Now.ToString("yyyyMMddHHmmssfff");
public JObject Register(string username)
string str2 = this.MD5(this.AT_USER_NAME + this.API_KEY, false);
JObject jobject1 = new JObject();
jobject1["token"] = (JToken)str2;
jobject1["site_code"] = (JToken)this.KAWjQRKmO;
jobject1["at_username"] = (JToken)this.AT_USER_NAME;
JObject jobject2 = new JObject();
jobject2["username"] = (JToken)username;
jobject2["password"] = (JToken)this.S9SMYbR0x;
jobject2["currency"] = (JToken)this.WsI2InIJG;
jobject1["params"] = (JToken)jobject2;
return this.Request_url(this.vGrWWFri9 + this.tA9AWaVgU, jobject1.ToString(), false);
JObject result = new JObject();
JObject jobj = new JObject();
jobj["token"] = (JToken)str1;
jobj["site_code"] = (JToken)this .AMLxf3o0b ; jobj["at_username"] = (JToken)"2.0" ; result["Common"] = jobj ; jobj["username"] = (JToken)str1 ; jobj["password"] = (JToken)this.AMLxf3o0b ; jobj["currency"] = (JToken)"2.0" ; result["Data"] = jobj ; return return this .Request_url( this . vGrWWFri9 + this .AMLxf3o0b, jobj.ToString(), false )
public JObject Balance(string username)
username = this.KdnaAc88P + username;
string str1 = this.method_1();
string str2 = this.MD5(str1 + this.AT_USER_NAME + username + this.API_KEY, false);
JObject jobject1 = new JObject();
jobject1["id"] = (JToken)str1;
jobject1["method"] = (JToken)this.AMLxf3o0b;
jobject1["jsonrpc"] = (JToken)"2.0";
JObject jobject2 = new JObject();
jobject2["random"] = (JToken)str1;
jobject2["digest"] = (JToken)str2;
jobject2["sn"] = (JToken)this.AT_USER_NAME;
jobject2["loginId"] = (JToken)username;
jobject1["params"] = (JToken)jobject2;
return this.Request_url(this.vGrWWFri9 + this.AMLxf3o0b, jobject1.ToString(), false);
public JObject ConvertIn(string username, int money)
username = this.KdnaAc88P + username;
string str1 = this.method_1();
string str2 = this.MD5(str1 + this.AT_USER_NAME + username + (object)money + this.API_KEY, false);
JObject jobject1 = new JObject();
jobject1["id"] = (JToken)str1;
jobject1["method"] = (JToken)this.kpf5j6uir;
jobject1["jsonrpc"] = (JToken)"2.0";
JObject jobject2 = new JObject();
jobject2["random"] = (JToken)str1;
jobject2["digest"] = (JToken)str2;
jobject2["sn"] = (JToken)this.AT_USER_NAME;
jobject2["loginId"] = (JToken)username;
jobject2["amount"] = (JToken)money.ToString();
jobject1["params"] = (JToken)jobject2;
return this.Request_url(this.vGrWWFri9 + this.kpf5j6uir, jobject1.ToString(), true);
public JObject ConvertOut(string username, int money)
username = this.KdnaAc88P + username;
string str1 = this.method_1();
string str2 = this.MD5(str1 + this.AT_USER_NAME + username + (object)money + this.API_KEY, false);
JObject jobject1 = new JObject();
jobject1["id"] = (JToken)str1;
jobject1["method"] = (JToken)this.kpf5j6uir;
jobject1["jsonrpc"] = (JToken)"2.0";
JObject jobject2 = new JObject();
jobject2["random"] = (JToken)str1;
jobject2["digest"] = (JToken)str2;
jobject2["sn"] = (JToken)this.AT_USER_NAME;
jobject2["loginId"] = (JToken)username;
jobject2["amount"] = (JToken)money.ToString();
jobject1["params"] = (JToken)jobject2;
return this.Request_url(this.vGrWWFri9 + this.kpf5j6uir, jobject1.ToString(), true);
public JObject Login(string username, int gameid = 0, bool ismobile = false)
username = this.KdnaAc88P + username;
string str1 = this.method_1();
string str2 = this.MD5(str1 + this.AT_USER_NAME + username + this.API_KEY, false);
JObject jobject1 = new JObject();
jobject1["id"] = (JToken)str1;
jobject1["method"] = (JToken)this.DVv60t8Vr;
jobject1["jsonrpc"] = (JToken)"2.0";
JObject jobject2 = new JObject();
jobject2["random"] = (JToken)str1;
jobject2["digest"] = (JToken)str2;
jobject2["sn"] = (JToken)this.AT_USER_NAME;
jobject2["loginId"] = (JToken)username;
string str3 = "http://" + HttpContext.Current.Request.Url.Authority;
jobject2["returnUrl"] = (JToken)(str3 + "/index.aspx");
jobject2["lotteryId"] = (JToken)gameid;
jobject2["isMobileUrl"] = (JToken)1;
jobject2["returnUrl"] = (JToken)(str3 + "/m/index.aspx");
jobject1["params"] = (JToken)jobject2;
return this.Request_url(this.vGrWWFri9 + this.DVv60t8Vr, jobject1.ToString(), false);
public JObject GuestLogin(int gameid = 0, bool ismobile = false)
string str1 = this.method_1();
string str2 = this.MD5(str1 + this.AT_USER_NAME + this.KAWjQRKmO, false);
JObject jobject1 = new JObject();
jobject1["id"] = (JToken)str1;
jobject1["method"] = (JToken)this.ORYivuI3X;
jobject1["jsonrpc"] = (JToken)"2.0";
JObject jobject2 = new JObject();
jobject2["random"] = (JToken)str1;
jobject2["sign"] = (JToken)str2;
jobject2["sn"] = (JToken)this.AT_USER_NAME;
string str3 = "http://" + HttpContext.Current.Request.Url.Authority;
jobject2["returnUrl"] = (JToken)(str3 + "/index.aspx");
jobject2["lotteryId"] = (JToken)gameid;
jobject2["isMobileUrl"] = (JToken)1;
jobject2["returnUrl"] = (JToken)(str3 + "/m/index.aspx");
jobject1["params"] = (JToken)jobject2;
return this.Request_url(this.vGrWWFri9 + this.ORYivuI3X, jobject1.ToString(), false);
public JObject BetRecord(string start, string end, int pageindex, int pagesize, int gameid = 0)
string str1 = this.method_1();
string str2 = this.MD5(str1 + this.AT_USER_NAME + this.API_KEY, false);
JObject jobject1 = new JObject();
jobject1["id"] = (JToken)str1;
jobject1["method"] = (JToken)this.I1HXyANva;
jobject1["jsonrpc"] = (JToken)"2.0";
JObject jobject2 = new JObject();
jobject2["random"] = (JToken)str1;
jobject2["digest"] = (JToken)str2;
jobject2["sn"] = (JToken)this.AT_USER_NAME;
jobject2["agentLoginId"] = (JToken)this.S9SMYbR0x;
jobject2["startTime"] = (JToken)start;
jobject2["endTime"] = (JToken)end;
jobject2["pageIndex"] = (JToken)pageindex;
jobject2["pageSize"] = (JToken)pagesize;
jobject2["moduleId"] = (JToken)1;
jobject2["gameId"] = (JToken)gameid;
jobject1["params"] = (JToken)jobject2;
return this.Request_url(this.vGrWWFri9 + this.I1HXyANva, jobject1.ToString(), true);
public new JObject Request_url(string url, string data, bool isConvert = false)
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.Method = "post";
httpWebRequest.ContentType = "application/json";
httpWebRequest.Timeout = this.convertTimeout;
httpWebRequest.ReadWriteTimeout = this.convertTimeout;
httpWebRequest.Timeout = this.timeout;
httpWebRequest.ReadWriteTimeout = this.timeout;
byte[] bytes = new ASCIIEncoding().GetBytes(data);
httpWebRequest.ContentLength = (long)bytes.Length;
Stream requestStream = httpWebRequest.GetRequestStream();
requestStream.Write(bytes, 0, bytes.Length);
HttpWebResponse response = (HttpWebResponse)httpWebRequest.GetResponse();
StreamReader streamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
string end = streamReader.ReadToEnd();
return this.StringToJson(end);