智简魔方文档

商品详情

方法概览

项目内容
文档类型PHP 类方法
方法标识app\common\model\ProductModel::indexProduct
所属业务商品管理
来源模块/系统商品模型

功能说明

商品详情

调用示例

$id = 1;
$result = (new \app\common\model\ProductModel())->indexProduct($id);

参数

参数类型必填默认值校验规则说明
idintrequired商品ID

返回值

返回项类型说明
idintID
namestring商品名称
product_group_idint所属商品组ID
descriptionstring商品描述
hiddenint0显示默认,1隐藏
stock_controlint库存控制(1:启用)默认0
qtyint库存数量(与stock_control有关)
pay_typeint付款类型(免费free,一次onetime,周期先付recurring_prepayment,周期后付recurring_postpaid
auto_setupint是否自动开通:1是默认,0否
typeint关联类型:server,server_group
rel_idint关联ID
upgradearray可升降级商品ID,数组
product_idint父商品ID
plugin_custom_fieldsobject插件钩子返回的自定义字段{"k1":"v1"}
showint是否将商品展示在会员中心对应模块的列表中:0否1是
renew_rulestring续费规则:due到期日,current当前时间
auto_renew_in_advanceint自动续费提前开关(0=关闭1=开启)
auto_renew_in_advance_numint自动续费提前时间数
auto_renew_in_advance_unitstring自动续费提前时间单位(minute=分钟,hour=小时,day=天)
modestring代理模式:only_api仅调用接口,sync同步商品
supplier_idint供应商ID
supplier_namestring供应商名称
profit_typeint0表示百分比价格方案,1表示自定义金额
show_base_infoint产品列表是否展示基础信息:1是默认,0否
modulestring商品对应模块
pay_ontrialobject试用配置
pay_ontrial.statusint是否开启
pay_ontrial.cycle_typestring时长单位(hour/day/month)
pay_ontrial.cycle_numint时长
pay_ontrial.client_limitstringno不限制/new新用户/host用户必须存在激活中的产品
pay_ontrial.account_limitstring账户限制(email绑定邮件/phone绑定手机/certification)
pay_ontrial.old_client_exclusivestring老用户专享(商品ID多选,逗号分隔)
pay_ontrial.maxint单用户最大试用数量
on_demand.min_creditstring购买时用户最低余额
on_demand.min_usage_timeint最低使用时长
on_demand.min_usage_time_unitstring最低使用时长单位(second=秒,minute=分,hour=小时)
on_demand.credit_limit_payint允许信用额支付(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调用失败时由具体实现抛出异常,异常信息以运行时结果为准。