MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / pushPlus

Function pushPlus

tech-study.js:564–593  ·  view source on GitHub ↗

* @description 推送

(token, title, content, template, toToken)

Source from the content-addressed store, hash-verified

562 * @description 推送
563 */
564async 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 获取用户信息

Callers 1

pushMessageFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected