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
90e6985e
Commit
90e6985e
authored
Jul 04, 2019
by
wangjiangze
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://code.dev.soooner.com:18000/wuxiande/SooonerHotel
into develop
parents
a8df5e03
c972fa23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
311 additions
and
2 deletions
+311
-2
config.php
SooonerHotel/App/Conf/config.php
+2
-2
CenterAction.class.php
SooonerHotel/App/Lib/Action/Api/CenterAction.class.php
+248
-0
FrontAction.class.php
SooonerHotel/App/Lib/Action/Api/FrontAction.class.php
+61
-0
No files found.
SooonerHotel/App/Conf/config.php
View file @
90e6985e
...
...
@@ -18,10 +18,10 @@ return array(
'DB_FIELDTYPE_CHECK'
=>
true
,
//开启字段类型验证
'TMPL_STRIP_SPACE'
=>
true
,
//是否去除模板文件里面的html空格与换行
'VAR_PAGE'
=>
'p'
,
//分页参数
'APP_STATUS'
=>
'
debug
'
,
'APP_STATUS'
=>
'
release
'
,
//分组
'APP_GROUP_LIST'
=>
'System,Hotel,Sp,Media,Inject'
,
//项目分组列表(配置即表示开启分组)
'APP_GROUP_LIST'
=>
'System,Hotel,Sp,Media,Inject
,Api
'
,
//项目分组列表(配置即表示开启分组)
'DEFAULT_GROUP'
=>
''
,
//多语言
...
...
SooonerHotel/App/Lib/Action/Api/CenterAction.class.php
0 → 100644
View file @
90e6985e
<?php
/**
* Created by PhpStorm.
* User: wuxiande
* Date: 2019/6/27
* Time: 14:16
* 中心服务接口
* 系统配置接口
* 合作方配置接口
* 推送日志记录接口
* 云端片库修改接口
*/
class
CenterAction
extends
Action
{
/**
* 系统配置接口
*/
public
function
conf_sys
(){
$sql
=
"SELECT k,v FROM sh_system_config WHERE status=0 ORDER BY id ASC;"
;
$arr
=
M
(
""
)
->
query
(
$sql
);
foreach
(
$arr
as
$item
){
$result
[
$item
[
"k"
]]
=
$item
[
"v"
];
}
echo
json_encode
(
$result
);
}
/**
* 合作方配置接口
*
*/
public
function
conf_sps
(){
$sql
=
"SELECT sp.id,sp.code,sp.push_type,sp.push_offset,config.type_code as k,config.v"
.
" FROM sh_sp sp,sh_sp_config config"
.
" WHERE sp.status=0 AND config.status=0 AND sp.id=config.sp_id ORDER BY sp.id ASC;"
;
$arr
=
M
(
""
)
->
query
(
$sql
);
foreach
(
$arr
as
$item
){
$result
[
$item
[
"id"
]][
"id"
]
=
$item
[
"id"
];
$result
[
$item
[
"id"
]][
"code"
]
=
$item
[
"code"
];
$result
[
$item
[
"id"
]][
"push_type"
]
=
$item
[
"push_type"
];
$result
[
$item
[
"id"
]][
"push_offset"
]
=
$item
[
"push_offset"
];
$result
[
$item
[
"id"
]][
$item
[
"k"
]]
=
$item
[
"v"
];
}
echo
json_encode
(
$result
);
}
public
function
push_log
(){
}
/**
* 修改云端片库媒资信息
* 参数:
* url : 华数媒资详情url
*/
public
function
media_update
(){
// http://115.29.7.64:8092/XmlData/incrementJson?date=20190625&version=20190625150313
//{"actor":"安娜·舒若希基娜,伊万·阿赫洛贝斯金,加林娜·秋宁娜,德米特里·纳吉耶夫,莉莎·阿尔扎马索娃"
//,"description":""
//,"id":"2018239"
//,"md5":"a3e0d11328e0feb3114921851f39ac41"
//,"picUrl":"http://localhost:8080/cms/cms_images/www224/2015-08/10/1439187356969_393049.jpg"
//,"playUrl":"http://downloader.media.wasu.tv/data13/ott/344/2015-08/10/e0a341ae74eb62574a7d4070686f07df/5d148f9d/1439187357125_958916.ts"
//,"programType":"儿童动漫","region":"欧美","score":"8.7","startTime":"2015-08-10 14:16:46"
//,"status":"1","title":"冰雪女王","type":"movie","updateTime":"2015-11-27 10:06:17","year":"2012"}
// $url="http://115.29.7.64:8092/XmlData/incrementJson?date=20190625&version=20190625150313";
$rawData
=
@
file_get_contents
(
"php://input"
);
//echo $rawData."\n";
$json
=
json_decode
(
$rawData
,
true
);
$url
=
$json
[
"jsonUrl"
];
//echo "url:".$url; exit;
$content
=
file_get_contents
(
$url
);
$json
=
json_decode
(
$content
,
true
);
// var_dump($json);
$data
[
'type'
]
=
$json
[
"type"
];
$data
[
'title'
]
=
$json
[
"title"
];
$data
[
'code'
]
=
$json
[
"id"
];
$data
[
'description'
]
=
$json
[
"description"
];
$data
[
'url_play'
]
=
$json
[
"playUrl"
];
$data
[
'url_pic'
]
=
$json
[
"picUrl"
];
$data
[
'year'
]
=
$json
[
"year"
];
$data
[
'score'
]
=
floatval
(
$json
[
"score"
]);
$data
[
'region'
]
=
$json
[
"region"
];
$data
[
'actor'
]
=
$json
[
"actor"
];
$data
[
'director'
]
=
$json
[
"director"
];
$data
[
'md5'
]
=
$this
->
null2str
(
$json
[
"md5"
]);
$data
[
'status'
]
=
intval
(
$json
[
"status"
]);
$data
[
"_starttime"
]
=
$this
->
null2str
(
$json
[
"startTime"
]);
$data
[
"_updatetime"
]
=
$this
->
null2str
(
$json
[
"updateTime"
]);
$model
=
D
(
"Media"
);
$tmp
=
$model
->
field
(
"id"
)
->
where
(
"code='"
.
$data
[
'code'
]
.
"'"
)
->
find
();
$id
=
$tmp
[
"id"
];
// var_dump($tmp);exit;
if
(
$id
){
$data
[
'id'
]
=
$id
;
$data
[
"updatetime"
]
=
date
(
'Y-m-d H:i:s'
);
$r
=
$model
->
save
(
$data
);
// echo $model->_sql();
if
(
$r
){
echo
'true'
;
}
else
{
echo
'false'
;
}
}
else
{
$id
=
$model
->
add
(
$data
);
if
(
$id
){
echo
'true'
;
}
else
{
echo
'false'
;
}
}
}
function
null2str
(
$str
){
if
(
is_null
(
$str
)){
$str
=
""
;
}
return
$str
;
}
/**
* 增量媒资变更列表
* /Api/Front/incrementList?hid=1&spid=1&start=xxx&end=xxx&page=1
* 输入:
* spid : 合作方id
* start : 开始时间
* end : 结束时间
* page : 请求页
*/
public
function
incrementList
(){
$page_size
=
10
;
$spid
=
$_GET
[
"spid"
];
$start
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$_GET
[
"start"
]));
//date('Y-m-d H:i:s', strtotime($date))
$end
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$_GET
[
"end"
]));
$page
=
$_GET
[
"page"
];
$sqlTotal
=
"SELECT count(1) total FROM sh_hotel_media_map_
$spid
WHERE updatetime BETWEEN '
$start
' AND '
$end
';"
;
$totalArr
=
M
(
""
)
->
query
(
$sqlTotal
);
$total
=
0
;
if
(
count
(
$totalArr
)
>
0
){
$total
=
$totalArr
[
0
][
"total"
];
}
$page_num
=
ceil
(
$total
/
$page_size
);
$limit_from
=
$page
*
$page_size
;
$sql
=
"SELECT mw.code id,mw.title,mw.description,mw.url_play playUrl,mw.url_pic picUrl"
.
",mw.year,mw.type,mw.score,mw.region,mw.actor,mw.director"
.
",h.code hotelId,hm.status,hm.status_inject statusInject"
.
" FROM (SELECT media_id,hotel_id,status,status_inject FROM sh_hotel_media_map_
$spid
"
.
" WHERE updatetime BETWEEN'
$start
' AND '
$end
' ORDER BY updatetime ASC LIMIT
$limit_from
,
$page_size
) hm"
.
" JOIN sh_media_wasu mw ON mw.id=hm.media_id"
.
" JOIN sh_hotel h ON h.id=hm.hotel_id"
;
// echo $sql;exit;
$list
=
M
(
""
)
->
query
(
$sql
);
$result
[
"total"
]
=
$total
;
$result
[
"page_cur"
]
=
$page
;
$result
[
"page_num"
]
=
$page_num
;
$result
[
"list"
]
=
$list
;
echo
json_encode
(
$result
);
}
/**
* 增量媒资变更检测接口
* /Api/Center/incrementCheck?spid=1&start=20190701120000&end=20190702120000&page=1
* 输入:
* spid : 合作方id
* start : 开始时间
* end : 结束时间
* 输出:
* {"total":100,"page_cur":1,"page_num":10}
*/
public
function
incrementCheck
(){
$page_size
=
10
;
$spid
=
$_GET
[
"spid"
];
$start
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$_GET
[
"start"
]));
//date('Y-m-d H:i:s', strtotime($date))
$end
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$_GET
[
"end"
]));
$page
=
$_GET
[
"page"
];
$sqlTotal
=
"SELECT count(1) total FROM sh_hotel_media_map_
$spid
WHERE updatetime BETWEEN '
$start
' AND '
$end
';"
;
$totalArr
=
M
(
""
)
->
query
(
$sqlTotal
);
$total
=
0
;
if
(
count
(
$totalArr
)
>
0
){
$total
=
$totalArr
[
0
][
"total"
];
}
$page_num
=
ceil
(
$total
/
$page_size
);
$result
[
"total"
]
=
$total
;
$result
[
"page_cur"
]
=
$page
;
$result
[
"page_num"
]
=
$page_num
;
echo
json_encode
(
$result
);
}
/**
* 增量媒资变更推送接口
* /Api/Center/incrementPush?spid=1&start=20190701120000&end=20190702120000&page=1
* 输入:
* spid : 合作方id
* start : 开始时间
* end : 结束时间
* page : 请求页
* url : 合作方接收地址
* key : 私钥
* 输出:
* {"code":0,"msg":"err msg"}
*/
public
function
incrementPush
(){
$page_size
=
10
;
$rawData
=
@
file_get_contents
(
"php://input"
);
$json
=
json_decode
(
$rawData
,
true
);
$spid
=
$json
[
"spid"
];
$start
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$json
[
"start"
]));
//date('Y-m-d H:i:s', strtotime($date))
$end
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$json
[
"end"
]));
$page
=
$json
[
"page"
];
$url
=
$json
[
"url"
];
$key
=
$json
[
"key"
];
$limit_from
=
$page
*
$page_size
;
$sql
=
"SELECT mw.code id,mw.title,mw.description,mw.url_play playUrl,mw.url_pic picUrl"
.
",mw.year,mw.type,mw.score,mw.region,mw.actor,mw.director"
.
",h.code hotelId,hm.status,hm.status_inject statusInject"
.
" FROM (SELECT media_id,hotel_id,status,status_inject FROM sh_hotel_media_map_
$spid
"
.
" WHERE updatetime BETWEEN'
$start
' AND '
$end
' ORDER BY updatetime ASC LIMIT
$limit_from
,
$page_size
) hm"
.
" JOIN sh_media_wasu mw ON mw.id=hm.media_id"
.
" JOIN sh_hotel h ON h.id=hm.hotel_id"
;
// echo $sql;exit;
$list
=
M
(
""
)
->
query
(
$sql
);
$url
=
$result
[
"list"
]
=
$list
;
echo
json_encode
(
$result
);
}
}
\ No newline at end of file
SooonerHotel/App/Lib/Action/Api/FrontAction.class.php
0 → 100644
View file @
90e6985e
<?php
/**
* Created by PhpStorm.
* User: wuxiande
* Date: 2019/6/27
* Time: 14:15
* 分前端接口
* 媒资列表接口
* 分前端注册接口
*/
class
FrontAction
extends
Action
{
/**
* 分前端增量媒资变更列表
* /Api/Front/incrementList?hid=1&spid=1&start=xxx&end=xxx&page=1
* 输入:
* hid : 酒店id
* spid : 合作方id
* start : 开始时间
* end : 结束时间
* page : 请求页
*/
public
function
incrementList
(){
$page_size
=
10
;
$hid
=
$_GET
[
"hid"
];
$spid
=
$_GET
[
"spid"
];
$start
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$_GET
[
"start"
]));
//date('Y-m-d H:i:s', strtotime($date))
$end
=
date
(
'Y-m-d H:i:s'
,
strtotime
(
$_GET
[
"end"
]));
$page
=
$_GET
[
"page"
];
$sqlTotal
=
"SELECT count(1) total FROM sh_hotel_media_map_
$spid
WHERE hotel_id=
$hid
AND updatetime BETWEEN '
$start
' AND '
$end
';"
;
// echo $sqlTotal;exit;
$totalArr
=
M
(
""
)
->
query
(
$sqlTotal
);
$total
=
0
;
if
(
count
(
$totalArr
)
>
0
){
$total
=
$totalArr
[
0
][
"total"
];
}
$page_num
=
ceil
(
$total
/
$page_size
);
$limit_from
=
$page
*
$page_size
;
$sql
=
"SELECT mw.code,mw.url_play,hm.status,hm.status_inject"
.
" FROM (SELECT media_id,hotel_id,status,status_inject FROM sh_hotel_media_map_
$spid
"
.
" WHERE updatetime BETWEEN '
$start
' AND '
$end
' ORDER BY updatetime ASC LIMIT
$limit_from
,
$page_size
) hm"
.
" JOIN sh_media_wasu mw ON mw.id=hm.media_id"
;
$list
=
M
(
""
)
->
query
(
$sql
);
$result
[
"total"
]
=
$total
;
$result
[
"page_cur"
]
=
$page
;
$result
[
"page_num"
]
=
$page_num
;
$result
[
"list"
]
=
$list
;
echo
json_encode
(
$result
);
}
}
\ 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