|
|
@@ -36,7 +36,7 @@ class AdminClass extends BaseClass
|
|
|
$userId = $val['userId'];
|
|
|
$list[$key]['nickName'] = isset($userInfo[$userId]['userName']) ? $userInfo[$userId]['userName'] : '';
|
|
|
$list[$key]['avatarUrl'] = isset($userInfo[$userId]['avatar']) ? $prefix . $userInfo[$userId]['avatar'] : $prefix . '/none.jpg';
|
|
|
- $list[$key]['mobile'] = isset($userInfo[$userId]['mobile']) ? $prefix . $userInfo[$userId]['mobile'] : '';
|
|
|
+ $list[$key]['mobile'] = isset($userInfo[$userId]['mobile']) ? $userInfo[$userId]['mobile'] : '';
|
|
|
$list[$key]['addDate'] = date("Y-m-d H:i", $val['addTime']);
|
|
|
$list[$key]['lastLoginTime'] = date("Y-m-d H:i", $val['loginTime']);
|
|
|
}
|
|
|
@@ -69,15 +69,17 @@ class AdminClass extends BaseClass
|
|
|
$user = UserClass::getById($userId);
|
|
|
UserClass::valid($user, $merchantId);
|
|
|
|
|
|
+ $relateUserIdList = self::getAdminRelateUserId($merchantId);
|
|
|
+ if (in_array($userId, $relateUserIdList)) {
|
|
|
+ util::fail('您选择的微信已经绑定别的帐号');
|
|
|
+ }
|
|
|
+
|
|
|
$adminName = $data['adminName'];
|
|
|
$adminNameList = self::getAdminNameList($merchantId);
|
|
|
if (in_array($adminName, $adminNameList)) {
|
|
|
util::fail('名字已被使用');
|
|
|
}
|
|
|
- $relateUserIdList = self::getAdminRelateUserId($merchantId);
|
|
|
- if (in_array($userId, $relateUserIdList)) {
|
|
|
- util::fail('您选择的微信已经绑定别的帐号');
|
|
|
- }
|
|
|
+
|
|
|
$respond = self::add($data);
|
|
|
return $respond;
|
|
|
}
|
|
|
@@ -112,7 +114,7 @@ class AdminClass extends BaseClass
|
|
|
util::fail('您没有权限操作此员工');
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//删除员工,需要考虑权限 shish 2019.12.9
|
|
|
public static function deleteAdmin($admin, $adminId)
|
|
|
{
|
|
|
@@ -125,5 +127,43 @@ class AdminClass extends BaseClass
|
|
|
}
|
|
|
self::deleteById($id);
|
|
|
}
|
|
|
+
|
|
|
+ //更新员工 shish 2019.12
|
|
|
+ public static function updateAdmin($admin, $data)
|
|
|
+ {
|
|
|
+ $id = $admin['id'];
|
|
|
+ //验证角色
|
|
|
+ $roleId = $data['roleId'];
|
|
|
+ if ($roleId != $admin['roleId']) {
|
|
|
+ $role = AdminRoleClass::getById($roleId);
|
|
|
+ AdminRoleClass::valid($role, $merchantId);
|
|
|
+ }
|
|
|
+
|
|
|
+ //验证关联的微信
|
|
|
+ $userId = $data['userId'];
|
|
|
+ if ($userId != $admin['userId']) {
|
|
|
+ $user = UserClass::getById($userId);
|
|
|
+ UserClass::valid($user, $merchantId);
|
|
|
+
|
|
|
+ $relateUserIdList = self::getAdminRelateUserId($merchantId);
|
|
|
+ if (in_array($userId, $relateUserIdList)) {
|
|
|
+ util::fail('您选择的微信已经绑定别的帐号');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //密码留空不修改密码
|
|
|
+ if (isset($data['password']) && empty($data['password'])) {
|
|
|
+ unset($data['password']);
|
|
|
+ }
|
|
|
|
|
|
+ $adminName = $data['adminName'];
|
|
|
+ if ($adminName != $admin['adminName']) {
|
|
|
+ $adminNameList = self::getAdminNameList($merchantId);
|
|
|
+ if (in_array($adminName, $adminNameList)) {
|
|
|
+ util::fail('名字已被使用');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self::updateById($id, $data);
|
|
|
+ }
|
|
|
+
|
|
|
}
|