Commit a3a45d8e authored by 孙磊's avatar 孙磊

require

Signed-off-by: 孙磊's avatarsunlei <sunlei@romens.cn>
parent 6ab6533a
......@@ -15,7 +15,7 @@ use backend\helpers\Func;
use yii\web\ServerErrorHttpException;
use yidas\phpSpreadsheet\Helper;
use yii\data\ActiveDataProvider;
use app\models\v1\rbacuser\ShopRbacUser;
class BranchController extends BaseController
{
......@@ -56,10 +56,26 @@ class BranchController extends BaseController
*/
public function actionBranchList()
{
//权限信息
$rbac = new ShopRbacUser();
$userGuid = Yii::$app->user->identity->GUID;
$userinfo = $rbac->getRbacUserInfo($userGuid);
// print_r($userinfo);die();
$where_branch = '';
//是否是 分公司管理员 是的话只显示所管理门店的数据
if($userinfo['ROLE_ID']=='2'){
$branchguids_str = $userinfo['BRANCH_GUID'];
$where_branch = empty($branchguids_str)?$userinfo['SUPPROVINCE_GUID']:"'".$userinfo['SUPPROVINCE_GUID']."',".$branchguids_str;
}elseif($userinfo['ROLE_ID']=='3' ){
//门店
$branchguid = $userinfo['BRANCH_GUID'];
$where_branch = !empty($branchguid) ? $branchguid :'';
}
$model = new $this->modelClass();
$params = Yii::$app->request->queryParams;
$model->attributes = $params;
$params['where_branch'] = $where_branch;
if ($model->validate()) {
//所有输入数据都有效 all inputs are valid
......@@ -74,8 +90,8 @@ class BranchController extends BaseController
return $info;
} else {
//验证失败:$errors 是一个包含错误信息的数组
$errors = $model->errors;
return $errors;
Yii::$app->response->statusCode = 422;
return $model->errors;
}
}
......
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