github.com/angenalZZZ/gofunc@v0.0.0-20210507121333-48ff1be3917b/cmd/jsrun/jsrun.js (about)

     1  //扩展方法
     2  // Date.prototype.Add = function (seconds) { var t = new Date(); t.setTime(this.getTime() + seconds * 1000); return t; };
     3  // Date.prototype.AddDate = Date.prototype.AddDays = function (days) { var t = new Date(); t.setTime(this.getTime() + days * 24 * 3600 * 1000); return t; };
     4  // Date.prototype.Date = function () { return this.toISOString().split("T")[0]; };
     5  Date.prototype.Time = function () { return this.toISOString().split("T")[1].split(".")[0]; };
     6  // Date.prototype.DateTime = function () { return this.toISOString().replace("T", " ").split(".")[0]; };
     7  // String.prototype.Date = function () { return this.replace("T", " ").split(" ")[0]; };
     8  // String.prototype.Time = function () { return this.replace("T", " ").split(" ")[1].split(".")[0]; };
     9  // String.prototype.DateTime = function () { return this.replace("T", " ").split(".")[0]; };
    10  // function col(s) { if (!s) { return "NULL"; } return "'" + s.replace("'", "''") + "'"; };
    11  
    12  $.trace = true; // 反代接口 URL调试
    13  var bSubject = nats.subject + "-"; // 反代消息 注意后缀
    14  var item = { Subject: bSubject, Time: new Date().Time() };
    15  item.ActionName = '反代接口';
    16  var res = $.q("post", "https://postman-echo.com/post", item, "url");
    17  // dump(res);