获取购物车
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\home\model\CartModel::indexCart |
| 所属业务 | 商品管理 |
| 来源模块/系统 | 购物车模型 |
功能说明
获取购物车
调用示例
$result = (new \app\home\model\CartModel())->indexCart();参数
该函数/方法无需传入参数。
返回值
| 返回项 | 类型 | 说明 |
|---|---|---|
list | array | 计算后数据 |
list[].product_id | int | 商品ID |
list[].config_options | object | 自定义配置 |
list[].qty | int | 数量 |
list[].customfield | object | 自定义参数 |
list[].name | string | 商品名称 |
list[].description | string | 商品描述 |
list[].stock_control | int | 库存控制0:关闭1:启用 |
list[].stock_qty | int | 库存数量 |
list[].self_defined_field | object | 自定义字段({"5":"123"},5是自定义字段ID,123是填写的内容) |
正常返回
{
"list": [
{
"product_id": 1,
"config_options": {},
"qty": 1,
"customfield": {},
"name": "示例名称",
"description": "192.0.2.1",
"stock_control": 1,
"stock_qty": 1,
"self_defined_field": {}
}
]
}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |