编辑商品
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\common\model\ProductModel::updateProduct |
| 所属业务 | 商品管理 |
| 来源模块/系统 | 商品模型 |
功能说明
编辑商品
调用示例
$name = '示例名称';
$product_group_id = 1;
$description = '1';
$hidden = 1;
$stock_control = 1;
$qty = 1;
$pay_type = 'recurring_prepayment';
$auto_setup = 1;
$type = 'server_group';
$rel_id = 1;
$upgrade = ['string'];
$product_id = 1;
$price = 'string';
$renew_rule = 'string';
$show_base_info = 1;
$auto_renew_in_advance = 1;
$auto_renew_in_advance_num = 1;
$auto_renew_in_advance_unit = 'string';
$result = (new \app\common\model\ProductModel())->updateProduct($name, $product_group_id, $description, $hidden, $stock_control, $qty, $pay_type, $auto_setup, $type, $rel_id, $upgrade, $product_id, $price, $renew_rule, $show_base_info, $auto_renew_in_advance, $auto_renew_in_advance_num, $auto_renew_in_advance_unit);参数
| 参数 | 类型 | 必填 | 默认值 | 校验规则 | 说明 |
|---|---|---|---|---|---|
name | string | 是 | — | required | 测试商品 商品名称 |
product_group_id | int | 是 | 1 | required | 分组ID(只传二级分组ID) |
description | string | 是 | 1 | required | 描述 |
hidden | int | 是 | 1 | required | 是否隐藏:1隐藏默认,0显示 |
stock_control | int | 是 | 1 | required | 库存控制(1:启用)默认0 |
qty | int | 是 | 1 | required | 库存数量(与stock_control有关) |
pay_type | string | 是 | recurring_prepayment | required | 付款类型(免费free,一次onetime,周期先付recurring_prepayment(默认),周期后付recurring_postpaid |
auto_setup | int | 是 | 1 | required | 是否自动开通:1是默认,0否 |
type | string | 是 | server_group | required | 关联类型:server,server_group |
rel_id | int | 是 | 1 | required | 关联ID |
upgrade | array | 否 | [1,3,4] | — | 可升降级商品ID,数组 |
product_id | int | 否 | 1 | — | 父级商品ID |
price | string | 否 | — | — | 商品起售价格 |
renew_rule | string | 否 | — | — | 续费规则:due到期日,current当前时间 |
show_base_info | int | 否 | — | — | 产品列表是否展示基础信息:1是默认,0否 |
auto_renew_in_advance | int | 否 | — | — | 自动续费提前开关(0=关闭1=开启) |
auto_renew_in_advance_num | int | 否 | — | — | 自动续费提前时间数 |
auto_renew_in_advance_unit | string | 否 | — | — | 自动续费提前时间单位(minute=分钟,hour=小时,day=天) |
返回值
| 返回项 | 类型 | 说明 |
|---|---|---|
status | int | 状态码,200成功,400失败 |
msg | string | 提示信息 |
正常返回
{
"status": 1,
"msg": "string"
}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |