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
4cd04a5f
Commit
4cd04a5f
authored
5 years ago
by
吴贤德
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API : 媒资调度url生成 /Api/Tool/make_gslb_url?sp_id=9&media_id=1556323
parent
bf8f4cbf
develop
v1.2
v1.1
v1.0
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
ToolAction.class.php
SooonerHotel/App/Lib/Action/Api/ToolAction.class.php
+55
-0
No files found.
SooonerHotel/App/Lib/Action/Api/ToolAction.class.php
0 → 100644
View file @
4cd04a5f
<?php
/**
* Created by PhpStorm.
* User: wuxiande
* Date: 2019/7/19
* Time: 16:36
*/
class
ToolAction
extends
Action
{
/*
* 鉴权调度拼接
* 返回 : http://frontip:port/api/gslb?media_id=&sw_time=&sw_sign=
* 签名 :MD5(request_uri(不包含sw_sign)KEY),sw_sign必须放在最后面,key由平台提供
*/
public
function
make_gslb_url
(){
$sp_id
=
$_GET
[
"sp_id"
];
$mcode
=
$_GET
[
"media_id"
];
$sw_time
=
time
();
$pre
=
"/get_play?media_id=
$mcode
&sw_time=
$sw_time
"
;
$sql
=
"select * from sh_sp_config WHERE sp_id=
$sp_id
;"
;
$where
[
"sp_id"
]
=
$sp_id
;
$where
[
"type_code"
]
=
"front_api_key"
;
$model
=
D
(
"Conf"
);
$config
=
$model
->
field
(
"v"
)
->
where
(
$where
)
->
find
();
// echo $model->getLastSql();
// var_dump($config);
// exit;
if
(
$config
){
$key
=
$config
[
"v"
];
$sql
=
"SELECT h.id hid,h.code hcode,h.name hname,d.id did,d.code dcode,d.name fname,d.ip,d.port FROM sh_hotel h,sh_hotel_device d"
.
" WHERE h.sp_id=
$sp_id
AND d.hotel_id=h.id and h.status=0 AND d.status=0 and d.type=0;"
;
$hotels
=
M
(
""
)
->
query
(
$sql
);
echo
"<h1>分前端调度鉴权地址<h1>"
;
foreach
(
$hotels
as
$hotel
){
echo
"<h3>"
.
$hotel
[
"hname"
]
.
"</h3>"
;
echo
"<pre><code>"
;
$sw_sign
=
md5
(
$pre
.
$key
);
$gslb
=
"http://"
.
$hotel
[
"ip"
]
.
":"
.
$hotel
[
"port"
]
.
$pre
.
"&sw_sign=
$sw_sign
"
;
echo
"GSLB : <a href='
$gslb
' target='_blank'>
$gslb
</a>"
;
echo
"</code>"
;
}
}
else
{
echo
"SP配置不全!"
;
}
exit
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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