コード例 #1
0
ファイル: JJKit.cs プロジェクト: kwcode/AutoBetting
        public bool Login(string userName, string pwd, string phone = "1540139107855")
        {
            userName = userName;
            string md5Pwd = Ku.Common.MD5Helper.MD5Encrypt(pwd);

            Ku.Common.HttpHelper http     = new Common.HttpHelper();
            HttpItem             httpItem = new HttpItem();

            httpItem.URL = "http://" + Domain + "/tools/_ajax/login";
            //httpItem.Postdata = "{\"requirement\":[\"OG1K3\"]}";
            httpItem.Postdata = "{\"loginName\":\"" + userName + "\",\"loginPwd\":\"" + md5Pwd + "\",\"validCode\":\"\",\"validateDate\":\"" + phone + "\",\"isdefaultLogin\":true}";

            httpItem.Method      = "POST";
            httpItem.UserAgent   = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36";
            httpItem.Host        = Domain;
            httpItem.Cookie      = Cookie;
            httpItem.ContentType = "application/json";
            httpItem.Referer     = "http://" + Domain + "/login";
            HttpResult   httpRes = http.GetHtml(httpItem);
            string       html    = httpRes.Html;
            JsonUserInfo jsonR   = Util.DeserializeObject <JsonUserInfo>(html);
            string       code    = jsonR.code;

            if (code == "success")
            {
                Cookie    = httpRes.Cookie;
                accountId = jsonR.data.user.userDetail.accountId;
                money     = jsonR.data.user.money;
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
ファイル: UserLoad.cs プロジェクト: wgtinkle/RootSite
    public string UserZone(string userpassport)
    {
        JsonUserInfo userinfo = new JsonUserInfo();

        MySqlConnection conn = new MySqlConnection(sConn);

        conn.Open();

        string query     = "SELECT * FROM dballwithme.userinfo ";
        string qConditon = "where userpassport = " + "'" + userpassport + "'";

        query = query + qConditon;
        MySqlCommand cmd = new MySqlCommand(query, conn);


        MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

        if (reader.HasRows)     //查询到结果
        {
            while (reader.Read())
            {
                userinfo.sId   = reader.GetInt32(0).ToString();
                userinfo.sName = reader.GetString(1);
                userinfo.sAge  = reader.GetString(6);
                userinfo.sHead = reader.GetString(5);
                userinfo.sTag  = reader.GetString(7);
            }
        }

        reader.Close();
        conn.Close();
        return(JavaScriptConvert.SerializeObject(userinfo));
    }
コード例 #3
0
        private int requestMaxFailCount = 3;//请求允许次数

        #region 登陆账号
        public bool Login(string uName, string pwd, string phone = "1540139107855")
        {
            _userName = uName;
            _password = pwd;
            _phone    = phone;

            string md5Pwd = Ku.Common.MD5Helper.MD5Encrypt(pwd);

            Ku.Common.HttpHelper http     = new Common.HttpHelper();
            HttpItem             httpItem = new HttpItem();

            httpItem.URL = "http://" + Domain + "/tools/_ajax/login";
            //httpItem.Postdata = "{\"requirement\":[\"OG1K3\"]}";
            httpItem.Postdata = "{\"loginName\":\"" + _userName + "\",\"loginPwd\":\"" + md5Pwd + "\",\"validCode\":\"\",\"validateDate\":\"" + phone + "\",\"isdefaultLogin\":true}";

            httpItem.Method      = "POST";
            httpItem.UserAgent   = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36";
            httpItem.Host        = Domain;
            httpItem.Cookie      = Cookie;
            httpItem.ContentType = "application/json";
            httpItem.Referer     = "http://" + Domain + "/login";
            HttpResult httpRes = http.GetHtml(httpItem);

            if (httpRes.StatusCode == System.Net.HttpStatusCode.OK)
            {
                requestFailCount = 0;
                string       html  = httpRes.Html;
                JsonUserInfo jsonR = Util.DeserializeObject <JsonUserInfo>(html);
                string       code  = jsonR.code;
                if (code == "success")
                {
                    Cookie    = httpRes.Cookie;
                    accountId = jsonR.data.user.userDetail.accountId;
                    money     = jsonR.data.user.money;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                requestFailCount++;
                LogsRecord.write("接口调用异常", "重新登录,次数=" + requestFailCount + ",异常=" + httpRes.Html);
                if (requestFailCount >= requestMaxFailCount)
                {
                    throw new LogException("请求异常," + httpRes.Html);
                }
                return(Login(uName, pwd, phone));
            }
        }
コード例 #4
0
 public IActionResult GetJsonObject([FromBody] JsonUserInfo jsonUserInfo, [FromServices] IUserInfoService userInfoService)
 {
     return(View());
 }