Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SooonerHotel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴贤德
SooonerHotel
Commits
9db495a8
Commit
9db495a8
authored
Nov 12, 2019
by
吴贤德
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
中心接口:新增华数演示接口
parent
f1228ecf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
116 additions
and
0 deletions
+116
-0
WasuAction.class.php
SooonerHotel/App/Lib/Action/Api/WasuAction.class.php
+116
-0
No files found.
SooonerHotel/App/Lib/Action/Api/WasuAction.class.php
0 → 100644
View file @
9db495a8
<?php
/**
* Created by PhpStorm.
* User: wuxiande
* Date: 2019/11/6
* Time: 15:46
* 华数演示接口
* 这边希望两块数据
1.获得二级栏目,类似于电竞分dota2,lol等等
2.根据获得的栏目查询此栏目下的内容
*/
class
WasuAction
extends
Action
{
/*
* 获取栏目列表
* 输入:
* sid : 站点id
* 输出:
* {"movie":["栏目1","栏目2"],"news":["",""]}
*
* 示例:
* 小帅站点:
* http://api.hotel.wasu.tv/api/wasu/programs?sid=1
* 圆动站点:
* http://api.hotel.wasu.tv/api/wasu/programs?sid=2
*/
public
function
programs
(){
$sid
=
$_GET
[
"sid"
];
$sql
=
"select type,programType from sh_media_wasu
where site_id=
$sid
group by type,programType"
;
$arr
=
M
()
->
query
(
$sql
);
foreach
(
$arr
as
$item
){
$result
[
$item
[
"type"
]][]
=
$item
[
"programType"
];
}
header
(
'Content-type: application/json'
);
//json
echo
json_encode
(
$result
);
exit
;
}
/**
* 获取指定酒店指定栏目下媒资列表(分页获取)
* /api/wasu/medias?spid=1&hid=1&program=恐怖悬疑&page=1&size=10
* 输入:
* spid : 合作方id
* hid : 酒店id
* program : 栏目名称(不传或all获取所有栏目媒资)
* status_inject : 注入状态:1已注入 ,all为所有
* page : 请求页
* page_size : 每页记录数
* 输出:
*
* 示例:
* 圆动 -> 华数圆动测试酒店:
* http://api.hotel.wasu.tv/api/wasu/medias?status_inject=1&spid=33&hid=97&program=恐怖悬疑&page=1&size=20
* 华数测试 -> 华数测试酒店1:
* http://api.hotel.wasu.tv/api/wasu/medias?status_inject=1&spid=5&hid=3&program=恐怖悬疑&page=1&size=20
*/
public
function
medias
(){
$spid
=
$_GET
[
"spid"
];
$hid
=
$_GET
[
"hid"
];
$page
=
$_GET
[
"page"
];
$size
=
$_GET
[
"size"
];
$where
=
" 1=1 "
;
$status_inject
=
$_GET
[
"status_inject"
];
if
(
!
empty
(
$status_inject
)
&&
$status_inject
!=
"all"
){
$where
.=
" AND hm.status_inject=
$status_inject
"
;
}
$program
=
urldecode
(
$_GET
[
"program"
]);
if
(
!
empty
(
$program
)
&&
$program
!=
"all"
&&
$program
!=
""
){
$where
.=
" AND mw.programType='
$program
' "
;
}
if
(
empty
(
$size
)){
$size
=
10
;
}
$sqlTotal
=
"SELECT count(1) total FROM sh_hotel_media_map_
$spid
hm,sh_media_wasu mw"
.
" WHERE
$where
AND hm.status=1 AND hm.hotel_id=
$hid
AND mw.id=media_id "
;
// echo $sqlTotal;
$totalArr
=
M
(
""
)
->
query
(
$sqlTotal
);
$total
=
0
;
if
(
count
(
$totalArr
)
>
0
){
$total
=
$totalArr
[
0
][
"total"
];
}
$page_num
=
ceil
(
$total
/
$size
);
$limit_from
=
(
$page
-
1
)
*
$size
;
$fields
=
"mw.code id,mw.title,mw.description,mw.programType,mw.url_pic picUrl"
.
",mw.year,mw.type,mw.score,mw.region,mw.actor,mw.director"
.
",hm.status,hm.status_inject statusInject"
.
",mw.type,mw.nodeId,mw.nodeName"
.
",mw.newsImage_1,mw.newsImage_2,mw.newsImage_3,mw.englishTitle"
;
$sql
=
"SELECT
$fields
"
.
" FROM sh_hotel_media_map_
$spid
hm,sh_media_wasu mw"
.
" WHERE
$where
AND hm.status=1 AND hm.hotel_id=
$hid
"
.
" AND mw.id=media_id ORDER BY mw.id ASC limit
$limit_from
,
$size
;"
;
// echo $sql;exit;
$list
=
M
(
""
)
->
query
(
$sql
);
$result
[
"total"
]
=
(
int
)
$total
;
$result
[
"page_cur"
]
=
(
int
)
$page
;
$result
[
"page_num"
]
=
(
int
)
$page_num
;
$result
[
"list"
]
=
$list
;
header
(
'Content-type: application/json'
);
//json
echo
json_encode
(
$result
);
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