Files
xk-api-yii/member/behaviors/MallBehavior.php
2024-09-19 11:32:39 +08:00

21 lines
574 B
PHP

<?php
namespace member\behaviors;
use yii\base\ActionFilter;
use yii\base\Exception;
class MallBehavior extends ActionFilter
{
public function beforeAction($action)
{
$store_id = \Yii::$app->request->post('store_id')??\Yii::$app->request->get('store_id');
if(!$store_id && $action->id !='login'&& $action->id !='phone-number'&& $action->id !='send-code' && $action->id !='config'){
throw new Exception('缺少store_id参数');
}
$store=$store_id??11001;
\Yii::$app->store = $store;
return true;
}
}