Run any Skill in Manus
with one click
with one click
Run any Skill in Manus with one click
Get Started$pwd:
$ git log --oneline --stat
stars:8,841
forks:2,021
updated:March 23, 2026 at 06:57
SKILL.md
| name | CRMEB电商系统Agent |
| description | 专为CRMEB电商系统设计的智能开发助手,帮助开发者理解架构、快速开发功能、解决问题 |
crmeb/app/ 应用目录时触发crmeb/crmeb/ 核心库目录时触发template/ 前端目录时触发订单、商品、用户、支付、购物车优惠券、拼团、砍价、秒杀、积分CRMEB、ThinkPHP、后台管理、移动端Controller)Services)Model)*.vue)php think (ThinkPHP命令)composer install/update (依赖管理)npm run dev/build (前端构建)php think queue:listen (队列启动)php think workerman (WebSocket启动)- PHP: 7.1-7.4
- ThinkPHP: 6.x
- Composer: 依赖管理
- Workerman: 长连接服务
- PHPUnit: 单元测试(可选)
管理端:
- Vue.js 2.x
- Element UI 2.15.6
- Vuex 3.0
- Vue Router 3.0
- Axios
- ECharts 4.8.0
移动端:
- UniApp
- uView UI
- 支付: 微信支付、支付宝支付
- 存储: 阿里云OSS、腾讯云COS、七牛云
- 短信: 阿里云短信
- 微信: 公众号、小程序
crmeb/
├── app/ # 应用目录
│ ├── adminapi/ # 后台管理API (多应用模式)
│ │ ├── controller/ # 控制器层
│ │ │ ├── system/ # 系统管理
│ │ │ ├── product/ # 商品管理
│ │ │ ├── order/ # 订单管理
│ │ │ ├── user/ # 用户管理
│ │ │ └── marketing/ # 营销管理
│ │ ├── middleware/ # 中间件
│ │ ├── route/ # 路由定义
│ │ └── validate/ # 验证器
│ ├── api/ # 移动端API
│ ├── kefuapi/ # 客服端API
│ ├── outapi/ # 外部接口API
│ ├── dao/ # 数据访问层
│ │ ├── UserDao.php
│ │ ├── StoreOrderDao.php
│ │ └── ...
│ ├── model/ # 数据模型层
│ │ ├── User.php
│ │ ├── StoreOrder.php
│ │ └── ...
│ ├── services/ # 业务服务层
│ │ ├── user/ # 用户服务
│ │ ├── product/ # 商品服务
│ │ ├── order/ # 订单服务
│ │ ├── activity/ # 营销服务
│ │ ├── agent/ # 分销服务
│ │ └── system/ # 系统服务
│ ├── jobs/ # 队列任务
│ ├── listener/ # 事件监听器
│ ├── http/ # HTTP中间件
│ └── common.php # 公共方法
├── crmeb/ # 核心框架目录
│ ├── basic/ # 基础类库
│ │ ├── BaseServices.php # 服务基类
│ │ ├── BaseDao.php # DAO基类
│ │ ├── BaseModel.php # 模型基类
│ │ └── BaseController.php # 控制器基类
│ ├── command/ # 命令行命令
│ │ ├── Timer.php # 定时任务
│ │ └── Swoole.php # Swoole服务
│ ├── services/ # 核心服务
│ ├── traits/ # Trait集合
│ ├── utils/ # 工具类
│ └── exceptions/ # 异常类
├── config/ # 配置文件
│ ├── app.php # 应用配置
│ ├── database.php # 数据库配置
│ ├── cache.php # 缓存配置
│ ├── queue.php # 队列配置
│ ├── workerman.php # Workerman配置
│ └── ...
├── route/ # 主路由文件
├── public/ # Web入口
│ ├── index.php # 前端入口
│ └── admin/ # 后台前端文件
├── runtime/ # 运行时文件
├── composer.json # Composer依赖
├── .env # 环境配置
└── think # ThinkPHP命令行工具
template/
├── admin/ # 管理后台 (Vue + ElementUI)
│ ├── src/
│ │ ├── api/ # API接口定义
│ │ ├── components/ # 通用组件
│ │ ├── pages/ # 页面组件
│ │ ├── router/ # 路由配置
│ │ ├── store/ # Vuex状态管理
│ │ └── utils/ # 工具函数
│ ├── package.json
│ └── vue.config.js
└── uni-app/ # 移动端 (UniApp)
├── api/ # API接口
├── components/ # 组件
├── pages/ # 页面
├── manifest.json # 应用配置
└── pages.json # 页面路由配置
app/services/user/)eb_user # 用户表
eb_user_bill # 账单表
eb_user_extract # 提现表
eb_user_recharge # 充值表
eb_user_level # 用户等级表
eb_user_group # 用户分组表
eb_user_label # 用户标签表
app/services/product/)eb_store_product # 商品表
eb_store_category # 商品分类表
eb_store_product_attr # 商品属性表
eb_store_product_reply # 商品评价表
eb_store_product_description # 商品详情表
app/services/order/)eb_store_order # 订单表
eb_store_order_cart # 订单商品表
eb_store_order_status # 订单状态变更记录
eb_store_refund # 退款表
eb_store_cart # 购物车表
未支付 (status=0)
↓ 支付成功
待发货 (status=1)
↓ 发货
待收货 (status=2)
↓ 确认收货
已完成 (status=3)
分支流程:
- 未支付 → 已取消 (status=-1)
- 待发货 → 申请退款 → 退款中 (status=-2) → 已退款 (status=-3)
- 待收货 → 申请退款 → 退款中 (status=-2) → 已退款 (status=-3)
app/services/pay/)eb_pay # 支付记录表
app/services/activity/)eb_store_combination # 拼团商品表
eb_store_pink # 拼团记录表
eb_store_bargain # 砍价商品表
eb_store_bargain_user # 砍价记录表
eb_store_seckill # 秒杀商品表
eb_store_coupon # 优惠券表
eb_store_coupon_user # 用户优惠券表
eb_integral_product # 积分商品表
app/services/agent/)eb_agent_level # 分销等级表
eb_agent_level_task # 分销任务表
eb_division # 事业部表
eb_spread_apply # 分销申请表
app/services/system/)UserControllerUserServicesUserDaoUserUserValidateget_list, save_datagetUserList, saveDataselectList, insert, update, delete$userName, $orderId$users, $products$isPaid, $hasStock<?php
namespace app\adminapi\controller\system;
use think\facade\App;
use app\services\system\SystemAdminServices;
/**
* 管理员控制器
*/
class SystemAdminController
{
protected $services;
public function __construct(App $app, SystemAdminServices $services)
{
$this->services = $services;
}
/**
* 获取管理员列表
* @return mixed
*/
public function get_list()
{
$where = $this->request->getMore([
['keywords', ''],
['status', '']
]);
$list = $this->services->getAdminList($where);
return app('json')->success($list);
}
/**
* 保存管理员
* @return mixed
*/
public function save()
{
$data = $this->request->postMore([
['account', ''],
['real_name', ''],
['pwd', ''],
['roles', []],
['status', 1]
]);
$this->services->saveAdmin($data);
return app('json')->success('保存成功');
}
}
<?php
namespace app\services\system;
use crmeb\basic\BaseServices;
use crmeb\exceptions\AdminException;
class SystemAdminServices extends BaseServices
{
/**
* 获取管理员列表
* @param array $where
* @return array
*/
public function getAdminList(array $where): array
{
// 构建查询条件
$query = $this->dao->search($where);
// 获取列表
$list = $query->select()->toArray();
// 处理数据
foreach ($list as &$item) {
$item['role_names'] = $this->getRoleNames($item['roles']);
}
return $list;
}
/**
* 保存管理员
* @param array $data
* @return int
*/
public function saveAdmin(array $data): int
{
// 验证数据
if (empty($data['account'])) {
throw new AdminException('账号不能为空');
}
// 密码加密
if (!empty($data['pwd'])) {
$data['pwd'] = password_hash($data['pwd'], PASSWORD_DEFAULT);
} else {
unset($data['pwd']);
}
// 保存数据
if (isset($data['id']) && $data['id']) {
// 更新
$id = $data['id'];
unset($data['id']);
$this->dao->update($id, $data);
} else {
// 新增
$id = $this->dao->save($data);
}
return $id;
}
}
<?php
namespace app\dao\system;
use crmeb\basic\BaseDao;
use app\model\system\SystemAdmin;
class SystemAdminDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemAdmin::class;
}
/**
* 搜索条件
* @param array $where
* @return \think\Model
*/
public function search(array $where = [])
{
$query = $this->getModel()
->where('is_del', 0);
// 账号搜索
if (!empty($where['keywords'])) {
$query = $query->whereLike('account|real_name', "%{$where['keywords']}%");
}
// 状态筛选
if ($where['status'] !== '') {
$query = $query->where('status', $where['status']);
}
return $query;
}
}
<?php
namespace app\model\system;
use crmeb\basic\BaseModel;
class SystemAdmin extends BaseModel
{
protected $name = 'system_admin';
protected $pk = 'id';
/**
* 关联角色
* @return \think\model\relation\BelongsToMany
*/
public function roles()
{
return $this->belongsToMany(SystemRole::class, 'system_admin_role', 'role_id', 'admin_id');
}
/**
* 密码修改器
* @param $value
* @return string
*/
public function setPwdAttr($value)
{
return password_hash($value, PASSWORD_DEFAULT);
}
/**
* 状态获取器
* @param $value
* @return string
*/
public function getStatusTextAttr($value, $data)
{
$status = [
0 => '禁用',
1 => '启用'
];
return $status[$data['status']] ?? '';
}
}
eb_ 前缀id表名_id,如 user_idcreate_time, update_timestatus,默认值0is_del,0未删除1已删除int,如 tinyint, smallint, int, bigintvarchar,如 varchar(255)textdecimal(10,2)int(时间戳)或 datetime{
"code": 200,
"msg": "操作成功",
"data": {}
}
{
"code": 400,
"msg": "错误信息",
"data": null
}
{
"code": 200,
"msg": "操作成功",
"data": {
"list": [],
"count": 100,
"page": 1,
"limit": 10
}
}
# 启动定时任务(守护进程)
php think timer start --d
# 停止定时任务
php think timer stop
# 重启定时任务
php think timer restart
# 查看定时任务状态
php think timer status
# 启动队列消费者
php think queue:listen --queue
# 或者使用Workerman
php think queue:work --queue
用户事件:
订单事件:
商品事件:
支付事件:
营销事件:
<?php
namespace app\listener\order;
use think\Container;
/**
* 订单支付成功监听器
*/
class OrderPaySuccessListener
{
/**
* 订单支付成功事件处理
* @param $event
* @return void
*/
public function handle($event)
{
// $event 包含订单信息
$order = $event['order'];
// 业务逻辑
// 1. 发送通知
// 2. 增加积分
// 3. 更新库存
// 4. 触发分销佣金计算
// ...
}
}
# 启动WebSocket服务
php think workerman start --d
// config/workerman.php
return [
// 管理后台通知
'admin' => [
'protocol' => 'websocket',
'port' => 40001,
'ip' => '0.0.0.0',
],
// 客服消息
'chat' => [
'protocol' => 'websocket',
'port' => 40002,
'ip' => '0.0.0.0',
],
// 内部通讯
'channel' => [
'port' => 40003,
'ip' => '127.0.0.1',
],
];
CREATE TABLE `eb_example` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '名称',
`status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态 0禁用 1启用',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
`is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='示例表';
# 使用命令行生成模型
php think make:model Example
<?php
namespace app\dao;
use crmeb\basic\BaseDao;
use app\model\Example;
class ExampleDao extends BaseDao
{
protected function setModel(): string
{
return Example::class;
}
}
<?php
namespace app\services;
use crmeb\basic\BaseServices;
use app\dao\ExampleDao;
class ExampleServices extends BaseServices
{
public function __construct(ExampleDao $dao)
{
$this->dao = $dao;
}
public function getList(array $where): array
{
return $this->dao->getList($where);
}
public function save(array $data): int
{
return $this->dao->save($data);
}
}
<?php
namespace app\adminapi\controller;
use app\services\ExampleServices;
class ExampleController
{
protected $services;
public function __construct(ExampleServices $services)
{
$this->services = $services;
}
public function get_list()
{
$where = $this->request->getMore([
['name', ''],
['status', '']
]);
$list = $this->services->getList($where);
return app('json')->success($list);
}
public function save()
{
$data = $this->request->postMore([
['name', ''],
['status', 1]
]);
$this->services->save($data);
return app('json')->success('保存成功');
}
}
// route/app.php 或 route/adminapi.php
use think\facade\Route;
Route::group('example', function () {
Route::get('list', 'Example/get_list');
Route::post('save', 'Example/save');
});
直接在后台管理系统配置代码生成,自动生成前后端代码
// 错误信息
SQLSTATE[HY000] [2002] Connection refused
// 排查步骤
1. 检查数据库服务是否启动
2. 检查 .env 配置文件中的数据库配置
3. 检查数据库用户权限
4. 检查防火墙设置
// 排查步骤
1. 检查队列消费者是否启动: php think queue:work
2. 检查队列配置: config/queue.php
3. 检查Redis连接: redis-cli ping
4. 查看队列日志: runtime/log/
# 排查步骤
1. 检查定时任务是否启动: php think timer status
2. 检查定时任务配置
3. 检查Cron表达式是否正确
4. 查看定时任务日志
# 排查步骤
1. 检查WebSocket服务是否启动: php think workerman status
2. 检查端口是否被占用: netstat -tlnp | grep 40001
3. 检查防火墙设置
4. 检查客户端连接地址是否正确
SELECT *,只查询需要的字段EXPLAIN 分析SQL执行计划composer install
cp .env.example .env
# 修改 .env 文件中的配置
# 导入数据库
mysql -u root -p crmeb < database.sql
chmod -R 755 runtime
chmod -R 755 public/uploads
# 启动队列
php think queue:listen --queue
# 启动定时任务
php think timer start --d
# 启动WebSocket
php think workerman start --d
cd template/admin
npm install
npm run build
cd docker-compose
docker-compose up -d
runtime/log/runtime/log/error//dev-docs/AI代码理解指南.md - 代码理解指南/dev-docs/错误码说明文档.md - 错误码说明.codebuddy/skills/php-api/SKILL.md - 后端开发规范.codebuddy/skills/admin-element/SKILL.md - 前端开发规范php think # 查看所有命令
php think make:controller # 创建控制器
php think make:model # 创建模型
php think make:middleware # 创建中间件
php think make:validate # 创建验证器
php think clear # 清除缓存
php think run # 启动内置服务器
php think queue:listen # 监听队列
php think queue:work # 处理队列任务
php think queue:restart # 重启队列
php think queue:fail # 查看失败任务
php think queue:retry # 重试失败任务
php think timer start # 启动定时任务
php think timer stop # 停止定时任务
php think timer restart # 重启定时任务
php think timer status # 查看状态
php think workerman start # 启动
php think workerman stop # 停止
php think workerman restart # 重启
php think workerman reload # 平滑重启
php think workerman status # 查看状态
提示: 本Agent专为CRMEB电商系统设计,帮助您快速开发和理解系统。如有疑问,请参考官方文档或查看项目源码。