Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
施宇
/
icsales
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f7880a78
authored
Jul 29, 2019
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
热门商品接口
parent
a5a02bbd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
3 deletions
Application/Common/Conf/config_url.php
Application/Home/Controller/BaseController.class.php
Application/Home/Controller/CmsController.class.php
Application/Common/Conf/config_url.php
View file @
f7880a78
...
...
@@ -69,7 +69,7 @@ return array(
'uploadresult'
=>
'Home/Index/uploadresult'
,
'integral'
=>
'Home/Index/integral'
,
'notice'
=>
'Home/Index/notice'
,
'chat'
=>
'Home/Index/chat'
'chat'
=>
'Home/Index/chat'
,
'hotgoods'
=>
'Home/Cms/getHotGoods'
,
),
);
\ No newline at end of file
Application/Home/Controller/BaseController.class.php
View file @
f7880a78
...
...
@@ -32,7 +32,7 @@ class BaseController extends Controller
}
else
{
return
$this
->
apiReturn
(
7004
,
'未找到数据'
);
}
}
}
/**
* 统一格式返回
...
...
Application/Home/Controller/CmsController.class.php
0 → 100644
View file @
f7880a78
<?php
namespace
Home\Controller
;
use
Home\Controller\BaseController
;
class
CmsController
extends
BaseController
{
// 获取热门商品
public
function
getHotGoods
()
{
$datas
=
$this
->
apiBaseCache
(
'pc_hot_goods'
,
''
,
5
);
// 热门商品
return
$this
->
jsonReturn
(
0
,
''
,
$datas
[
'data'
]);
}
/**
* 统一格式返回
* @param integer $code [description]
* @param string $msg [description]
* @param array $extend [description]
* @return [type] [description]
*/
protected
function
jsonReturn
(
$code
=
0
,
$msg
=
''
,
$extend
=
array
())
{
$data
=
array
(
'err_code'
=>
$code
,
'err_msg'
=>
$msg
,
'data'
=>
$extend
,
);
if
(
isset
(
$_GET
[
'callback'
])
&&
!
empty
(
$_GET
[
'callback'
])){
echo
$_GET
[
'callback'
]
.
'('
.
json_encode
(
$data
)
.
')'
;
exit
;
}
else
{
echo
json_encode
(
$data
);
exit
;
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment