|
|
@@ -24,17 +24,17 @@ class ShopAdminClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
//创建管理准备数据key ssh 2020.4.17
|
|
|
- public static function getGenerateAdminDataKey($shopId, $adminId)
|
|
|
+ public static function getGenerateAdminDataKey($mainId, $adminId)
|
|
|
{
|
|
|
- return self::GENERATE_ADMIN_DATA . $shopId . '_' . $adminId;
|
|
|
+ return self::GENERATE_ADMIN_DATA . $mainId . '_' . $adminId;
|
|
|
}
|
|
|
|
|
|
//创建管理员数据准备 ssh 2020.4.17
|
|
|
public static function prepareBindAdmin($data)
|
|
|
{
|
|
|
$adminId = $data['adminId'];
|
|
|
- $shopId = $data['shopId'];
|
|
|
- $cacheKey = self::getGenerateAdminDataKey($shopId, $adminId);
|
|
|
+ $mainId = $data['mainId'];
|
|
|
+ $cacheKey = self::getGenerateAdminDataKey($mainId, $adminId);
|
|
|
$params = [$cacheKey];
|
|
|
if (!empty($data)) {
|
|
|
foreach ($data as $key => $val) {
|
|
|
@@ -48,9 +48,9 @@ class ShopAdminClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
//获取创建管理员需要的信息 ssh 2020.4.20
|
|
|
- public static function getBindAdminData($shopId, $adminId)
|
|
|
+ public static function getBindAdminData($mainId, $adminId)
|
|
|
{
|
|
|
- $cacheKey = self::getGenerateAdminDataKey($shopId, $adminId);
|
|
|
+ $cacheKey = self::getGenerateAdminDataKey($mainId, $adminId);
|
|
|
$cacheData = Yii::$app->redis->executeCommand('HGETALL', [$cacheKey]);
|
|
|
$data = [];
|
|
|
if (!empty($cacheData)) {
|
|
|
@@ -73,9 +73,9 @@ class ShopAdminClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
//删除创建管理员需要的信息 ssh 2020.4.20
|
|
|
- public static function delBindAdminData($shopId, $adminId)
|
|
|
+ public static function delBindAdminData($mainId, $adminId)
|
|
|
{
|
|
|
- $cacheKey = self::getGenerateAdminDataKey($shopId, $adminId);
|
|
|
+ $cacheKey = self::getGenerateAdminDataKey($mainId, $adminId);
|
|
|
$keyNameList = Yii::$app->redis->executeCommand('HKEYS', [$cacheKey]);
|
|
|
if (!empty($keyNameList)) {
|
|
|
$data = array_merge([$cacheKey], $keyNameList);
|
|
|
@@ -104,17 +104,20 @@ class ShopAdminClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
//切换门店时增加员工关系 ssh 2021.3.1
|
|
|
- public static function changeShopAddRelate($originShopAdmin, $toggleShopId)
|
|
|
+ public static function changeShopAddRelate($originShopAdmin, $newShop)
|
|
|
{
|
|
|
- $name = $originShopAdmin['name'];
|
|
|
- $mobile = $originShopAdmin['mobile'];
|
|
|
- $avatar = $originShopAdmin['avatar'];
|
|
|
- $adminId = $originShopAdmin['adminId'];
|
|
|
- $roleId = $originShopAdmin['roleId'];
|
|
|
- $sjId = $originShopAdmin['sjId'];
|
|
|
- $super = $originShopAdmin['super'] ?? 0;
|
|
|
- $has = self::getByCondition(['shopId' => $toggleShopId, 'adminId' => $adminId, 'delStatus' => 0]);
|
|
|
- if ($has) {
|
|
|
+ $newMainId = $newShop->mainId ?? 0;
|
|
|
+ $name = $originShopAdmin->name ?? '';
|
|
|
+ $mobile = $originShopAdmin->mobile ?? 0;
|
|
|
+ $avatar = $originShopAdmin->avatar ?? '';
|
|
|
+ $adminId = $originShopAdmin->adminId ?? 0;
|
|
|
+ $roleId = $originShopAdmin->roleId ?? 0;
|
|
|
+ $sjId = $originShopAdmin->sjId ?? 0;
|
|
|
+ $super = $originShopAdmin->super ?? 0;
|
|
|
+ $has = self::getByCondition(['mainId' => $newMainId, 'adminId' => $adminId], true);
|
|
|
+ if (!empty($has)) {
|
|
|
+ $has->delStatus = 0;
|
|
|
+ $has->save();
|
|
|
return $has;
|
|
|
}
|
|
|
$data = [
|
|
|
@@ -123,9 +126,9 @@ class ShopAdminClass extends BaseClass
|
|
|
'avatar' => $avatar,
|
|
|
'roleId' => $roleId,
|
|
|
'adminId' => $adminId,
|
|
|
- 'shopId' => $toggleShopId,
|
|
|
'sjId' => $sjId,
|
|
|
- 'super' => $super
|
|
|
+ 'super' => $super,
|
|
|
+ 'mainId' => $newMainId,
|
|
|
];
|
|
|
$return = self::addShopAdmin($data, true);
|
|
|
return $return;
|
|
|
@@ -160,7 +163,7 @@ class ShopAdminClass extends BaseClass
|
|
|
//是否有切换门店权限 0不是 1是
|
|
|
public static function hasSwitchShopRight($shopAdmin)
|
|
|
{
|
|
|
- $super = isset($shopAdmin['super']) && $shopAdmin['super'] == 1 ? 1 : 0;
|
|
|
+ $super = isset($shopAdmin->super) && $shopAdmin->super == 1 ? 1 : 0;
|
|
|
return $super;
|
|
|
}
|
|
|
|