订单退款
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\common\model\OrderModel::orderRefund |
| 所属业务 | 订单管理 |
| 来源模块/系统 | 订单模型 |
功能说明
订单退款
调用示例
$param = ['id' => 1, 'host_id' => 1, 'amount' => 0.01, 'type' => 'string', 'notes' => '示例说明', 'gateway' => 'credit'];
$result = (new \app\common\model\OrderModel())->orderRefund($param);参数
| 参数 | 类型 | 必填 | 默认值 | 校验规则 | 说明 |
|---|---|---|---|---|---|
param.id | int | 是 | — | require | 订单ID |
param.host_id | int | 否 | — | — | 产品ID |
param.amount | float | 是 | — | require | 退款金额 |
param.type | string | 是 | — | require | 退款类型(credit_first=余额优先,gateway_first=渠道优先,credit=余额,transaction=支付接口) |
param.notes | string | 否 | — | — | 备注 |
param.gateway | string | 否 | — | — | 支付接口 requireIf:type=transaction |
返回值
| 返回项 | 类型 | 说明 |
|---|---|---|
status | int | 状态码(200=成功,400=失败) |
msg | string | 信息 |
data.id | int | 退款记录ID |
正常返回
{
"status": 1,
"msg": "string",
"data": {
"id": 1
}
}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |