{"id":13781615,"url":"https://github.com/sls-open/think-eolinker-apishop","last_synced_at":"2025-05-11T15:31:55.867Z","repository":{"id":57377002,"uuid":"123144190","full_name":"sls-open/think-eolinker-apishop","owner":"sls-open","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-28T01:41:27.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-01T00:39:51.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sls-open.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":"2018-02-27T14:54:49.000Z","updated_at":"2018-02-27T14:55:19.000Z","dependencies_parsed_at":"2022-08-26T14:24:16.435Z","dependency_job_id":null,"html_url":"https://github.com/sls-open/think-eolinker-apishop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sls-open%2Fthink-eolinker-apishop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sls-open%2Fthink-eolinker-apishop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sls-open%2Fthink-eolinker-apishop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sls-open%2Fthink-eolinker-apishop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sls-open","download_url":"https://codeload.github.com/sls-open/think-eolinker-apishop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253588571,"owners_count":21932279,"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":[],"created_at":"2024-08-03T18:01:27.690Z","updated_at":"2025-05-11T15:31:55.583Z","avatar_url":"https://github.com/sls-open.png","language":"JavaScript","funding_links":[],"categories":["Extends"],"sub_categories":["websocket"],"readme":"# think-eolinker-apishop\r\n\r\n基于ThinkJS3+的eolinker的官方商店API拓展。\r\n\r\n[EolinkerApiShop官方地址](https://www.apishop.net)\r\n\r\n此拓展依赖**[superagent](https://github.com/visionmedia/superagent)**\r\n\r\n### 安装\r\n\r\n```bash\r\ncnpm install superagent --save\r\ncnpm install think-eolinker-apishop --save\r\n```\r\n\r\n### 启用\r\n\r\n`src/config/extend.js` or `src/common/config/extend.js`\r\n\r\n```js\r\nconst eolink = require('think-eolinker-apishop');\r\nmodule.exports = [\r\n    eolink(think)\r\n];\r\n```\r\n\r\n\r\n### 配置eolinker官方apiKey\r\n`src/config/config.js` or `src/common/config/config.js`,因为apiKey为私密信息，一般都是在环境变量配置文件里，自行调整\r\n```js\r\nmodule.exports = {\r\n    eolinker: {\r\n    \t//如果官方没有改变host，那么可以忽略，如果要配置，后面请加斜杠\r\n        host: 'https://api.apishop.net/',\r\n        apiKey: 'eolinker官方apishop中的apiKey'\r\n    }\r\n};\r\n```\r\n\r\n### 使用\r\n`src/controller/控制器.js` or `src/moduleName/controller/控制器.js`\r\n```js\r\nasync indexAction() {\r\n    const resData = await this.eoApi('Get24Jieqi');\r\n    return this.json(resData);\r\n}\r\n```\r\n\r\n### API\r\n```js\r\nthis.eoApi(type, opts);\r\n```\r\n\r\n#### type\r\n\r\ntype代表接口类型，目前支持如下：\r\n\r\n- queryIPInfo   // 中英数_验证码识别\r\n\r\n\r\n- recognizeVerifyCodeComplicate     // 中英数_验证码识别    \r\n   \r\n\r\n- recognizeVerifyCodeSimple // 英数_验证码识别\r\n\r\n\r\n- recognizeSimpleCode   // 简单验证码识别\r\n\r\n\r\n- queryAddrByAreaCode   // 区号查询\r\n\r\n\r\n- queryRoutes   // 公交、地铁路线规划\r\n\r\n\r\n- getStandardWeightTable    // 标准体重计算器\r\n\r\n\r\n- getExpressInfo    // 快递物流查询\r\n\r\n\r\n- queryChineseWords // 汉语词典\r\n\r\n\r\n- queryChineseWord  // 新华字典\r\n\r\n\r\n- queryPolygonPOI   // POI检索\r\n\r\n\r\n- convertChineseToCode  // 标准中文电码查询\r\n\r\n\r\n- getLeftTicket // 火车票查询\r\n\r\n\r\n- queryHoliday  // 节假日查询\r\n\r\n\r\n- queryCalendar // 万年历查询\r\n\r\n\r\n- getExchangeByCurrency // 汇率查询\r\n\r\n\r\n- get24Jieqi    // 二十四节气查询\r\n\r\n\r\n- getOilPriceToday  // 全国油价查询\r\n\r\n\r\n- exchangeLatLngByAddr  // 经纬度地址转换\r\n\r\n\r\n- get15DaysWeatherByArea    // 全国天气预报\r\n\r\n\r\n- examGetQuestions  // 驾考题库\r\n\r\n\r\n- postcodeGetQuestions  // 邮编查询\r\n\r\n\r\n- postcodeGetAddrs  // 中国省市区查询\r\n\r\n\r\n- getLocationByPhoneNum // 手机号归属地查询\r\n\r\n- sendSms // 短信服务\r\n\r\ntype的值是有规律的，一般都为接口的path后面的最后一个单词，个别接口后面的单词是一样的，那么再加上前面的单词组装成驼峰，例如下面：\r\n\r\n查询IP的接口：\r\n`common/ip/queryIPInfo` 那么后面的 `queryIPInfo` 就是type值。\r\n\r\n驾考题库和邮编查询两个接口：\r\n`transport/exam/getQuestions`和`common/postcode/getQuestions`，后面都叫`getQuestions`，那么这两个type则分别为：\r\n`examGetQuestions`和`postcodeetQuestions`\r\n\r\n像上面这种类型的目前有如下：\r\n\r\n- examGetQuestions\r\n- postcodeGetQuestions\r\n- postcodeGetAddrs\r\n- sendSms\r\n\r\n\r\n其他的均为path的最后一个单词。\r\n\r\n如果eolinker官方更新了API，这里面没有的话，您可以提pull request，也可以留言给我，补上，当调用不存在的类型时，会抛出异常提示。\r\n\r\n#### opts\r\n\r\n此值为一个对象，对象的属性就是eolinker官方API接口中的参数，看官方文档即可。\r\n\r\n### 返回参数\r\n\r\n由于这是第三方API集成，返回参数自然来自第三方，自行查看eolinker的apishop官方文档即可。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsls-open%2Fthink-eolinker-apishop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsls-open%2Fthink-eolinker-apishop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsls-open%2Fthink-eolinker-apishop/lists"}