切换导航条
此项目
正在载入...
登录
王晓刚
/
market
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
耿培杰
5 years ago
提交
82214ede89df1eb80f6b4820317a210aa1dc22d5
1 个父辈
5be5b001
修改接口
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
44 行增加
和
5 行删除
application/api/controller/Goods.php
application/extra/site.php
public/api.html
application/api/controller/Goods.php
查看文件 @
82214ed
...
...
@@ -56,6 +56,7 @@ class Goods extends Api
* @ApiSummary (推荐商品列表)
* @ApiMethod (POST)
* @ApiRoute (/api/goods/getRecommendGoods)
* @ApiParams (name=limit, type=string, required=false, description="显示条数 默认10条")
* @ApiReturn({
"code": 1,
"msg": "请求成功",
...
...
@@ -77,10 +78,12 @@ class Goods extends Api
*/
public
function
getRecommendGoods
()
{
$limit
=
$this
->
request
->
param
(
'limit'
)
?
$this
->
request
->
param
(
'limit'
)
:
10
;
$where
[
'g.is_recommend'
]
=
1
;
$data
=
$this
->
goodsModel
->
selectData
(
$where
,
10
,
$this
->
lang
);
$list
=
$this
->
goodsModel
->
selectData
(
$where
,
$limit
,
$this
->
lang
);
$data
[
'image'
]
=
cdnurl
(
config
(
'site.index_recommend_image'
));
$data
[
'list'
]
=
$list
;
$this
->
success
(
'请求成功'
,
$data
);
}
...
...
@@ -90,6 +93,7 @@ class Goods extends Api
* @ApiSummary (商品列表)
* @ApiMethod (POST)
* @ApiRoute (/api/goods/getGoodsList)
* @ApiParams (name=type, type=string, required=false, description="类型:1=普通商品,2=推荐商品 默认全部")
* @ApiParams (name=page, type=string, required=false, description="页数")
* @ApiReturn({
"code": 1,
...
...
@@ -118,6 +122,7 @@ class Goods extends Api
$limit
=
Config
::
get
(
'paginate.index_rows'
);
$where
=
[];
$type
=
$this
->
request
->
param
(
'type'
);
$keyword
=
$this
->
request
->
param
(
'keyword'
);
if
(
$keyword
){
$where
[
'g.ch_name|g.en_name|g.ch_content|g.en_content'
]
=
[
'like'
,
'%'
.
$keyword
.
'%'
];
...
...
@@ -125,6 +130,11 @@ class Goods extends Api
if
(
$this
->
userId
)
$this
->
keywordLogModel
->
save
([
'user_id'
=>
$this
->
userId
,
'content'
=>
$keyword
,
'createtime'
=>
time
()]);
}
if
(
!
empty
(
$type
)
&&
$type
==
2
){
$where
[
'g.is_recommend'
]
=
1
;
}
elseif
(
!
empty
(
$type
)
&&
$type
==
1
){
$where
[
'g.is_recommend'
]
=
2
;
}
$data
=
$this
->
goodsModel
->
selectPageData
(
$where
,
$page
,
$limit
,
$this
->
lang
);
$this
->
success
(
'请求成功'
,
$data
);
}
...
...
application/extra/site.php
查看文件 @
82214ed
...
...
@@ -50,4 +50,5 @@ return array (
'en_vip_text'
=>
'<p>会员特权英文</p>'
,
'en_withdraw_deposit_text'
=>
'<p>会员特权英文</p>'
,
'en_distribution_text'
=>
'<p>会员特权英文</p>'
,
'index_recommend_image'
=>
'/uploads/20200526/a677bd6b92fca41ed1a5be015a14f8a0.png'
,
);
\ No newline at end of file
...
...
public/api.html
查看文件 @
82214ed
...
...
@@ -9418,7 +9418,24 @@
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading"
><strong>
参数
</strong></div>
<div
class=
"panel-body"
>
无
<table
class=
"table table-hover"
>
<thead>
<tr>
<th>
名称
</th>
<th>
类型
</th>
<th>
必选
</th>
<th>
描述
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
limit
</td>
<td>
string
</td>
<td>
否
</td>
<td>
显示条数 默认10条
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div
class=
"panel panel-default"
>
...
...
@@ -9436,7 +9453,8 @@
<div
class=
"panel-body"
>
<form
enctype=
"application/x-www-form-urlencoded"
role=
"form"
action=
"/api/goods/getRecommendGoods"
method=
"POST"
name=
"form21"
id=
"form21"
>
<div
class=
"form-group"
>
无
<label
class=
"control-label"
for=
"limit"
>
limit
</label>
<input
type=
"string"
class=
"form-control input-sm"
id=
"limit"
placeholder=
"显示条数 默认10条"
name=
"limit"
>
</div>
<div
class=
"form-group"
>
<button
type=
"submit"
class=
"btn btn-success send"
rel=
"21"
>
提交
</button>
...
...
@@ -9538,6 +9556,12 @@
</thead>
<tbody>
<tr>
<td>
type
</td>
<td>
string
</td>
<td>
否
</td>
<td>
类型:1=普通商品,2=推荐商品 默认全部
</td>
</tr>
<tr>
<td>
page
</td>
<td>
string
</td>
<td>
否
</td>
...
...
@@ -9562,6 +9586,10 @@
<div
class=
"panel-body"
>
<form
enctype=
"application/x-www-form-urlencoded"
role=
"form"
action=
"/api/goods/getGoodsList"
method=
"POST"
name=
"form22"
id=
"form22"
>
<div
class=
"form-group"
>
<label
class=
"control-label"
for=
"type"
>
type
</label>
<input
type=
"string"
class=
"form-control input-sm"
id=
"type"
placeholder=
"类型:1=普通商品,2=推荐商品 默认全部"
name=
"type"
>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label"
for=
"page"
>
page
</label>
<input
type=
"string"
class=
"form-control input-sm"
id=
"page"
placeholder=
"页数"
name=
"page"
>
</div>
...
...
@@ -12827,7 +12855,7 @@
<div
class=
"row mt0 footer"
>
<div
class=
"col-md-6"
align=
"left"
>
Generated on 2020-05-2
1 17:02:37
</div>
Generated on 2020-05-2
6 15:11:09
</div>
<div
class=
"col-md-6"
align=
"right"
>
<a
href=
"./"
target=
"_blank"
>
E-MP market
</a>
</div>
...
...
请
注册
或
登录
后发表评论