商品详情
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\common\model\ProductModel::indexProduct |
| 所属业务 | 商品管理 |
| 来源模块/系统 | 商品模型 |
功能说明
商品详情
调用示例
$id = 1;
$result = (new \app\common\model\ProductModel())->indexProduct($id);参数
| 参数 | 类型 | 必填 | 默认值 | 校验规则 | 说明 |
|---|---|---|---|---|---|
id | int | 是 | — | required | 商品ID |
返回值
| 返回项 | 类型 | 说明 |
|---|---|---|
id | int | ID |
name | string | 商品名称 |
product_group_id | int | 所属商品组ID |
description | string | 商品描述 |
hidden | int | 0显示默认,1隐藏 |
stock_control | int | 库存控制(1:启用)默认0 |
qty | int | 库存数量(与stock_control有关) |
pay_type | int | 付款类型(免费free,一次onetime,周期先付recurring_prepayment,周期后付recurring_postpaid |
auto_setup | int | 是否自动开通:1是默认,0否 |
type | int | 关联类型:server,server_group |
rel_id | int | 关联ID |
upgrade | array | 可升降级商品ID,数组 |
product_id | int | 父商品ID |
plugin_custom_fields | object | 插件钩子返回的自定义字段{"k1":"v1"} |
show | int | 是否将商品展示在会员中心对应模块的列表中:0否1是 |
renew_rule | string | 续费规则:due到期日,current当前时间 |
auto_renew_in_advance | int | 自动续费提前开关(0=关闭1=开启) |
auto_renew_in_advance_num | int | 自动续费提前时间数 |
auto_renew_in_advance_unit | string | 自动续费提前时间单位(minute=分钟,hour=小时,day=天) |
mode | string | 代理模式:only_api仅调用接口,sync同步商品 |
supplier_id | int | 供应商ID |
supplier_name | string | 供应商名称 |
profit_type | int | 0表示百分比价格方案,1表示自定义金额 |
show_base_info | int | 产品列表是否展示基础信息:1是默认,0否 |
module | string | 商品对应模块 |
pay_ontrial | object | 试用配置 |
pay_ontrial.status | int | 是否开启 |
pay_ontrial.cycle_type | string | 时长单位(hour/day/month) |
pay_ontrial.cycle_num | int | 时长 |
pay_ontrial.client_limit | string | no不限制/new新用户/host用户必须存在激活中的产品 |
pay_ontrial.account_limit | string | 账户限制(email绑定邮件/phone绑定手机/certification) |
pay_ontrial.old_client_exclusive | string | 老用户专享(商品ID多选,逗号分隔) |
pay_ontrial.max | int | 单用户最大试用数量 |
on_demand.min_credit | string | 购买时用户最低余额 |
on_demand.min_usage_time | int | 最低使用时长 |
on_demand.min_usage_time_unit | string | 最低使用时长单位(second=秒,minute=分,hour=小时) |
on_demand.credit_limit_pay | int | 允许信用额支付(0=否,1=是) |
正常返回
{
"id": 1,
"name": "示例名称",
"product_group_id": 1,
"description": "192.0.2.1",
"hidden": 1,
"stock_control": 1,
"qty": 1,
"pay_type": 1,
"auto_setup": 1,
"type": 1,
"rel_id": 1,
"upgrade": [
"string"
],
"product_id": 1,
"plugin_custom_fields": {},
"show": 1,
"renew_rule": "string",
"auto_renew_in_advance": 1,
"auto_renew_in_advance_num": 1,
"auto_renew_in_advance_unit": "string",
"mode": "string",
"supplier_id": 1,
"supplier_name": "示例名称",
"profit_type": 1,
"show_base_info": 1,
"module": "string",
"pay_ontrial": {
"status": 1,
"cycle_type": "string",
"cycle_num": 1,
"client_limit": "string",
"account_limit": "string",
"old_client_exclusive": "string",
"max": 1
},
"on_demand": {
"min_credit": "string",
"min_usage_time": 1752984000,
"min_usage_time_unit": "string",
"credit_limit_pay": 1
}
}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |