Commit b4735183 authored by shajiaiming's avatar shajiaiming

Merge branch 'feature/optimize' into 'master'

fix See merge request !452
parents c47176be 6734f4de
......@@ -24,7 +24,7 @@ class ExploreAppController extends BaseController
if (Yii::$app->request->isPost) {
$params = Yii::$app->request->post();
if ('administrator' == $group) {
$params['platform_id'] = $params['platform_id'];
$params['platform_id'] = isset($params['platform_id']) ? $params['platform_id'] : Yii::$app->request->getPlatformId();
} else {
$params['platform_id'] = Yii::$app->request->getPlatformId();
}
......@@ -99,7 +99,8 @@ class ExploreAppController extends BaseController
}
$model = ExploreAppCategory::findOne($id);
if ($model->platform_id != $platform_id) {
$group = Yii::$app->request->getGroup();
if ('administrator' != $group && $model->platform_id != $platform_id) {
$msg = '无权修改';
$code = -1;
goto doEnd;
......@@ -146,9 +147,10 @@ class ExploreAppController extends BaseController
$code = -1;
goto doEnd;
}
$model = ExploreAppCategory::find()->where(['id' => $id, 'platform_id' => $platform_id])->one();
$model = ExploreAppCategory::find()->where(['id' => $id])->one();
if ($model->platform_id != $platform_id) {
$group = Yii::$app->request->getGroup();
if ('administrator' != $group && $model->platform_id != $platform_id) {
$msg = '无权修改';
$code = -1;
goto doEnd;
......@@ -206,7 +208,8 @@ class ExploreAppController extends BaseController
$model = new ExploreApp();
$model->setScenario(ExploreApp::SCENARIOS_CREATE);
$params = Yii::$app->request->post();
$params['platform_id'] = $platform_id;
$AppCategory = ExploreAppCategory::find()->select('platform_id')->where(['id' => $params['app_category_id']])->asArray()->one();
$params['platform_id'] = (int)$AppCategory['platform_id'] ?? 0;
$params['email'] = isset($params['email']) ? $params['email'] : 0;
$params['phone'] = isset($params['phone']) ? $params['phone'] : 0;
$params['real_name'] = isset($params['real_name']) ? $params['real_name'] : 0;
......@@ -254,7 +257,8 @@ class ExploreAppController extends BaseController
}
$model = ExploreApp::findOne($id);
if ($model->platform_id != $platform_id) {
$group = Yii::$app->request->getGroup();
if ('administrator' != $group && $model->platform_id != $platform_id) {
$msg = '无权修改';
$code = -1;
goto doEnd;
......@@ -298,9 +302,10 @@ class ExploreAppController extends BaseController
goto doEnd;
}
if (Yii::$app->request->isDelete) {
$model = ExploreApp::find()->where(['id' => $id, 'platform_id' => $platform_id])->one();
$model = ExploreApp::find()->where(['id' => $id])->one();
if ($model->platform_id != $platform_id) {
$group = Yii::$app->request->getGroup();
if ('administrator' != $group && $model->platform_id != $platform_id) {
$msg = '无权修改';
$code = -1;
goto doEnd;
......
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