shish 5 年 前
コミット
55ca609f1a

+ 10 - 0
app-ghs/controllers/ShopAdminController.php

@@ -3,6 +3,7 @@
 namespace ghs\controllers;
 
 use biz\admin\classes\AdminClass;
+use biz\shop\classes\ShopClass;
 use bizHd\wx\classes\WxOpenClass;
 use bizGhs\shop\classes\ShopAdminClass;
 use bizGhs\admin\services\AdminRoleService;
@@ -48,6 +49,15 @@ class ShopAdminController extends BaseController
     {
         $post = Yii::$app->request->post();
         $post['adminId'] = $this->adminId;
+        $admin = $this->admin;
+        $currentShopId = $admin['currentShopId'] ?? 0;
+        if (!empty($currentShopId)) {
+            $shop = ShopClass::getShopInfo($currentShopId);
+            //一个人不能同时在二个商家门店下工作
+            if (isset($shop['merchantId']) && $shop['merchantId'] != $this->sjId) {
+                util::fail('您已经是别的商家员工');
+            }
+        }
         $respond = ShopAdminService::generateAdmin($post);
         util::success($respond);
     }

+ 11 - 0
app-hd/controllers/ShopAdminController.php

@@ -3,6 +3,7 @@
 namespace hd\controllers;
 
 use biz\admin\classes\AdminClass;
+use biz\shop\classes\ShopClass;
 use bizGhs\shop\classes\ShopAdminClass;
 use bizHd\admin\services\AdminRoleService;
 use bizHd\admin\services\ShopAdminService;
@@ -46,6 +47,16 @@ class ShopAdminController extends BaseController
     public function actionGenerateAdmin()
     {
         $post = Yii::$app->request->post();
+        $post['adminId'] = $this->adminId;
+        $admin = $this->admin;
+        $currentShopId = $admin['currentShopId'] ?? 0;
+        if (!empty($currentShopId)) {
+            $shop = ShopClass::getShopInfo($currentShopId);
+            //一个人不能同时在二个商家门店下工作
+            if (isset($shop['merchantId']) && $shop['merchantId'] != $this->sjId) {
+                util::fail('您已经是别的商家员工');
+            }
+        }
         $respond = ShopAdminService::generateAdmin($post);
         util::success($respond);
     }

+ 3 - 10
biz-ghs/shop/services/ShopAdminService.php

@@ -5,18 +5,11 @@ namespace bizGhs\shop\services;
 use bizGhs\admin\classes\AdminClass;
 use bizGhs\admin\classes\AdminRoleClass;
 use bizGhs\shop\classes\ShopAdminClass;
-use bizGhs\auth\services\AuthService;
 use bizHd\base\services\BaseService;
 use bizGhs\merchant\classes\ShopClass;
-use bizGhs\merchant\services\MerchantService;
-use bizGhs\user\services\UserService;
-use common\components\error;
 use common\components\imgUtil;
 use common\components\miniUtil;
-use common\components\stringUtil;
 use common\components\util;
-use common\components\wxUtil;
-use common\services\xhTMessageService;
 use Yii;
 
 class ShopAdminService extends BaseService
@@ -24,7 +17,7 @@ class ShopAdminService extends BaseService
 
     public static $baseFile = '\bizGhs\shop\classes\ShopAdminClass';
 
-    ///创建管理员生成小程序 ssh 2020.4.17
+    //创建管理员生成小程序 ssh 2020.4.17
     public static function prepareBindAdmin($data)
     {
         $merchant = $data['merchant'];
@@ -39,6 +32,7 @@ class ShopAdminService extends BaseService
         return ['miniCode' => $imgUrl];
     }
 
+    //创建员工 shish 2021.5.9
     public static function generateAdmin($data)
     {
         $recommendAdminId = $data['recommendAdminId'] ?? 0;
@@ -115,7 +109,6 @@ class ShopAdminService extends BaseService
     }
 
     //获取管理员 ssh 2020.4.21
-    // $sensitive true 密码等敏感信息不显示
     public static function getAdminList($where, $sensitive = true)
     {
         $data = ShopAdminClass::getList('*', $where, 'addTime DESC');
@@ -145,7 +138,7 @@ class ShopAdminService extends BaseService
     public static function getNoticeAdminList($shopId)
     {
         $where = ['shopId' => $shopId];
-        $respond = self::getAdminList($where, false);
+        $respond = self::getAdminList($where);
         $list = isset($respond['list']) ? $respond['list'] : [];
         if (!empty($list)) {
             foreach ($list as $key => $val) {

+ 1 - 1
biz-hd/admin/services/ShopAdminService.php

@@ -133,7 +133,7 @@ class ShopAdminService extends BaseService
     public static function getNoticeAdminList($shopId)
     {
         $where = ['shopId' => $shopId];
-        $respond = self::getAdminList($where, false);
+        $respond = self::getAdminList($where);
         $list = isset($respond['list']) ? $respond['list'] : [];
         if (!empty($list)) {
             foreach ($list as $key => $val) {

+ 1 - 1
biz-mall/admin/services/ShopAdminService.php

@@ -122,7 +122,7 @@ class ShopAdminService extends BaseService
     public static function getNoticeAdminList($shopId)
     {
         $where = ['shopId' => $shopId];
-        $respond = self::getAdminList($where, false);
+        $respond = self::getAdminList($where);
         $list = isset($respond['list']) ? $respond['list'] : [];
         if (!empty($list)) {
             foreach ($list as $key => $val) {

+ 1 - 1
biz/shop/services/ShopAdminService.php

@@ -122,7 +122,7 @@ class ShopAdminService extends BaseService
     public static function getNoticeAdminList($shopId)
     {
         $where = ['shopId' => $shopId];
-        $respond = self::getAdminList($where, false);
+        $respond = self::getAdminList($where);
         $list = isset($respond['list']) ? $respond['list'] : [];
         if (!empty($list)) {
             foreach ($list as $key => $val) {