{"id":22964815,"url":"https://github.com/oiuv/workec","last_synced_at":"2025-09-20T01:13:22.418Z","repository":{"id":32623978,"uuid":"138261610","full_name":"oiuv/workec","owner":"oiuv","description":"EC开放平台API","archived":false,"fork":false,"pushed_at":"2022-01-13T07:23:33.000Z","size":56,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-08T15:49:03.147Z","etag":null,"topics":["ec"],"latest_commit_sha":null,"homepage":"https://open.workec.com/","language":"PHP","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/oiuv.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-06-22T06:06:53.000Z","updated_at":"2021-12-26T11:41:03.000Z","dependencies_parsed_at":"2022-08-07T17:46:46.962Z","dependency_job_id":null,"html_url":"https://github.com/oiuv/workec","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oiuv%2Fworkec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oiuv%2Fworkec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oiuv%2Fworkec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oiuv%2Fworkec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oiuv","download_url":"https://codeload.github.com/oiuv/workec/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229749308,"owners_count":18118325,"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":["ec"],"created_at":"2024-12-14T20:12:29.920Z","updated_at":"2025-09-20T01:13:17.336Z","avatar_url":"https://github.com/oiuv.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eEC开放平台\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e使用API，您可将EC与第三方系统进行数据级别的集成\u003c/p\u003e\n\n## 环境需求\n\n- PHP \u003e= 7.1.3\n\n## 安装\n\n```shell\ncomposer require \"oiuv/workec\"\n```\n\n如果你的项目PHP版本低于v7.1.3，可安装 v2.1.1 版。\n\n```shell\ncomposer require oiuv/workec 2.1.1\n```\n\n## 使用\n\n### 通过composer自动加载\n\n```php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse Oiuv\\WorkEc\\EC;\n\n$ec = new EC('corpId', 'appId', 'appSecret');\n// 获取部门和员工信息\necho $ec-\u003estructure();\n```\n\n### 在Laravel框架中使用\n\n在`.env`中增加以下配置：\n\n```\nEC_CORP_ID=XXXXXXXX\nEC_APP_ID=XXXXXXXXX\nEC_APP_SECRET=XXXXX\n```\n\n在`config/services.php`中增加以下配置：\n\n```php\n'workec' =\u003e [\n    'corp_id' =\u003e env('EC_CORP_ID'),\n    'app_id' =\u003e env('EC_APP_ID'),\n    'app_secret' =\u003e env('EC_APP_SECRET'),\n],\n```\n\n方法参数注入的方式调用\n\n```php\nuse Oiuv\\WorkEc\\EC;\n\npublic function show(EC $ec)\n{\n    // 获取部门和员工信息\n    return $ec-\u003estructure();\n}\n```\n\n使用Facade的方式调用\n\n```php\npublic function show()\n{\n    // 获取部门和员工信息\n    return WorkEC::structure();\n}\n```\n\n---\n\n### 示例\n\n\u003e 获取配置信息\n\n```php\n// 获取部门和员工信息\necho $ec-\u003estructure();\n// 获取客户来源信息\necho $ec-\u003egetChannelSource();\n// 获取标签信息\necho $ec-\u003egetLabelInfo();\n// 获取全国地区信息\necho $ec-\u003egetAreas();\n```\n\n\u003e 查询客户\n\n```php\n// 通过条件查询客户列表\necho $ec-\u003equeryList(['name'=\u003e'测试']);\necho $ec-\u003equeryList(['mobile'=\u003e'13800138000']);\n\n// 通过手机号查询客户\n$mobile = 13800138000;\necho $ec-\u003egetCustomer($mobile);\n\n// 批量获取客户列表\necho $ec-\u003egetCustomers();\necho $ec-\u003equeryCustomers();\n\n// 通过crmId批量查询客户\n$crmIds = '12345,14336,13093';\necho $ec-\u003epreciseQueryCustomer($crmIds);\n\n// 判断客户是否存在\n$mobile = 13800138000;\necho $ec-\u003equeryExist($mobile);\necho $ec-\u003equeryExist($mobile, 0); //只查询数量不返回客户资料\n```\n\n\u003e 创建客户\n\n```php\n// 单个创建\necho $ec-\u003eaddCustomer($optUserId, $name, $mobile);\n// 批量创建\n\n$list =\u003e [\n    [\n        'name' =\u003e $name1,\n        'mobile' =\u003e $mobile1,\n        'followUserId' =\u003e $followUserId,\n        'channelId' =\u003e $channelId,\n        'memo' =\u003e $memo,\n    ],\n    [\n        'name' =\u003e $name2,\n        'mobile' =\u003e $mobile2,\n        'followUserId' =\u003e $followUserId,\n        'channelId' =\u003e $channelId,\n        'memo' =\u003e $memo,\n    ],\n    [\n        'name' =\u003e $name3,\n        'mobile' =\u003e $mobile3,\n        'followUserId' =\u003e $followUserId,\n        'channelId' =\u003e $channelId,\n        'memo' =\u003e $memo,\n    ]\n];\necho $ec-\u003eaddCustomers($optUserId, $list);\n```\n\n\u003e 修改客户资料\n\n```php\n// 修改单个用户\n$data = [\n    'name'   =\u003e '陈小萌',\n    'mobile' =\u003e '13800138000'\n];\necho $ec-\u003eupdateCustomer(123456, 123456789, $data); // 操作员ID，客户ID，要修改的资料\n// 批量修改用户\n$list =[\n    [\n        'optUserId' =\u003e12345,\n        'crmId'=\u003e1234567,\n        'name'=\u003e'用户1'\n    ],\n    [\n        'optUserId' =\u003e12345,\n        'crmId'=\u003e1234568,\n        'name'=\u003e'用户2'\n    ],\n    [\n        'optUserId' =\u003e67890,\n        'crmId'=\u003e1234569,\n        'name'=\u003e'用户3'\n    ]\n];\necho $ec-\u003ebatchUpdateCustomer($list);\n```\n\n\u003e 电话外呼\n\n```php\necho $ec-\u003ecall($userid, $phone);\n```\n\n\u003e 问题和需求反馈可联系QQ 7300637\n\n### 方法列表\n\n本接口提供的所有方法请见以下文档，对未封装的接口，可自己调用`client()`方法实现。\n\n- [EC开放平台API接口](https://api.oiuv.cn/workec/)\n\n各方法返回值参数很复杂，如有问题请从**EC开放平台技术文档**查询。\n\n### 接口文档\n\n- [EC开放平台技术文档](https://open.workec.com/newdoc/)\n- [业务返回码说明](https://open.workec.com/newdoc/doc/1iqT8Bqqm)\n- [系统字段对照表](https://open.workec.com/newdoc/doc/1jRy6T9uy)\n- [api 认证信息查看](https://open.workec.com/newdoc/doc/7wQRq1umF)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foiuv%2Fworkec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foiuv%2Fworkec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foiuv%2Fworkec/lists"}