Commit 4c24e425 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into develop

parents 4786a4d9 7d17982e
...@@ -51,6 +51,17 @@ class BaseController extends Controller ...@@ -51,6 +51,17 @@ class BaseController extends Controller
if (\Yii::$app->request->headers->get('FZM-CURRENCY-ID')) { if (\Yii::$app->request->headers->get('FZM-CURRENCY-ID')) {
$this->currency_id = \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) public function beforeAction($action)
...@@ -151,4 +162,14 @@ class BaseController extends Controller ...@@ -151,4 +162,14 @@ class BaseController extends Controller
return $models; 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment