فهرست منبع

Merge branch 'master' into feature/EK-76

# Conflicts:
#	backendApi/modules/v1/models/lists/shop/OrderList.php
#	frontendApi/modules/v1/controllers/ShopController.php
kevinElken 8 ماه پیش
والد
کامیت
56c56db887

+ 1 - 0
backendApi/config/menu.php

@@ -29,6 +29,7 @@ return [
             ['name'=>'编辑商品', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'goods-edit', 'routePath'=>'shop/goods-edit', 'show'=>0,],
             ['name'=>'商品上下架', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'goods-status', 'routePath'=>'shop/goods-status', 'show'=>0],
             ['name'=>'删除商品', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'goods-delete', 'routePath'=>'shop/goods-delete', 'show'=>0,],
+            ['name'=>'商品国家', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'goods-add', 'routePath'=>'site/countries', 'show'=>0],
             ['name'=>'商品列表导出', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'goods-list-export', 'routePath'=>'shop/goods-list-export', 'show'=>0,],
             ['name'=>'Order list', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-list', 'routePath'=>'shop/order-list', 'show'=>1, 'wiki' => 'orderList'],//订单列表
             ['name'=>'订单列表导出', 'class'=>'', 'icon'=>'', 'controller'=>'shop', 'action'=>'order-list-export', 'routePath'=>'shop/order-list-export', 'show'=>0,],

+ 1 - 4
backendApi/config/params.php

@@ -13,7 +13,6 @@ return [
         'v1/site/send-notice',
         'v1/site/send-notify',
         'v1/site/languages',
-        'v1/site/countries',
         'v1/ad/sort',
         'v1/article/detail',
         'v1/admin/change-language',
@@ -24,8 +23,8 @@ return [
         'v1/bonus/calc-period',
         'v1/calc/record-list',
         'v1/calc/auto-calc',
-        'v1/shop/order-detail',
         'v1/shop/order-period-adjust-batch',
+//        'v1/site/countries'
     ],
     'noCheckPermissionActions' => [
         'oauth/login',
@@ -39,7 +38,6 @@ return [
         'site/page-data',
         'site/captcha',
         'site/languages',
-        'site/countries',
         'user/full-info',
         'user/filter-user',
         'user/generate-user-name',
@@ -96,7 +94,6 @@ return [
         'bonus/calc-period',
         'calc/record-list',
         'calc/auto-calc',
-        'shop/order-detail',
         'shop/order-period-adjust-batch',
     ],
 ];

+ 73 - 15
backendApi/modules/v1/controllers/AdminController.php

@@ -8,6 +8,7 @@
 namespace backendApi\modules\v1\controllers;
 
 use backendApi\modules\v1\models\Admin;
+use backendApi\modules\v1\models\AdminCountry;
 use backendApi\modules\v1\models\AdminForm;
 use backendApi\modules\v1\models\AdminRoleForm;
 use common\helpers\Cache;
@@ -15,6 +16,7 @@ use common\helpers\Date;
 use common\helpers\Form;
 use common\helpers\Log;
 use common\helpers\Tool;
+use common\models\Countries;
 use Yii;
 use backendApi\modules\v1\models\AdminRole;
 use backendApi\modules\v1\models\User;
@@ -23,6 +25,7 @@ use yii\helpers\Json;
 class AdminController extends BaseController
 {
     public $modelClass = User::class;
+
     public function behaviors() {
         $behaviors = parent::behaviors();
         //$behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_JSON;
@@ -38,22 +41,27 @@ class AdminController extends BaseController
         $filter = $this->filterCondition([
             'ADMIN_NAME' => 'A.ADMIN_NAME',
             'REAL_NAME' => 'A.REAL_NAME',
-            'REMARK' => 'A.REMARK',
             'ROLE_NAME' => 'AR.ROLE_NAME',
             'IS_ENABLE' => 'A.IS_ENABLE',
-            'LOGIN_NUMS' => 'A.LOGIN_NUMS',
-            'LAST_LOGIN_IP' => 'A.LAST_LOGIN_IP',
-            'LAST_LOGIN_AT' => 'A.LAST_LOGIN_AT',
-            'BIND_IP' => 'A.BIND_IP',
-            'CREATED_AT' => 'A.CREATED_AT',
-            'UPDATED_AT' => 'A.UPDATED_AT',
-            'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
-            'UPDATE_ADMIN_NAME' => 'ADMU.ADMIN_NAME',
         ]);
 
         $condition = $filter['condition'];
-        $condition .= ' AND A.IS_DEL=0';
         $params = $filter['params'];
+        $condition .= ' AND A.IS_DEL=0';
+
+        $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
+        if (!$isSuper) {
+            $adminId = Yii::$app->getUser()->getUserInfo()['id'];
+            $adminCountry = AdminCountry::getCountry($adminId);
+
+            $adminIds = AdminCountry::find()->select('ADMIN_ID')->where(['in', 'COUNTRY_ID', $adminCountry])->column();
+            $quotedAdminId = array_map(function($item) {
+                return "'" . addslashes($item) . "'";
+            }, $adminIds);
+
+            $condition .= ' AND A.ID IN (' . implode(',', $quotedAdminId) . ')';
+        }
+
         $data = Admin::lists($condition, $params, [
             'select' => 'A.*,AR.ROLE_NAME,ADMC.ADMIN_NAME CREATE_ADMIN_NAME,ADMU.ADMIN_NAME UPDATE_ADMIN_NAME',
             'from' => Admin::tableName().' AS A',
@@ -64,6 +72,19 @@ class AdminController extends BaseController
             ],
             'orderBy' => 'A.CREATED_AT ASC',
         ]);
+
+        foreach ($data['list'] as &$admin) {
+            $isSuperAdmin = AdminRole::isSuperAdmin($admin['ROLE_ID']);
+            $admin['isSuper'] = $isSuperAdmin;
+            if ($isSuperAdmin) {
+                $admin['countryId'] = [];
+                $admin['country'] = [];
+            } else {
+                $admin['countryId'] = AdminCountry::getCountry($admin['ID']);
+                $admin['country'] = Countries::find()->select('NAME')->where(['in', 'ID', $admin['countryId']])->column();
+            }
+        }
+
         return static::notice($data);
     }
 
@@ -80,9 +101,21 @@ class AdminController extends BaseController
                 // Log::adminHandle('添加管理员:'.$result->ADMIN_NAME);
             });
         }
-        // 获取全部管理员角色
-        $adminRoles = Cache::getAdminRole();
-        return static::notice(['adminRoles'=>$adminRoles]);
+
+        $countries = Cache::getCountries();
+        $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
+        if (!$isSuper) {
+            $adminId = Yii::$app->getUser()->getUserInfo()['id'];
+            $adminCountry = AdminCountry::getCountry($adminId);
+
+            $countries = array_filter($countries, fn($country) => in_array($country['ID'], $adminCountry));
+            $countries = array_values($countries);
+        }
+
+        return static::notice([
+            'adminRoles' => Cache::getAdminRole(),
+            'countries'  => $countries
+        ]);
     }
 
     /**
@@ -99,10 +132,35 @@ class AdminController extends BaseController
                 // Log::adminHandle('编辑管理员:'.$result->ADMIN_NAME);
             });
         }
-        $oneData = Admin::findOneAsArray(['ID'=>$id]);
+
+        $oneData = Admin::findOneAsArray(['ID' => $id]);
+        $adminCountry = AdminCountry::getCountry($id);
         // 获取全部管理员角色
         $adminRoles = Cache::getAdminRole();
-        return static::notice(['oneData'=>['adminName'=>$oneData['ADMIN_NAME'],'realName'=>$oneData['REAL_NAME'],'remark'=>$oneData['REMARK'],'isEnable'=>$oneData['IS_ENABLE']?true:false,'isModifyPassword'=>$oneData['IS_MODIFY_PASSWORD']?true:false,'bindIp'=>$oneData['BIND_IP'],'roleId'=>$oneData['ROLE_ID']], 'adminRoles'=>$adminRoles]);
+
+        $countries = Cache::getCountries();
+        $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
+        if (!$isSuper) {
+            $adminId = Yii::$app->getUser()->getUserInfo()['id'];
+            $adminCountry = AdminCountry::getCountry($adminId);
+
+            $countries = array_filter($countries, fn($country) => in_array($country['ID'], $adminCountry));
+            $countries = array_values($countries);
+        }
+
+        return static::notice([
+            'adminRoles' => $adminRoles,
+            'countries'  => $countries,
+            'oneData' => [
+                'adminName' => $oneData['ADMIN_NAME'],
+                'realName' => $oneData['REAL_NAME'],
+                'remark' => $oneData['REMARK'],
+                'isEnable' => (bool)$oneData['IS_ENABLE'],
+                'isModifyPassword' => (bool)$oneData['IS_MODIFY_PASSWORD'],
+                'bindIp' => $oneData['BIND_IP'],
+                'roleId' => $oneData['ROLE_ID'],
+                'countryId' => AdminCountry::getCountry($oneData['ID']),
+            ]]);
     }
 
     /**

+ 89 - 9
backendApi/modules/v1/controllers/ShopController.php

@@ -8,6 +8,8 @@
 
 namespace backendApi\modules\v1\controllers;
 
+use backendApi\modules\v1\models\AdminCountry;
+use backendApi\modules\v1\models\AdminRole;
 use backendApi\modules\v1\models\exportForms\BaShopExportForm;
 use backendApi\modules\v1\models\exportForms\ShopExportForm;
 use backendApi\modules\v1\models\lists\shop\DecOrderList;
@@ -24,6 +26,8 @@ use backendApi\modules\v1\models\lists\shop\FlowRemainPvList;
 use common\helpers\Cache;
 use common\helpers\Date;
 use common\helpers\Form;
+use common\helpers\LoggerTool;
+use common\models\Countries;
 use common\models\CurrencyConversions;
 use common\models\DeclarationPackage;
 use common\models\DecOrder;
@@ -138,11 +142,24 @@ class ShopController extends BaseController {
                 return static::notice(Form::formatErrorsForApi($formModel->getErrors()),400);
             }
         }
+
+        $countries = Cache::getCountries();
+
+        $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
+        if (!$isSuper) {
+            $adminId = Yii::$app->getUser()->getUserInfo()['id'];
+            $adminCountry = AdminCountry::getCountry($adminId);
+
+            $countries = array_filter($countries, fn($country) => in_array($country['ID'], $adminCountry));
+            $countries = array_values($countries);
+        }
+
         return static::notice([
             'sellType' => ShopGoods::getSaleType(),
             'goodsType' => ShopGoods::getGoodType(),
             'giftType' => ShopGoods::getGiftType(),
             'categoryType' => ShopGoods::getCategoryType(),
+            'countries' => $countries,
         ]);
     }
 
@@ -181,15 +198,24 @@ class ShopController extends BaseController {
         $currenciesConversions = CurrencyConversions::getFromCache();
         $currenciesConversions = array_column($currenciesConversions, NULL, 'TO_CURRENCY_ID');
 
-        foreach ($countries as &$country) {
+        $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
+        if (!$isSuper) {
+            $adminId = Yii::$app->getUser()->getUserInfo()['id'];
+            $adminCountry = AdminCountry::getCountry($adminId);
+
+            $countries = array_filter($countries, fn($country) => in_array($country['ID'], $adminCountry));
+            $countries = array_values($countries);
+        }
+
+        foreach ($countries as $key => $country) {
             // 货币
-            $country['LOCAL_CURRENCY_NAME'] = $currencies[$country['LOCAL_CURRENCY_ID']]['NAME'] ?? '';
-            $country['CURRENCY_PRODUCT_RATE'] = $currenciesConversions[$country['LOCAL_CURRENCY_ID']]['PRODUCT_RATE'] ?? 0;
+            $countries[$key]['LOCAL_CURRENCY_NAME'] = $currencies[$country['LOCAL_CURRENCY_ID']]['NAME'] ?? '';
+            $countries[$key]['CURRENCY_PRODUCT_RATE'] = $currenciesConversions[$country['LOCAL_CURRENCY_ID']]['PRODUCT_RATE'] ?? 0;
             // 商品属性
-            $country['SHOP_GOODS_NATURE'] = ShopGoodsNature::findAllAsArray('GOODS_ID=:GOODS_ID AND COUNTRY_ID=:COUNTRY_ID', [':GOODS_ID' => $id, ':COUNTRY_ID' => $country['ID']]);
+            $countries[$key]['SHOP_GOODS_NATURE'] = ShopGoodsNature::findAllAsArray('GOODS_ID=:GOODS_ID AND COUNTRY_ID=:COUNTRY_ID', [':GOODS_ID' => $id, ':COUNTRY_ID' => $country['ID']]);
         }
 
-        $data['SHOP_GOODS_NATURE'] = $countries;
+        $data['SHOP_GOODS_NATURE'] = array_values($countries);
 
         return static::notice(
             [
@@ -430,7 +456,21 @@ class ShopController extends BaseController {
             'COUNTRY' => 'O.COUNTRY_ID',
             'AUTO_MAINTENANCE' => 'O.AUTO_MAINTENANCE'
         ]);
+
         $condition = ' 1=1 ' . $filter['condition'];
+
+        $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 = ' 1=1 ' . $filter['condition'] . " AND O.COUNTRY_ID IN (" . implode(',', $quotedAdminCountry) . ")";
+        }
+
         $params = $filter['params'];
         $condition .= $condition ? ' AND O.IS_DELETE=0' : ' O.IS_DELETE=0';
         $listObj = new OrderList();
@@ -456,7 +496,21 @@ class ShopController extends BaseController {
             'STATUS' => 'O.STATUS',
             'AUTO_MAINTENANCE' => 'O.AUTO_MAINTENANCE'
         ]);
-        $filter['condition'] = !$filter['condition'] ? '1=1 AND O.IS_DELETE=0' : ('O.IS_DELETE=0 ' . $filter['condition']);
+
+        $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);
+
+            $filter['condition'] = ('O.IS_DELETE=0 ' . $filter['condition']) . " AND O.COUNTRY_ID IN (" . implode(',', $quotedAdminCountry) . ")";
+        } else {
+            $filter['condition'] = ('O.IS_DELETE=0 ' . $filter['condition']);
+        }
+
         $form = new ShopExportForm();
         $result = $form->run($filter, \Yii::t('ctx', 'shopOrderListExport')); // 订单列表
         if (!$result) {
@@ -912,6 +966,17 @@ class ShopController extends BaseController {
                 'MODERN_PERIOD'=> 'P.MODERN_PERIOD',
                 'CREATED_AT'=> 'P.CREATED_AT',
             ]);
+
+            $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);
+                $filter['condition'] .= ' AND O.COUNTRY_ID IN (' . implode(',', $quotedAdminCountry) . ')';
+            }
+
             $listObj = new OrderPeriodAdjustList();
             $data = $listObj->getList(['condition' => $filter['condition'], 'params' => $filter['params']]);
             return static::notice($data);
@@ -927,12 +992,26 @@ class ShopController extends BaseController {
     {
         $orderSn = \Yii::$app->request->get('orderSn');
 
-        $order = Order::findOneAsArray('SN=:SN', [':SN' => $orderSn]);
+        $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);
+
+            $order = Order::findOneAsArray('SN=:SN AND COUNTRY_ID IN (' . implode(',', $quotedAdminCountry) . ')', [':SN' => $orderSn]);
+        } else {
+            $order = Order::findOneAsArray('SN=:SN', [':SN' => $orderSn]);
+        }
         if (!$order) {
             return static::notice(Yii::t('ctx', 'orderNotExist'), 400);
         }
+
         $order['ORDER_TYPE'] = $order['ORDER_TYPE'] === 'ZC' ? Yii::t('ctx', 'shopOrderListOrderTypeZc') : Yii::t('ctx', 'shopOrderListOrderTypeFx');
-        // 如果当前订单所在期数已挂网,则不可调整
+        $order['COUNTRY'] = Countries::getById($order['COUNTRY_ID'])['NAME'] ?? '';
+
+        // 已挂网,不可调整
         $period = Period::getInfoByPeriodNum($order['PERIOD_NUM']);
         if (!$period) {
             return static::notice(Yii::t('ctx', 'invalidPcNo'), 400);
@@ -940,7 +1019,8 @@ class ShopController extends BaseController {
         if ($period['IS_SENT'] > 0) {
             return static::notice(Yii::t('ctx', 'orderHasBeenConnected'), 400);
         }
-        // 根据订单期数查询可调整期数
+
+        // 可调整期数
         $availablePeriod = [];
         if ($order['PERIOD_NUM']) {
             $availablePeriod = Period::getPeriodList(+$order['PERIOD_NUM'] - 1);

+ 26 - 4
backendApi/modules/v1/controllers/SiteController.php

@@ -7,6 +7,9 @@
  */
 namespace backendApi\modules\v1\controllers;
 
+use backendApi\modules\v1\models\AdminCountry;
+use backendApi\modules\v1\models\AdminRole;
+use common\helpers\LoggerTool;
 use common\helpers\snowflake\PageSnowFake;
 use common\helpers\Tool;
 use common\models\CurrencyConversions;
@@ -103,6 +106,8 @@ class SiteController extends BaseController
         $periodNum = $period->getNowPeriodNum();
         // 汇率
         $exchangeRate = floatval(Cache::getSystemConfig()['exchangeRate']['VALUE'] ?? 0);
+        $isSuperAdmin = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
+
         return [
             'decLevels' => $decLevels,
             'empLevels' => $empLevels,
@@ -122,6 +127,7 @@ class SiteController extends BaseController
             'allNation' => $allNation,
             'nowPeriodNum' => $periodNum,
             'exchangeRate' => $exchangeRate,
+            'isSuperAdmin' => $isSuperAdmin,
         ];
     }
 
@@ -179,6 +185,17 @@ class SiteController extends BaseController
     {
         // 国家
         $countries = Cache::getCountries();
+
+//        $filter = \Yii::$app->request->get('filter', 0);
+        $isSuperAdmin = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
+        if (!$isSuperAdmin) {
+            $adminId = Yii::$app->getUser()->getUserInfo()['id'];
+            $adminCountry = AdminCountry::getCountry($adminId);
+
+            $countries = array_filter($countries, fn($country) => in_array($country['ID'], $adminCountry));
+            $countries = array_values($countries);
+        }
+
         // 货币
         $currencies = Cache::getCurrencies();
         $currencies = array_column($currencies, NULL, 'ID');
@@ -186,10 +203,15 @@ class SiteController extends BaseController
         $currenciesConversions = CurrencyConversions::getFromCache();
         $currenciesConversions = array_column($currenciesConversions, NULL, 'TO_CURRENCY_ID');
 
-        foreach ($countries as &$country) {
-            $country['LOCAL_CURRENCY_NAME'] = $currencies[$country['LOCAL_CURRENCY_ID']]['NAME'] ?? '';
-            $country['CURRENCY_PRODUCT_RATE'] = $currenciesConversions[$country['LOCAL_CURRENCY_ID']]['PRODUCT_RATE'] ?? 0;
-        }
+        $countries = array_map(function ($country) use ($currencies, $currenciesConversions) {
+            return array_merge(
+                $country,
+                [
+                    'LOCAL_CURRENCY_NAME' => $currencies[$country['LOCAL_CURRENCY_ID']]['NAME'] ?? '',
+                    'CURRENCY_PRODUCT_RATE' => $currenciesConversions[$country['LOCAL_CURRENCY_ID']]['PRODUCT_RATE'] ?? 0
+                ]
+            );
+        }, $countries);
 
         return static::notice(['data' => $countries]);
     }

+ 75 - 13
backendApi/modules/v1/controllers/UserController.php

@@ -10,6 +10,8 @@ namespace backendApi\modules\v1\controllers;
 
 use backendApi\modules\v1\components\UserAuth;
 use backendApi\modules\v1\models\Admin;
+use backendApi\modules\v1\models\AdminCountry;
+use backendApi\modules\v1\models\AdminRole;
 use backendApi\modules\v1\models\exportForms\BaUserExportForm;
 use backendApi\modules\v1\models\exportForms\UserExportForm;
 use backendApi\modules\v1\models\lists\shop\BaUserList;
@@ -27,6 +29,7 @@ use common\helpers\Date;
 use common\helpers\Form;
 use common\helpers\http\BackendToFrontendApi;
 use common\helpers\Log;
+use common\helpers\LoggerTool;
 use common\helpers\NetPoint;
 use common\helpers\Tool;
 use common\helpers\user\Balance;
@@ -143,9 +146,26 @@ class UserController extends BaseController
             ],
             'ADDRESS' => 'U.ADDRESS',
         ]);
-        $condition = $filter['condition'];
-        $params = $filter['params'];
-        $condition .= ' AND UI.DELETED=0 ';
+
+        $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 = $filter['condition'] ?? '';
+            $filter['condition'] = $condition . " AND U.COUNTRY_ID IN (" . implode(',', $quotedAdminCountry) . ")";
+
+            $condition = $filter['condition'];
+            $params = $filter['params'];
+            $condition .= " AND UI.DELETED=0 AND U.COUNTRY_ID IN (" . implode(',', $quotedAdminCountry) . ")";
+        } else {
+            $condition = $filter['condition'] ?? '';
+            $params = $filter['params'];
+        }
+
         $listObj = new IndexList();
         $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
         return static::notice($data);
@@ -200,6 +220,22 @@ class UserController extends BaseController
             'VERIFIED_AT' => 'U.VERIFIED_AT',
             'ALLOW_TRANSFER' => 'UI.ALLOW_TRANSFER',
         ]);
+
+        $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 = $filter['condition'] ?? '';
+            $filter['condition'] = $condition . " AND U.COUNTRY_ID IN (" . implode(',', $quotedAdminCountry) . ")";
+        } else {
+            $condition = $filter['condition'] ?? '';
+            $filter['condition'] = $condition;
+        }
+
         $form = new UserExportForm();
         $result = $form->run($filter, 'Member_List');
         if (!$result) {
@@ -691,24 +727,15 @@ class UserController extends BaseController
     public function actionMove()
     {
         $filter = $this->filterCondition([
-//            'userIds' => 'UM.USER_ID',
             'filterStatus' => 'UM.AUDIT_STATUS',
             'MOVE_USER_NAME' => 'CU.USER_NAME',
             'MOVE_REAL_NAME' => 'CU.REAL_NAME',
-//            'moveType' => 'UM.TYPE',
-//            'FROM_USER_NAME' => 'FUI.USER_NAME',
-//            'TO_USER_NAME' => 'TUI.USER_NAME',
             'MOVE_PERCENT_SHOW' => 'UM.MOVE_PERCENT',
-//            'STARTED_AT' => 'UM.STARTED_AT',
-//            'ENDED_AT' => 'UM.ENDED_AT',
             'CREATE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
             'PERIOD_NUM' => 'UM.PERIOD_NUM',
-//            'CREATED_AT' => 'UM.CREATED_AT',
             'AUDIT_ADMIN_NAME' => 'ADMU.ADMIN_NAME',
             'MOVE_ADMIN_NAME' => 'ADMC.ADMIN_NAME',
-//            'AUDIT_PERIOD_NUM' => 'UM.AUDIT_PERIOD_NUM',
             'AUDITED_AT' => 'UM.AUDITED_AT',
-//            'CREATE_REMARK' => 'UM.CREATE_REMARK',
         ]);
         $condition = $filter['condition'];
         $params = $filter['params'];
@@ -876,6 +903,17 @@ class UserController extends BaseController
     {
         $userName = Yii::$app->request->get('userName');
         $userInfo = Info::getBaseUserByUserName($userName);
+
+        $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
+        if (!$isSuper) {
+            $adminId = Yii::$app->getUser()->getUserInfo()['id'];
+            $adminCountry = AdminCountry::getCountry($adminId);
+
+            if (!in_array($userInfo['COUNTRY_ID'], $adminCountry)) {
+                return static::notice('Member number does not exist', 400);
+            }
+        }
+
         if($userInfo){
             $decLevelConfig = Cache::getDecLevelConfig();
             $userInfo['LEVEL_NAME'] = isset($decLevelConfig[$userInfo['DEC_LV']])?$decLevelConfig[$userInfo['DEC_LV']]['LEVEL_NAME'] : '';
@@ -1152,13 +1190,25 @@ class UserController extends BaseController
         $data['allNation'] = \Yii::$app->params['nation'];
         $data['region'] = Region::getByCountryId($userInfo['COUNTRY_ID']);
         $data['language'] = Language::getFromCache();
-        $data['country'] = Countries::getFromCache();
         $data['allOpenBank'] = OpenBank::find()
             ->where('STATUS=:STATUS AND COUNTRY_ID=:COUNTRY_ID', [':STATUS' => 1, ':COUNTRY_ID' => $userInfo['COUNTRY_ID']])
             ->orderBy('BANK_NAME ASC')
             ->asArray()
             ->all();
 
+        $countries = Countries::getFromCache();
+
+        $isSuper = AdminRole::isSuperAdmin(\Yii::$app->getUser()->getUserInfo()['roleId']);
+        if (!$isSuper) {
+            $adminId = Yii::$app->getUser()->getUserInfo()['id'];
+            $adminCountry = AdminCountry::getCountry($adminId);
+
+            $countries = array_filter($countries, fn($country) => in_array($country['ID'], $adminCountry));
+            $countries = array_values($countries);
+        }
+
+        $data['country'] = array_values($countries);
+
         $data['userInfo'] = [
             'userId' => $userInfo['ID'],
             'nation' => \Yii::$app->params['nation'][$userInfo['NATION']]['name']??'',
@@ -1433,6 +1483,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 DecLevelList();
         $data = $listObj->getList(['condition' => $condition, 'params' => $params]);
 

+ 31 - 31
backendApi/modules/v1/models/Admin.php

@@ -140,11 +140,11 @@ class Admin extends ActiveRecord
         return [
             'ADMIN_NAME' => '用户名',
             'REAL_NAME' => '会员姓名',
-            'REMARK' => '备注',
+//            'REMARK' => '备注',
             'ROLE_ID' => [
                 'label' => '角色名称',
                 'type' => function($data){
-                    $value = isset($data['value']) ? $data['value'] : '';
+                    $value = $data['value'] ?? '';
                     $result = AdminRole::findOneAsArray('ID=:ID', [':ID'=>$value], 'ROLE_NAME');
                     return !empty($result) ? $result['ROLE_NAME'] : '';
                 },
@@ -153,35 +153,35 @@ class Admin extends ActiveRecord
                 'label' => '是否启用',
                 'type' => ValueTypeConfig::YES_NO_TYPE,
             ],
-            'BIND_IP' => '绑定IP',
-            'CREATE_ADMIN' => [
-                'label' => '创建人',
-                'type' => function($data){
-                    $value = isset($data['value']) ? $data['value'] : '';
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return !empty($result) ? $result['ADMIN_NAME'] : '';
-                },
-            ],
-            'UPDATE_ADMIN' => [
-                'label' => '更新人',
-                'type' => function($data){
-                    $value = isset($data['value']) ? $data['value'] : '';
-                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
-                    return !empty($result) ? $result['ADMIN_NAME'] : '';
-                },
-            ],
-            'CREATED_AT' => [
-                'label' => '创建时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-            'UPDATED_AT' => [
-                'label' => '更新时间',
-                'type' => ValueTypeConfig::DATE_TIME_TYPE,
-            ],
-            'IS_MODIFY_PASSWORD' => [
-                'label' => '是否修改密码',
-                'type' => ValueTypeConfig::YES_NO_TYPE,
-            ],
+//            'BIND_IP' => '绑定IP',
+//            'CREATE_ADMIN' => [
+//                'label' => '创建人',
+//                'type' => function($data){
+//                    $value = isset($data['value']) ? $data['value'] : '';
+//                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
+//                    return !empty($result) ? $result['ADMIN_NAME'] : '';
+//                },
+//            ],
+//            'UPDATE_ADMIN' => [
+//                'label' => '更新人',
+//                'type' => function($data){
+//                    $value = isset($data['value']) ? $data['value'] : '';
+//                    $result = Admin::findOneAsArray('ID=:ID', [':ID'=>$value], 'ADMIN_NAME');
+//                    return !empty($result) ? $result['ADMIN_NAME'] : '';
+//                },
+//            ],
+//            'CREATED_AT' => [
+//                'label' => '创建时间',
+//                'type' => ValueTypeConfig::DATE_TIME_TYPE,
+//            ],
+//            'UPDATED_AT' => [
+//                'label' => '更新时间',
+//                'type' => ValueTypeConfig::DATE_TIME_TYPE,
+//            ],
+//            'IS_MODIFY_PASSWORD' => [
+//                'label' => '是否修改密码',
+//                'type' => ValueTypeConfig::YES_NO_TYPE,
+//            ],
         ];
     }
 }

+ 56 - 0
backendApi/modules/v1/models/AdminCountry.php

@@ -0,0 +1,56 @@
+<?php
+
+namespace backendApi\modules\v1\models;
+
+use common\components\ActiveRecord;
+
+/**
+ * This is the model class for table "{{%ADMIN_COUNTRY}}".
+ *
+ * @property string $ID
+ * @property string $ADMIN_ID 管理ID
+ * @property string $COUNTRY_ID 国家ID
+ */
+class AdminCountry extends ActiveRecord
+{
+    /**
+     * @inheritdoc
+     */
+    public static function tableName()
+    {
+        return '{{%ADMIN_COUNTRY}}';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['ADMIN_ID', 'COUNTRY_ID',], 'required'],
+            [['ID', 'COUNTRY_ID'], 'string', 'max' => 32],
+            [['ID'], 'unique'],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'ID' => 'ID',
+            'ADMIN_ID' => '管理ID',
+            'COUNTRY_ID' => '国家ID',
+        ];
+    }
+
+    /**
+     * @param $adminId
+     * @return array
+     */
+    public static function getCountry($adminId): array
+    {
+        return self::find()->select('COUNTRY_ID')->where(['ADMIN_ID' => $adminId])->column();
+    }
+}

+ 24 - 2
backendApi/modules/v1/models/AdminForm.php

@@ -23,6 +23,7 @@ class AdminForm extends Model
     public $surePassword;
     public $roleId;
     public $lang;
+    public $countryId;
 
     public function init() {
         parent::init();
@@ -54,8 +55,8 @@ class AdminForm extends Model
     {
         $parentScenarios =  parent::scenarios();
         $customScenarios = [
-            'add' => ['adminName', 'realName', 'password', 'surePassword', 'roleId', 'remark', 'isEnable', 'isModifyPassword', 'bindIp'],
-            'edit' => ['id', 'password', 'surePassword', 'roleId', 'realName', 'remark', 'isEnable', 'isModifyPassword', 'bindIp'],
+            'add' => ['adminName', 'realName', 'password', 'surePassword', 'roleId', 'remark', 'isEnable', 'isModifyPassword', 'bindIp', 'countryId'],
+            'edit' => ['id', 'password', 'surePassword', 'roleId', 'realName', 'remark', 'isEnable', 'isModifyPassword', 'bindIp', 'countryId'],
             'changePassword' => ['password', 'surePassword'],
             'noLoginModifyPassword' => ['adminName', 'oldPassword', 'password', 'surePassword'],
             'changeLanguage' => ['adminName', 'lang'],
@@ -77,6 +78,7 @@ class AdminForm extends Model
             'password' => '密码',
             'surePassword' => '确认密码',
             'roleId' => '角色',
+            'countryId' => '国家',
         ];
     }
 
@@ -173,6 +175,15 @@ class AdminForm extends Model
                 'userName' => $model->ADMIN_NAME,
                 'remark' => $this->remark,
             ]);
+
+            if (!AdminRole::isSuperAdmin($this->roleId)) {
+                foreach ($this->countryId as $country) {
+                    $adminCountry = new AdminCountry();
+                    $adminCountry->ADMIN_ID = $model->ID;
+                    $adminCountry->COUNTRY_ID = $country;
+                    $adminCountry->save();
+                }
+            }
         } elseif($this->scenario == 'edit') {
             $this->adminOperateLogger->afterUpdate($model);
             $this->adminOperateLogger->clean()->save([
@@ -180,6 +191,17 @@ class AdminForm extends Model
                 'userName' => $model->ADMIN_NAME,
                 'remark' => $this->remark,
             ]);
+
+            (new AdminCountry())->deleteAll(['ADMIN_ID' => $model->ID]);
+            if (!AdminRole::isSuperAdmin($this->roleId)) {
+                // 国家
+                foreach ($this->countryId as $country) {
+                    $adminCountry = new AdminCountry();
+                    $adminCountry->ADMIN_ID = $model->ID;
+                    $adminCountry->COUNTRY_ID = $country;
+                    $adminCountry->save();
+                }
+            }
         } elseif($this->scenario == 'noLoginModifyPassword') {
             $this->adminOperateLogger->clean()->save([
                 'optType' => '不登录重置密码',

+ 9 - 0
backendApi/modules/v1/models/AdminRole.php

@@ -187,4 +187,13 @@ class AdminRole extends \common\components\ActiveRecord
         }
         return $allColumns;
     }
+
+    /**
+     * 判断是否为超级管理员角色
+     * @param string $roleId 角色ID
+     * @return bool
+     */
+    public static function isSuperAdmin($roleId){
+        return $roleId === Yii::$app->params['superAdminRoleId'];
+    }
 }

+ 9 - 63
backendApi/modules/v1/models/lists/shop/GoodsList.php

@@ -46,22 +46,6 @@ class GoodsList extends \common\libs\dataList\DataList implements DataListInterf
                     'header' => \Yii::t('ctx', 'shopListProductsCode'), // 商品编号
                     'headerOther' => ['width' => '200'],
                 ],
-                'SELL_DISCOUNT' => [
-                    'header' => \Yii::t('ctx', 'shopListDiscountRate'), // 商品折扣
-                    'value' => function($row) {
-                        $discount = 0;
-                        if ($row['TYPE'] == 1) {
-                            $discount = '0.5';
-                        } else if($row['TYPE'] == 2) {
-                            $discount = '0.6';
-                        } else {
-                            $discount = $row['SELL_DISCOUNT'];
-                        }
-
-                        return $discount;
-                    },
-                    'headerOther' => ['width' => '150'],
-                ],
                 'GIFT_TYPE' => [
                     'header' => \Yii::t('ctx', 'shopListProductsType'), // 商品类型
                     'value' => function($row){
@@ -76,27 +60,6 @@ class GoodsList extends \common\libs\dataList\DataList implements DataListInterf
                     },
                     'headerOther' => ['width' => '150'],
                 ],
-//                'CATEGORY_TYPE' => [
-//                    'header' => \Yii::t('ctx', 'shopListProductCategory'), // 商品分类
-//                    'value' => function($row) {
-//                        $categoryType =  array_column($this->getCategoryType(), NULL, 'id'); //array_column(ShopGoods::CATEGORY_TYPE, NULL, 'id');
-//                        return $categoryType[$row['CATEGORY_TYPE']]['name'] ?? '';
-//                    },
-//                    'headerOther' => ['width' => '150'],
-//                ],
-//                'SELL_TYPE' => [
-//                    'header' => \Yii::t('ctx', 'shopListPaymentMode'), // 购买方式
-//                    'value' => function($row){
-//                        $sellType =  $this->getSaleType(); //ShopGoods::SALE_TYPE;
-//                        $sel = explode(',',$row['SELL_TYPE']);
-//                        $value = '';
-//                        foreach ($sel as $v){
-//                            $value.= $sellType[$v]['name'].',';
-//                        }
-//                        return $value;
-//                    },
-//                    'headerOther' => ['width' => '150'],
-//                ],
                 'SELL_PRICE_STANDARD' => [
                     'header' => \Yii::t('ctx', 'shopListPriceStandard'), // 标准价格($)
                     'headerOther' => [
@@ -105,11 +68,6 @@ class GoodsList extends \common\libs\dataList\DataList implements DataListInterf
                     'value' => function ($row) {
                         return Tool::formatPrice($row['SELL_PRICE_STANDARD']);
                     },
-                    'valueOther' => function ($row) {
-                        return [
-                            'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
-                        ];
-                    },
                 ],
                 'PRICE_PV' => [
                     'header' => \Yii::t('ctx', 'shopListProductsBv'), // 产品BV
@@ -119,11 +77,6 @@ class GoodsList extends \common\libs\dataList\DataList implements DataListInterf
                     'value' => function ($row) {
                         return Tool::formatPrice($row['PRICE_PV']);
                     },
-                    'valueOther' => function ($row) {
-                        return [
-                            'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
-                        ];
-                    },
                 ],
                 'STORE_NUMS' => [
                     'header' => \Yii::t('ctx', 'shopListInventory'), // 库存
@@ -132,22 +85,19 @@ class GoodsList extends \common\libs\dataList\DataList implements DataListInterf
                     ],
                 ],
                 'STATUS' => [
-                    'header' => \Yii::t('ctx', 'shopListStatus'), // 状态
-                    'value' => function($row) {
-                        return $row['STATUS'] == 1 ? \Yii::t('ctx', 'shopListOnSale') : \Yii::t('ctx', 'shopListSoldOut'); //已上架:已下架
-                    },
+                    'header' => \Yii::t('ctx', 'shopListStatus'), // 产品BV
                     'headerOther' => [
-                        'width' => '110',
+                        'width' => '120',
                     ],
-                ],
-                'UPDATED_AT' => [
-                    'header' => \Yii::t('ctx', 'shopListUpdatedAt'), // 更新时间
                     'value' => function ($row) {
-                        return (new DateTime([
-                            'value' => $row['UPDATED_AT'],
-                        ]))->result();
+                        return $row['STATUS'] == 1 ? \Yii::t('ctx', 'shopListOnSale') : \Yii::t('ctx', 'shopListSoldOut');
+                    },
+                    'valueOther' => function ($row) {
+                        $tag = ($row['STATUS'] == 1) ? 'success' : 'danger';
+                        return [
+                            'tag' => ['type' => $tag, 'size' => 'small', 'class' => 'no-border']
+                        ];
                     },
-                    'headerOther' => ['width' => '190'],
                 ],
                 'AUTO_MAINTENANCE' => [
                     'header' => \Yii::t('ctx', 'shopListAutoMaintenance'),
@@ -178,8 +128,6 @@ class GoodsList extends \common\libs\dataList\DataList implements DataListInterf
                     'selectData' => [
                         ['id' => 1, 'name' => \Yii::t('ctx', 'shopList1stPurchase')], 
                         ['id' => 2, 'name' => \Yii::t('ctx', 'shopListRepeatPurchase')], 
-//                        ['id' => 3, 'name' => \Yii::t('ctx', 'shopListEntryArea')],
-//                        ['id' => 4, 'name' => \Yii::t('ctx', 'shopListResellingArea')]
                     ]
                 ],
                 'STATUS'=> [
@@ -195,8 +143,6 @@ class GoodsList extends \common\libs\dataList\DataList implements DataListInterf
                 'CATEGORY_TYPE' => [
                     'name' => \Yii::t('ctx', 'shopListProductCategory'), 
                     'other'=> 'select', 
-                    // 翻译无法使用const,改成其他方式
-                    // 'selectData'=> ShopGoods::CATEGORY_TYPE
                     'selectData'=> $this->getCategoryType()
                 ], // 商品分类
             ];

+ 6 - 1
backendApi/modules/v1/models/lists/shop/OrderPeriodAdjustList.php

@@ -2,6 +2,7 @@
 namespace backendApi\modules\v1\models\lists\shop;
 
 use common\libs\dataList\DataListInterface;
+use common\models\Countries;
 use common\models\Order;
 use common\models\OrderPeriodAdjust;
 use common\libs\dataList\column\DateTime;
@@ -23,11 +24,12 @@ class OrderPeriodAdjustList extends \common\libs\dataList\DataList implements Da
     public function dataHandle()
     {
         $this->listData = OrderPeriodAdjust::lists($this->condition, $this->params, [
-            'select' => 'P.*,O.ORDER_TYPE',
+            'select' => 'P.*,O.ORDER_TYPE,O.COUNTRY_ID,C.NAME AS COUNTRY_NAME',
             'orderBy' => 'P.CREATED_AT DESC, P.ID DESC',
             'from' => OrderPeriodAdjust::tableName() . ' AS P',
             'join' => [
                 ['LEFT JOIN', Order::tableName() . ' AS O', 'P.ORDER_SN=O.SN'],
+                ['LEFT JOIN', Countries::tableName() . ' AS C', 'O.COUNTRY_ID=C.ID'],
             ],
             'page' => $this->page,
             'pageSize' => $this->pageSize,
@@ -51,6 +53,9 @@ class OrderPeriodAdjustList extends \common\libs\dataList\DataList implements Da
                         return $row['ORDER_TYPE'] == 'ZC' ? Yii::t('ctx', 'shopOrderListOrderTypeZc') : Yii::t('ctx', 'shopOrderListOrderTypeFx');
                     },
                 ],
+                'COUNTRY_NAME' => [
+                    'header' => Yii::t('ctx', 'country'),
+                ],
                 'ORIGIN_PERIOD' => [
                     'header' => Yii::t('ctx', 'beforeAdjustmentPcNo'),
                 ],

+ 2 - 3
backendApi/modules/v1/models/lists/user/DecLevelList.php

@@ -27,13 +27,12 @@ class DecLevelList extends \common\libs\dataList\DataList implements DataListInt
     public function dataHandle()
     {
         $this->listData = DecLevelLog::lists($this->condition, $this->params, [
-            'select' => 'LL.*,
-                CU.USER_NAME,ADM.ADMIN_NAME',
+            'select' => 'LL.*, CU.USER_NAME, ADM.ADMIN_NAME',
             'orderBy' => 'LL.CREATED_AT DESC, LL.ID DESC',
             'from' => DecLevelLog::tableName() . ' AS LL',
             'join' => [
                 ['LEFT JOIN', Admin::tableName() . ' AS ADM', 'LL.ADMIN_ID=ADM.ID'],
-                ['LEFT JOIN', User::tableName() . ' AS CU', 'LL.USER_ID=CU.ID'],
+                ['INNER JOIN', User::tableName() . ' AS CU', 'LL.USER_ID=CU.ID'],
             ],
             'page' => $this->page,
             'pageSize' => $this->pageSize,

BIN
backendEle/static/src/img/ngds-logo.jpg


+ 2 - 10
common/config/main.php

@@ -55,10 +55,8 @@ return [
         'mailer' => [
             'class' => 'yii\swiftmailer\Mailer',
             'viewPath' => '@common/mail',
-            // send all mails to a file by default. You have to set
-            // 'useFileTransport' to false and configure a transport
-            // for the mailer to send real emails.
-            'useFileTransport' => true, // true(缓存到文件中) false(发送邮件)
+            'useFileTransport' => false,
+            'enableSwiftMailerLogging' => true,
             'transport' => [
                 'class' => 'Swift_SmtpTransport',
                 'host' => 'mail.authsmtp.com',
@@ -66,12 +64,6 @@ return [
                 'username' => 'ac71555',
                 'password' => 'I1j-MKi-fJ8-nHb',
                 'encryption' => 'TLS',
-
-//                'host' => 'smtp.163.com',
-//                'port' => 465,
-//                'username' => '18511880790@163.com',
-//                'password' => 'YOUSSWQHISDSWPVB',
-//                'encryption' => 'SSL',
             ],
         ],
         'swooleAsyncTimer' => [

+ 4 - 2
common/helpers/Email.php

@@ -13,16 +13,18 @@ class Email
      */
     public static function sendRegistrationEmail(string $email, string $userName, string $password)
     {
-        $subject = \Yii::t('app', 'decRegistrationEmailSubject');
+        $subject = \Yii::t('app', 'decRegistrationEmailSubject', []);
         $message = \Yii::t('app', 'decRegistrationEmailContent', ['userName' => $userName, 'passWord' => $password]);
 
         $mailer = Yii::$app->mailer;
         $mailer->useFileTransport = false;
-        $mailer->compose()
+        $response = $mailer->compose()
             ->setFrom('eshop-noreply@elken.com')
             ->setTo($email)
             ->setSubject($subject)
             ->setHtmlBody($message)
             ->send();
+
+        LoggerTool::debug('sendRegistrationEmail' . sprintf('sendRegistrationEmail: %s', json_encode([$email, $userName, $password, $response])));
     }
 }

+ 3 - 4
common/libs/export/BaseExport.php

@@ -308,7 +308,7 @@ class BaseExport extends Component {
         $orderQuery = Order::find()
             ->alias('O')
             ->where($this->params['condition'], $this->params['params'])
-            ->select('O.*,U.REAL_NAME,U.DEC_ID,SG.CATEGORY_TYPE,OG.REAL_PRICE,OG.TAX_RATE,OG.BUY_NUMS,OG.SKU_CODE,OG.GOODS_TITLE,OG.REAL_PV,OG.STANDARD_PRICE')
+            ->select('O.*,U.REAL_NAME,SG.CATEGORY_TYPE,OG.REAL_PRICE,OG.TAX_RATE,OG.BUY_NUMS,OG.SKU_CODE,OG.GOODS_TITLE,OG.REAL_PV,OG.STANDARD_PRICE')
             ->join('LEFT JOIN', User::tableName() . ' AS U', 'U.ID=O.USER_ID')
             ->join('LEFT JOIN', OrderGoods::tableName() . ' AS OG', 'OG.ORDER_SN=O.SN')
             ->join('LEFT JOIN', ShopGoods::tableName() . ' AS SG', 'SG.ID=OG.GOODS_ID')
@@ -320,7 +320,7 @@ class BaseExport extends Component {
         $orderStandardQuery = ApproachOrder::find()
             ->alias('O')
             ->where($this->params['condition'] . ' AND (O.STATUS = :NOT_PAID OR O.STATUS = :FAIL_PAID)', $this->params['params'])
-            ->select('O.*,U.REAL_NAME,U.DEC_ID,SG.CATEGORY_TYPE,OG.REAL_PRICE,OG.TAX_RATE,OG.BUY_NUMS,OG.SKU_CODE,OG.GOODS_TITLE,OG.REAL_PV,OG.STANDARD_PRICE')
+            ->select('O.*,U.REAL_NAME,SG.CATEGORY_TYPE,OG.REAL_PRICE,OG.TAX_RATE,OG.BUY_NUMS,OG.SKU_CODE,OG.GOODS_TITLE,OG.REAL_PV,OG.STANDARD_PRICE')
             ->join('LEFT JOIN', User::tableName() . ' AS U', 'U.ID=O.USER_ID')
             ->join('LEFT JOIN', ApproachOrderGoods::tableName() . ' AS OG', 'OG.ORDER_SN=O.SN')
             ->join('LEFT JOIN', ShopGoods::tableName() . ' AS SG', 'SG.ID=OG.GOODS_ID')
@@ -335,11 +335,10 @@ class BaseExport extends Component {
             foreach($lists as $columnData) {
                 $CREATE_USER_ID = Info::getUserIdByUserName($columnData['CREATE_USER']);
                 $createUserName = Info::getUserRealNameByUserId($CREATE_USER_ID);
-                $decUserName = Info::getUserNameByUserId($columnData['DEC_ID']);
 
                 $columnAccept = [
                     'USER_NAME' => $columnData['USER_NAME'],
-                    'DEC_USER_NAME' => $decUserName,
+                    'DEC_USER_NAME' => $columnData['DEC_USER_ID'],
                     'CREATE_USER' => $columnData['CREATE_USER'],
                     'CREATE_USER_NAME' => $createUserName,
                     'SN' => $columnData['SN'],

+ 6 - 3
common/models/Region.php

@@ -92,7 +92,7 @@ class Region extends \common\components\ActiveRecord
      */
     public static function getFromCache(){
         $data = Yii::$app->cache->get(Cache::REGION_CONFIG_KEY);
-        Yii::$app->cache->delete(Cache::REGION_CONFIG_KEY);
+        $data = null;
         if(!$data){
             // 获取信息
             $data = self::getAllData();
@@ -133,10 +133,13 @@ class Region extends \common\components\ActiveRecord
     public static function getWarehouseByCode($regionCode){
         //'540000','710000','810000','820000'
         $ZoningArr = [
-            '01'=>['10100','10200','10300','10400','10500','10600','10700','10800','10900',
+            '01' => ['10100','10200','10300','10400','10500','10600','10700','10800','10900',
                 '11000','11100','11200','11300','11400','11500','11600','11700','11800',
                 '11900','12000','12100','12200','12300','12400','12500','12600','12700',
-                '12800','12900','13000','13100','13200','13300','13400','13500','13600','19900']
+                '12800','12900','13000','13100','13200','13300','13400','13500','13600','19900',
+
+                '10000', '10001', '10002', '10003', '10004', '10005', '10006',
+                ]
         ];
         $zoning = '';
         foreach ($ZoningArr as $key=>$val){

+ 0 - 4
common/models/forms/ShopGoodsForm.php

@@ -279,15 +279,11 @@ class ShopGoodsForm extends Model
                 throw new Exception(Form::formatErrorsForApi($model->getErrors()));
             }
 
-            // 移除属性表中商品属性
             ShopGoodsNature::deleteAll(['GOODS_ID' => $model->ID]);
 
             // 商品属性
             foreach ($this->nature as $item) {
-                // 国家
                 $country = Countries::getById($item['ID']);
-                // 转换美元汇率
-                $productRate = CurrencyConversions::getToUSDRate($country['LOCAL_CURRENCY_ID']);
 
                 $shopGoodsNature = new ShopGoodsNature();
                 $shopGoodsNature->GOODS_ID = $model->ID;

+ 6 - 0
console/controllers/ToolController.php

@@ -11,6 +11,7 @@ namespace console\controllers;
 use common\helpers\bonus\CalcCache;
 use common\helpers\Cache;
 use common\helpers\Date;
+use common\helpers\Email;
 use common\helpers\LoggerTool;
 use common\helpers\Tool;
 use common\helpers\user\Balance;
@@ -202,6 +203,11 @@ class ToolController extends BaseController
         }
     }
 
+    public function actionSendEmail()
+    {
+        Email::sendRegistrationEmail('18511880790@163.com', 'zhangl', 'test123');
+    }
+
     public function actionUpdatePercent() {
         $percent = 100;
         $periodNum = 134;

+ 1 - 1
frontendApi/config/params.php

@@ -20,7 +20,7 @@ return [
         'v1/finance/prove-add',
         'v1/site/get-instance',
         'v1/site/languages',
-        'v1/site/countries',
+//        'v1/site/countries',
         'v1/bonus/period',
         ],
     'noCheckPermissionActions' => [],

+ 14 - 0
frontendApi/modules/v1/controllers/ShopController.php

@@ -145,17 +145,31 @@ class ShopController extends BaseController {
                 $allAddress[$key]['COUNTY_NAME'] = Region::getCnName($row['COUNTY']);
             }
         }
+
+        // 账户币种
+        $country = Countries::getById($user['COUNTRY_ID']);
+        $coin = Currency::getById($country['LOCAL_CURRENCY_ID']);
+
+        $decCountryId = User::getEnCodeInfo(\Yii::$app->user->id)['COUNTRY_ID'];
+        $decCountry = Countries::getById($decCountryId);
+        $decUserCurrencyRate = CurrencyConversions::getToUSDRate($decCountry['LOCAL_CURRENCY_ID']);
+        $currencyRate = CurrencyConversions::getToUSDRate($country['LOCAL_CURRENCY_ID']);
+
         $userBalance = [
             'cash' => 0,
             'prp' => 0,
+            'localCash' => 0,
+            'localRrp' => 0,
         ];
 
         if ($userCashResult = UserWallet::findOneAsArray(['USER_ID' => $user['ID']])) {
             $userBalance['cash'] = $userCashResult['CASH'];
+            $userBalance['localCash'] = Tool::convertAmount($userCashResult['CASH'], $decUserCurrencyRate, $currencyRate);
         }
 
         if ($userPerformance = UserPerformance::getAmounts($user['ID'])) {
             $userBalance['prp'] = $userPerformance;
+            $userBalance['localCash'] = Tool::convertAmount($userPerformance, $decUserCurrencyRate, $currencyRate);
         }
 
         // 运费模板

+ 3 - 4
frontendApi/modules/v1/controllers/SiteController.php

@@ -415,15 +415,14 @@ class SiteController extends BaseController
 
     public function actionCountries()
     {
-        // 国家列表
-        $data = Cache::getCountries();
+        $countryId = User::getEnCodeInfo(\Yii::$app->user->id)['COUNTRY_ID'];
+        $countries = array_filter(Cache::getCountries(), fn($country) => $country['ID'] === $countryId);
 
-        return static::notice(['data' => $data]);
+        return static::notice(['data' => array_values($countries)]);
     }
 
     public function actionLanguages()
     {
-        // 语言列表
         $data = Cache::getLanguages();
 
         return static::notice(['data' => $data]);

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

@@ -245,6 +245,12 @@ class UserController extends BaseController {
         if ($baseInfo['STATUS'] != 1) {
             return static::notice(Yii::t('app', 'inactiveUser'), 400);
         }
+
+        $loginUserInfo = User::getEnCodeInfo(\Yii::$app->user->id);
+        if ($baseInfo['COUNTRY_ID'] !== $loginUserInfo['COUNTRY_ID']) {
+            return static::notice(Yii::t('app', 'memberNumberDoesNotExist'), 400);
+        }
+
         // 1. 如果是最高级别,则只显示用户基本信息
         // 2. 如果不是最高级别,如果用户累计报单数据是0, 或者用户累计报单业绩不符合级别信息,则提示 请联系客服核对业绩
         $userId = $baseInfo['ID'];
@@ -770,6 +776,12 @@ SQL;
         $userId = Info::getUserIdByUserName($userName);
         $userInfo['REAL_NAME'] = '';
         $user = User::findOneAsArray('ID=:ID', [':ID' => $userId]);
+
+        $loginUserInfo = User::getEnCodeInfo(\Yii::$app->user->id);
+        if ($user['COUNTRY_ID'] !== $loginUserInfo['COUNTRY_ID']) {
+            return static::notice(Yii::t('app', 'memberNumberDoesNotExist'), 400);
+        }
+
         if($user){
             $userInfo['REAL_NAME'] = $user['REAL_NAME'];
             $allChildUser = UserNetwork::getFirstFloorChildren($userId);

BIN
frontendEle/static/src/img/ngds-logo.jpg