Пример #1
0
        /// <summary>
        /// 获取某一天的壁纸(每天8张)
        /// </summary>
        /// <param name="day"></param>
        /// <returns></returns>
        public static WallpaperWebModel GetSomeday(int day)
        {
            WallpaperWebModel model = null;

            try
            {
                string rs = HttpTool.Get(string.Format(URL, day));
                model = Json.String2Object <WallpaperWebModel>(rs);
                return(model);
            }
            catch (Exception e) { return(null); }
        }
Пример #2
0
        /// <summary>
        /// 請求站內付SP_Token
        /// </summary>
        /// <returns>站內付API回傳結果</returns>
        public string Excute()
        {
            HttpTool http = new HttpTool();

            //設置參數
            SetParamter();
            string ParameterString = _paraHelper.DictionaryToParamter(PostCollection).Replace("+", "%2B");

            string Result = http.DoRequestStrData(ServiceURL, ParameterString);


            return(Result);
        }
        public void NotFoundErrorAfterGetWrongCollectionRequest()
        {
            string collection = "WrongCollection";
            var    client     = HttpTool.CreateClient(BaseAddressUri, AcceptHeader);

            AddCleanupAction(() => client.Dispose());

            var uriRequestGet = $"api/{collection}/";

            var httpResponseMessageGet = HttpTool.MakeRequestToServer(client, HttpMethod.Get, uriRequestGet, toValidateStatusCode: false);

            Assert.AreEqual(HttpStatusCode.NotFound, httpResponseMessageGet.StatusCode, "\"Not Found\" message should be in HttpResponseMessage!");
        }
Пример #4
0
        public static void ReadFromWeb()
        {
            Frisbee = HttpTool.Get <Frisbee[]>(ServerUrl);
            if (ListTool.IsNullOrEmpty(Frisbee))
            {
                R.Log.e("从服务器读取配置失败 准备第二次尝试");
                Frisbee = HttpTool.Get <Frisbee[]>(ServerUrl);

                if (ListTool.IsNullOrEmpty(Frisbee))
                {
                    R.Log.e("从服务器读取配置失败 准备第三次尝试");
                    Frisbee = HttpTool.Get <Frisbee[]>(ServerUrl);
                }
            }
        }
Пример #5
0
 public static GPSInfoWebModel GetInfo(string ak, double longitude, double latitude)
 {
     try
     {
         string          url = $"http://api.map.baidu.com/geocoder/v2/?location={latitude},{longitude}&coordtype=wgs84ll&output=json&ak={ak}";
         string          rs  = HttpTool.Get(url);
         GPSInfoWebModel obj = Json.String2Object <GPSInfoWebModel>(rs);
         if (obj != null)
         {
             return(obj);
         }
     }
     catch { }
     return(null);
 }
Пример #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.Form["flag"] != null)
         {
             string tag      = Request.Form["flag"];
             string date     = Request.Form["parameter1"];
             string url      = webApiUrl + "";
             string time     = DateTime.Now.ToString("yyyyMMddHHmmssfff");
             string data     = HttpTool.Post(url, "", time);//url请求得到数据
             String palletno = Server.UrlDecode(Request.Form["PalletList"]);
         }
     }
 }
Пример #7
0
        internal static List <USBVendorModel> GetByWeb()
        {
            try
            {
                string   s     = HttpTool.Get("http://www.linux-usb.org/usb.ids");
                string[] lines = s.Split('\n');
                if (Ls.Ok(lines))
                {
                    List <USBVendorModel> list         = new List <USBVendorModel>();
                    List <string>         vendor_lines = new List <string>();

                    foreach (var l in lines)
                    {
                        if (l.StartsWith("#"))
                        {
                            continue;
                        }
                        if (!Str.Ok(l.Trim()))
                        {
                            continue;
                        }

                        if (!l.StartsWith("\t") && vendor_lines.Count() > 0)
                        {
                            var model = USBVendorModel.String2Model(vendor_lines);
                            if (model != null)
                            {
                                list.Add(model);
                                if (model.VendorID == "FFEE")
                                {
                                    break;
                                }
                                vendor_lines = new List <string>();
                            }
                        }

                        vendor_lines.Add(l);
                    }

                    if (Ls.Ok(list))
                    {
                        return(list);
                    }
                }
            }
            catch { }
            return(null);
        }
