/// <summary> /// 获取Access_token /// </summary> /// <returns></returns> public static string GetAccess_token() { string token = RedisUtil.Instance.Get <string>("token"); if (!string.IsNullOrEmpty(token)) { return(token); } string url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + appSecret; string result = HttpHelp.Get(url); var data = JsonConvert.DeserializeObject <AccessTokenModel>(result); if (data.Errcode == 0) { AccessToken_Time = DateTime.Now.AddSeconds(data.Expires_in); RedisUtil.Instance.Set <string>("token", data.Access_Token, DateTime.Now.AddSeconds(7200)); return(data.Access_Token); } else { string msg = ErrorCode.ReturnErrorMsg(data.Errcode + "") + ", " + data.Errmsg; Common.WriteLog($"GetAccess_token -> { msg }"); throw new Exception(msg); //中断 } }
static async Task GetHistoryOrderTest() { try { HttpHelp httpHelp = new HttpHelp(); string url = host + "/api/v1/gethistoryorder"; GetHistoryOrderInput inputDto = new GetHistoryOrderInput { Symbol = "BTC/VHKD", PageIndex = 1, PageSize = 10, Status = OrderStatus.Cancel }; string input = JsonConvert.SerializeObject(inputDto); var response = httpHelp.HttpPost <OperateMessage <List <GetOrderInfoOutput> > >(url, ApiKey, input, ApiSign.CreateSign(SecretKey, input) ); Console.WriteLine($"code:{response.code}"); Console.WriteLine($"result:{response.result}"); Console.WriteLine($"data:{response.data.ToJson()}"); } catch (Exception ex) { Console.WriteLine($"{nameof(GetTickerTest)}出错:{ex.Message}"); } }
static async Task GetWithdrawInfoTest() { try { HttpHelp httpHelp = new HttpHelp(); string url = host + "/api/v1/getwithdrawinfo"; WithdrawinfoInput inputDto = new WithdrawinfoInput { Symbol = "VHKD", WithdrawID = "VBssvPs5ayEzYMfBxVN3Ux2uGzgBBVBR2S" }; string input = JsonConvert.SerializeObject(inputDto); var response = httpHelp.HttpPost <OperateMessage <GetWithdrawInfoOutput> >(url, ApiKey, input, ApiSign.CreateSign(SecretKey, input) ); Console.WriteLine($"code:{response.code}"); Console.WriteLine($"result:{response.result}"); Console.WriteLine($"data:{response.data.ToJson()}"); } catch (Exception ex) { Console.WriteLine($"{nameof(GetWithdrawInfoTest)}出错:{ex.Message}"); } }
public string GetBusInfo(string line) { string apiUr = $"http://47.99.211.28:8088/Bus/{line}"; string result = HttpHelp.Get(apiUr); return(result); }
static async Task GetKLineTest() { try { HttpHelp httpHelp = new HttpHelp(); GetKLineInput inputDto = new GetKLineInput { Symbol = "BTC/VHKD", Since = 1528359729, Size = 100, Type = "5min" }; string url = host + "/api/v1/getkline"; string input = JsonConvert.SerializeObject(inputDto); var response = httpHelp.HttpPost <OperateMessage <IEnumerable <GetKLineOutput> > >(url, ApiKey, input, ApiSign.CreateSign(SecretKey, input) ); Console.WriteLine($"code:{response.code}"); Console.WriteLine($"result:{response.result}"); Console.WriteLine($"data:{response.data.ToJson()}"); } catch (Exception ex) { Console.WriteLine($"{nameof(GetTradesTest)}出错:{ex.Message}"); } }
public ActionResult AdminLogin(string User, string Pwd) { if (string.IsNullOrEmpty(User) || string.IsNullOrEmpty(Pwd)) { return(View()); } #region 登录验证 int logStatus = 2; if (!CurrenUserInfo.IsNull() && CurrenUserInfo.UserAccount.IsNotNull()) { ViewBag.UserName = CurrenUserInfo; logStatus = 1; } else if (User.IsNotNull() && Pwd.IsNotNull()) { var result = HttpHelp.Post <S_UserInfo, KeyValuePair <string, string> >(ActionEnum.Login, new KeyValuePair <string, string>(User, Pwd)); if (result != null) { Session["S_UserInfo"] = result; ViewBag.UserName = result; logStatus = 1; } } return(this.Json(logStatus, JsonRequestBehavior.AllowGet)); #endregion }
public bool SaveAreaInfo() { if (string.IsNullOrEmpty(NameEdit.Text) || string.IsNullOrEmpty(CurrencyEdit.Text) || string.IsNullOrEmpty(MultipleEdit.Text) || string.IsNullOrEmpty(ShortCurrencyEdit.Text) || string.IsNullOrEmpty(IDEdit.Text) ) { MessageBox.Show("有些事情,你不能空着的", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return(false); } var query = new Dictionary <string, string>(); query["gameID"] = NameEdit.Text; query["gameName"] = NameEdit.Text; query["currency"] = CurrencyEdit.Text; query["multiple"] = MultipleEdit.Text; query["gameWord"] = ShortCurrencyEdit.Text; query["agentsID"] = "0"; query["isRelease"] = string.Format("{0}", EnabledBox.SelectedIndex != 0 ? false : true); query["releaseDate"] = DateTime.Now.ToString(); query["payStyle"] = PayEdit.Text; query["SocketServer"] = ProxyEdit.Text; query["SocketPort"] = ProtEdit.Text; string queryString = HttpUtils.BuildPostParams(query); string Url = HttpHelp.getInst().URL + "/DirService.asmx/AddGameNew"; HttpHelp.getInst().httpPost(Url, queryString, Encoding.UTF8); return(true); }
/// <summary> /// 微信转账 /// </summary> /// <param name="request">请求</param> /// <param name="config">配置</param> /// <returns>结果</returns> public static TransfersResult Transfers(TransfersRequest request, Config config) { TransfersResult result = new TransfersResult(); TransfersQueryRequest transfersQueryRequest = new TransfersQueryRequest { PartnerTradeNo = request.PartnerTradeNo }; TransfersQueryResult transfersQueryResult = TransfersQuery(transfersQueryRequest, config); if (transfersQueryResult.Status == TransfersStatus.Success) { result.IsSuccess = TransfersStatus.Success; return(result); } if (transfersQueryResult.Status == TransfersStatus.Processing) { result.IsSuccess = TransfersStatus.Processing; return(result); } var requestStr = TenpayUtil.GetTransfersRequestXml(request, config); var response = HttpHelp.PostXmlToUrl(Config.TransfersUrl, requestStr, config.GetTransfersCertPath(), config.GetPid()); result = TenpayUtil.ConvertToTransfersResult(response); return(result); }
public static BaseResult GetResult(string url, Dictionary <string, string> dir) { string info_json = JSON.Serialize(dir); string data = AESUtil.Encrypt(info_json, Config.AescKey); string postParams = "data=" + data + "&customernumber=" + Config.merchantAccount; BaseResult ybResult = HttpHelp.HttpPost(url, postParams); dynamic result = null; if (ybResult.Success) { RespondJson respJson = JSON.Deserialize <RespondJson>(ybResult.Data.ToString()); if (respJson.data != null) { result = JSON.Deserialize <T>(AESUtil.Decrypt(respJson.data, Config.AescKey)); } else { result = JSON.Deserialize <FailJson>(ybResult.Data.ToString()); } ybResult.Success = true; ybResult.Data = result; return(ybResult); } return(ybResult); }
private static JObject getOpenid() { JObject result = new JObject(); string openid = HttpContext.Current.Request.QueryString["idweixin"]; result["openid"] = ""; result["access_token"] = ""; string code = HttpContext.Current.Request.QueryString["code"]; if (!string.IsNullOrWhiteSpace(code)) { string url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + Pub.appid + "&secret=" + Pub.secret + "&code=" + code + "&grant_type=authorization_code"; string data = HttpHelp.Get(url); if (!string.IsNullOrWhiteSpace(data)) { JObject json = JObject.Parse(data); if (json != null) { openid = json["openid"] + ""; string access_token = json["access_token"] + ""; if (!string.IsNullOrWhiteSpace(openid) && !string.IsNullOrWhiteSpace(access_token)) { result["openid"] = openid; result["access_token"] = access_token; } } } } else { result["openid"] = openid; } return(result); }
/// <summary> /// 获取openId /// </summary> /// <param name="request">请求参数</param> /// <param name="config">配置</param> /// <returns>结果</returns> public static string GetOpenidFromCode(OpenidFromCodeRequest request, Config config) { var url = TenpayUtil.GetOpenidFromCodeUrl(request, config); var data = HttpHelp.GetUrl(url); return(data); }
/// <summary> /// 处方上传 /// </summary> /// <returns></returns> public ApiJsonResultData PrescriptionUpload(PrescriptionUploadWebParam param, HisBaseParam baseParam) { //选择性上次 var resultData = new ApiJsonResultData(); if (param.BusinessIdDetailList != null && param.BusinessIdDetailList.Any()) { var queryParam = new InpatientInfoDetailQueryBasiclevelParam(); queryParam.IdList = param.BusinessIdDetailList; var resultSaveData = HttpHelp.HttpPost(Logs.ToJson(queryParam), "InpatientInfoDetailQuery", new List <OutpatientDetailQueryBasiclevelDto>()); if (resultSaveData.Any()) { var uploadData = resultSaveData.OrderBy(c => c.Id).ToList(); var uploadParam = new PrescriptionUploadParam(); uploadParam.PI_ZHY = param.PI_ZHY; uploadParam.PI_JBR = baseParam.EmpIDCode; uploadParam.CFMX = uploadData.Select(c => new PrescriptionUploadCFMX() { CO = "0", AKA072 = "0", AKC229 = "0" }).ToList(); } } return(resultData); }
private void txtShlefLab_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { try { // 获取灯信息 var storageLocationDto = HttpHelp.GetAbp <StorageLocationDto>("/api/services/app/StorageLocation/Get?Id=" + txtShlefLab.Text, null).Result; // 亮灯暂时未添加 HttpHelp.Post <LightMsg>(lightSer + "/api/Light/LightOrder", new StorageLight[] { new StorageLight() { ContinuedTime = 10, LightColor = lightIsRGB? LightColor.Green:LightColor.Default, LightOrder = 2, MainBoardId = storageLocationDto.MainBoardId, RackPositionId = storageLocationDto.PositionId } }); txtBarCode.Focus(); txtBarCode.SelectAll(); } catch (Exception ex) { txtShlefLab.Focus(); txtShlefLab.SelectAll(); WinCEUtils.FormHelp.SetTsLab(txtmag, "输入库位标签不合法" + ex.Message, new List <string>() { "Fail" }, Color.Red); } } }
public frmReelMove(ReelMoveMethodDto reelMoveMethod) { _reelMoveMethod = reelMoveMethod; // 获取货架类型 var setting = HttpHelp.PostAbp <List <SettingValue> >("/api/services/app/Configuration/GetAppConfig", new List <string>() { "lightIsRGB" }).Result; if (setting.Count != 0 && setting[0].Value == "1") { lightIsRGB = true; } InitializeComponent(); if (!_reelMoveMethod.AllocationTypes.Contains(AllocationType.OnSL)) { this.panKW.Visible = false; } if (!_reelMoveMethod.AllocationTypes.Contains(AllocationType.Received)) { panReceiveds.Visible = false; IsLineReturn = true; } if (_reelMoveMethod.AllocationTypes.Contains(AllocationType.UpByShelf)) { labReel.Text = "库位标签"; } txtQty.Text = "0"; }
private void GUI_login_Click(object sender, EventArgs e) { if (GUI_login.Text == "登录") { while (HttpHelp.Network() == null) { var result = MessageBox.Show("网路连接失败请重试", "ERROR", MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (result == DialogResult.No) { return; } } FormLogin login = new FormLogin(); login.ShowDialog(); // load(); } else { Global.clear(); lvkb.Clear(); GUI_tips.Text = "你当前已退出"; //load(); } load(); }
protected int IsIns(string filePath) { string json = "{\"type\":\"select\", \"file\":\"" + filePath + "\",\"id\":0}"; json = json.Replace("\\", "/"); string url = string.Format("http://127.0.0.1:5478/?json={0}", HttpUtility.UrlEncode(json)); string str = HttpHelp.Get(url); JsonData DataList = JsonMapper.ToObject(str); string state = DataList["state"].ToString(); if (state == "true") { int FaceID = (int)DataList["returnid"]; if (FaceID > 0) { Face condition = new Face(); condition.ID = FaceID; Face user = TableOperate <Face> .GetRowData(condition); if (user.UserinfoID > 0) { return(user.UserinfoID); } } } return(0); }
private void Del() { string str = ""; Userinfo condition = new Userinfo(); condition.State = 0; Userinfo value = new Userinfo(); List <Userinfo> list = TableOperate <Userinfo> .Select(value, condition); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { str += list[i].ID + ","; } if (str != "") { str = str.Trim(','); string sql1 = " Delete UserFaceTime where UserID in (" + str + ") "; TableOperate <UserFaceTime> .Execute(sql1); string sql2 = " Delete Userinfo where State=0 "; TableOperate <Userinfo> .Execute(sql2); string sql3 = " Delete Face where UserinfoID in (“+str+”) "; TableOperate <Face> .Execute(sql3); string url = "http://127.0.0.1:5477/?json=restart"; HttpHelp.Get(url); } } }
// GET: Admin/Home public ActionResult Index() { try { base.UserCheck(); if (CurrenUserInfo.IsNotNull()) { ViewBag.UserName = CurrenUserInfo; var menuLIst = HttpHelp.Post <List <S_Menu>, string>(ActionEnum.GetMenuList, null); var result = HttpHelp.Post <List <UrlType>, string>(ActionEnum.GetHomePageCount, null); ViewBag.CountTool = result; ViewBag.menu = menuLIst; var menuType = menuLIst.Select(n => n.Types).Distinct(); ViewBag.menuType = menuType; } else { return(Redirect("../Admin/User/Login")); } } catch (Exception ex) { LogHelper.AddLog(ex); } return(View()); }
public IActionResult login() { string loginUrl = "http://m.tnblog.net/api/v2/Login/cz/123456"; var oo = HttpHelp.Get(loginUrl); return(Json(oo)); }
public override bool AuthorizeHubConnection(HubDescriptor hubDescriptor, IRequest request) { bool flag = false; string uid = request.QueryString.Get("uid"); string token = request.QueryString.Get("token"); if (string.IsNullOrWhiteSpace(uid)) { return(flag); } //token 验证 if (!string.IsNullOrWhiteSpace(token) && Tool.MD5Check(uid, token)) { flag = true; } else { //接口验证 HttpRequestItem req = new HttpRequestItem() { URL = Constant.AuthenUrl, Postdata = string.Format("uid={0}", uid) }; string resData = HttpHelp.SendHttpRequest(req); if (!string.IsNullOrWhiteSpace(resData)) { HttpResponseItem res = JsonUtil <HttpResponseItem> .Deserialize(resData); flag = res.AckCode == ResultAckCodeEnum.Success && res.ResultCode == 1; } } return(flag ? base.AuthorizeHubConnection(hubDescriptor, request) : false); }
public async Task <ResultBean <IList <NewsListBean> > > GetNewsList(long time, string type) { string key = "ff3460eb96b32f8dca051ae1248a2e8a"; string result = await HttpHelp.getInstance().Get("http://v.juhe.cn/toutiao/index?type=" + type + "&key=" + key); NewsResultBean resultBean = JsonHelp.FromJson <NewsResultBean>(result); logger.info("GetNewsList - " + time + ", " + resultBean.error_code + ", " + resultBean.reason); ResultBean <IList <NewsListBean> > rb = new ResultBean <IList <NewsListBean> >(); if (resultBean != null && resultBean.result != null && resultBean.result.data != null) { rb.Success = true; rb.Message = "请求成功"; rb.Data = resultBean.result.data; foreach (NewsListBean b in rb.Data) { b.image = b.thumbnail_pic_s; } } else { rb.Success = false; rb.Message = "请求失败"; } return(rb); }
private void SaveBut_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(IDEdit.Text) || string.IsNullOrEmpty(NameEdit.Text) || string.IsNullOrEmpty(TargetId.Text) || string.IsNullOrEmpty(Weight.Text) || string.IsNullOrEmpty(IntranetAddress.Text) || string.IsNullOrEmpty(BaseUrl.Text) ) { MessageBox.Show("有些事情,你不能空着的", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); return; } var query = new Dictionary <string, string>(); string queryString; string Url; if (editType == CommandMode.Insert) { query["serverID"] = IDEdit.Text; query["gameID"] = GameId.ToString(); query["serverName"] = NameEdit.Text; query["serverUrl"] = BaseUrl.Text; query["status"] = string.Format("{0}", Status.SelectedIndex); query["intranetAddress"] = IntranetAddress.Text; queryString = HttpUtils.BuildPostParams(query); Url = HttpHelp.getInst().URL + "/DirService.asmx/AddServer"; HttpHelp.getInst().httpPost(Url, queryString, Encoding.UTF8); } else { query["serverID"] = IDEdit.Text; query["gameID"] = GameId.ToString(); query["serverName"] = NameEdit.Text; query["serverUrl"] = BaseUrl.Text; query["status"] = string.Format("{0}", Status.SelectedIndex); query["weight"] = Weight.Text; query["intranetAddress"] = IntranetAddress.Text; queryString = HttpUtils.BuildPostParams(query); Url = HttpHelp.getInst().URL + "/DirService.asmx/SetServer"; HttpHelp.getInst().httpPost(Url, queryString, Encoding.UTF8); } //还要设置是否开启 query.Clear(); query["serverID"] = IDEdit.Text; query["gameID"] = GameId.ToString(); query["isEnable"] = string.Format("{0}", EnabledBox.SelectedIndex != 0 ? true : false); queryString = HttpUtils.BuildPostParams(query); Url = HttpHelp.getInst().URL + "/DirService.asmx/EnableServer"; HttpHelp.getInst().httpPost(Url, queryString, Encoding.UTF8); //开启时间 query.Clear(); query["serverID"] = IDEdit.Text; query["gameID"] = GameId.ToString(); query["enableDate"] = tpStartDate.Text; queryString = HttpUtils.BuildPostParams(query); Url = HttpHelp.getInst().URL + "/DirService.asmx/SetServerEnableDate"; HttpHelp.getInst().httpPost(Url, queryString, Encoding.UTF8); Close(); }
public string GetYYS(string ss) { string apiUr = $"http://47.99.211.28:8088/YYS/{ss}"; string result = HttpHelp.Get(apiUr); return(result); }
public ActionResult UpadateValue(string Id, string Value, int type) { string result = string.Empty; var entity = HttpHelp.Post <U_Url_List, dynamic>(ActionEnum.Find_Url, new { Id = Id }); if (entity.IsNotNull()) { entity.Id = Id; entity.LastUpdate_Id = CurrenUserInfo.UserAccount; entity.LastUpdate_Time = GetStr.GetCurrentDate; switch (type) { case 1: entity.SortDesc = Convert.ToInt32(Value); break; case 2: entity.Name = Value; break; case 3: entity.Url = Value; break; case 4: entity.Source = Value; break; case 5: entity.Title = Value; break; } result = HttpHelp.Post <string, U_Url_List>(ActionEnum.UpadateValue, entity); } return(this.Json(result, JsonRequestBehavior.AllowGet)); }
static async Task TradeTest() { try { HttpHelp httpHelp = new HttpHelp(); string url = host + "/api/v1/trade"; SendOrderInput inputDto = new SendOrderInput { Symbol = "BTC/VHKD", Size = 1, Side = TradeSide.BUY, Price = (decimal)1, Type = OrderType.Limit }; string input = JsonConvert.SerializeObject(inputDto); var response = httpHelp.HttpPost <OperateMessage <TradeOutput> >(url, ApiKey, input, ApiSign.CreateSign(SecretKey, input) ); Console.WriteLine($"code:{response.code}"); Console.WriteLine($"result:{response.result}"); Console.WriteLine($"data:{response.data.ToJson()}"); } catch (Exception ex) { Console.WriteLine($"{nameof(GetTickerTest)}出错:{ex.Message}"); } }
public string Report(int limit, int offset, string pare, string starTime, string endTime) { var p = new { method = Request.QueryString["method"].ToLower(), limit = limit, offset = offset, pare = pare, starTime = starTime, endTime = endTime }; var result = HttpHelp.Post <dynamic>(ActionEnum.Report, p); return(result); }
static async Task Cancel_WithdrawTest() { try { HttpHelp httpHelp = new HttpHelp(); string url = host + "/api/v1/cancel_withdraw"; CancelWithdrawInput inputDto = new CancelWithdrawInput { Symbol = "VHKD", WithdrawID = "XXXXXX" }; string input = JsonConvert.SerializeObject(inputDto); var response = httpHelp.HttpPost <OperateMessage <bool> >(url, ApiKey, input, ApiSign.CreateSign(SecretKey, input) ); Console.WriteLine($"code:{response.code}"); Console.WriteLine($"result:{response.result}"); Console.WriteLine($"data:{response.data.ToString()}"); } catch (Exception ex) { Console.WriteLine($"{nameof(GetTickerTest)}出错:{ex.Message}"); } }
public ActionResult WebSiteSecurityCheck() { var result = HttpHelp.Post <string, dynamic>(ActionEnum.PerformTask, new { method = "web" }); Thread.Sleep(1000 * 6); return(this.Json("执行成功", JsonRequestBehavior.AllowGet)); }
static async Task GetDepthTest() { try { HttpHelp httpHelp = new HttpHelp(); GetDepthInput inputDto = new GetDepthInput { Symbol = "BTC/VHKD" }; string url = host + "/api/v1/getdepth"; string input = JsonConvert.SerializeObject(inputDto); var response = httpHelp.HttpPost <OperateMessage <GetDepthOutput> >(url, ApiKey, input, ApiSign.CreateSign(SecretKey, input) ); Console.WriteLine($"code:{response.code}"); Console.WriteLine($"result:{response.result}"); Console.WriteLine($"data:{response.ToJson()}"); } catch (Exception ex) { Console.WriteLine($"{nameof(GetDepthTest)}出错:{ex.Message}"); } }
public string Test() { if (!WriteRecruit(@"http://www.shiyebian.net/zhejiang/jiaxing/")) { return("false"); } string str = HttpHelp.DownLoadString(@"http://www.shiyebian.net/zhejiang/jiaxing/"); HtmlDocument htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(str); if (htmlDoc.DocumentNode.SelectSingleNode("//div[@class='fenye']") == null) { return("false"); } HtmlNodeCollection liNodes2 = htmlDoc.DocumentNode.SelectSingleNode("//div[@class='fenye']").SelectNodes("a"); if (liNodes2 != null && liNodes2.Count > 0) { for (int i = 0; i < liNodes2.Count; i++) { if (string.IsNullOrEmpty(liNodes2[i].GetAttributeValue("href", ""))) { continue; } string href = liNodes2[i].GetAttributeValue("href", "").Trim(); WriteRecruit(href); } } return("true"); }