json = reader.ReadToEnd();

逻辑代码的灵活的修改 测试不通过不让保存或者只能存为草稿。
https://www.cnblogs.com/zhang1f/p/12902774.html
value-format="yyyy-MM-dd"
https://www.jianshu.com/p/b1997400fc77
https://www.cnblogs.com/e0yu/p/9949857.html
https://www.cnblogs.com/fps2tao/p/9378799.html
https://www.cnblogs.com/wuhuacong/p/12955579.html
https://www.cnblogs.com/steamed-twisted-roll/p/10167501.html
https://www.cnblogs.com/yysbolg/p/14175683.html
https://blog.csdn.net/weixin_43054542/article/details/103051611

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace WebApplication1.ashx
{
    /// <summary>
    /// TestHandler 的摘要说明
    /// </summary>
    public class TestHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string json = string.Empty;
            using (StreamReader reader = new StreamReader(context.Request.InputStream))
            {
                json = reader.ReadToEnd();
            }

            JObject jObject = JsonConvert.DeserializeObject(json) as JObject;
            double num = double.Parse(jObject["num"].ToString());
            context.Response.Write((num * num).ToString());
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

Vue http.get vue-rMessage 消息提示(elementUI)

火柴头9527 2018-06-30 11:07:40  7836  收藏
分类专栏: elementUI
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!-- import CSS -->
  <link rel="stylesheet" href="https://unpkg.com/element-ui@2.4.2/lib/theme-chalk/index.css">
  <!-- import Vue before Element -->
  <script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script>
  <!-- import JavaScript -->
  <script src="https://unpkg.com/element-ui@2.4.2/lib/index.js"></script>  
</head>
<body>
  <div id="app">
    <p οnclick="myFun()">消息(自动消失、可关闭)</p>
    <p οnclick="myFun2()">成功(自动消失、可关闭)</p>
    <p οnclick="myFun3()">警告(自动消失、可关闭)</p>
    <p οnclick="myFun4()">错误(自动消失、可关闭)</p>
  </div>
</body>
  <script>
    var vm = new Vue({
      el: '#app'
    })
    
    function myFun() {
      console.log('11111111');
      
      vm.$message({
          showClose: true,
          message: '这是一条消息提示'
        });
    }
    
    function myFun2() {
      console.log('2222222');
      
      vm.$message({
          showClose: true,
          message: '恭喜你,这是一条成功消息',
          type: 'success'
        });
    }
    
    function myFun3() {
      console.log('3333333');
      
      vm.$message({
          showClose: true,
          message: '警告哦,这是一条警告消息',
          type: 'warning'
        });
    }    
    
    function myFun4() {
      console.log('4444444');
      
      vm.$message({
          showClose: true,
          message: '错了哦,这是一条错误消息',
          type: 'error'
        });
    }    
  </script>
  
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
帮我翻译为java代码 var http = (HttpWebRequest)WebRequest.Create(url); http.Accept = "*/*"; http.Method = "POST"; http.ContentType = "application/json; charset=utf-8"; TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); var currentTimeSeconds = Convert.ToInt64(ts.TotalSeconds); var signature = AESHelper.AesLocal(AppId + ApiId + currentTimeSeconds, AppKey); http.Headers["signature"] = signature; http.Headers["apiname"] = ApiId; http.Headers["appid"] = AppId; http.Headers["appkey"] = AppKey; http.ContentType = "application/json;charset=utf-8"; http.UserAgent = "PostmanRuntime/7.26.8"; Random rd = new Random(); var rdNum = rd.Next(100000, 1000000); var signStr = thirdId + "/n" + rdNum + "/n" + currentTimeSeconds + "/n" + key+"/n"; var sign = Md5Helper.Encrypt32(Base64Helper.EncodeBase64(Encoding.UTF8,signStr)); http.Headers["thirdId"] = thirdId; http.Headers["nonceStr"] = rdNum.ToString(); http.Headers["time"] = currentTimeSeconds.ToString(); http.Headers["sign"] = sign; byte[] bs = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(data)); using (var reqStream = http.GetRequestStream()) { reqStream.Write(bs, 0, bs.Length); } using (var wr = http.GetResponse()) { using (var reader = new StreamReader(wr.GetResponseStream(), Encoding.UTF8)) { var result = reader.ReadToEnd(); var json = (JObject)JsonConvert.DeserializeObject(result); if (json["success"] == null || json["success"].ToString().ToLower() != "true") { Logger.Log(MethodBase.GetCurrentMethod().Name, GetType().Name, 1, "获取广告点位失败:" + JsonConvert.SerializeObject(param)+"////"+result, LogLevel.Error); } return result; } }
最新发布
06-09
下面是Java代码的翻译: ``` URL url = new URL(urlStr); HttpURLConnection http = (HttpURLConnection)url.openConnection(); http.setRequestMethod("POST"); http.setDoOutput(true); http.setDoInput(true); http.setUseCaches(false); http.setRequestProperty("Accept", "*/*"); http.setRequestProperty("Content-Type", "application/json; charset=utf-8"); TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); long currentTimeSeconds = Convert.ToInt64(ts.TotalSeconds); String signature = AESHelper.AesLocal(AppId + ApiId + currentTimeSeconds, AppKey); http.setRequestProperty("signature", signature); http.setRequestProperty("apiname", ApiId); http.setRequestProperty("appid", AppId); http.setRequestProperty("appkey", AppKey); http.setRequestProperty("User-Agent", "PostmanRuntime/7.26.8"); Random rd = new Random(); int rdNum = rd.nextInt(1000000) + 100000; String signStr = thirdId + "/n" + rdNum + "/n" + currentTimeSeconds + "/n" + key+"/n"; String sign = Md5Helper.Encrypt32(Base64Helper.EncodeBase64(Encoding.UTF8,signStr)); http.setRequestProperty("thirdId", thirdId); http.setRequestProperty("nonceStr", String.valueOf(rdNum)); http.setRequestProperty("time", String.valueOf(currentTimeSeconds)); http.setRequestProperty("sign", sign); byte[] postData = data.toString().getBytes(StandardCharsets.UTF_8); DataOutputStream wr = new DataOutputStream(http.getOutputStream()); wr.write(postData); wr.flush(); wr.close(); int responseCode = http.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream())); String inputLine; StringBuilder response = new StringBuilder(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); String result = response.toString(); JSONObject json = new JSONObject(result); if (json.isNull("success") || !json.getString("success").toLowerCase().equals("true")) { Logger.Log(MethodBase.GetCurrentMethod().getName(), getClass().getName(), 1, "获取广告点位失败:" + param.toString() + "////" + result, LogLevel.Error); } return result; } else { throw new Exception("HTTP请求失败,状态码:" + responseCode); } ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值