PHPackages                             oiuv/workec - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. oiuv/workec

ActiveLibrary[API Development](/categories/api)

oiuv/workec
===========

EC开放平台API

v2.2.2(4y ago)52.4k—0%2MITPHPPHP &gt;=7.1.3

Since Jun 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/oiuv/workec)[ Packagist](https://packagist.org/packages/oiuv/workec)[ RSS](/packages/oiuv-workec/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (1)Versions (13)Used By (0)

EC开放平台
======

[](#ec开放平台)

使用API，您可将EC与第三方系统进行数据级别的集成

环境需求
----

[](#环境需求)

- PHP &gt;= 7.1.3

安装
--

[](#安装)

```
composer require "oiuv/workec"
```

如果你的项目PHP版本低于v7.1.3，可安装 v2.1.1 版。

```
composer require oiuv/workec 2.1.1
```

使用
--

[](#使用)

### 通过composer自动加载

[](#通过composer自动加载)

```
require __DIR__ . '/vendor/autoload.php';

use Oiuv\WorkEc\EC;

$ec = new EC('corpId', 'appId', 'appSecret');
// 获取部门和员工信息
echo $ec->structure();
```

### 在Laravel框架中使用

[](#在laravel框架中使用)

在`.env`中增加以下配置：

```
EC_CORP_ID=XXXXXXXX
EC_APP_ID=XXXXXXXXX
EC_APP_SECRET=XXXXX

```

在`config/services.php`中增加以下配置：

```
'workec' => [
    'corp_id' => env('EC_CORP_ID'),
    'app_id' => env('EC_APP_ID'),
    'app_secret' => env('EC_APP_SECRET'),
],
```

方法参数注入的方式调用

```
use Oiuv\WorkEc\EC;

public function show(EC $ec)
{
    // 获取部门和员工信息
    return $ec->structure();
}
```

使用Facade的方式调用

```
public function show()
{
    // 获取部门和员工信息
    return WorkEC::structure();
}
```

---

### 示例

[](#示例)

> 获取配置信息

```
// 获取部门和员工信息
echo $ec->structure();
// 获取客户来源信息
echo $ec->getChannelSource();
// 获取标签信息
echo $ec->getLabelInfo();
// 获取全国地区信息
echo $ec->getAreas();
```

> 查询客户

```
// 通过条件查询客户列表
echo $ec->queryList(['name'=>'测试']);
echo $ec->queryList(['mobile'=>'13800138000']);

// 通过手机号查询客户
$mobile = 13800138000;
echo $ec->getCustomer($mobile);

// 批量获取客户列表
echo $ec->getCustomers();
echo $ec->queryCustomers();

// 通过crmId批量查询客户
$crmIds = '12345,14336,13093';
echo $ec->preciseQueryCustomer($crmIds);

// 判断客户是否存在
$mobile = 13800138000;
echo $ec->queryExist($mobile);
echo $ec->queryExist($mobile, 0); //只查询数量不返回客户资料
```

> 创建客户

```
// 单个创建
echo $ec->addCustomer($optUserId, $name, $mobile);
// 批量创建

$list => [
    [
        'name' => $name1,
        'mobile' => $mobile1,
        'followUserId' => $followUserId,
        'channelId' => $channelId,
        'memo' => $memo,
    ],
    [
        'name' => $name2,
        'mobile' => $mobile2,
        'followUserId' => $followUserId,
        'channelId' => $channelId,
        'memo' => $memo,
    ],
    [
        'name' => $name3,
        'mobile' => $mobile3,
        'followUserId' => $followUserId,
        'channelId' => $channelId,
        'memo' => $memo,
    ]
];
echo $ec->addCustomers($optUserId, $list);
```

> 修改客户资料

```
// 修改单个用户
$data = [
    'name'   => '陈小萌',
    'mobile' => '13800138000'
];
echo $ec->updateCustomer(123456, 123456789, $data); // 操作员ID，客户ID，要修改的资料
// 批量修改用户
$list =[
    [
        'optUserId' =>12345,
        'crmId'=>1234567,
        'name'=>'用户1'
    ],
    [
        'optUserId' =>12345,
        'crmId'=>1234568,
        'name'=>'用户2'
    ],
    [
        'optUserId' =>67890,
        'crmId'=>1234569,
        'name'=>'用户3'
    ]
];
echo $ec->batchUpdateCustomer($list);
```

> 电话外呼

```
echo $ec->call($userid, $phone);
```

> 问题和需求反馈可联系QQ 7300637

### 方法列表

[](#方法列表)

本接口提供的所有方法请见以下文档，对未封装的接口，可自己调用`client()`方法实现。

- [EC开放平台API接口](https://api.oiuv.cn/workec/)

各方法返回值参数很复杂，如有问题请从**EC开放平台技术文档**查询。

### 接口文档

[](#接口文档)

- [EC开放平台技术文档](https://open.workec.com/newdoc/)
- [业务返回码说明](https://open.workec.com/newdoc/doc/1iqT8Bqqm)
- [系统字段对照表](https://open.workec.com/newdoc/doc/1jRy6T9uy)
- [api 认证信息查看](https://open.workec.com/newdoc/doc/7wQRq1umF)

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 96.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~118 days

Recently: every ~5 days

Total

12

Last Release

1529d ago

Major Versions

1.0.x-dev → v2.0.12020-06-20

PHP version history (2 changes)v1.0PHP &gt;=5.6

v2.2.0PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/c275477319cf1d90492f34aa9274eff4a3416df97962980bec82b9e8e3061a9c?d=identicon)[oiuv](/maintainers/oiuv)

---

Top Contributors

[![oiuv](https://avatars.githubusercontent.com/u/13300261?v=4)](https://github.com/oiuv "oiuv (25 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

ec

### Embed Badge

![Health badge](/badges/oiuv-workec/health.svg)

```
[![Health](https://phpackages.com/badges/oiuv-workec/health.svg)](https://phpackages.com/packages/oiuv-workec)
```

###  Alternatives

[mocking-magician/coinbase-pro-sdk

Library for coinbase pro API calls

223.2k](/packages/mocking-magician-coinbase-pro-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