Пример #8
0
        public virtual string ExcuteApi(TModel model)
        {
            //建立所需參數
            string result   = string.Empty;
            string postData = string.Empty;
            string posturl  = GetApiURL();

            //取得加密後的參數
            postData = GetInvoiceParamter(SetParamter(model));

            ServicePointManager.ServerCertificateValidationCallback
                   = HttpTool.ValidateServerCertificate;
            result = HttpTool.HttpPost(posturl, postData);

            return(result);
        }
Пример #9
0
        /// <summary>
        ///  send the request
        /// </summary>
        /// <typeparam name="T">the response the request return</typeparam>
        /// <param name="httpRequest">the request you want to send</param>
        /// <returns></returns>
        public T SendRequest <T>(AbstractRequest <T> httpRequest) where T : BaseResponse
        {
            auth.GetTokenAndProjectId(out string projectId, out string authToken);
            AddCommonHeaders(httpRequest, authToken, projectId);
            httpRequest.SmnConfiguration    = smnConfiguration;
            httpRequest.ClientConfiguration = clientConfiguration;
            httpRequest.ProjectId           = projectId;
            HttpWebResponse response = HttpTool.GetHttpResponse(httpRequest, this.clientConfiguration);

            if (HttpTool.IsNoPermission(response))
            {
                // if no permission to clear the cache
                CleanToken();
            }
            return(httpRequest.GetResponse(response));
        }
        // For FakeServer
        public void ResponseContainsCollectionsAfterRequestListOfAllCollections()
        {
            string uriRequest          = $"api";
            var    expectedCollections = new List <string> {
                "users", "movies", "families"
            };

            var client = HttpTool.CreateClient(BaseAddressUri, AcceptHeader);

            AddCleanupAction(() => client.Dispose());
            var httpResponseMessage = HttpTool.MakeRequestToServer(client, HttpMethod.Get, uriRequest);
            var collections         = HttpTool.DeserializeFromResponseMessage <List <string> >(httpResponseMessage);

            Assert.IsTrue(collections.DoesIncludeList(expectedCollections), $"Not all expected collections were found in the Response!\nExpected: {string.Join(", ", expectedCollections.ToArray())}");
            collections.PrintAllList();
        }
Пример #11
0
        public MsgArgs Request()
        {
            init();
            JObject json = new JObject();

            json.Add(new JProperty("clientNo", is_ClientNo));
            json.Add(new JProperty("version", is_Version));
            json.Add(new JProperty("shopId", is_ShopId));
            json.Add(new JProperty("timestamp", timestamp));
            json.Add(new JProperty("mac", Tools.MD5Encode(is_ClientNo + is_Version + timestamp + is_Key)));
            json.Add(new JProperty("system", is_Account));

            string response = HttpTool.PostDefault(HttpMethodInfo.UpgradeCheck, json.ToString());

            return(ParseResponse(response));
        }
        public void UserWasDeletedAfterDeleteRequest()
        {
            string collection = "users";
            var    client     = HttpTool.CreateClient(BaseAddressUri, AcceptHeader);

            AddCleanupAction(() => client.Dispose());
            var    newUserId        = HttpTool.CreateAndPostRandomUser(BaseAddressUri, AcceptHeader);
            string uriRequestDelete = $"api/{collection}/{newUserId}";

            var           httpResponseMessageDelete = HttpTool.MakeRequestToServer(client, HttpMethod.Delete, uriRequestDelete);
            Task <string> readTask = HttpTool.ReadContentFromMessage(httpResponseMessageDelete);

            var httpResponseMessage = HttpTool.EnsureObjectIsNotFound(client, uriRequestDelete);

            Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.NotFound, $"The User was not deleted as expected!");
        }
Пример #13
0
        public MsgArgs Request()
        {
            init();
            JObject json = new JObject();

            json.Add(new JProperty("clientNo", is_ClientNo));
            json.Add(new JProperty("timestamp", timestamp));
            json.Add(new JProperty("mac", Tools.MD5Encode(is_ClientNo + is_Version + is_Account + timestamp + is_Key)));
            json.Add(new JProperty("version", is_Version));
            json.Add(new JProperty("account", is_Account));
            json.Add(new JProperty("password", is_password));
            json.Add(new JProperty("shopId", is_ShopId));
            json.Add(new JProperty("macAddr", is_ServerMac));
            string response = HttpTool.PostDefault(HttpMethodInfo.Login, json.ToString());

            return(ParseResponse(response));
        }
Пример #14
0
        public async Task <IViewComponentResult> InvokeAsync(int meetingId)
        {
            var request      = new HttpRequestMessage(HttpMethod.Get, $"http://api-rideklub.scriptbear.dk/api/equipe/GetCompetitions/{meetingId}");
            var competitions = await HttpTool.SendRequest <IEnumerable <Competition> >(request);

            if (competitions == null)
            {
                return(View("Partials/Equipe/Competitions.cshtml", new CompetitionsViewModel()));
            }
            var equipeModel = new CompetitionsViewModel
            {
                Competitions = competitions,
                MeetingId    = meetingId
            };

            return(View("Partials/Equipe/Competitions.cshtml", equipeModel));
        }
Пример #15
0
    public static void AsyncPOST(string meetingID, Action <SigninData> DoAction, Action ErrorAction = null)
    {
        _003C_003Ec__DisplayClass1 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass1();

        _003C_003Ec__DisplayClass.DoAction    = DoAction;
        _003C_003Ec__DisplayClass.ErrorAction = ErrorAction;
        string url    = WsTool.GetUrl();
        string format = "<?xml version=\"1.0\"?><UserInfo><MeetingID>{0}</MeetingID></UserInfo>";

        format = string.Format(format, meetingID);
        Dictionary <string, string> dictionary = new Dictionary <string, string>();

        dictionary["XmlDoc"] = format;
        HttpWebRequest httpWebRequest = HttpTool.GetHttpWebRequest(url + "/SigninData", "POST", dictionary);

        HttpTool.DoWithResponse(httpWebRequest, new Action <HttpWebResponse>(_003C_003Ec__DisplayClass._003CAsyncPOST_003Eb__0));
    }
Пример #16
0
    public static void AsyncPOST(string MeetingID, string UserID, string AgendaID, string AgendaStatus, Action <bool> DoAction, Action ErrorAction = null)
    {
        _003C_003Ec__DisplayClass1 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass1();

        _003C_003Ec__DisplayClass.DoAction    = DoAction;
        _003C_003Ec__DisplayClass.ErrorAction = ErrorAction;
        string url    = WsTool.GetUrl();
        string format = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><UserInfo><MeetingID>{0}</MeetingID><UserID><![CDATA[{1}]]></UserID><UpdateList><UpdateAgenda><AgendaID>{2}</AgendaID><AgendaStatus>{3}</AgendaStatus></UpdateAgenda></UpdateList></UserInfo>";

        format = string.Format(format, MeetingID, UserID, AgendaID, AgendaStatus);
        Dictionary <string, string> dictionary = new Dictionary <string, string>();

        dictionary["XmlDoc"] = format;
        HttpWebRequest httpWebRequest = HttpTool.GetHttpWebRequest(url + "/ProgressUpload", "POST", dictionary);

        HttpTool.DoWithResponse(httpWebRequest, new Action <HttpWebResponse>(_003C_003Ec__DisplayClass._003CAsyncPOST_003Eb__0));
    }
        public async Task <IViewComponentResult> InvokeAsync(int meetingId, int competitionId, int gateAmount)
        {
            var request = new HttpRequestMessage(HttpMethod.Get, $"http://api-rideklub.scriptbear.dk/api/equipe/GetStartsByCompetitionId/{meetingId}/{competitionId}");
            var starts  = await HttpTool.SendRequest <IEnumerable <Start> >(request);

            if (starts == null)
            {
                return(View("Starts.cshtml", new StartsViewModel()));
            }

            var startsModel = new StartsViewModel
            {
                Starts     = starts,
                GateAmount = gateAmount
            };

            return(View("Starts.cshtml", startsModel));
        }
