Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wallet
token
Commits
4c24e425
Commit
4c24e425
authored
Aug 26, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into develop
parents
4786a4d9
7d17982e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
BaseController.php
api/base/BaseController.php
+22
-0
No files found.
api/base/BaseController.php
View file @
4c24e425
...
...
@@ -51,6 +51,17 @@ class BaseController extends Controller
if
(
\Yii
::
$app
->
request
->
headers
->
get
(
'FZM-CURRENCY-ID'
))
{
$this
->
currency_id
=
\Yii
::
$app
->
request
->
headers
->
get
(
'FZM-CURRENCY-ID'
);
}
$allow_list
=
array_unique
(
\Yii
::
$app
->
params
[
'allow_options_domain'
][
'allow_options_domain'
]);
$origin
=
\Yii
::
$app
->
request
->
headers
->
get
(
'Origin'
);
if
(
!
in_array
(
$origin
,
$allow_list
))
{
$origin
=
implode
(
','
,
$allow_list
);
}
$this
->
header
(
'Access-Control-Allow-Origin'
,
$origin
);
$this
->
header
(
'Access-Control-Allow-Methods'
,
'POST,GET,OPTIONS,PUT,DELETE'
);
$this
->
header
(
'Access-Control-Allow-Credentials'
,
'true'
);
$this
->
header
(
'Access-Control-Allow-Headers'
,
'Authorization,FZM-REQUEST-OS,FZM-USER-IP,FZM-REQUEST-UUID,FZM-PLATFORM-ID,Content-Type,Content-Length'
);
}
public
function
beforeAction
(
$action
)
...
...
@@ -151,4 +162,14 @@ class BaseController extends Controller
return
$models
;
}
public
function
header
(
$key
,
$value
)
{
$this
->
header_list
[
$key
]
=
$value
;
}
public
function
getHeaders
()
{
return
$this
->
header_list
;
}
}
\ 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