



# 1. 登录注册类

## 1.1 发送验证码

**请求JSON**

```json
{
    "user_name":"civet148",
    "email":"civet148@126.com"
}
```

**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
```



## 1.2 商户注册

**请求JSON**

```sh
{
    "user_name":"civet148@126.com",
    "password":"e10adc3949ba59abbe56e057f20f883e",
    "email":"civet148@126.com",
    "reg_code": "888888"
}
```

**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
```



## 1.3 商户登录


**请求JSON**

```sh
{
    "user_name":"civet148@126.com",
    "password":"e10adc3949ba59abbe56e057f20f883e"
}
```

**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
```


## 1.4 商户退出


**请求JSON**

```sh
{
}
```

**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
```

# 2. AI员工类接口

## 2.1 创建员工

Token: required

POST   /api/v1/customer/create/staff

**请求JSON**

```json
{
    "name":"我的AI员工1号",     //员工名称(必填)
    "org_name":"主板销售部",    //组织名称(必填)
    "tone":"亲切且专业",        //语气
    "output_length":"简短",    //回复长度
    "description":"销冠的潜质", //员工描述
    "avatar_url":"https://www.pic.com/avatar001.jpg" //头像URL
}
```



**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {
      "id": 1001
  }
}
```



## 2.2 员工列表

Token: required

POST   /api/v1/customer/list/staff

**请求JSON**

```json
{
    "id": 0, //按员工ID查询
    "name": "", //按员工名称查询
    "serial_no": "", //按员工序列号查询
    "page_no": 0,    
    "page_size": 20
}
```



**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {
      "list": [
        {
            "id":1,                 //自增ID
            "serial_no":"123456",   //员工序列号
            "customer_id":1,        //归属客户ID
            "name":"AI001",         //员工名称
            "org_name":"SellDepartment",    //组织名称
            "tone":"",          //语气(亲切/严肃/专业等等)
            "output_length":"", //回复长度(短/中/长等等)
            "description":"",   //描述
            "trial_time":"",    //试用结束时间
            "expiring_time":"", //有效期截止时间
            "state":0,          //状态(0=未激活 1=正常 2=接近过期 3=已过期)
            "edit_user":"",     //最后编辑人
            "is_frozen": false, //是否已冻结
            "chat_url":"",      //智能员工URL
            "avatar_url":"",    //智能员工头像
            "is_deleted": false, //是否已删除(0=未删除 1=已删除)
            "created_time":"2024-04-23 10:32:30",  //创建时间
            "updated_time":"2024-04-23 10:32:30"   //更新时间
        }
      ]
  }
}


```


## 2.3 编辑员工

Token: required

POST   /api/v1/customer/edit/staff 

**请求JSON**

```json
{
    "id": 1,                 //自增ID (必填)
    "serial_no": "123456",   //员工序列号
    "name": "AI001",         //员工名称
    "org_name": "SellDepartment",    //组织名称
    "tone": "",          //语气(亲切/严肃/专业等等)
    "output_length": "", //回复长度(短/中/长等等)
    "description": "",   //描述
    "is_frozen": false,  //是否已冻结
    "chat_url": "",      //智能员工URL
    "avatar_url": ""     //智能员工头像
}
```



**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
```


## 2.4 删除员工

Token: required

 POST   /api/v1/customer/delete/staff 

 **请求JSON**

```json
{
    "id": 1                 //自增ID (必填)
}
```



**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
```



## 2.5 冻结员工

Token: required

POST   /api/v1/customer/frozen/staff

**请求JSON**

```json
{
    "id": 1                 //自增ID (必填)
}
```



**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
```



## 2.6 套餐支付

Token: required

POST  /api/v1/customer/pay/staff 

**请求JSON**

```json
{
    "id": 1, //需要支付的员工ID
	"production_id": 2, //支付套餐ID
	"pay_type":"alipay" //支付方式(wxpay=微信支付 alipay=支付宝 stripe=Stripe支付)
}
```



**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {
    "pay_type": "alipay", //支付方式
	"trade_no": "NO202404251606089389209168633" //支付订单号
	"pay_url": "https://qr.alipay.com/bax02518wkpb3p3e9fro3071"  //支付链接(自行用插件转为二维码)
  }
}
```

## 2.7 查询支付状态

Token: required

POST   /api/v1/customer/query/trade

**请求JSON**

```json
{
    "trade_no": "NO202404251606089389209168633" //支付订单号
}
```



**响应JSON**

```json

{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {
    "state": 0,          //订单状态(0=待支付 1=处理中 2=已成功支付 3=已取消 4=已退款 5=支付平台异常)
	"message": "Success" //订单交易状态信息
  }
}
```

## 2.8 上传资料

Token: required

POST  /api/v1/customer/upload/file 

**请求Form-data**

```json
file_name => QQ.jpg
file_data => 图片二进制数据
```



**响应JSON**

```json
{
    "header": {
        "code": 0,
        "message": "",
        "total": 1,
        "count": 1
    },
    "data": {
        "file_name": "QQ.jpg",
        "file_url": "http://116.213.39.234:8084/assets/files/1713856350987496426_QQ.jpg"
    }
}
```



# 3. 产品类接口

## 3.1 创建产品 (管理端)

Token: required

POST   /api/v1/customer/create/production

**请求JSON**

```json
{
    "name":"标准版包月套餐"                                  //产品名称
	"price":"199",                                         //产品价格(单位: 元)
	"currency":"CNY",                                      //单位(CNY/USD...)
	"state": 0,                                            //状态(0=待上架 1=已上架 2=已下架)
	"language":"zh-CN",                                    //区域语言(中国=zh-CN 英美=en)
	"description":"标准版包月套餐，中小企业福利",             //产品描述
	"trial_days": 7,                                       //产品试用期(单位: 天)
	"expiring_days":31                                     //产品有效期(单位: 天)
}
```



**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {
      "id": 10
  }
}
```

## 3.2 产品列表 (商户和管理端)

Token: required

POST   /api/v1/customer/list/production

**请求JSON**

```json
{
    "id": 0, //按产品ID查询
    "name": "", //按产品名称查询
    "serial_no": "", //按产品序列号查询
    "page_no": 0,    
    "page_size": 20
}
```



**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {
      "list": [
        {
            "id": 1, 										   //产品ID
            "name":"标准版包月套餐"                                  //产品名称
            "price":"199",                                         //产品价格(单位: 元)
            "currency":"CNY",                                      //单位(CNY/USD...)
            "state": 0,                                            //状态(0=待上架 1=已上架 2=已下架)
            "language":"zh-CN",                                    //区域语言(中国=zh-CN 英美=en)
            "description":"标准版包月套餐，中小企业福利",             //产品描述
            "trial_days": 7,                                       //产品试用期(单位: 天)
            "expiring_days":31                                     //产品有效期(单位: 天)
            "serial_no": "asfsafasfs"                              //产品序列号(唯一)
            "is_deleted": false,                                   //是否已删除(0=未删除 1=已删除)
            "create_user": "admin",                                //创建人
            "edit_user": "admin",                                  //编辑人
            "created_time":"2024-04-23 10:32:30",  				 //创建时间
            "updated_time":"2024-04-23 10:32:30"   				 //更新时间
        }
      ]
  }
}
```

## 3.3 编辑产品 (管理端)

Token: required

POST   /api/v1/customer/edit/production

**请求JSON**

```json
{
    "id": 1, 										   //产品ID (必填)
    "name":"标准版包月套餐"                                  //产品名称
	"price":"199",                                         //产品价格(单位: 元)
	"currency":"CNY",                                      //单位(CNY/USD...)
	"state": 0,                                            //状态(0=待上架 1=已上架 2=已下架)
	"language":"zh-CN",                                    //区域语言(中国=zh-CN 英美=en)
	"description":"标准版包月套餐，中小企业福利",             //产品描述
	"trial_days": 7,                                       //产品试用期(单位: 天)
	"expiring_days":31                                     //产品有效期(单位: 天)
}
```



**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {
  }
}
```

## 3.4 删除产品 (管理端)

Token: required

POST   /api/v1/customer/delete/production

**请求JSON**

```json
{
    "id": 1 //产品ID (必填)
}
```



**响应JSON**

```json
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {
  }
}
```




