(options)
| 413 | |
| 414 | ///////////////////////////////////////////////////////////////////////////////////// |
| 415 | function httpRequest(options) { |
| 416 | if (!options["method"]) { |
| 417 | return console.log(`请求方法不存在`); |
| 418 | } |
| 419 | if (!options["fn"]) { |
| 420 | console.log(`函数名不存在`); |
| 421 | } |
| 422 | return new Promise((resolve) => { |
| 423 | $[options.method](options, (err, resp, data) => { |
| 424 | try { |
| 425 | if (err) { |
| 426 | $.logErr(err); |
| 427 | } else { |
| 428 | try { |
| 429 | resp = JSON.parse(resp); |
| 430 | } catch (error) { } |
| 431 | } |
| 432 | } catch (e) { |
| 433 | $.logErr(e, resp); |
| 434 | } finally { |
| 435 | resolve(resp); |
| 436 | } |
| 437 | }); |
| 438 | }); |
| 439 | } |
| 440 | async function SendMsg(message) { |
| 441 | if (!message) return; |
| 442 | if ($.isNode()) { |
no test coverage detected