@dead_fish/api
Version:
Wechat JsTicket、SendEmail、getImageBase64
2 lines (1 loc) • 2.96 kB
JavaScript
;function t(t,e,n,r){return new(n||(n=Promise))(function(o,s){function u(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(u,a)}c((r=r.apply(t,e||[])).next())})}function e(t,e){var n,r,o,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return u.next=a(0),u.throw=a(1),u.return=a(2),"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;u&&(u=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}Object.defineProperty(exports,"__esModule",{value:!0}),"function"==typeof SuppressedError&&SuppressedError;var n="https://api.roxmotor.top/freeApi/jsTicket",r="https://api.roxmotor.top/freeApi/mail",o="https://api.roxmotor.top/freeApi/image2Base64",s=new(function(){function s(){}return s.prototype.wxSign=function(r){return t(this,void 0,void 0,function(){var t;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t="".concat(n,"?url=").concat(null==r?void 0:r.url),[4,fetch(t,{mode:"cors"}).then(function(t){return t.json()})];case 1:return[2,e.sent()];case 2:return[2,{status:!1,message:e.sent().message,data:null}];case 3:return[2]}})})},s.prototype.sendEmail=function(n){return t(this,void 0,void 0,function(){return e(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,fetch(r,{mode:"cors",method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(function(t){return t.json()})];case 1:return[2,t.sent()];case 2:return[2,{status:!1,message:t.sent().message,data:null}];case 3:return[2]}})})},s.prototype.getImageBase64=function(n,r){return t(this,void 0,void 0,function(){var t;return e(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t="".concat(o,"?url=").concat(n),r&&(t+="&referer=".concat(r)),[4,fetch(t,{mode:"cors"}).then(function(t){return t.json()})];case 1:return[2,e.sent()];case 2:return[2,{status:!1,message:e.sent().message,data:null}];case 3:return[2]}})})},s}());exports.default=s;