切换导航条
此项目
正在载入...
登录
王晓刚
/
market
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
耿培杰
5 years ago
提交
97ee12475db1ae733474e32ebcf6051c73a643c7
1 个父辈
f906135a
修改搜索商品接口
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
14 行增加
和
5 行删除
application/api/controller/Goods.php
application/api/model/Category.php
application/api/model/Goods.php
application/api/controller/Goods.php
查看文件 @
97ee124
...
...
@@ -321,14 +321,12 @@ class Goods extends Api
if
(
!
empty
(
$params
[
'level_id'
]))
$where
[
'level_id'
]
=
$params
[
'level_id'
];
if
(
!
empty
(
$params
[
'part_id'
]))
$where
[
'part_id'
]
=
$params
[
'part_id'
];
if
(
!
empty
(
$params
[
'category2_id'
]))
$where
[
'category2_id'
]
=
$params
[
'category2_id'
];
$goodsWhere
=
$where
;
$where
[
'ch_name|en_name|ch_content|en_content'
]
=
[
'like'
,
'%'
.
$params
[
'keyword'
]
.
'%'
];
$goodsWhere
[
'g.ch_name|g.en_name|g.ch_content|g.en_content'
]
=
[
'like'
,
'%'
.
$params
[
'keyword'
]
.
'%'
];
$where
[
'g.ch_name|g.en_name|g.ch_content|g.en_content|cate1.name|cate2.name|cate3.name'
]
=
[
'like'
,
'%'
.
$params
[
'keyword'
]
.
'%'
];
//获取筛选标签,国家,品牌,等级,部位,品类
$data
[
'extend'
]
=
$this
->
categoryModel
->
getExtend
(
$where
,
$this
->
lang
);
//获取列表数据
$data
[
'list'
]
=
$this
->
goodsModel
->
selectPageData
(
$
goodsW
here
,
$page
,
$limit
,
$this
->
lang
);
$data
[
'list'
]
=
$this
->
goodsModel
->
selectPageData
(
$
w
here
,
$page
,
$limit
,
$this
->
lang
);
$this
->
success
(
'请求成功'
,
$data
);
}
...
...
application/api/model/Category.php
查看文件 @
97ee124
...
...
@@ -30,7 +30,12 @@ class Category extends Model
public
function
getExtend
(
$where
,
$lang
)
{
$goodsModel
=
new
Goods
();
$ids
=
$goodsModel
->
where
(
$where
)
->
column
(
'country_id,brand_id,level_id,part_id,category2_id'
);
$ids
=
$goodsModel
->
alias
(
'g'
)
->
join
(
'fa_category cate1'
,
'g.category_one_id=cate1.id'
)
->
join
(
'fa_category cate2'
,
'g.category_two_id=cate2.id'
)
->
join
(
'fa_category cate3'
,
'g.category_three_id=cate3.id'
)
->
where
(
$where
)
->
column
(
'country_id,brand_id,level_id,part_id,category2_id'
);
$countryids
=
[];
$brandids
=
[];
...
...
application/api/model/Goods.php
查看文件 @
97ee124
...
...
@@ -142,11 +142,17 @@ class Goods extends Model
$total
=
$this
->
alias
(
'g'
)
->
join
(
'fa_country c'
,
'g.country_id=c.id'
)
->
join
(
'fa_category cate1'
,
'g.category_one_id=cate1.id'
)
->
join
(
'fa_category cate2'
,
'g.category_two_id=cate2.id'
)
->
join
(
'fa_category cate3'
,
'g.category_three_id=cate3.id'
)
->
where
(
$where
)
->
count
();
$list
=
$this
->
alias
(
'g'
)
->
join
(
'fa_country c'
,
'g.country_id=c.id'
)
->
join
(
'fa_category cate1'
,
'g.category_one_id=cate1.id'
)
->
join
(
'fa_category cate2'
,
'g.category_two_id=cate2.id'
)
->
join
(
'fa_category cate3'
,
'g.category_three_id=cate3.id'
)
->
where
(
$where
)
->
field
(
$field
)
->
order
(
'g.weigh desc'
)
...
...
请
注册
或
登录
后发表评论