{"id":13487607,"url":"https://github.com/seasonstar/egg-weapp-sdk","last_synced_at":"2025-07-01T14:31:25.510Z","repository":{"id":55058808,"uuid":"88018594","full_name":"seasonstar/egg-weapp-sdk","owner":"seasonstar","description":"Egg的微信小程序登录会话管理SDK","archived":false,"fork":false,"pushed_at":"2018-09-21T07:11:17.000Z","size":24,"stargazers_count":116,"open_issues_count":3,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-07T01:52:21.500Z","etag":null,"topics":["egg","egg-plugin","login","session","weapp"],"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/seasonstar.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}},"created_at":"2017-04-12T06:41:28.000Z","updated_at":"2025-02-23T11:49:45.000Z","dependencies_parsed_at":"2022-08-14T10:30:55.869Z","dependency_job_id":null,"html_url":"https://github.com/seasonstar/egg-weapp-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seasonstar/egg-weapp-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seasonstar%2Fegg-weapp-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seasonstar%2Fegg-weapp-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seasonstar%2Fegg-weapp-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seasonstar%2Fegg-weapp-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seasonstar","download_url":"https://codeload.github.com/seasonstar/egg-weapp-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seasonstar%2Fegg-weapp-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262980977,"owners_count":23394444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["egg","egg-plugin","login","session","weapp"],"created_at":"2024-07-31T18:01:01.124Z","updated_at":"2025-07-01T14:31:25.461Z","avatar_url":"https://github.com/seasonstar.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Plugins","仓库"],"sub_categories":["插件"],"readme":"# egg-weapp-sdk\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-weapp-sdk.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-weapp-sdk\n[travis-image]: https://img.shields.io/travis/eggjs/egg-weapp-sdk.svg?style=flat-square\n[travis-url]: https://travis-ci.org/eggjs/egg-weapp-sdk\n[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-weapp-sdk.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/eggjs/egg-weapp-sdk?branch=master\n[david-image]: https://img.shields.io/david/eggjs/egg-weapp-sdk.svg?style=flat-square\n[david-url]: https://david-dm.org/eggjs/egg-weapp-sdk\n[snyk-image]: https://snyk.io/test/npm/egg-weapp-sdk/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/egg-weapp-sdk\n[download-image]: https://img.shields.io/npm/dm/egg-weapp-sdk.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-weapp-sdk\n\n可移步[中文文档](README.zh_CN.md)\n\n## Dependencies\n\n- egg-redis\n\n- [qcloud-weapp-client-sdk](https://github.com/tencentyun/weapp-client-sdk) for Weapp Client\n\n Egg-weapp-sdk should be interacted with qcloud-weapp-client-sdk in Weapp Client\n\n## Demo\n\n\u003e [egg-24time](https://github.com/seasonstar/egg-24time)\n\nServer [Egg，Mysql，Redis, ES6]\n\n\u003e [weapp-24time](https://github.com/seasonstar/weapp-24time)\n\nWeapp Client\n\n\n## Install\n\n```bash\n$ npm i egg-weapp-sdk --save\n```\n\n## Usage\n\n```js\n// {app_root}/config/plugin.js\nexports.redis = {\n  enable: true,\n  package: 'egg-redis',\n};\n\nexports.weappSDK = {\n  enable: true,\n  package: 'egg-weapp-sdk',\n};\n```\n\n## Configuration\n\n```js\n// {app_root}/config/config.default.js\n\nmodule.exports = appInfo =\u003e {\n  const config = {};\n\n  config.redis = {\n    client: {\n      host: '127.0.0.1',\n      port: '6379',\n      password: '',\n      db: '0',\n    },\n  };\n\n  // replace your appId and appSecret of WEAPP\n  config.weappSDK = {\n    appId: 'xxxxxxxxxxx',\n    appSecret: 'xxxxxxxxxxxxxxxxxx',\n  };\n\n  return config;\n};\n```\n\n- Why and What: Manage weapp user session independently, use Redis to store session.\n\nsee [config/config.default.js](config/config.default.js) for more detail.\n\n- Two methods:\n\n1. Login:  loginService.login()\n\n2. Check:  loginService.check()\n\n## Example\n\n\u003c!-- example here --\u003e\n\n```js\n// app/controller/weapp.js\nmodule.exports = app =\u003e {\n  class WeappController extends app.Controller {\n    * login() {\n      const { ctx, app } = this;\n      const loginService = app.weapp.LoginService.create(ctx.request, ctx.response);\n      yield loginService.login()\n        .then(data =\u003e {\n          ctx.body = data;\n        });\n    }\n\n    * user() {\n      const { ctx, app } = this;\n      const loginService = app.weapp.LoginService.create(ctx.request, ctx.response);\n      yield loginService.check()\n        .then(data =\u003e {\n          ctx.body = {\n            code: 0,\n            message: 'ok',\n            data: {\n              userInfo: data.userInfo,\n            },\n          };\n        });\n    }\n  }\n  return WeappController;\n};\n```\n\n## Credits \u0026\u0026 Inspiration\n\n[腾讯云微信小程序客户端 SDK](https://github.com/tencentyun/weapp-client-sdk)\n\n\n## Questions \u0026 Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseasonstar%2Fegg-weapp-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseasonstar%2Fegg-weapp-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseasonstar%2Fegg-weapp-sdk/lists"}