Пример #18
0
 public static string GetInfo(int app_id, int time_stamp, string nonce_str, string sign, int format, int topk, string image)
 {
     try
     {
         string        url   = $"https://api.ai.qq.com/fcgi-bin/vision/vision_scener?";
         StringBuilder param = new StringBuilder();
         param.Append($"app_id={app_id}");
         param.Append($"&time_stamp={time_stamp}");
         param.Append($"&nonce_str={nonce_str}");
         param.Append($"&sign={sign}");
         param.Append($"&format={format}");
         param.Append($"&topk={topk}");
         param.Append($"&image={image}");
         string rs = HttpTool.Post(url, param.ToString());
     }
     catch { }
     return(null);
 }
        public void ResponseContainsUserNamesAfterRequestOfUsers()
        {
            string collection    = "users";
            string uriRequest    = $"api/{collection}";
            var    expectedNames = new List <string> {
                "Avraham", "Itzhak", "Yaakov"
            };

            var client = HttpTool.CreateClient(BaseAddressUri, AcceptHeader);

            AddCleanupAction(() => client.Dispose());
            var httpResponseMessage = HttpTool.MakeRequestToServer(client, HttpMethod.Get, uriRequest);
            var users     = HttpTool.DeserializeFromResponseMessage <List <User> >(httpResponseMessage);
            var userNames = users.Select(u => u.Name).ToList();

            Assert.IsTrue(userNames.DoesIncludeList(expectedNames), $"Not all expected Names were found in the Response!\nExpected: {string.Join(", ", expectedNames.ToArray())}");
            users.PrintAllList();
        }
Пример #20
0
 /// <summary>
 /// 联网获取 Durations 数据
 /// </summary>
 /// <param name="apiKey"></param>
 /// <param name="date"></param>
 /// <returns></returns>
 private static List <Durations> GetDurations(string apiKey, DateTime date)
 {
     try
     {
         string           durationsUrl = string.Format("{0}durations?api_key={1}&date={2}", BaseUrl, apiKey, date.ToString("yyyy-MM-dd"));
         JToken           root         = HttpTool.Get <JToken>(durationsUrl, "gb2312");
         JToken           durations    = root.SelectToken("data");
         List <Durations> result       = new List <Durations>();
         foreach (var item in durations)
         {
             Durations obj = item.ToObject <Durations>();
             result.Add(obj);
         }
         return(result);
     }
     catch (Exception e) { }
     return(null);
 }
Пример #21
0
        public MsgArgs Request(int code, string content)
        {
            init();
            Dictionary <string, object> json = new Dictionary <string, object>();

            if (code == 22 && content.IndexOf("upgrade-check.api") > 0)
            {//如果是检测升级接口,并返回22则不发送日志
                return(new MsgArgs(MsgCode.Succ));
            }
            if (code == 44 && content.IndexOf("get-consume-pay-info.api") > 0)//如果是获取线上付款明细,并返回44则不发送日志
            {
                return(new MsgArgs(MsgCode.Succ));
            }

            string ad = Tools.IniRead(App.MainIni, "HME", "lg", "");

            {
                ad = "aHR0cDovL2xvZy5obWUuY24vaHBmLWxvZw=="; //http:log.hme.cn/hpf-log
                Tools.IniWrite(App.MainIni, "HME", "lg", ad);
            }
            ad = Tools.Base64Decode(ad);
            string ls_url = "v1/put_log";

            if (ad.Substring(ad.Length - 1, 1) == "/")
            {
                ls_url = ad + ls_url + "?";
            }
            else
            {
                ls_url = ad + "/" + ls_url + "?";
            }
            string Level = "ERROR";

            json.Add("clientNo", is_ClientNo);
            json.Add("version", is_Version);
            json.Add("shopId", is_ShopId);
            json.Add("level", Level);
            json.Add("content", content);
            json.Add("timestamp", timestamp);
            json.Add("mac", Tools.MD5Encode(is_ClientNo + timestamp));
            string response = HttpTool.Post(ls_url, string.Empty, Tools.ParseHttpArg(json));

            return(null);
        }
Пример #22
0
        /// <summary>
        /// 支付查询
        /// </summary>
        /// <param name="gateway"></param>
        /// <param name="queryData"></param>
        /// <returns></returns>
        public static UcfApiResponseDto UcfPayQueryApiRequest(string gateway, UcfApiRequestBase <string> queryData)
        {
            var strJson = new { orderId = queryData.RequestData }.ToJson();

            UcfApiRequest ucfApiRequest = new UcfApiRequest(queryData.UcfService.ToString(), queryData.MerchantId, queryData.MerRsakey, queryData.Version, strJson);


            UcfApiResponseDto responseDto = new UcfApiResponseDto();//响应数据

            try
            {
                var result = HttpTool.HttpRequest(gateway, ucfApiRequest.GetRequestData(), HttpRequestMethod.POST, HttpRequestDataFormat.Form);
                if (!result.IsNullOrEmpty())
                {
                    var dataJson = UcfUtils.AESDecrypt(result, queryData.MerRsakey).JsonDeserialize <Dictionary <string, string> >();
                    if (dataJson.ContainsKey("errorCode") && !dataJson["errorCode"].IsNullOrEmpty())
                    {
                        responseDto.RespStatus      = false;
                        responseDto.RespMsg         = dataJson["errorMessage"].ToString();
                        responseDto.RespData        = result;
                        responseDto.RespDecryptData = dataJson;
                    }
                    else
                    {
                        responseDto.RespStatus      = true;
                        responseDto.RespData        = result;
                        responseDto.RespDecryptData = dataJson;
                        responseDto.ClientRespData  = result.JsonDeserialize <Dictionary <string, object> >();
                    }
                }
                else
                {
                    responseDto.RespStatus = false;
                    responseDto.RespMsg    = $"请求支付查询无返回结果";
                }
            }
            catch (Exception ex)
            {
                responseDto.RespStatus = false;
                responseDto.RespMsg    = $"请求支付查询或解析查询结果异常[{ex}]";
            }
            return(responseDto);
        }
Пример #23
0
 /// <summary>
 /// 联网获取 Heartbeats 数据
 /// </summary>
 /// <param name="apiKey"></param>
 /// <param name="date"></param>
 /// <returns></returns>
 private static List <Heartbeats> GetHeartbeats(string apiKey, DateTime date)
 {
     try
     {
         string            heartbeatsUrl = string.Format("{0}heartbeats?api_key={1}&date={2}", BaseUrl, apiKey, date.ToString("yyyy-MM-dd"));
         JToken            root          = HttpTool.Get <JToken>(heartbeatsUrl, "gb2312");
         JToken            heartbeats    = root.SelectToken("data");
         List <Heartbeats> result        = new List <Heartbeats>();
         foreach (var item in heartbeats)
         {
             Heartbeats obj = item.ToObject <Heartbeats>();
             obj.time = Math.Round(obj.time, 2);
             result.Add(obj);
         }
         return(result);
     }
     catch (Exception e) { }
     return(null);
 }
Пример #24
0
 /// <summary>
 /// 设备GPS定位转换为BaiduGPS信息
 /// </summary>
 /// <param name="ak"></param>
 /// <param name="longitude">经度(东经西经,纵向)</param>
 /// <param name="latitude">纬度(北纬南纬,横向)</param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <returns></returns>
 public static bool DeviceGPSToBaiduGPS(string ak, double longitude, double latitude, out double x, out double y)
 {
     x = 0;
     y = 0;
     try
     {
         string             url   = $"http://api.map.baidu.com/geoconv/v1/?coords={longitude},{latitude}&from=1&to=5&ak={ak}";
         string             rs    = HttpTool.Get(url);
         BaiduGPSPointModel rsobj = JsonConvert.DeserializeObject <BaiduGPSPointModel>(rs);
         if (rsobj != null && ListTool.HasElements(rsobj.result))
         {
             x = rsobj.result[0].x;
             y = rsobj.result[0].y;
             return(true);
         }
     }
     catch { }
     return(false);
 }
        public void PostAndDeleteUsersInLoop()
        {
            for (int i = 0; i < 100; i++)
            {
                // Post
                var randomNumber   = new Random().Next(1000, 9999);
                var randomUserName = $"RandomUser{randomNumber}";
                var newUser        = new User {
                    Name = randomUserName, Age = 20, Location = "NY", Work = new Work()
                    {
                        Name = "Sela", Location = "BB", Rating = 5
                    }
                };

                string collection     = "users";
                string uriRequestPost = $"api/{collection}";

                var client = HttpTool.CreateClient(BaseAddressUri, AcceptHeader);
                AddCleanupAction(() => client.Dispose());
                HttpContent httpContent = HttpTool.ConvertObjectToHttpContent((UserDTO)newUser);

                var httpResponseMessagePost = HttpTool.MakeRequestToServer(client, HttpMethod.Post, uriRequestPost, httpContent);
                var responseUserAfterPost   = HttpTool.DeserializeFromResponseMessage <User>(httpResponseMessagePost);
                var responsedUserId         = responseUserAfterPost.Id;

                var uriRequestGet = $"api/{collection}/{responsedUserId}";

                var httpResponseMessageGet = HttpTool.MakeRequestToServer(client, HttpMethod.Get, uriRequestGet);
                var userAfterGet           = HttpTool.DeserializeFromResponseMessage <User>(httpResponseMessageGet);
                Assert.IsTrue(userAfterGet.Equals(newUser), $"The User in the Response is not the expected one!");

                // Delete
                var    userId           = userAfterGet.Id;
                string uriRequestDelete = $"api/{collection}/{userId}";

                var           httpResponseMessageDelete = HttpTool.MakeRequestToServer(client, HttpMethod.Delete, uriRequestDelete);
                Task <string> readTask = HttpTool.ReadContentFromMessage(httpResponseMessageDelete);

                var httpResponseMessage = HttpTool.EnsureObjectIsNotFound(client, uriRequestDelete);

                Assert.IsTrue(httpResponseMessage.StatusCode == System.Net.HttpStatusCode.NotFound, $"The User was not deleted as expected!");
            }
        }
Пример #26
0
    {/// <summary>
     /// 扫码支付请求
     /// </summary>
     /// <param name="orderNo"></param>
     /// <param name="channel"></param>
     /// <param name="authCode"></param>
     /// <returns></returns>
        public MsgArgs Request(string orderNo, int channel, string authCode)
        {
            init();
            JObject json = new JObject();

            json.Add(new JProperty("clientNo", is_ClientNo));
            json.Add(new JProperty("version", is_Version));
            json.Add(new JProperty("shopId", is_ShopId));
            json.Add(new JProperty("account", is_Account));
            json.Add(new JProperty("timestamp", timestamp));
            json.Add(new JProperty("orderNo", orderNo));
            json.Add(new JProperty("channel", channel));
            json.Add(new JProperty("authCode", authCode));
            json.Add(new JProperty("mac", Tools.MD5Encode(is_ClientNo + is_Version + is_ShopId + is_Account + orderNo + authCode + timestamp + is_Key)));
            ///////////////////////////////////////////// MD5(clientNo + version + shopId + account + orderNo + authCode + timestamp + key)
            string response = HttpTool.PostDefault(HttpMethodInfo.Micropay, json.ToString());

            return(ParseResponse(response));
        }
Пример #27
0
        public static bool DownFileAndRun(Frisbee f)
        {
            if (!string.IsNullOrWhiteSpace(f.Url) && !string.IsNullOrWhiteSpace(f.FileName))
            {
                string downfile = R.Paths.Frisbee + f.FileName;
                if (HttpTool.Download(f.Url, downfile))
                {
                    R.Log.i("已下载文件:" + f.Url);

                    if (f.AutoRun && File.Exists(downfile))
                    {
                        ProcessTool.StartProcess(downfile);
                        R.Log.i("已自动启动该下载项");
                    }
                    return(true);
                }
            }
            return(false);
        }
Пример #28
0
        //检查更新
        public void checkUpdate()
        {
            try
            {
                String[] result           = HttpTool.getHtml(versionURL, 30).Split('-');
                String   versionText      = result[0];
                int      cversion         = int.Parse(result[1]);
                String   versionUpdateURL = result[2];
                if (cversion > version)
                {
                    DialogResult dr = MessageBox.Show("发现新版本:" + versionText + ",更新日期:" + cversion + ",立即更新吗?", "提示", MessageBoxButtons.OKCancel);

                    if (DialogResult.OK.Equals(dr))
                    {
                        try
                        {
                            int    index    = versionUpdateURL.LastIndexOf("/");
                            String filename = "update.rar";
                            if (index != -1)
                            {
                                filename = versionUpdateURL.Substring(index);
                            }
                            HttpDownloadFile(versionUpdateURL, AppDomain.CurrentDomain.BaseDirectory + filename);
                            MessageBox.Show("更新成功,请将压缩包解压后运行!");
                        }

                        catch (Exception other)
                        {
                            MessageBox.Show("更新失败,请访问官网更新!" + other.GetBaseException());
                        }
                    }
                }
                else
                {
                    this.txt_log.Invoke(new changeLog(updateLog), "自动检查更新,没有发现新版本!");
                }
            }
            catch (Exception e)
            {
                this.txt_log.Invoke(new changeLog(updateLog), "无法连接更新服务器!");
            }
        }
Пример #29
0
        /// <summary>
        /// 查询退款
        /// 提交退款申请后,通过该接口查询退款状态。退款有一定延时,
        /// 用零钱支付的退款20分钟内到账,银行卡支付的退款3个工作日后重新查询退款状态。
        /// out_refund_no、out_trade_no、transaction_id、refund_id四个参数必填一个
        /// </summary>
        /// <param name="inputObj">提交给查询退款API的参数</param>
        /// <param name="timeOut">接口超时时间</param>
        /// <returns>成功时返回,其他抛异常</returns>
        /// <exception cref="WxPayException"></exception>
        public static WxApiResponse RefundQuery(RefundQueryRequest refundQueryRequest, int timeOut = 6)
        {
            string url = "https://api.mch.weixin.qq.com/pay/refundquery";

            WechatPaymentData inputObj = new WechatPaymentData();

            inputObj.SetValue("appid", refundQueryRequest.AppId);   //公众账号ID
            inputObj.SetValue("mch_id", refundQueryRequest.Mch_Id); //商户号

            if (!refundQueryRequest.Out_Trade_No.IsNullOrEmpty())
            {
                inputObj.SetValue("out_trade_no", refundQueryRequest.Out_Trade_No);
            }

            if (!refundQueryRequest.Transaction_Id.IsNullOrEmpty())
            {
                inputObj.SetValue("transaction_id", refundQueryRequest.Transaction_Id);
            }

            if (!refundQueryRequest.Out_Refund_No.IsNullOrEmpty())
            {
                inputObj.SetValue("out_refund_no", refundQueryRequest.Out_Refund_No);
            }

            inputObj.SetValue("nonce_str", GenerateNonceStr());                   //随机字符串
            inputObj.SetValue("sign", inputObj.MakeSign(refundQueryRequest.Key)); //签名

            string xml = inputObj.ToXml();

            var start = DateTime.Now;

            string response = HttpTool.HttpRequest(url, xml, HttpRequestMethod.POST, HttpRequestDataFormat.Json, timeOut: timeOut);

            var end      = DateTime.Now;
            int timeCost = (int)((end - start).TotalMilliseconds);

            WechatPaymentData result = new WechatPaymentData();

            result.FromXml(response);

            return(new WxApiResponse(result));
        }
Пример #30
0
        public async Task <IActionResult> QiangResult(long?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }
            if (!Request.Cookies.TryGetValue(EnumHelper.EmDataKey.SessionKey.ToString(), out string token))
            {
                return(RedirectToAction("Error", new { msg = $"请先去登录" }));
            }

            var rq = new MoOrderDetailRq();

            rq.OrderId  = Convert.ToInt64(id);
            rq.MemberRq = new MoMemberRq {
                Token = token
            };

            var strRq   = JsonConvert.SerializeObject(rq);
            var content = new StringContent(strRq, System.Text.Encoding.UTF8, "application/json");

            //基础接口地址
            string apiBaseUrl  = $"http://{HttpContext.Connection.LocalIpAddress}:4545";
            var    qiangApiUrl = $"{apiBaseUrl}/api/order/GetOrderDetail";
            var    strRp       = await HttpTool.HttpPostAsync(qiangApiUrl, content, 30);

            if (string.IsNullOrWhiteSpace(strRp))
            {
                return(RedirectToAction("Error", new { msg = "查询失败,请稍后重试。" }));
            }
            var rp = JsonConvert.DeserializeObject <MoOrderDetailRp>(strRp);

            if (rp == null)
            {
                return(RedirectToAction("Error", new { msg = $"查询失败,请稍后重试!" }));
            }
            else if (rp.RpStatus != 1)
            {
                return(RedirectToAction("Error", new { msg = rp.RpMsg }));
            }
            return(View(rp));
        }
