计算自动填充
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\common\model\ProductDurationRatioModel::autoFill |
| 所属业务 | 公共接口 |
| 来源模块/系统 | 周期比例模型 |
功能说明
计算自动填充
调用示例
$param = [['product_id' => 1, 'price' => ['string'], 'on_demand_price' => 0.01]];
$result = (new \app\common\model\ProductDurationRatioModel())->autoFill($param);参数
| 参数 | 类型 | 必填 | 默认值 | 校验规则 | 说明 |
|---|---|---|---|---|---|
param | array | 是 | — | require | 参数 |
param.product_id | int | 是 | — | require | 商品ID |
param.price | array | 是 | — | require | 价格(如["2"=>"1.5"],键是周期ID,值是价格) |
param.on_demand_price | float | 否 | — | — | 按需价格 |
返回值
| 返回项 | 类型 | 说明 |
|---|---|---|
status | int | 状态(200=成功,400=失败) |
msg | string | 信息 |
data.list | array | 填充的价格(键是周期ID,值是填充的价格) |
on_demand_price | string | 按需价格 |
正常返回
{
"status": 1,
"msg": "string",
"data": {
"list": [
"string"
]
},
"on_demand_price": "string"
}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |