获取周期比例
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\common\model\ProductDurationRatioModel::indexRatio |
| 所属业务 | 公共接口 |
| 来源模块/系统 | 周期比例模型 |
功能说明
获取周期比例
调用示例
$product_id = 1;
$result = (new \app\common\model\ProductDurationRatioModel())->indexRatio($product_id);参数
| 参数 | 类型 | 必填 | 默认值 | 校验规则 | 说明 |
|---|---|---|---|---|---|
product_id | int | 是 | — | require | 商品ID |
返回值
| 返回项 | 类型 | 说明 |
|---|---|---|
[].id | int | 关联周期表ID |
[].name | string | 周期名称 |
[].num | string | 周期时长 |
[].unit | string | 周期单位(hour=小时,day=天,month=月) |
[].ratio | float | 周期比例 |
[].price_factor | float | 价格系数 |
正常返回
{
"id": 1,
"name": "示例名称",
"num": "string",
"unit": "string",
"ratio": 0.01,
"price_factor": 0.01
}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |