新建订单
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\common\model\OrderModel::createOrder |
| 所属业务 | 订单管理 |
| 来源模块/系统 | 订单模型 |
功能说明
新建订单
调用示例
$type = 'string';
$products = [['product_id' => 1, 'config_options' => [], 'qty' => 1, 'price' => 0.01, 'customfield' => []]];
$host_id = 1;
$product = ['product_id' => 1, 'config_options' => [], 'price' => 0.01];
$upgrade_refund = 1;
$price_difference = 0.01;
$renew_price_difference = 0.01;
$base_price = 0.01;
$config_options = [];
$id = 1;
$amount = 0.01;
$description = '192.0.2.1';
$client_id = 1;
$customfield = [];
$result = (new \app\common\model\OrderModel())->createOrder($type, $products, $host_id, $product, $upgrade_refund, $price_difference, $renew_price_difference, $base_price, $config_options, $id, $amount, $description, $client_id, $customfield);参数
| 参数 | 类型 | 必填 | 默认值 | 校验规则 | 说明 |
|---|---|---|---|---|---|
type | string | 是 | — | required | 类型new新订单upgrade升降级商品订单upgrade_config升降级配置订单renew续费订单artificial人工订单 |
products | array | 否 | — | — | 商品 类型为新订单时需要 |
products[].product_id | int | 否 | — | — | 商品ID |
products[].config_options | object | 否 | — | — | 自定义配置 |
products[].qty | int | 否 | — | — | 数量 |
products[].price | float | 否 | — | — | 商品价格 |
products[].customfield | object | 否 | — | — | 自定义字段 |
host_id | int | 否 | — | — | 产品ID 类型为升降级商品订单时需要 |
product | object | 否 | — | — | 升降级商品 类型为升降级商品订单时需要 |
product.product_id | int | 否 | — | — | 商品ID |
product.config_options | object | 否 | — | — | 自定义配置 |
product.price | float | 否 | — | — | 商品价格 |
upgrade_refund | int | 否 | — | — | 是否退款0否1是 类型为升降级商品订单和升降级配置订单时需要 |
price_difference | float | 否 | — | — | 产品价格差价 类型为升降级配置订单时需要 |
renew_price_difference | float | 否 | — | — | 产品续费价格差价 类型为升降级配置订单时需要 |
base_price | float | 否 | — | — | 产品新原价 类型为升降级配置订单时需要 |
config_options | object | 否 | — | — | 自定义配置 类型为升降级配置订单时需要 |
id | int | 否 | — | — | 产品ID 类型为续费订单时需要 |
amount | float | 否 | — | — | 金额 类型为升降级配置订单和人工订单时需要 |
description | string | 否 | — | — | 描述 类型为升降级配置订单和人工订单时需要 |
client_id | int | 是 | — | required | 用户ID |
customfield | object | 否 | — | — | 自定义字段 |
返回值
| 返回项 | 类型 | 说明 |
|---|---|---|
status | int | 状态码,200成功,400失败 |
msg | string | 提示信息 |
正常返回
{
"status": 1,
"msg": "string"
}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |