{"id":42647569,"url":"https://github.com/evolify/wxtools","last_synced_at":"2026-01-29T07:08:07.192Z","repository":{"id":223007021,"uuid":"110772342","full_name":"evolify/wxtools","owner":"evolify","description":"微信开发常用工具","archived":false,"fork":false,"pushed_at":"2024-02-28T02:11:16.000Z","size":10,"stargazers_count":36,"open_issues_count":1,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-08T11:55:31.719Z","etag":null,"topics":["promise","request","wechat","wxmp"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evolify.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-11-15T02:23:58.000Z","updated_at":"2024-04-09T01:32:35.000Z","dependencies_parsed_at":"2024-02-17T16:54:50.321Z","dependency_job_id":null,"html_url":"https://github.com/evolify/wxtools","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.1428571428571429,"last_synced_commit":"43ccc07514b948758cdb52bfc30105e62cb46430"},"previous_names":["evolify/wxtools"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/evolify/wxtools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evolify%2Fwxtools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evolify%2Fwxtools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evolify%2Fwxtools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evolify%2Fwxtools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evolify","download_url":"https://codeload.github.com/evolify/wxtools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evolify%2Fwxtools/sbom","scorecard":{"id":386995,"data":{"date":"2025-08-11","repo":{"name":"github.com/evolify/wxtools","commit":"3ed8ce30205e9ec65a1c9b47837a3c81bde4bee5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-18T16:52:28.385Z","repository_id":223007021,"created_at":"2025-08-18T16:52:28.385Z","updated_at":"2025-08-18T16:52:28.385Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28868877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T06:56:44.678Z","status":"ssl_error","status_checked_at":"2026-01-29T06:56:35.794Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["promise","request","wechat","wxmp"],"created_at":"2026-01-29T07:08:05.651Z","updated_at":"2026-01-29T07:08:07.187Z","avatar_url":"https://github.com/evolify.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### 微信开发中常用的工具，目前主要是网络请求方法的增强，以及对几乎所有的异步操作的Promisify.\n\n* ### 安装：\n\n```\nyarn add @evolify/wxtools\n```\n\n或者\n\n```\nnpm i @evolify/wxtools\n```\n\n\n\n* ### 小程序网络请求\n\n\u0026emsp;把wx.request封装成了Promise风格的。使用的时候使用get、post等方法即可。支持添加拦截器，可以单独设置header、token、baseUrl等。下面以post方法为例。\n\n* 引入js文件：\n\n  ```js\n  import {request as req} from '@evolify/wxtools'\n  ```\n\n* 配置Request，一般在小程序App.js\u003eonLaunch方法中配置\n\n  ``` javascript\n    configReq(){\n      //配置baseUrl和拦截器，baseUrl例如 /api\n      req.baseUrl(config.serverUrl)\n        .interceptor(res=\u003e{\n          switch(res.data.code){\n            case 401: \n              wx.showToast({\n                icon: 'loading',\n                title: '重新登录',\n              })\n              this.login()\n              return false;\n            case 0:\n              return true;\n            default:\n              wx.showToast({\n                title: '操作失败',\n              })\n              return false;\n          }\n        })\n    },\n  ```\n\n* 登录成功后设置token\n\n  ```javascript\n  req.token(token)\n  ```\n\n* 发起网络请求\n\n  ```javascript\n  req.post('/goods',data,header)\n  \t.then(res=\u003eres.data.data)\n  \t.then(data=\u003e{\n      \twx.showToast({\n              title:'创建成功'\n          })\n  \t})\n  ```\n\n* ### 异步操作Promise的使用\n\u0026emsp; wx api里面很多操作都是异步的，基本上参数形式都差不多.这里做了Promise封装，方法名称、参数和官方api一致，只是参数里面不用传success、fail回调。以showToast为例，简单对比一下:  \n\u0026emsp; 常规用法：\n```js\nwx.showToast({\n  title: '成功',\n  icon: 'success',\n  duration: 2000,\n  success: ()=\u003e{\n    console.log('调用成功')\n  },\n  fail: err=\u003e{\n    console.error('调用失败',err)\n  }\n})\n```\n\u0026emsp; Promise用法：\n```js\nimport {Wx} from '@evolify/wxtools'\n\nWx.showToast({\n  title: '成功',\n  icon: 'success',\n  duration: 2000,\n}).then(()=\u003e{\n  console.log('调用成功')\n}).catch(err=\u003e{\n  console.error('调用失败',err)\n})\n```\n\u0026emsp; 其他的api用法都一样，方法、参数、返回值可以参考官方文档。如果有错误或者有缺失的，欢迎提issue.\n\n* ### Promisify\n\n  ```js\n  import {promisify} from '@evolify/wxtools'\n  \n  function func({\n    param1,\n    param2,\n    success: ()=\u003e{},\n    fail: ()=\u003e{}\n  }){\n    // do something\n    success()\n  }\n  \n  const promisifyFunc = params =\u003e promisify(func, params)\n  \n  // then you can use\n  promisifyFunc(data)\n  \t.then(res=\u003e{\n    \t\t// on success\n  \t})\n  \t.catch(err=\u003e{\n    \t// on failed\n  })\n  // instand of \n  func({\n    ...data,\n    success: res=\u003e{\n      \n    },\n    fail: res =\u003e {\n      \n    }\n  })\n  ```\n\n  \n\n- ### 定时任务队列\n\n  \u0026emsp;有些场景，我们需要定义一序列的延时任务，比如就界面动画而言，一些元素依次进场，并且有一定间隔，这时候如果我们直接用setTimeout, 就会遇到毁掉地狱的问题，代码很难看，且难以维护。这里封装了一个工具，可解决此类问题，具体介绍请参考文章：[js定时任务队列](https://blog.evolify.cn/2018/05/24/js定时任务队列/)，用法如下：\n\n  ```js\n  import {Schedule} from '@evolify/wxtools'\n  \n  new Schedule().task(task1)\n    .delay(1000).task(()=\u003ethis.setData({title:'Shedule'}))\n    .delay(500).task(task3)\n  ```\n\n  ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevolify%2Fwxtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevolify%2Fwxtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevolify%2Fwxtools/lists"}