Przeglądaj źródła

feat: EK-879: 【AE】管理员增加“Country”属性,根据所选国家限制登录后所显示的奖金、余额等数据(二期).

kevinElken 9 miesięcy temu
rodzic
commit
60f94b3625

+ 12 - 0
backendApi/modules/v1/controllers/UserController.php

@@ -739,6 +739,18 @@ class UserController extends BaseController
         ]);
         $condition = $filter['condition'];
         $params = $filter['params'];
+
+        $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
+        if (!$isSuper) {
+            $adminId = Yii::$app->getUser()->getUserInfo()['id'];
+            $adminCountry = AdminCountry::getCountry($adminId);
+            $quotedAdminCountry = array_map(function($item) {
+                return "'" . addslashes($item) . "'";
+            }, $adminCountry);
+
+            $condition .= " AND CU.COUNTRY_ID IN (" . implode(',', $quotedAdminCountry) . ")";
+        }
+
         $listObj = new MoveList();
         $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
         return static::notice($data);

+ 7 - 2
backendApi/modules/v1/models/lists/user/MoveList.php

@@ -6,6 +6,7 @@ use common\helpers\Cache;
 use common\helpers\http\BackendToFrontendApi;
 use common\helpers\user\Info;
 use common\libs\dataList\DataListInterface;
+use common\models\Countries;
 use common\models\DecRole;
 use common\models\OpenBank;
 use common\models\Region;
@@ -36,15 +37,16 @@ class MoveList extends \common\libs\dataList\DataList implements DataListInterfa
         $this->listData = User::lists($this->condition, $this->params, [
             'select' => 'UM.*,
                 CU.USER_NAME MOVE_USER_NAME,CU.REAL_NAME MOVE_REAL_NAME,FUI.USER_NAME FROM_USER_NAME,TUI.USER_NAME TO_USER_NAME,ADMC.ADMIN_NAME MOVE_ADMIN_NAME,ADMU.ADMIN_NAME AUDIT_ADMIN_NAME
-                ',
+                , C.NAME AS COUNTRY',
             'orderBy' => 'UM.CREATED_AT DESC, UM.ID DESC',
             'from' => UserMove::tableName() . ' AS UM',
             'join' => [
-                ['LEFT JOIN', User::tableName() . ' AS CU', 'UM.USER_ID=CU.ID'],
+                ['INNER JOIN', User::tableName() . ' AS CU', 'UM.USER_ID=CU.ID'],
                 ['LEFT JOIN', UserInfo::tableName() . ' AS FUI', 'UM.FROM_UID=FUI.USER_ID'],
                 ['LEFT JOIN', UserInfo::tableName() . ' AS TUI', 'UM.TO_UID=TUI.USER_ID'],
                 ['LEFT JOIN', Admin::tableName() . ' AS ADMC', 'UM.MOVE_ADMIN_ID=ADMC.ID'],
                 ['LEFT JOIN', Admin::tableName() . ' AS ADMU', 'UM.AUDIT_ADMIN_ID=ADMU.ID'],
+                ['INNER JOIN', Countries::tableName() . ' AS C', 'CU.COUNTRY_ID=C.ID'],
             ],
             'page' => $this->page,
             'pageSize' => $this->pageSize,
@@ -71,6 +73,9 @@ class MoveList extends \common\libs\dataList\DataList implements DataListInterfa
                         'tag'=>['type'=>'success', 'size' => 'small', 'class'=>'no-border']
                     ],
                 ],
+                'COUNTRY' => [
+                    'header' => Yii::t('ctx', 'country'),
+                ],
                 'FROM_USER_NAME' => [
                     'header' => Yii::t('ctx', 'uperCodeBeforeMoving'),
                     'headerOther' => ['width' => '120'],