Ver Fonte

feat: EK-2806: 会员端Promo和banner图增加分国家设置.

kevin há 5 meses atrás
pai
commit
3133e3e454

+ 11 - 4
backendApi/modules/v1/controllers/AdController.php

@@ -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()

+ 1 - 1
backendApi/modules/v1/models/lists/ad/AdIndexList.php

@@ -89,7 +89,7 @@ class AdIndexList extends \common\libs\dataList\DataList implements DataListInte
             $this->filterTypes = [
                 'TITLE'=> ['name'=> Yii::t('ctx', 'title')],
                 'CONTENT' => ['name'=> Yii::t('ctx', 'content')],
-                // 将'COUNTRY'改为'COUNTRY_ID',与getColumn()中的列名保持一致
+                // 确保这里的键名与getColumn()方法中的列名一致
                 'COUNTRY_ID'=> [
                     'name'=> \Yii::t('ctx', 'country'),
                     'other'=> 'select',