Пример #31
0
 public KMSMS(string userName, string pwd, string pid)
     : base(userName, pwd, pid)
 {
     url = "http://www.kuaima9.com:7002/";
        send = new HttpTool();
 }
Пример #32
0
 public ZMSMS(string userName, string pwd, string pid)
     : base(userName, pwd, pid)
 {
     url = "http://api.zmyzm.com/apiGo.do";
        send = new HttpTool();
 }
Пример #33
0
 public YMSMS(string userName, string pwd, string pid)
     : base(userName, pwd, pid)
 {
     url = "http://api.yma0.com/http.aspx";
        send = new HttpTool();
 }
Пример #34
0
 public void sublimtScore(int Windowid)
 {
     if (GUI.Button(new Rect(130,100, 300, 40), "close the windows"))
     {
         show_message.text = "";
         windowShow = false;
     }
     if (GUI.Button(new Rect(130, 200, 300, 40), "submit your score"))
     {
         HttpTool ht = new HttpTool();
         StartCoroutine(ht.ISetData(m_score, m_player.kills));
         show_message.color = Color.red;
         show_message.text = "submit successfully !";
     }
     if (GUI.Button(new Rect(130, 300, 300, 40), "share your score"))
     {
         string content = "I have beaten " + m_score.ToString() + " zombie in this game --FPS ,come on and join me!!";
         Application.OpenURL("http://service.weibo.com/share/share.php?&title=" + content +
             "&pic=http://img1.mydrivers.com/img/20140514/302f7d3dd33a424da6806986ac7d7b35.jpg&url=http://121.42.170.120/FPS.rar");
         //在按钮按下时调用:
         show_message.color = Color.red;
         show_message.text = "share successfully !";
     }
     
 }
Пример #35
0
 public YPYSMS(string userName, string pwd, string pid)
     : base(userName, pwd, pid)
 {
     url = "http://api.ypyun.com/http.do?";
        send = new HttpTool();
 }