商品搜索
方法概览
| 项目 | 内容 |
|---|---|
| 文档类型 | PHP 类方法 |
| 方法标识 | app\common\model\ProductModel::productListSearch |
| 所属业务 | 商品管理 |
| 来源模块/系统 | 商品模型 |
功能说明
商品搜索
调用示例
$param = ['keywords' => '示例关键字', 'product_group_id' => 1, 'page' => 1, 'limit' => 1, 'orderby' => 'id', 'sort' => 'string', 'exclude_domain' => 1];
$result = (new \app\common\model\ProductModel())->productListSearch($param);参数
| 参数 | 类型 | 必填 | 默认值 | 校验规则 | 说明 |
|---|---|---|---|---|---|
param.keywords | string | 否 | — | — | 关键字,搜索范围:商品ID,商品名,描述 |
param.product_group_id | int | 否 | — | — | 商品分组ID |
param.page | int | 否 | — | — | 页数 |
param.limit | int | 否 | — | — | 每页条数 |
param.orderby | string | 否 | — | — | 排序 id,name |
param.sort | string | 否 | — | — | 升/降序 asc,desc |
param.exclude_domain | int | 否 | — | — | 是否排除域名(0=否,1=是) |
返回值
| 返回项 | 类型 | 说明 |
|---|---|---|
list | array | 商品列表 |
list[].id | int | 商品ID |
list[].name | string | 商品名 |
list[].stock_control | int | 是否开启库存控制:1开启,0关闭 |
list[].qty | int | 库存 |
list[].pay_type | string | 付款类型(免费free,一次onetime,周期先付recurring_prepayment,周期后付recurring_postpaid |
list[].hidden | int | 是否隐藏:1隐藏,0显示 |
list[].product_group_name_second | int | 二级分组名称 |
list[].product_group_id_second | int | 二级分组ID |
list[].product_group_name_first | int | 一级分组名称 |
list[].product_group_id_first | int | 一级分组ID |
list[].agentable | int | 是否可代理商品0否1是 |
list[].agent | int | 代理商品0否1是 |
list[].host_num | int | 产品数量 |
list[].mode | string | 代理模式:only_api仅调用接口,sync同步数据,这里判断一下如果为sync,不需要显示接口类型和即可,并直接拉取所有信息 |
count | int | 商品总数 |
正常返回
{
"list": [
{
"id": 1,
"name": "示例名称",
"stock_control": 1,
"qty": 1,
"pay_type": "string",
"hidden": 1,
"product_group_name_second": 1,
"product_group_id_second": 1,
"product_group_name_first": 1,
"product_group_id_first": 1,
"agentable": 1,
"agent": 1,
"host_num": 1,
"mode": "string"
}
],
"count": 1
}异常情况
| 异常类型 | 说明 |
|---|---|
Throwable | 调用失败时由具体实现抛出异常,异常信息以运行时结果为准。 |