|
|
@@ -57,7 +57,11 @@ class AdController extends BaseController
|
|
|
*/
|
|
|
public function actionList()
|
|
|
{
|
|
|
- $lid = Yii::$app->request->get('lid');
|
|
|
+ // 获取位置ID
|
|
|
+ $lid = Yii::$app->request->get('lid', 0);
|
|
|
+ if (empty($lid)) {
|
|
|
+ throw new \yii\web\HttpException(400, Yii::t('ctx', 'paramError'));
|
|
|
+ }
|
|
|
|
|
|
// 如果admin不是超管,只允许查询自己关联的国家
|
|
|
$admin = Admin::findOne(Yii::$app->user->id);
|
|
|
@@ -76,14 +80,15 @@ class AdController extends BaseController
|
|
|
}
|
|
|
|
|
|
$filter = $this->filterCondition([
|
|
|
- 'TITLE' => 'TITLE',
|
|
|
- 'COUNTRY_ID' => 'COUNTRY_ID',
|
|
|
+ 'AD.TITLE' => 'TITLE',
|
|
|
+ 'AD.COUNTRY_ID' => 'COUNTRY_ID',
|
|
|
+ 'AD.STATUS' => 'STATUS',
|
|
|
]);
|
|
|
$condition = $filter['condition'];
|
|
|
$params = $filter['params'];
|
|
|
|
|
|
$condition .= ' AND AD.LID=:LID';
|
|
|
- $params[':LID']=$lid;
|
|
|
+ $params[':LID'] = $lid;
|
|
|
|
|
|
$countryIds = array_column($countries, 'ID');
|
|
|
if (!empty($countryIds)) {
|
|
|
@@ -97,8 +102,10 @@ class AdController extends BaseController
|
|
|
}
|
|
|
|
|
|
$obj = new AdIndexList();
|
|
|
+ // 直接获取完整的数据,包括columnsShow和filterTypes
|
|
|
$data = $obj->getList(['condition' => $condition, 'params' => $params]);
|
|
|
|
|
|
+ // 添加额外数据
|
|
|
$data['allLocation'] = AdLocation::getAllLocation();
|
|
|
$data['countries'] = $countries;
|
|
|
$data['allArticle'] = Article::find()
|