* @description 推送
(token, title, content, template, toToken)
| 562 | * @description 推送 |
| 563 | */ |
| 564 | async function pushPlus(token, title, content, template, toToken) { |
| 565 | try { |
| 566 | // 参数体 |
| 567 | const body = { |
| 568 | token, |
| 569 | title, |
| 570 | content, |
| 571 | template, |
| 572 | }; |
| 573 | // 好友令牌 |
| 574 | if (toToken) { |
| 575 | body.to = toToken; |
| 576 | } |
| 577 | // 推送 |
| 578 | const res = await fetch(API_CONFIG.push, { |
| 579 | method: 'POST', |
| 580 | mode: 'cors', |
| 581 | headers: { |
| 582 | 'Content-Type': 'application/json', |
| 583 | }, |
| 584 | body: JSON.stringify(body), |
| 585 | }); |
| 586 | // 请求成功 |
| 587 | if (res.ok) { |
| 588 | const data = await res.json(); |
| 589 | return data; |
| 590 | } |
| 591 | } |
| 592 | catch (error) { } |
| 593 | } |
| 594 | /* 用户 API */ |
| 595 | /** |
| 596 | * @description 获取用户信息 |