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
1f0745c1
Commit
1f0745c1
authored
Sep 02, 2019
by
吴贤德
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
中心接口:增量媒资列表接口、增量媒资推送接口改造(修复多表联查问题),增加媒资拉取日志
中心服务:增加媒拉取日子记录
parent
fbb7fcd5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
25 deletions
+68
-25
WasuChecker.go
Services/CenterService/Controller/WasuChecker.go
+0
-1
MediaListModel.go
Services/CenterService/Model/Wasu/MediaListModel.go
+11
-7
SpModel.go
Services/CenterService/Model/Wasu/SpModel.go
+4
-3
config.ini
Services/CenterService/config.ini
+5
-0
CenterAction.class.php
SooonerHotel/App/Lib/Action/Api/CenterAction.class.php
+43
-14
PullLogModel.class.php
SooonerHotel/App/Lib/Model/PullLogModel.class.php
+5
-0
No files found.
Services/CenterService/Controller/WasuChecker.go
View file @
1f0745c1
...
@@ -44,4 +44,3 @@ func (this *WasuChecker) check() {
...
@@ -44,4 +44,3 @@ func (this *WasuChecker) check() {
}
}
}
}
Services/CenterService/Model/Wasu/MediaListModel.go
View file @
1f0745c1
...
@@ -28,13 +28,15 @@ import (
...
@@ -28,13 +28,15 @@ import (
**/
**/
type
Media
struct
{
type
Media
struct
{
Spid
string
`json:"spid"`
Spid
string
`json:"spid"`
PushMode
string
`json:"push_mode"`
//是否自动转推:0手动,1自动
PushMode
string
`json:"push_mode"`
//是否自动转推:0手动,1自动
JsonUrl
string
`json:"jsonUrl"`
JsonUrl
string
`json:"jsonUrl"`
//Md5 string `json:"md5"`
NewsId
string
`json:"newsId"`
//NewsId string `json:"newsId"`
NewsName
string
`json:"newsName"`
//NewsName string `json:"newsName"`
NodeId
string
`json:"nodeId"`
//PlayUrl string `json:"playUrl"`
NodeName
string
`json:"nodeName"`
// Md5 string `json:"md5"`
// PlayUrl string `json:"playUrl"`
}
}
type
MediaList
struct
{
type
MediaList
struct
{
...
@@ -116,7 +118,9 @@ func (this *MediaListModel) UpdateMedia(media *Media) bool {
...
@@ -116,7 +118,9 @@ func (this *MediaListModel) UpdateMedia(media *Media) bool {
b
:=
false
b
:=
false
if
ok
{
if
ok
{
inData
,
_
:=
json
.
Marshal
(
media
)
inData
,
_
:=
json
.
Marshal
(
media
)
//fmt.Printf("****** media_info : %v",media)
data
,
err
:=
Request
.
Post
(
center_api_media_update
.
(
string
),
*
(
*
string
)(
unsafe
.
Pointer
(
&
inData
)))
data
,
err
:=
Request
.
Post
(
center_api_media_update
.
(
string
),
*
(
*
string
)(
unsafe
.
Pointer
(
&
inData
)))
//data, err := Request.Post(center_api_media_update.(string), string(inData))
if
err
==
nil
{
if
err
==
nil
{
if
data
==
"true"
{
if
data
==
"true"
{
b
=
true
b
=
true
...
...
Services/CenterService/Model/Wasu/SpModel.go
View file @
1f0745c1
...
@@ -39,7 +39,7 @@ func (this *SpModel) pull() {
...
@@ -39,7 +39,7 @@ func (this *SpModel) pull() {
mediaModel
.
Config
=
this
.
Config
mediaModel
.
Config
=
this
.
Config
mediaModel
.
Spid
=
this
.
Spid
mediaModel
.
Spid
=
this
.
Spid
date
:=
DateTime
.
Format
(
"YYYYMMDD"
,
time
.
Now
())
date
:=
DateTime
.
Format
(
"YYYYMMDD"
,
time
.
Now
())
//date:="20190
627
"
//date:="20190
901
"
mediaList
:=
mediaModel
.
FetchList
(
date
,
1
)
mediaList
:=
mediaModel
.
FetchList
(
date
,
1
)
ok
:=
mediaModel
.
UpdateMediaList
(
mediaList
)
ok
:=
mediaModel
.
UpdateMediaList
(
mediaList
)
if
!
ok
{
if
!
ok
{
...
@@ -58,4 +58,6 @@ func (this *SpModel) pull() {
...
@@ -58,4 +58,6 @@ func (this *SpModel) pull() {
}
}
}
}
}
}
}
}
\ No newline at end of file
Services/CenterService/config.ini
View file @
1f0745c1
...
@@ -5,3 +5,7 @@ log_path = ./
...
@@ -5,3 +5,7 @@ log_path = ./
log_filename
=
center_service.log
log_filename
=
center_service.log
[release]
[release]
api_conf_sys
=
http://api.hotel.wasu.tv/api/center/conf_sys #系统配置接口
api_conf_sps
=
http://api.hotel.wasu.tv/api/center/conf_sps #合作方配置接口
log_path
=
./
log_filename
=
center_service.log
\ No newline at end of file
SooonerHotel/App/Lib/Action/Api/CenterAction.class.php
View file @
1f0745c1
...
@@ -50,10 +50,14 @@ class CenterAction extends Action
...
@@ -50,10 +50,14 @@ class CenterAction extends Action
/*
/*
* 媒资实时下线接口(华数经纬cms调用,下线媒资,同时需要下线所有酒店片库中相应媒资)
* 媒资实时下线接口(华数经纬cms调用,下线媒资,同时需要下线所有酒店片库中相应媒资)
* GET /api/center/media_offline?spid=1&mid=33431345
* GET /api/center/media_offline?spid=1&mid=33431345
&sw_time=1523345555&sw_sign=xxxxxx
* 参数说明:
* 参数说明:
* spid : 合作方标识(我们提供,每个合作方标识不一样)
* spid : 合作方标识(我们提供,每个合作方标识不一样)
* mid : 媒资标识代码(经纬cms中的媒资id)
* mid : 媒资标识代码(经纬cms中的媒资id)
* sw_time : 请求时间戳
* sw_sign : 请求签名 md5(uri+key) 如:
* uri :/api/center/media_offline?spid=1&mid=33431345&sw_time=1523345555
* key : 我们提供(每个spid对应不同的key)
* 返回说明:
* 返回说明:
* {"code":0,"msg":"ok"}
* {"code":0,"msg":"ok"}
* code : 0-成功,1001-传入的媒资参数有问题,2001-下线失败
* code : 0-成功,1001-传入的媒资参数有问题,2001-下线失败
...
@@ -105,10 +109,10 @@ class CenterAction extends Action
...
@@ -105,10 +109,10 @@ class CenterAction extends Action
public
function
media_update
(){
public
function
media_update
(){
$rawData
=
@
file_get_contents
(
"php://input"
);
$rawData
=
@
file_get_contents
(
"php://input"
);
//echo $rawData."\n";
//echo $rawData."\n";
$
j
son
=
json_decode
(
$rawData
,
true
);
$
inputJ
son
=
json_decode
(
$rawData
,
true
);
$spid
=
$
j
son
[
"spid"
];
$spid
=
$
inputJ
son
[
"spid"
];
$pushMode
=
$
j
son
[
"push_mode"
];
//
$pushMode
=
$
inputJ
son
[
"push_mode"
];
//
$url
=
$
j
son
[
"jsonUrl"
];
$url
=
$
inputJ
son
[
"jsonUrl"
];
$content
=
file_get_contents
(
$url
);
$content
=
file_get_contents
(
$url
);
$json
=
json_decode
(
$content
,
true
);
$json
=
json_decode
(
$content
,
true
);
...
@@ -132,6 +136,7 @@ class CenterAction extends Action
...
@@ -132,6 +136,7 @@ class CenterAction extends Action
$data
[
"programType"
]
=
$json
[
"programType"
];
$data
[
"programType"
]
=
$json
[
"programType"
];
$data
[
"nodeId"
]
=
intval
(
$json
[
"nodeId"
]);
$data
[
"nodeId"
]
=
intval
(
$json
[
"nodeId"
]);
$data
[
"sp_id"
]
=
intval
(
$spid
);
$data
[
"sp_id"
]
=
intval
(
$spid
);
$data
[
"nodeName"
]
=
$this
->
null2str
(
$json
[
"nodeName"
]);
$model
=
D
(
"Media"
);
$model
=
D
(
"Media"
);
$where
[
"code"
]
=
$data
[
"code"
];
$where
[
"code"
]
=
$data
[
"code"
];
...
@@ -139,6 +144,7 @@ class CenterAction extends Action
...
@@ -139,6 +144,7 @@ class CenterAction extends Action
$tmp
=
$model
->
field
(
"id"
)
->
where
(
$where
)
->
find
();
$tmp
=
$model
->
field
(
"id"
)
->
where
(
$where
)
->
find
();
$id
=
$tmp
[
"id"
];
$id
=
$tmp
[
"id"
];
// var_dump($tmp);exit;
// var_dump($tmp);exit;
$code
=
0
;
if
(
$id
){
if
(
$id
){
$data
[
'id'
]
=
$id
;
$data
[
'id'
]
=
$id
;
$data
[
"updatetime"
]
=
date
(
'Y-m-d H:i:s'
);
$data
[
"updatetime"
]
=
date
(
'Y-m-d H:i:s'
);
...
@@ -148,22 +154,40 @@ class CenterAction extends Action
...
@@ -148,22 +154,40 @@ class CenterAction extends Action
echo
'true'
;
echo
'true'
;
}
else
{
}
else
{
echo
'false'
;
echo
'false'
;
$code
=
1001
;
}
}
}
else
{
}
else
{
$id
=
$model
->
add
(
$data
);
$id
=
$model
->
add
(
$data
);
$data
[
"id"
]
=
$id
;
$data
[
"id"
]
=
$id
;
if
(
$id
){
if
(
$id
){
echo
'true'
;
echo
'true'
;
$b
=
true
;
}
else
{
}
else
{
echo
'false'
;
echo
'false'
;
$code
=
1002
;
}
}
}
}
if
(
$pushMode
==
"1"
)
{
if
(
$pushMode
==
"1"
)
{
$this
->
media_auto_push
(
$data
);
$this
->
media_auto_push
(
$data
);
}
}
if
(
$code
){
//更新媒资失败: 记录拉取失败日志
$this
->
log_pull_failture
(
$code
,
$inputJson
);
}
exit
;
exit
;
}
}
function
log_pull_failture
(
$code
,
&
$json
){
$data
[
"sp_id"
]
=
intval
(
$json
[
"spid"
]);
$data
[
"push_mode"
]
=
intval
(
$json
[
"push_mode"
]);
$data
[
"jsonUrl"
]
=
$json
[
"jsonUrl"
];
$data
[
"newsId"
]
=
$json
[
"newsId"
];
$data
[
"newsName"
]
=
$json
[
"newsName"
];
$data
[
"nodeId"
]
=
$json
[
"nodeId"
];
$data
[
"nodeName"
]
=
$json
[
"nodeName"
];
$data
[
"code"
]
=
$code
;
D
(
"PullLog"
)
->
add
(
$data
);
}
function
null2str
(
$str
){
function
null2str
(
$str
){
if
(
is_null
(
$str
)){
if
(
is_null
(
$str
)){
$str
=
""
;
$str
=
""
;
...
@@ -234,11 +258,17 @@ class CenterAction extends Action
...
@@ -234,11 +258,17 @@ class CenterAction extends Action
}
}
$page_num
=
ceil
(
$total
/
$page_size
);
$page_num
=
ceil
(
$total
/
$page_size
);
$limit_from
=
(
$page
-
1
)
*
$page_size
;
$limit_from
=
(
$page
-
1
)
*
$page_size
;
// $sql = "SELECT 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.hotel_id 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,media_id ASC LIMIT $limit_from,$page_size) hm"
// . " JOIN sh_media_wasu mw ON mw.id=hm.media_id";
$sql
=
"SELECT mw.code id,mw.title,mw.description,mw.programType,mw.url_pic picUrl"
$sql
=
"SELECT 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"
.
",mw.year,mw.type,mw.score,mw.region,mw.actor,mw.director"
.
",hm.
hotel_id
hotelId,hm.status,hm.status_inject statusInject"
.
",hm.
code
hotelId,hm.status,hm.status_inject statusInject"
.
" FROM (SELECT
media_id,hotel_id,status,status_inject FROM sh_hotel_media_map_
$spid
"
.
" FROM (SELECT
hm.media_id,h.code,hm.status,hm.status_inject FROM sh_hotel_media_map_
$spid
hm,sh_hotel h
"
.
" WHERE
updatetime BETWEEN'
$start
' AND '
$end
' ORDER BY updatetime,
media_id ASC LIMIT
$limit_from
,
$page_size
) hm"
.
" WHERE
hm.updatetime BETWEEN '
$start
' AND '
$end
' AND h.id=hm.hotel_id ORDER BY hm.updatetime,hm.
media_id ASC LIMIT
$limit_from
,
$page_size
) hm"
.
" JOIN sh_media_wasu mw ON mw.id=hm.media_id"
;
.
" JOIN sh_media_wasu mw ON mw.id=hm.media_id"
;
// echo $sql;exit;
// echo $sql;exit;
...
@@ -330,11 +360,10 @@ class CenterAction extends Action
...
@@ -330,11 +360,10 @@ class CenterAction extends Action
$limit_from
=
(
$page
-
1
)
*
$page_size
;
$limit_from
=
(
$page
-
1
)
*
$page_size
;
$sql
=
"SELECT mw.code id,mw.title,mw.description,mw.programType,mw.url_pic picUrl"
$sql
=
"SELECT 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"
.
",mw.year,mw.type,mw.score,mw.region,mw.actor,mw.director"
.
",h.code hotelId,hm.status,hm.status_inject statusInject"
.
",hm.code hotelId,hm.status,hm.status_inject statusInject"
.
" FROM (SELECT media_id,hotel_id,status,status_inject FROM sh_hotel_media_map_
$spid
"
.
" FROM (SELECT hm.media_id,h.code,hm.status,hm.status_inject FROM sh_hotel_media_map_
$spid
hm,sh_hotel h"
.
" WHERE updatetime BETWEEN'
$start
' AND '
$end
' ORDER BY updatetime,media_id ASC LIMIT
$limit_from
,
$page_size
) hm"
.
" WHERE hm.updatetime BETWEEN '
$start
' AND '
$end
' AND h.id=hm.hotel_id ORDER BY hm.updatetime,hm.media_id ASC LIMIT
$limit_from
,
$page_size
) hm"
.
" JOIN sh_media_wasu mw ON mw.id=hm.media_id"
.
" JOIN sh_media_wasu mw ON mw.id=hm.media_id"
;
.
" JOIN sh_hotel h ON h.id=hm.hotel_id"
;
// echo $sql;exit;
// echo $sql;exit;
$list
=
M
(
""
)
->
query
(
$sql
);
//获取增量媒资列表
$list
=
M
(
""
)
->
query
(
$sql
);
//获取增量媒资列表
...
@@ -381,7 +410,7 @@ class CenterAction extends Action
...
@@ -381,7 +410,7 @@ class CenterAction extends Action
$log
[
"req_json"
]
=
$rawData
;
$log
[
"req_json"
]
=
$rawData
;
$log
[
"resp_json"
]
=
$data
;
$log
[
"resp_json"
]
=
$data
;
$log
[
"code"
]
=
$result
[
"code"
];
$log
[
"code"
]
=
$result
[
"code"
];
D
(
"
LogPush
"
)
->
add
(
$log
);
D
(
"
PushLog
"
)
->
add
(
$log
);
}
}
echo
json_encode
(
$result
);
echo
json_encode
(
$result
);
exit
;
exit
;
...
...
SooonerHotel/App/Lib/Model/PullLogModel.class.php
0 → 100644
View file @
1f0745c1
<?php
class
PullLogModel
extends
RelationModel
{
protected
$tableName
=
'sh_log_pull'
;
//重新定义表名
}
\ 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