Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
system
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
_site-res
system
Commits
fc22d41b
Commit
fc22d41b
authored
Jun 01, 2018
by
tufengqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增旧的API返回
parent
c3824064
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
ResponseApi.php
classes/fpf/response/ResponseApi.php
+25
-0
No files found.
classes/fpf/response/ResponseApi.php
View file @
fc22d41b
...
...
@@ -136,6 +136,27 @@ class ResponseApi
}
}
public
static
function
printOldFail
(
$code
,
$code_msg
,
$detail_code
,
$detail_msg
,
$callback_key
=
''
)
{
header
(
'Access-Control-Allow-Origin:*'
);
header
(
'Access-Control-Allow-Methods:POST,GET'
);
header
(
'Access-Control-Allow-Credentials:true'
);
header
(
'Access-Control-Allow-Headers: Authorization,FZM-REQUEST-OS,FZM-USER-IP,FZM-REQUEST-UUID,Content-Type,Content-Length'
);
$callback
=
''
;
if
(
$callback_key
)
{
$callback
=
$_GET
[
$callback_key
]
??
''
;
}
$arr
=
[
'code'
=>
$code
,
'error'
=>
$code_msg
,
'ecode'
=>
$detail_code
,
'message'
=>
$detail_msg
,
'data'
=>
[]];
if
(
$callback
)
{
$callback
=
Html
::
encode
(
$callback_key
);
self
::
header
(
'Content-type'
,
'application/javascript'
);
return
$callback
.
'('
.
json_encode
(
$arr
)
.
')'
;
}
else
{
self
::
header
(
'Content-type'
,
'application/json'
);
return
json_encode
(
$arr
);
}
}
/**
* @param $success_data
* @param string $callback_key
...
...
@@ -143,6 +164,10 @@ class ResponseApi
*/
public
static
function
printOldSuccess
(
$success_data
,
$callback_key
=
''
)
{
header
(
'Access-Control-Allow-Origin:*'
);
header
(
'Access-Control-Allow-Methods:POST,GET'
);
header
(
'Access-Control-Allow-Credentials:true'
);
header
(
'Access-Control-Allow-Headers: Authorization,FZM-REQUEST-OS,FZM-USER-IP,FZM-REQUEST-UUID,Content-Type,Content-Length'
);
$callback
=
''
;
if
(
$callback_key
)
{
$callback
=
$_GET
[
$callback_key
]
??
''
;
...
...
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